diff options
Diffstat (limited to 'src/core/memory.h')
| -rw-r--r-- | src/core/memory.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/memory.h b/src/core/memory.h index 13047a545..ed8ebb5eb 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -15,8 +15,9 @@ | |||
| 15 | #include "core/hle/result.h" | 15 | #include "core/hle/result.h" |
| 16 | 16 | ||
| 17 | namespace Common { | 17 | namespace Common { |
| 18 | enum class MemoryPermission : u32; | ||
| 18 | struct PageTable; | 19 | struct PageTable; |
| 19 | } | 20 | } // namespace Common |
| 20 | 21 | ||
| 21 | namespace Core { | 22 | namespace Core { |
| 22 | class System; | 23 | class System; |
| @@ -82,9 +83,10 @@ public: | |||
| 82 | * @param size The amount of bytes to map. Must be page-aligned. | 83 | * @param size The amount of bytes to map. Must be page-aligned. |
| 83 | * @param target Buffer with the memory backing the mapping. Must be of length at least | 84 | * @param target Buffer with the memory backing the mapping. Must be of length at least |
| 84 | * `size`. | 85 | * `size`. |
| 86 | * @param perms The permissions to map the memory with. | ||
| 85 | */ | 87 | */ |
| 86 | void MapMemoryRegion(Common::PageTable& page_table, Common::ProcessAddress base, u64 size, | 88 | void MapMemoryRegion(Common::PageTable& page_table, Common::ProcessAddress base, u64 size, |
| 87 | Common::PhysicalAddress target); | 89 | Common::PhysicalAddress target, Common::MemoryPermission perms); |
| 88 | 90 | ||
| 89 | /** | 91 | /** |
| 90 | * Unmaps a region of the emulated process address space. | 92 | * Unmaps a region of the emulated process address space. |
| @@ -96,6 +98,17 @@ public: | |||
| 96 | void UnmapRegion(Common::PageTable& page_table, Common::ProcessAddress base, u64 size); | 98 | void UnmapRegion(Common::PageTable& page_table, Common::ProcessAddress base, u64 size); |
| 97 | 99 | ||
| 98 | /** | 100 | /** |
| 101 | * Protects a region of the emulated process address space with the new permissions. | ||
| 102 | * | ||
| 103 | * @param page_table The page table of the emulated process. | ||
| 104 | * @param base The start address to re-protect. Must be page-aligned. | ||
| 105 | * @param size The amount of bytes to protect. Must be page-aligned. | ||
| 106 | * @param perms The permissions the address range is mapped. | ||
| 107 | */ | ||
| 108 | void ProtectRegion(Common::PageTable& page_table, Common::ProcessAddress base, u64 size, | ||
| 109 | Common::MemoryPermission perms); | ||
| 110 | |||
| 111 | /** | ||
| 99 | * Checks whether or not the supplied address is a valid virtual | 112 | * Checks whether or not the supplied address is a valid virtual |
| 100 | * address for the current process. | 113 | * address for the current process. |
| 101 | * | 114 | * |
| @@ -472,6 +485,7 @@ public: | |||
| 472 | 485 | ||
| 473 | void SetGPUDirtyManagers(std::span<Core::GPUDirtyMemoryManager> managers); | 486 | void SetGPUDirtyManagers(std::span<Core::GPUDirtyMemoryManager> managers); |
| 474 | void InvalidateRegion(Common::ProcessAddress dest_addr, size_t size); | 487 | void InvalidateRegion(Common::ProcessAddress dest_addr, size_t size); |
| 488 | bool InvalidateNCE(Common::ProcessAddress vaddr, size_t size); | ||
| 475 | void FlushRegion(Common::ProcessAddress dest_addr, size_t size); | 489 | void FlushRegion(Common::ProcessAddress dest_addr, size_t size); |
| 476 | 490 | ||
| 477 | private: | 491 | private: |