|
@@ -35,6 +35,7 @@
|
|
|
#include "core/hle/lock.h"
|
|
#include "core/hle/lock.h"
|
|
|
#include "core/hle/result.h"
|
|
#include "core/hle/result.h"
|
|
|
#include "core/hle/service/service.h"
|
|
#include "core/hle/service/service.h"
|
|
|
|
|
+#include "core/memory.h"
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
namespace Kernel {
|
|
|
namespace {
|
|
namespace {
|
|
@@ -1066,9 +1067,8 @@ static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64
|
|
|
return shared_memory->Unmap(*current_process, addr);
|
|
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);
|
|
LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address);
|
|
|
const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
|
|
const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
|
|
|
SharedPtr<Process> process = handle_table.Get<Process>(process_handle);
|
|
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& 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;
|
|
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
|
|
/// Exits the current process
|