[Kernel] Workaround for crash seen on N3 demo boot.

Changes NtAllocateVirtualMemory so that it ignores specified page size when a
base address is specified. Requires verification if this is desired behavior.
This commit is contained in:
gibbed 2019-08-24 09:48:27 -05:00 committed by illusion98
parent 71085aae77
commit fa0800efed
1 changed files with 12 additions and 4 deletions

View File

@ -96,10 +96,18 @@ dword_result_t NtAllocateVirtualMemory(lpdword_t base_addr_ptr,
XELOGW("Game setting EXECUTE bit on allocation"); XELOGW("Game setting EXECUTE bit on allocation");
} }
// Adjust size. uint32_t page_size;
uint32_t page_size = 4096;
if (alloc_type & X_MEM_LARGE_PAGES) { if (*base_addr_ptr != 0) {
page_size = 64 * 1024; // TODO(gibbed): ignore specified page size when base address is specified.
auto heap = kernel_memory()->LookupHeap(*base_addr_ptr);
page_size = heap->page_size();
} else {
// Adjust size.
page_size = 4096;
if (alloc_type & X_MEM_LARGE_PAGES) {
page_size = 64 * 1024;
}
} }
// Round the base address down to the nearest page boundary. // Round the base address down to the nearest page boundary.