misc: Panic improvements
diff --git a/common/lib/panic.s2.c b/common/lib/panic.s2.c
index b61f6a98..605c14c5 100644
--- a/common/lib/panic.s2.c
+++ b/common/lib/panic.s2.c
@@ -21,23 +21,25 @@ noreturn void panic(bool allow_menu, const char *fmt, ...) {
quiet = false;
+ static bool is_nested = false;
+
+ if (is_nested) {
+ goto nested;
+ }
+
+ is_nested = true;
+
if (
#if bios == 1
stage3_loaded == true &&
#endif
term_backend == NOT_READY) {
-#if bios == 1
- term_textmode();
-#elif uefi == 1
+ early_term = true;
term_vbe(0, 0);
-#endif
}
- if (
-#if bios == 1
- stage3_loaded == true &&
-#endif
- term_backend == NOT_READY) {
+nested:
+ if (term_backend == NOT_READY) {
term_fallback();
}
diff --git a/common/linker_bios.ld.in b/common/linker_bios.ld.in
index 6e37e09a..1f7ab457 100644
--- a/common/linker_bios.ld.in
+++ b/common/linker_bios.ld.in
@@ -40,6 +40,7 @@ SECTIONS
menu = .;
term_write = .;
term_textmode = .;
+ term_vbe = .;
term_fallback = .;
stage3_addr = .;
data_begin = .;
