panic: Initialise a terminal backend if term is not ready

This commit is contained in:
mintsuki 2021-10-30 01:58:35 +02:00
parent f46ed6d984
commit 057715b60c
1 changed files with 9 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include <lib/blib.h>
#include <lib/readline.h>
#include <lib/gterm.h>
#include <lib/term.h>
#include <mm/pmm.h>
__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);