stivale: Panic if higher half addresses header flag is set for 32-bit kernels
diff --git a/stage23/protos/stivale.c b/stage23/protos/stivale.c
index 335e7f72..01134665 100644
--- a/stage23/protos/stivale.c
+++ b/stage23/protos/stivale.c
@@ -109,6 +109,10 @@ void stivale_load(char *config, char *cmdline) {
panic("stivale: Section .stivalehdr is smaller than size of the struct.");
}
+ if ((stivale_hdr.flags & (1 << 3)) && bits == 32) {
+ panic("stivale: Higher half addresses header flag not supported in 32-bit mode.");
+ }
+
bool want_5lv = level5pg && (stivale_hdr.flags & (1 << 1));
if (stivale_hdr.entry_point != 0)
diff --git a/stage23/protos/stivale2.c b/stage23/protos/stivale2.c
index ad347fc2..3b83f292 100644
--- a/stage23/protos/stivale2.c
+++ b/stage23/protos/stivale2.c
@@ -131,6 +131,10 @@ void stivale2_load(char *config, char *cmdline, bool pxe, void *efi_system_table
panic("stivale2: Section .stivale2hdr is smaller than size of the struct.");
}
+ if ((stivale2_hdr.flags & (1 << 1)) && bits == 32) {
+ panic("stivale2: Higher half addresses header flag not supported in 32-bit mode.");
+ }
+
bool want_5lv = (get_tag(&stivale2_hdr, STIVALE2_HEADER_TAG_5LV_PAGING_ID) ? true : false) && level5pg;
if (stivale2_hdr.entry_point != 0)
