aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-12-12 11:34:01 -0500
committerLioncash <mathew1800@gmail.com>2018-12-12 15:07:30 -0500
commitd7ba5372f3ea20e32fc421d1e6b4a40f2df96181 (patch)
tree71084e1b71b5fd705143bbceb44c46e49f63cac2 /src/core/hle/kernel/svc.cpp
parent1d3d7d08eb6f4968e5817b00233632375cd7f0c3 (diff)
vm_manager: Migrate memory querying to the VMManager interface
Gets rid of the need to directly access the managed VMAs outside of the memory manager itself just for querying memory.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 4ae92ff9e0..8b079bc402 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -1068,8 +1068,8 @@ static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64
/// Query process memory
static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_info*/,
- Handle process_handle, u64 addr) {
- LOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr={:X}", process_handle, addr);
+ Handle process_handle, u64 address) {
+ LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address);
const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
SharedPtr<Process> process = handle_table.Get<Process>(process_handle);
if (!process) {
@@ -1079,21 +1079,9 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i
}
const auto& vm_manager = process->VMManager();
- const auto vma = vm_manager.FindVMA(addr);
-
- memory_info->attributes = 0;
- if (vm_manager.IsValidHandle(vma)) {
- memory_info->base_address = vma->second.base;
- memory_info->permission = static_cast<u32>(vma->second.permissions);
- memory_info->size = vma->second.size;
- memory_info->type = ToSvcMemoryState(vma->second.meminfo_state);
- } else {
- memory_info->base_address = 0;
- memory_info->permission = static_cast<u32>(VMAPermission::None);
- memory_info->size = 0;
- memory_info->type = static_cast<u32>(MemoryState::Unmapped);
- }
+ const auto result = vm_manager.QueryMemory(address);
+ *memory_info = result;
return RESULT_SUCCESS;
}