From fb4002d54b25ab70d46649a76bf536c67cb92bf4 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 16 May 2025 20:07:43 -0400 Subject: kernel: Add cpu_halt_others() and harden panic() Ensure interrupts are disabled at the start of panic() to prevent any interrupts from further degrading the state of the system. Also adds a newline before "panic: " to clean up the logs. Signed-off-by: Ian Moffett --- sys/kern/kern_panic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sys/kern') diff --git a/sys/kern/kern_panic.c b/sys/kern/kern_panic.c index 950ea8f..7660fff 100644 --- a/sys/kern/kern_panic.c +++ b/sys/kern/kern_panic.c @@ -31,6 +31,8 @@ #include #include #include +#include +#include /* * Burn and sizzle - the core logic that really ends @@ -69,8 +71,12 @@ panic(const char *fmt, ...) { va_list ap; + /* Shut everything else up */ + md_intoff(); + cpu_halt_others(); + va_start(ap, fmt); - kprintf(OMIT_TIMESTAMP "panic: "); + kprintf(OMIT_TIMESTAMP "\npanic: "); vkprintf(fmt, &ap); bas(true, REBOOT_HALT); -- cgit v1.2.3