mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Move page table allocation to top 256GiB.
I forgot to account for tracking page table physical addresses, so this is a bit of an overhaul. Major changes: - Refactor bootstrap code into more functions and: - Only allocate 32 pages of scratch space - Remap remaining space into top 256GiB, the "page table space" - Use the page table space to directly offset-map page table pages from their physical addresses, to avoid tracking overhead. - Refactor page_block list functions into static functions to better handle null/empty lists
This commit is contained in:
@@ -66,10 +66,11 @@ memory_init_pointer_fixup(EFI_BOOT_SERVICES *bootsvc, EFI_RUNTIME_SERVICES *runs
|
||||
|
||||
CHECK_EFI_STATUS_OR_RETURN(status, "Failed to initialize pointer update event.");
|
||||
|
||||
// Reserve a page for our replacement PML4
|
||||
// Reserve a page for our replacement PML4, plus some pages for the kernel to use
|
||||
// as page tables while it gets started.
|
||||
EFI_PHYSICAL_ADDRESS addr = 0;
|
||||
status = bootsvc->AllocatePages(AllocateAnyPages, EfiLoaderData, 4, &addr);
|
||||
CHECK_EFI_STATUS_OR_RETURN(status, "Failed to allocate PML4 page.");
|
||||
status = bootsvc->AllocatePages(AllocateAnyPages, EfiLoaderData, 16, &addr);
|
||||
CHECK_EFI_STATUS_OR_RETURN(status, "Failed to allocate page table pages.");
|
||||
|
||||
new_pml4 = (uint64_t *)addr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user