efi: Ensure panics are (hopefully) always visible

This commit is contained in:
mintsuki 2022-09-15 13:31:42 +02:00
parent 886523359c
commit 50b524838a
4 changed files with 18 additions and 4 deletions

View File

@ -29,14 +29,22 @@ noreturn void panic(bool allow_menu, const char *fmt, ...) {
is_nested = true;
if (
#if defined (BIOS)
stage3_loaded == true &&
#endif
term_backend == NOT_READY) {
if (stage3_loaded == true && term_backend == NOT_READY) {
early_term = true;
term_vbe(NULL, 0, 0);
}
#endif
#if defined (UEFI)
if (term_backend == NOT_READY) {
if (term_enabled_once) {
term_vbe(NULL, 0, 0);
} else {
term_fallback();
}
}
#endif
nested:
if (term_backend == NOT_READY) {

View File

@ -109,6 +109,8 @@ void term_vbe(char *config, size_t width, size_t height) {
term_context_restore = gterm_context_restore;
term_full_refresh = gterm_full_refresh;
term_enabled_once = true;
term_backend = VBE;
}
@ -220,6 +222,8 @@ void term_textmode(void) {
term_context_restore = text_context_restore;
term_full_refresh = text_full_refresh;
term_enabled_once = true;
term_backend = TEXTMODE;
}
#endif

View File

@ -50,6 +50,7 @@ extern int term_backend;
extern size_t term_rows, term_cols;
extern bool term_runtime;
extern bool early_term;
extern bool term_enabled_once;
void term_fallback(void);

View File

@ -11,6 +11,7 @@ no_unwind int current_video_mode = -1;
int term_backend = NOT_READY;
size_t term_rows, term_cols;
bool term_runtime = false;
bool term_enabled_once = false;
void (*raw_putchar)(uint8_t c);
void (*clear)(bool move);