summaryrefslogtreecommitdiff
path: root/sys/kern/kern_panic.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_panic.c')
-rw-r--r--sys/kern/kern_panic.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/sys/kern/kern_panic.c b/sys/kern/kern_panic.c
index 950ea8f..099f620 100644
--- a/sys/kern/kern_panic.c
+++ b/sys/kern/kern_panic.c
@@ -31,6 +31,9 @@
#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>
/*
* Burn and sizzle - the core logic that really ends
@@ -51,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.
@@ -69,11 +97,13 @@ panic(const char *fmt, ...)
{
va_list ap;
- va_start(ap, fmt);
- kprintf(OMIT_TIMESTAMP "panic: ");
- vkprintf(fmt, &ap);
- bas(true, REBOOT_HALT);
+ /* Shut everything else up */
+ md_intoff();
+ cpu_halt_others();
+ panic_screen();
+ va_start(ap, fmt);
+ do_panic(fmt, &ap);
__builtin_unreachable();
}
@@ -89,7 +119,6 @@ hcf(const char *fmt, ...)
{
va_list ap;
-
if (fmt != NULL) {
va_start(ap, fmt);
kprintf(OMIT_TIMESTAMP);