From 4766baddf3501695b6048ed78f251f4ec28ae0aa Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 17 Nov 2023 20:57:39 +0200 Subject: host_memory: Switch to FreeRegionManager --- src/common/host_memory.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/common/host_memory.h') diff --git a/src/common/host_memory.h b/src/common/host_memory.h index 447975ded..4014a1962 100644 --- a/src/common/host_memory.h +++ b/src/common/host_memory.h @@ -37,6 +37,8 @@ public: void Protect(size_t virtual_offset, size_t length, bool read, bool write); + void EnableDirectMappedAddress(); + [[nodiscard]] u8* BackingBasePointer() noexcept { return backing_base; } -- cgit v1.2.3 From 5938a9582a238d7679eb15f9812f8a85bfdb1cc3 Mon Sep 17 00:00:00 2001 From: GPUCode Date: Fri, 17 Nov 2023 21:43:15 +0200 Subject: core: Respect memory permissions in Map --- src/common/host_memory.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/common/host_memory.h') 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 +#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(); -- cgit v1.2.3