summaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-12-06 10:59:22 -0500
committerLioncash <mathew1800@gmail.com>2018-12-06 15:02:17 -0500
commitd4c1b9d311c978a6354574d09c451522ceb74e82 (patch)
tree4fd85da1f82ec31892c6645e45d2a04f6e010b9f /src/core/memory.cpp
parent4d3d2fcebde1cb2347b4da83471d01858da7f958 (diff)
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
* using a VMA from the current process
*/
static u8* GetPointerFromVMA(const Kernel::Process& process, VAddr vaddr) {
- u8* direct_pointer = nullptr;
-
- auto& vm_manager = process.VMManager();
+ const auto& vm_manager = process.VMManager();
- auto it = vm_manager.FindVMA(vaddr);
- ASSERT(it != vm_manager.vma_map.end());
+ const auto it = vm_manager.FindVMA(vaddr);
+ ASSERT(vm_manager.IsValidHandle(it));
- auto& vma = it->second;
+ u8* direct_pointer = nullptr;
+ const auto& vma = it->second;
switch (vma.type) {
case Kernel::VMAType::AllocatedMemoryBlock:
direct_pointer = vma.backing_block->data() + vma.offset;