fix(boot): read the ACPI RSDP before taking the memory-map key

ExitBootServices failed with EFI_INVALID_PARAMETER because Print ran
after GetMemoryMap, so the console output could change the memory map
and invalidate MapKey. Locate the RSDP and print it before GetMemoryMap.
This commit is contained in:
TermiNexus committed 2026-10-27 17:14:51 +08:00
1 parent 7e0aa5c7af
commit b33fbb75dc
1 file changed
+6 -2
+6 -2
View File
@@ -500,6 +500,11 @@ EFI_STATUS ExitBootServicesAndJumpToKernel(
// ==========================
Print(L"Exiting Boot Services...\r\n");
// Capture the RSDP before GetMemoryMap: any boot-service call that
// allocates after the map key is taken invalidates ExitBootServices.
UINT64 AcpiRsdp = FindAcpiRsdp(SystemTable);
Print(L"ACPI RSDP: 0x%lx\r\n", AcpiRsdp);
UINTN MemoryMapSize = 0;
UINTN MapKey;
UINTN DescriptorSize;
@@ -546,8 +551,7 @@ EFI_STATUS ExitBootServicesAndJumpToKernel(
BootInfo.framebuffer_pitch = framebuffer_pitch;
BootInfo.framebuffer_format = framebuffer_format;
BootInfo.system_table = 0;
BootInfo.acpi_rsdp = FindAcpiRsdp(SystemTable);
Print(L"ACPI RSDP: 0x%lx\r\n", BootInfo.acpi_rsdp);
BootInfo.acpi_rsdp = AcpiRsdp;
static boot_info_t static_boot_info;
static_boot_info = BootInfo;