entry/uefi: Abort if loaded above 4GiB. Fix #206
diff --git a/common/entry.s3.c b/common/entry.s3.c
index f3e7f2c3..c527c6d1 100644
--- a/common/entry.s3.c
+++ b/common/entry.s3.c
@@ -46,6 +46,8 @@ EFI_STATUS efi_main(
#endif
}
+extern symbol __image_base;
+
noreturn void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
gST = SystemTable;
gBS = SystemTable->BootServices;
@@ -67,6 +69,10 @@ noreturn void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
init_gdt();
+ if ((uintptr_t)__image_base > 0x100000000) {
+ panic(false, "Limine does not support being loaded above 4GiB");
+ }
+
disk_create_index();
boot_volume = NULL;
