diff options
author | Lioncash <mathew1800@gmail.com> | 2018-12-12 17:48:06 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-12-12 21:43:31 +0100 |
commit | d8deb39b83409f1d9b5eeec0a719d560e4409aae (patch) | |
tree | 6dcc744b9761db6c5107e3adf752e81c383a5ff5 /src/core/hle/kernel/svc.cpp | |
parent | vm_manager: Correct ordering of last two struct members of MemoryInfo (diff) | |
download | yuzu-d8deb39b83409f1d9b5eeec0a719d560e4409aae.tar yuzu-d8deb39b83409f1d9b5eeec0a719d560e4409aae.tar.gz yuzu-d8deb39b83409f1d9b5eeec0a719d560e4409aae.tar.bz2 yuzu-d8deb39b83409f1d9b5eeec0a719d560e4409aae.tar.lz yuzu-d8deb39b83409f1d9b5eeec0a719d560e4409aae.tar.xz yuzu-d8deb39b83409f1d9b5eeec0a719d560e4409aae.tar.zst yuzu-d8deb39b83409f1d9b5eeec0a719d560e4409aae.zip |
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 8b079bc40..a1ecc4540 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -35,6 +35,7 @@ #include "core/hle/lock.h" #include "core/hle/result.h" #include "core/hle/service/service.h" +#include "core/memory.h" namespace Kernel { namespace { @@ -1066,9 +1067,8 @@ static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 return shared_memory->Unmap(*current_process, addr); } -/// Query process memory -static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_info*/, - Handle process_handle, u64 address) { +static ResultCode QueryProcessMemory(VAddr memory_info_address, VAddr page_info_address, + Handle process_handle, VAddr 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); @@ -1079,16 +1079,29 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i } const auto& vm_manager = process->VMManager(); - const auto result = vm_manager.QueryMemory(address); + const MemoryInfo memory_info = vm_manager.QueryMemory(address); + + Memory::Write64(memory_info_address, memory_info.base_address); + Memory::Write64(memory_info_address + 8, memory_info.size); + Memory::Write32(memory_info_address + 16, memory_info.state); + Memory::Write32(memory_info_address + 20, memory_info.attributes); + Memory::Write32(memory_info_address + 24, memory_info.permission); + + // Page info appears to be currently unused by the kernel and is always set to zero. + Memory::Write32(page_info_address, 0); - *memory_info = result; return RESULT_SUCCESS; } -/// Query memory -static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAddr addr) { - LOG_TRACE(Kernel_SVC, "called, addr={:X}", addr); - return QueryProcessMemory(memory_info, page_info, CurrentProcess, addr); +static ResultCode QueryMemory(VAddr memory_info_address, VAddr page_info_address, + VAddr query_address) { + LOG_TRACE(Kernel_SVC, + "called, memory_info_address=0x{:016X}, page_info_address=0x{:016X}, " + "query_address=0x{:016X}", + memory_info_address, page_info_address, query_address); + + return QueryProcessMemory(memory_info_address, page_info_address, CurrentProcess, + query_address); } /// Exits the current process |