From fbeaa330a35f93857c249aa5f69dfee6b09eefe0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 27 Dec 2018 18:31:31 -0500 Subject: kernel/process: Remove most allocation functions from Process' interface In all cases that these functions are needed, the VMManager can just be retrieved and used instead of providing the same functions in Process' interface. This also makes it a little nicer dependency-wise, since it gets rid of cases where the VMManager interface was being used, and then switched over to using the interface for a Process instance. Instead, it makes all accesses uniform and uses the VMManager instance for all necessary tasks. All the basic memory mapping functions did was forward to the Process' VMManager instance anyways. --- src/core/hle/service/ldr/ldr.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/core/hle/service/ldr/ldr.cpp') diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index 13bcefe07..9df7ac50f 100644 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp @@ -318,14 +318,18 @@ public: return; } - ASSERT(process->MirrorMemory(*map_address, nro_addr, nro_size, - Kernel::MemoryState::ModuleCodeStatic) == RESULT_SUCCESS); - ASSERT(process->UnmapMemory(nro_addr, 0, nro_size) == RESULT_SUCCESS); + ASSERT(vm_manager + .MirrorMemory(*map_address, nro_addr, nro_size, + Kernel::MemoryState::ModuleCodeStatic) + .IsSuccess()); + ASSERT(vm_manager.UnmapRange(nro_addr, nro_size).IsSuccess()); if (bss_size > 0) { - ASSERT(process->MirrorMemory(*map_address + nro_size, bss_addr, bss_size, - Kernel::MemoryState::ModuleCodeStatic) == RESULT_SUCCESS); - ASSERT(process->UnmapMemory(bss_addr, 0, bss_size) == RESULT_SUCCESS); + ASSERT(vm_manager + .MirrorMemory(*map_address + nro_size, bss_addr, bss_size, + Kernel::MemoryState::ModuleCodeStatic) + .IsSuccess()); + ASSERT(vm_manager.UnmapRange(bss_addr, bss_size).IsSuccess()); } vm_manager.ReprotectRange(*map_address, header.text_size, @@ -380,13 +384,14 @@ public: return; } - auto* process = Core::CurrentProcess(); - auto& vm_manager = process->VMManager(); + auto& vm_manager = Core::CurrentProcess()->VMManager(); const auto& nro_size = iter->second.size; - ASSERT(process->MirrorMemory(heap_addr, mapped_addr, nro_size, - Kernel::MemoryState::ModuleCodeStatic) == RESULT_SUCCESS); - ASSERT(process->UnmapMemory(mapped_addr, 0, nro_size) == RESULT_SUCCESS); + ASSERT(vm_manager + .MirrorMemory(heap_addr, mapped_addr, nro_size, + Kernel::MemoryState::ModuleCodeStatic) + .IsSuccess()); + ASSERT(vm_manager.UnmapRange(mapped_addr, nro_size).IsSuccess()); Core::System::GetInstance().InvalidateCpuInstructionCaches(); -- cgit v1.2.3