summaryrefslogtreecommitdiff
path: root/src/core/memory.h
diff options
context:
space:
mode:
authorGravatar liamwhite2023-11-30 09:20:55 -0500
committerGravatar GitHub2023-11-30 09:20:55 -0500
commit57a391e71db13ade7a3d96f59d53781eff18d2ac (patch)
tree0b4223de40a2d77598ac9095b1374353c2e9da7c /src/core/memory.h
parentMerge pull request #12223 from liamwhite/fruit-company (diff)
parentcore: Rename patcher file (diff)
downloadyuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.tar.gz
yuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.tar.xz
yuzu-57a391e71db13ade7a3d96f59d53781eff18d2ac.zip
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.h18
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
17namespace Common { 17namespace Common {
18enum class MemoryPermission : u32;
18struct PageTable; 19struct PageTable;
19} 20} // namespace Common
20 21
21namespace Core { 22namespace Core {
22class System; 23class 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
477private: 491private: