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