summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-12-12 11:34:01 -0500
committerGravatar Lioncash2018-12-12 15:07:30 -0500
commita8cc03502b41b44150af71535d2b662a7ee3390c (patch)
tree71084e1b71b5fd705143bbceb44c46e49f63cac2 /src/core/hle/kernel/svc.cpp
parentvm_manager: Migrate MemoryInfo and PageInfo to vm_manager.h (diff)
downloadyuzu-a8cc03502b41b44150af71535d2b662a7ee3390c.tar.gz
yuzu-a8cc03502b41b44150af71535d2b662a7ee3390c.tar.xz
yuzu-a8cc03502b41b44150af71535d2b662a7ee3390c.zip
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 4ae92ff9e..8b079bc40 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
1068 1068
1069/// Query process memory 1069/// Query process memory
1070static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_info*/, 1070static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_info*/,
1071 Handle process_handle, u64 addr) { 1071 Handle process_handle, u64 address) {
1072 LOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr={:X}", process_handle, addr); 1072 LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address);
1073 const auto& handle_table = Core::CurrentProcess()->GetHandleTable(); 1073 const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
1074 SharedPtr<Process> process = handle_table.Get<Process>(process_handle); 1074 SharedPtr<Process> process = handle_table.Get<Process>(process_handle);
1075 if (!process) { 1075 if (!process) {
@@ -1079,21 +1079,9 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i
1079 } 1079 }
1080 1080
1081 const auto& vm_manager = process->VMManager(); 1081 const auto& vm_manager = process->VMManager();
1082 const auto vma = vm_manager.FindVMA(addr); 1082 const auto result = vm_manager.QueryMemory(address);
1083
1084 memory_info->attributes = 0;
1085 if (vm_manager.IsValidHandle(vma)) {
1086 memory_info->base_address = vma->second.base;
1087 memory_info->permission = static_cast<u32>(vma->second.permissions);
1088 memory_info->size = vma->second.size;
1089 memory_info->type = ToSvcMemoryState(vma->second.meminfo_state);
1090 } else {
1091 memory_info->base_address = 0;
1092 memory_info->permission = static_cast<u32>(VMAPermission::None);
1093 memory_info->size = 0;
1094 memory_info->type = static_cast<u32>(MemoryState::Unmapped);
1095 }
1096 1083
1084 *memory_info = result;
1097 return RESULT_SUCCESS; 1085 return RESULT_SUCCESS;
1098} 1086}
1099 1087