MmQueryAllocationSize.

This commit is contained in:
Ben Vanik
2014-01-05 11:19:02 -08:00
parent cbf4a9b519
commit e8ca05ca0a
4 changed files with 65 additions and 0 deletions

View File

@@ -330,6 +330,30 @@ SHIM_CALL MmQueryAddressProtect_shim(
}
uint32_t xeMmQueryAllocationSize(uint32_t base_address) {
KernelState* state = shared_kernel_state_;
XEASSERTNOTNULL(state);
size_t size = state->memory()->QuerySize(base_address);
return (uint32_t)size;
}
SHIM_CALL MmQueryAllocationSize_shim(
PPCContext* ppc_state, KernelState* state) {
uint32_t base_address = SHIM_GET_ARG_32(0);
XELOGD(
"MmQueryAllocationSize(%.8X)",
base_address);
uint32_t result = xeMmQueryAllocationSize(base_address);
SHIM_SET_RETURN(result);
}
SHIM_CALL MmQueryStatistics_shim(
PPCContext* ppc_state, KernelState* state) {
uint32_t stats_ptr = SHIM_GET_ARG_32(0);
@@ -434,6 +458,7 @@ void xe::kernel::xboxkrnl::RegisterMemoryExports(
SHIM_SET_MAPPING("xboxkrnl.exe", MmAllocatePhysicalMemoryEx, state);
SHIM_SET_MAPPING("xboxkrnl.exe", MmFreePhysicalMemory, state);
SHIM_SET_MAPPING("xboxkrnl.exe", MmQueryAddressProtect, state);
SHIM_SET_MAPPING("xboxkrnl.exe", MmQueryAllocationSize, state);
SHIM_SET_MAPPING("xboxkrnl.exe", MmQueryStatistics, state);
SHIM_SET_MAPPING("xboxkrnl.exe", MmGetPhysicalAddress, state);
}