summaryrefslogtreecommitdiffstats
path: root/src/common/host_memory.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-11-30 15:20:55 +0100
committerGitHub <noreply@github.com>2023-11-30 15:20:55 +0100
commit57a391e71db13ade7a3d96f59d53781eff18d2ac (patch)
tree0b4223de40a2d77598ac9095b1374353c2e9da7c /src/common/host_memory.h
parentMerge pull request #12223 from liamwhite/fruit-company (diff)
parentcore: Rename patcher file (diff)
downloadyuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.tar
yuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.tar.gz
yuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.tar.bz2
yuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.tar.lz
yuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.tar.xz
yuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.tar.zst
yuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.zip
Diffstat (limited to 'src/common/host_memory.h')
-rw-r--r--src/common/host_memory.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/common/host_memory.h b/src/common/host_memory.h
index 447975ded..cebfacab2 100644
--- a/src/common/host_memory.h
+++ b/src/common/host_memory.h
@@ -4,11 +4,20 @@
#pragma once
#include <memory>
+#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/virtual_buffer.h"
namespace Common {
+enum class MemoryPermission : u32 {
+ Read = 1 << 0,
+ Write = 1 << 1,
+ ReadWrite = Read | Write,
+ Execute = 1 << 2,
+};
+DECLARE_ENUM_FLAG_OPERATORS(MemoryPermission)
+
/**
* A low level linear memory buffer, which supports multiple mappings
* Its purpose is to rebuild a given sparse memory layout, including mirrors.
@@ -31,11 +40,13 @@ public:
HostMemory(HostMemory&& other) noexcept;
HostMemory& operator=(HostMemory&& other) noexcept;
- void Map(size_t virtual_offset, size_t host_offset, size_t length);
+ void Map(size_t virtual_offset, size_t host_offset, size_t length, MemoryPermission perms);
void Unmap(size_t virtual_offset, size_t length);
- void Protect(size_t virtual_offset, size_t length, bool read, bool write);
+ void Protect(size_t virtual_offset, size_t length, bool read, bool write, bool execute = false);
+
+ void EnableDirectMappedAddress();
[[nodiscard]] u8* BackingBasePointer() noexcept {
return backing_base;