summaryrefslogtreecommitdiff
path: root/src/common/host_memory.h
diff options
context:
space:
mode:
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 @@
4#pragma once 4#pragma once
5 5
6#include <memory> 6#include <memory>
7#include "common/common_funcs.h"
7#include "common/common_types.h" 8#include "common/common_types.h"
8#include "common/virtual_buffer.h" 9#include "common/virtual_buffer.h"
9 10
10namespace Common { 11namespace Common {
11 12
13enum class MemoryPermission : u32 {
14 Read = 1 << 0,
15 Write = 1 << 1,
16 ReadWrite = Read | Write,
17 Execute = 1 << 2,
18};
19DECLARE_ENUM_FLAG_OPERATORS(MemoryPermission)
20
12/** 21/**
13 * A low level linear memory buffer, which supports multiple mappings 22 * A low level linear memory buffer, which supports multiple mappings
14 * Its purpose is to rebuild a given sparse memory layout, including mirrors. 23 * Its purpose is to rebuild a given sparse memory layout, including mirrors.
@@ -31,11 +40,13 @@ public:
31 HostMemory(HostMemory&& other) noexcept; 40 HostMemory(HostMemory&& other) noexcept;
32 HostMemory& operator=(HostMemory&& other) noexcept; 41 HostMemory& operator=(HostMemory&& other) noexcept;
33 42
34 void Map(size_t virtual_offset, size_t host_offset, size_t length); 43 void Map(size_t virtual_offset, size_t host_offset, size_t length, MemoryPermission perms);
35 44
36 void Unmap(size_t virtual_offset, size_t length); 45 void Unmap(size_t virtual_offset, size_t length);
37 46
38 void Protect(size_t virtual_offset, size_t length, bool read, bool write); 47 void Protect(size_t virtual_offset, size_t length, bool read, bool write, bool execute = false);
48
49 void EnableDirectMappedAddress();
39 50
40 [[nodiscard]] u8* BackingBasePointer() noexcept { 51 [[nodiscard]] u8* BackingBasePointer() noexcept {
41 return backing_base; 52 return backing_base;