[XBDM] Implement DmQueryTitleMemoryStatistics

This commit is contained in:
Anton Dorozhkin
2025-11-29 18:01:29 +07:00
committed by Radosław Gliński
parent 78e753ef52
commit e588a772d4
4 changed files with 85 additions and 26 deletions

View File

@@ -557,32 +557,7 @@ dword_result_t MmQueryAllocationSize_entry(lpvoid_t base_address) {
}
DECLARE_XBOXKRNL_EXPORT1(MmQueryAllocationSize, kMemory, kImplemented);
// https://code.google.com/p/vdash/source/browse/trunk/vdash/include/kernel.h
struct X_MM_QUERY_STATISTICS_SECTION {
xe::be<uint32_t> available_pages;
xe::be<uint32_t> total_virtual_memory_bytes;
xe::be<uint32_t> reserved_virtual_memory_bytes;
xe::be<uint32_t> physical_pages;
xe::be<uint32_t> pool_pages;
xe::be<uint32_t> stack_pages;
xe::be<uint32_t> image_pages;
xe::be<uint32_t> heap_pages;
xe::be<uint32_t> virtual_pages;
xe::be<uint32_t> page_table_pages;
xe::be<uint32_t> cache_pages;
};
struct X_MM_QUERY_STATISTICS_RESULT {
xe::be<uint32_t> size;
xe::be<uint32_t> total_physical_pages;
xe::be<uint32_t> kernel_pages;
X_MM_QUERY_STATISTICS_SECTION title;
X_MM_QUERY_STATISTICS_SECTION system;
xe::be<uint32_t> highest_physical_page;
};
static_assert_size(X_MM_QUERY_STATISTICS_RESULT, 104);
dword_result_t MmQueryStatistics_entry(
dword_result_t xeMmQueryStatistics(
pointer_t<X_MM_QUERY_STATISTICS_RESULT> stats_ptr) {
if (!stats_ptr) {
return X_STATUS_INVALID_PARAMETER;
@@ -649,6 +624,11 @@ dword_result_t MmQueryStatistics_entry(
return X_STATUS_SUCCESS;
}
dword_result_t MmQueryStatistics_entry(
pointer_t<X_MM_QUERY_STATISTICS_RESULT> stats_ptr) {
return xeMmQueryStatistics(stats_ptr);
}
DECLARE_XBOXKRNL_EXPORT2(MmQueryStatistics, kMemory, kImplemented,
kHighFrequency);

View File

@@ -17,11 +17,38 @@ namespace xe {
namespace kernel {
namespace xboxkrnl {
// https://code.google.com/p/vdash/source/browse/trunk/vdash/include/kernel.h
struct X_MM_QUERY_STATISTICS_SECTION {
xe::be<uint32_t> available_pages;
xe::be<uint32_t> total_virtual_memory_bytes;
xe::be<uint32_t> reserved_virtual_memory_bytes;
xe::be<uint32_t> physical_pages;
xe::be<uint32_t> pool_pages;
xe::be<uint32_t> stack_pages;
xe::be<uint32_t> image_pages;
xe::be<uint32_t> heap_pages;
xe::be<uint32_t> virtual_pages;
xe::be<uint32_t> page_table_pages;
xe::be<uint32_t> cache_pages;
};
struct X_MM_QUERY_STATISTICS_RESULT {
xe::be<uint32_t> size;
xe::be<uint32_t> total_physical_pages;
xe::be<uint32_t> kernel_pages;
X_MM_QUERY_STATISTICS_SECTION title;
X_MM_QUERY_STATISTICS_SECTION system;
xe::be<uint32_t> highest_physical_page;
};
static_assert_size(X_MM_QUERY_STATISTICS_RESULT, 104);
uint32_t xeMmAllocatePhysicalMemoryEx(uint32_t flags, uint32_t region_size,
uint32_t protect_bits,
uint32_t min_addr_range,
uint32_t max_addr_range,
uint32_t alignment);
dword_result_t xeMmQueryStatistics(
pointer_t<X_MM_QUERY_STATISTICS_RESULT> stats_ptr);
uint32_t xeAllocatePoolTypeWithTag(PPCContext* context, uint32_t size,
uint32_t tag, uint32_t zero);