stivale: Refuse to boot if text mode wanted on UEFI
diff --git a/stage23/protos/stivale.c b/stage23/protos/stivale.c
index fa0b3cb5..5048b6cb 100644
--- a/stage23/protos/stivale.c
+++ b/stage23/protos/stivale.c
@@ -156,9 +156,9 @@ void stivale_load(char *config, char *cmdline) {
stivale_struct.epoch = time();
print("stivale: Current epoch: %U\n", stivale_struct.epoch);
- term_deinit();
-
if (stivale_hdr.flags & (1 << 0)) {
+ term_deinit();
+
int req_width = stivale_hdr.framebuffer_width;
int req_height = stivale_hdr.framebuffer_height;
int req_bpp = stivale_hdr.framebuffer_bpp;
@@ -183,6 +183,12 @@ void stivale_load(char *config, char *cmdline) {
stivale_struct.fb_green_mask_shift = fbinfo.green_mask_shift;
stivale_struct.fb_blue_mask_size = fbinfo.blue_mask_size;
stivale_struct.fb_blue_mask_shift = fbinfo.blue_mask_shift;
+ } else {
+#if defined (uefi)
+ panic("stivale: Cannot use text mode with UEFI.");
+#endif
+
+ term_deinit();
}
#if defined (uefi)
diff --git a/stage23/protos/stivale2.c b/stage23/protos/stivale2.c
index 7b791aac..47747384 100644
--- a/stage23/protos/stivale2.c
+++ b/stage23/protos/stivale2.c
@@ -262,9 +262,9 @@ void stivale2_load(char *config, char *cmdline, bool pxe, void *efi_system_table
{
struct stivale2_header_tag_framebuffer *hdrtag = get_tag(&stivale2_hdr, STIVALE2_HEADER_TAG_FRAMEBUFFER_ID);
- term_deinit();
-
if (hdrtag != NULL) {
+ term_deinit();
+
int req_width = hdrtag->framebuffer_width;
int req_height = hdrtag->framebuffer_height;
int req_bpp = hdrtag->framebuffer_bpp;
@@ -306,6 +306,12 @@ void stivale2_load(char *config, char *cmdline, bool pxe, void *efi_system_table
mtrr_save();
}
}
+ } else {
+#if defined (uefi)
+ panic("stivale2: Cannot use text mode with UEFI.");
+#endif
+
+ term_deinit();
}
}
