diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_panic.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/sys/kern/kern_panic.c b/sys/kern/kern_panic.c index 703dba9..099f620 100644 --- a/sys/kern/kern_panic.c +++ b/sys/kern/kern_panic.c @@ -31,6 +31,7 @@ #include <sys/spinlock.h> #include <sys/syslog.h> #include <sys/reboot.h> +#include <dev/cons/cons.h> #include <machine/cdefs.h> #include <machine/cpu.h> @@ -53,10 +54,35 @@ bas(bool do_trace, int reboot_type) md_backtrace(); } + kprintf(OMIT_TIMESTAMP "\n-- ALL CORES HAVE BEEN HALTED --\n"); cpu_reboot(reboot_type); __builtin_unreachable(); } +static void +panic_screen(void) +{ + struct cons_screen *scr = &g_root_scr; + + if (scr->fb_mem != NULL) { + scr->bg = 0x8B0000; + scr->fg = 0xAABBAA; + cons_reset_cursor(scr); + cons_clear_scr(scr, 0x393B39); + } +} + +static void +do_panic(const char *fmt, va_list *ap) +{ + syslog_silence(false); + kprintf(OMIT_TIMESTAMP "panic: "); + vkprintf(fmt, ap); + bas(true, REBOOT_HALT); + + __builtin_unreachable(); +} + /* * Tells the user something terribly wrong happened then * halting the system as soon as possible. @@ -75,11 +101,9 @@ panic(const char *fmt, ...) md_intoff(); cpu_halt_others(); + panic_screen(); va_start(ap, fmt); - kprintf(OMIT_TIMESTAMP "\npanic: "); - vkprintf(fmt, &ap); - bas(true, REBOOT_HALT); - + do_panic(fmt, &ap); __builtin_unreachable(); } |