mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-26 03:55:34 +00:00
kernel/vm_manager: Remove usages of global system accessors
Makes the dependency on the system instance explicit within VMManager's interface.
This commit is contained in:
parent
9186f76b07
commit
b6a87b422e
|
@ -248,7 +248,8 @@ void Process::LoadModule(CodeSet module_, VAddr base_addr) {
|
|||
}
|
||||
|
||||
Process::Process(Core::System& system)
|
||||
: WaitObject{system.Kernel()}, address_arbiter{system}, mutex{system}, system{system} {}
|
||||
: WaitObject{system.Kernel()}, vm_manager{system},
|
||||
address_arbiter{system}, mutex{system}, system{system} {}
|
||||
|
||||
Process::~Process() = default;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ bool VirtualMemoryArea::CanBeMergedWith(const VirtualMemoryArea& next) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
VMManager::VMManager() {
|
||||
VMManager::VMManager(Core::System& system) : system{system} {
|
||||
// Default to assuming a 39-bit address space. This way we have a sane
|
||||
// starting point with executables that don't provide metadata.
|
||||
Reset(FileSys::ProgramAddressSpaceType::Is39Bit);
|
||||
|
@ -111,7 +111,6 @@ ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target,
|
|||
VirtualMemoryArea& final_vma = vma_handle->second;
|
||||
ASSERT(final_vma.size == size);
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
system.ArmInterface(0).MapBackingMemory(target, size, block->data() + offset,
|
||||
VMAPermission::ReadWriteExecute);
|
||||
system.ArmInterface(1).MapBackingMemory(target, size, block->data() + offset,
|
||||
|
@ -140,7 +139,6 @@ ResultVal<VMManager::VMAHandle> VMManager::MapBackingMemory(VAddr target, u8* me
|
|||
VirtualMemoryArea& final_vma = vma_handle->second;
|
||||
ASSERT(final_vma.size == size);
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
system.ArmInterface(0).MapBackingMemory(target, size, memory, VMAPermission::ReadWriteExecute);
|
||||
system.ArmInterface(1).MapBackingMemory(target, size, memory, VMAPermission::ReadWriteExecute);
|
||||
system.ArmInterface(2).MapBackingMemory(target, size, memory, VMAPermission::ReadWriteExecute);
|
||||
|
@ -223,7 +221,6 @@ ResultCode VMManager::UnmapRange(VAddr target, u64 size) {
|
|||
|
||||
ASSERT(FindVMA(target)->second.size >= size);
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
system.ArmInterface(0).UnmapMemory(target, size);
|
||||
system.ArmInterface(1).UnmapMemory(target, size);
|
||||
system.ArmInterface(2).UnmapMemory(target, size);
|
||||
|
@ -376,7 +373,7 @@ ResultCode VMManager::UnmapCodeMemory(VAddr dst_address, VAddr src_address, u64
|
|||
Reprotect(src_vma_iter, VMAPermission::ReadWrite);
|
||||
|
||||
if (dst_memory_state == MemoryState::ModuleCode) {
|
||||
Core::System::GetInstance().InvalidateCpuInstructionCaches();
|
||||
system.InvalidateCpuInstructionCaches();
|
||||
}
|
||||
|
||||
return unmap_result;
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
#include "core/hle/result.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace FileSys {
|
||||
enum class ProgramAddressSpaceType : u8;
|
||||
}
|
||||
|
@ -321,7 +325,7 @@ class VMManager final {
|
|||
public:
|
||||
using VMAHandle = VMAMap::const_iterator;
|
||||
|
||||
VMManager();
|
||||
explicit VMManager(Core::System& system);
|
||||
~VMManager();
|
||||
|
||||
/// Clears the address space map, re-initializing with a single free area.
|
||||
|
@ -712,5 +716,7 @@ private:
|
|||
// The end of the currently allocated heap. This is not an inclusive
|
||||
// end of the range. This is essentially 'base_address + current_size'.
|
||||
VAddr heap_end = 0;
|
||||
|
||||
Core::System& system;
|
||||
};
|
||||
} // namespace Kernel
|
||||
|
|
Loading…
Reference in a new issue