linux: Find compromise for 32-bit EFI boot

This commit is contained in:
mintsuki 2022-08-04 14:16:42 +02:00
parent 4b55b45382
commit 367bf3e5e9
1 changed files with 10 additions and 1 deletions

View File

@ -577,15 +577,24 @@ set_textmode:;
#if defined (__x86_64__)
memcpy(&boot_params->efi_info.efi_loader_signature, "EL64", 4);
#elif defined (__i386__)
memcpy(&boot_params->efi_info.efi_loader_signature, "EL32", 4);
#endif
boot_params->efi_info.efi_systab = (uint32_t)(uint64_t)(uintptr_t)gST;
boot_params->efi_info.efi_systab_hi = (uint32_t)((uint64_t)(uintptr_t)gST >> 32);
boot_params->efi_info.efi_memmap = (uint32_t)(uint64_t)(uintptr_t)efi_mmap;
boot_params->efi_info.efi_memmap_hi = (uint32_t)((uint64_t)(uintptr_t)efi_mmap >> 32);
#if defined (__x86_64__)
boot_params->efi_info.efi_memmap_size = efi_mmap_size;
#elif defined (__i386__)
// A memmap size of 0 will cause Linux to force bail out of trying to use
// 32-bit EFI runtime services without ignoring other EFI info.
// XXX: Figure out why 64-bit Linux hangs if trying to use 32-bit boot services.
boot_params->efi_info.efi_memmap_size = 0;
#endif
boot_params->efi_info.efi_memdesc_size = efi_desc_size;
boot_params->efi_info.efi_memdesc_version = efi_desc_ver;
#endif
#endif
///////////////////////////////////////