summaryrefslogtreecommitdiffstats
path: root/src/common/host_memory.h
diff options
context:
space:
mode:
authorGPUCode <geoster3d@gmail.com>2023-11-17 20:43:15 +0100
committert895 <clombardo169@gmail.com>2023-11-25 06:46:15 +0100
commit5938a9582a238d7679eb15f9812f8a85bfdb1cc3 (patch)
tree935356a1cc03fea528e349d5027f2d885537272a /src/common/host_memory.h
parenthost_memory: Switch to FreeRegionManager (diff)
downloadyuzu-5938a9582a238d7679eb15f9812f8a85bfdb1cc3.tar
yuzu-5938a9582a238d7679eb15f9812f8a85bfdb1cc3.tar.gz
yuzu-5938a9582a238d7679eb15f9812f8a85bfdb1cc3.tar.bz2
yuzu-5938a9582a238d7679eb15f9812f8a85bfdb1cc3.tar.lz
yuzu-5938a9582a238d7679eb15f9812f8a85bfdb1cc3.tar.xz
yuzu-5938a9582a238d7679eb15f9812f8a85bfdb1cc3.tar.zst
yuzu-5938a9582a238d7679eb15f9812f8a85bfdb1cc3.zip
Diffstat (limited to 'src/common/host_memory.h')
-rw-r--r--src/common/host_memory.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/common/host_memory.h b/src/common/host_memory.h
index 4014a1962..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,11 @@ 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();