summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/kernel/process.cpp3
-rw-r--r--src/core/hle/kernel/vm_manager.cpp7
-rw-r--r--src/core/hle/kernel/vm_manager.h8
3 files changed, 11 insertions, 7 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index 20d01fc88..0775a89fb 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -241,7 +241,8 @@ void Process::LoadModule(CodeSet module_, VAddr base_addr) {
241} 241}
242 242
243Process::Process(Core::System& system) 243Process::Process(Core::System& system)
244 : WaitObject{system.Kernel()}, address_arbiter{system}, mutex{system}, system{system} {} 244 : WaitObject{system.Kernel()}, vm_manager{system},
245 address_arbiter{system}, mutex{system}, system{system} {}
245 246
246Process::~Process() = default; 247Process::~Process() = default;
247 248
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp
index f0c0c12fc..48b13cfdd 100644
--- a/src/core/hle/kernel/vm_manager.cpp
+++ b/src/core/hle/kernel/vm_manager.cpp
@@ -62,7 +62,7 @@ bool VirtualMemoryArea::CanBeMergedWith(const VirtualMemoryArea& next) const {
62 return true; 62 return true;
63} 63}
64 64
65VMManager::VMManager() { 65VMManager::VMManager(Core::System& system) : system{system} {
66 // Default to assuming a 39-bit address space. This way we have a sane 66 // Default to assuming a 39-bit address space. This way we have a sane
67 // starting point with executables that don't provide metadata. 67 // starting point with executables that don't provide metadata.
68 Reset(FileSys::ProgramAddressSpaceType::Is39Bit); 68 Reset(FileSys::ProgramAddressSpaceType::Is39Bit);
@@ -111,7 +111,6 @@ ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target,
111 VirtualMemoryArea& final_vma = vma_handle->second; 111 VirtualMemoryArea& final_vma = vma_handle->second;
112 ASSERT(final_vma.size == size); 112 ASSERT(final_vma.size == size);
113 113
114 auto& system = Core::System::GetInstance();
115 system.ArmInterface(0).MapBackingMemory(target, size, block->data() + offset, 114 system.ArmInterface(0).MapBackingMemory(target, size, block->data() + offset,
116 VMAPermission::ReadWriteExecute); 115 VMAPermission::ReadWriteExecute);
117 system.ArmInterface(1).MapBackingMemory(target, size, block->data() + offset, 116 system.ArmInterface(1).MapBackingMemory(target, size, block->data() + offset,
@@ -140,7 +139,6 @@ ResultVal<VMManager::VMAHandle> VMManager::MapBackingMemory(VAddr target, u8* me
140 VirtualMemoryArea& final_vma = vma_handle->second; 139 VirtualMemoryArea& final_vma = vma_handle->second;
141 ASSERT(final_vma.size == size); 140 ASSERT(final_vma.size == size);
142 141
143 auto& system = Core::System::GetInstance();
144 system.ArmInterface(0).MapBackingMemory(target, size, memory, VMAPermission::ReadWriteExecute); 142 system.ArmInterface(0).MapBackingMemory(target, size, memory, VMAPermission::ReadWriteExecute);
145 system.ArmInterface(1).MapBackingMemory(target, size, memory, VMAPermission::ReadWriteExecute); 143 system.ArmInterface(1).MapBackingMemory(target, size, memory, VMAPermission::ReadWriteExecute);
146 system.ArmInterface(2).MapBackingMemory(target, size, memory, VMAPermission::ReadWriteExecute); 144 system.ArmInterface(2).MapBackingMemory(target, size, memory, VMAPermission::ReadWriteExecute);
@@ -223,7 +221,6 @@ ResultCode VMManager::UnmapRange(VAddr target, u64 size) {
223 221
224 ASSERT(FindVMA(target)->second.size >= size); 222 ASSERT(FindVMA(target)->second.size >= size);
225 223
226 auto& system = Core::System::GetInstance();
227 system.ArmInterface(0).UnmapMemory(target, size); 224 system.ArmInterface(0).UnmapMemory(target, size);
228 system.ArmInterface(1).UnmapMemory(target, size); 225 system.ArmInterface(1).UnmapMemory(target, size);
229 system.ArmInterface(2).UnmapMemory(target, size); 226 system.ArmInterface(2).UnmapMemory(target, size);
@@ -376,7 +373,7 @@ ResultCode VMManager::UnmapCodeMemory(VAddr dst_address, VAddr src_address, u64
376 Reprotect(src_vma_iter, VMAPermission::ReadWrite); 373 Reprotect(src_vma_iter, VMAPermission::ReadWrite);
377 374
378 if (dst_memory_state == MemoryState::ModuleCode) { 375 if (dst_memory_state == MemoryState::ModuleCode) {
379 Core::System::GetInstance().InvalidateCpuInstructionCaches(); 376 system.InvalidateCpuInstructionCaches();
380 } 377 }
381 378
382 return unmap_result; 379 return unmap_result;
diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h
index 288eb9450..ec84d9a70 100644
--- a/src/core/hle/kernel/vm_manager.h
+++ b/src/core/hle/kernel/vm_manager.h
@@ -14,6 +14,10 @@
14#include "core/hle/result.h" 14#include "core/hle/result.h"
15#include "core/memory.h" 15#include "core/memory.h"
16 16
17namespace Core {
18class System;
19}
20
17namespace FileSys { 21namespace FileSys {
18enum class ProgramAddressSpaceType : u8; 22enum class ProgramAddressSpaceType : u8;
19} 23}
@@ -321,7 +325,7 @@ class VMManager final {
321public: 325public:
322 using VMAHandle = VMAMap::const_iterator; 326 using VMAHandle = VMAMap::const_iterator;
323 327
324 VMManager(); 328 explicit VMManager(Core::System& system);
325 ~VMManager(); 329 ~VMManager();
326 330
327 /// Clears the address space map, re-initializing with a single free area. 331 /// Clears the address space map, re-initializing with a single free area.
@@ -712,5 +716,7 @@ private:
712 // The end of the currently allocated heap. This is not an inclusive 716 // The end of the currently allocated heap. This is not an inclusive
713 // end of the range. This is essentially 'base_address + current_size'. 717 // end of the range. This is essentially 'base_address + current_size'.
714 VAddr heap_end = 0; 718 VAddr heap_end = 0;
719
720 Core::System& system;
715}; 721};
716} // namespace Kernel 722} // namespace Kernel