diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-11-30 09:20:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-30 09:20:55 -0500 |
commit | 57a391e71db13ade7a3d96f59d53781eff18d2ac (patch) | |
tree | 0b4223de40a2d77598ac9095b1374353c2e9da7c /src/core/memory.h | |
parent | 9dc9aaf4af1c3c846c9cd46a9433dcf0684da19b (diff) | |
parent | 4a3abba16d9821ed163aab427d4c7bc9ef7acb32 (diff) |
Merge pull request #12074 from GPUCode/yuwu-on-the-metal
Implement Native Code Execution (NCE)
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 @@ #include "core/hle/result.h" namespace Common { +enum class MemoryPermission : u32; struct PageTable; -} +} // namespace Common namespace Core { class System; @@ -82,9 +83,10 @@ public: * @param size The amount of bytes to map. Must be page-aligned. * @param target Buffer with the memory backing the mapping. Must be of length at least * `size`. + * @param perms The permissions to map the memory with. */ void MapMemoryRegion(Common::PageTable& page_table, Common::ProcessAddress base, u64 size, - Common::PhysicalAddress target); + Common::PhysicalAddress target, Common::MemoryPermission perms); /** * Unmaps a region of the emulated process address space. @@ -96,6 +98,17 @@ public: void UnmapRegion(Common::PageTable& page_table, Common::ProcessAddress base, u64 size); /** + * Protects a region of the emulated process address space with the new permissions. + * + * @param page_table The page table of the emulated process. + * @param base The start address to re-protect. Must be page-aligned. + * @param size The amount of bytes to protect. Must be page-aligned. + * @param perms The permissions the address range is mapped. + */ + void ProtectRegion(Common::PageTable& page_table, Common::ProcessAddress base, u64 size, + Common::MemoryPermission perms); + + /** * Checks whether or not the supplied address is a valid virtual * address for the current process. * @@ -472,6 +485,7 @@ public: void SetGPUDirtyManagers(std::span<Core::GPUDirtyMemoryManager> managers); void InvalidateRegion(Common::ProcessAddress dest_addr, size_t size); + bool InvalidateNCE(Common::ProcessAddress vaddr, size_t size); void FlushRegion(Common::ProcessAddress dest_addr, size_t size); private: |