summaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-12-06 10:59:22 -0500
committerGravatar Lioncash2018-12-06 15:02:17 -0500
commitd4c1b9d311c978a6354574d09c451522ceb74e82 (patch)
tree4fd85da1f82ec31892c6645e45d2a04f6e010b9f /src/core/memory.cpp
parentMerge pull request #1870 from heapo/pagetable_shrink_to_fit (diff)
downloadyuzu-d4c1b9d311c978a6354574d09c451522ceb74e82.tar.gz
yuzu-d4c1b9d311c978a6354574d09c451522ceb74e82.tar.xz
yuzu-d4c1b9d311c978a6354574d09c451522ceb74e82.zip
vm_manager: Make vma_map private
This was only ever public so that code could check whether or not a handle was valid or not. Instead of exposing the object directly and allowing external code to potentially mess with the map contents, we just provide a member function that allows checking whether or not a handle is valid. This makes all member variables of the VMManager class private except for the page table.
Diffstat (limited to 'src/core/memory.cpp')
-rw-r--r--src/core/memory.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index 41fd2a6a0..76f468c78 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -125,14 +125,13 @@ void RemoveDebugHook(PageTable& page_table, VAddr base, u64 size, MemoryHookPoin
125 * using a VMA from the current process 125 * using a VMA from the current process
126 */ 126 */
127static u8* GetPointerFromVMA(const Kernel::Process& process, VAddr vaddr) { 127static u8* GetPointerFromVMA(const Kernel::Process& process, VAddr vaddr) {
128 u8* direct_pointer = nullptr; 128 const auto& vm_manager = process.VMManager();
129
130 auto& vm_manager = process.VMManager();
131 129
132 auto it = vm_manager.FindVMA(vaddr); 130 const auto it = vm_manager.FindVMA(vaddr);
133 ASSERT(it != vm_manager.vma_map.end()); 131 ASSERT(vm_manager.IsValidHandle(it));
134 132
135 auto& vma = it->second; 133 u8* direct_pointer = nullptr;
134 const auto& vma = it->second;
136 switch (vma.type) { 135 switch (vma.type) {
137 case Kernel::VMAType::AllocatedMemoryBlock: 136 case Kernel::VMAType::AllocatedMemoryBlock:
138 direct_pointer = vma.backing_block->data() + vma.offset; 137 direct_pointer = vma.backing_block->data() + vma.offset;