From 057715b60cb2eef474efb8631daa2702bc6e7fe3 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sat, 30 Oct 2021 01:58:35 +0200 Subject: [PATCH] panic: Initialise a terminal backend if term is not ready --- stage23/lib/panic.s2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stage23/lib/panic.s2.c b/stage23/lib/panic.s2.c index 1094b99e..d444523d 100644 --- a/stage23/lib/panic.s2.c +++ b/stage23/lib/panic.s2.c @@ -7,6 +7,7 @@ #include #include #include +#include #include __attribute__((noreturn)) void panic(const char *fmt, ...) { @@ -14,6 +15,14 @@ __attribute__((noreturn)) void panic(const char *fmt, ...) { va_start(args, fmt); + if (term_backend == NOT_READY) { +#if bios == 1 + term_textmode(); +#elif uefi == 1 + term_vbe(0, 0); +#endif + } + print("\033[31mPANIC\033[37;1m\033[0m: "); vprint(fmt, args);