From 85ddd63bddfa20bedce3a387c69dcf66f882a8ea Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 13 Jul 2025 00:17:38 +0000 Subject: kernel: Make panic screen configurable Signed-off-by: Ian Moffett --- sys/arch/amd64/conf/GENERIC | 1 + sys/kern/kern_panic.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index 44ab8b5..95fe2e0 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -9,6 +9,7 @@ option SPECTRE_IBRS no // Enable the IBRS CPU feature option SERIAL_DEBUG yes // Enable kmsg serial logging option USER_KMSG no // Show kmsg in user consoles option CPU_SMEP yes // Supervisor Memory Exec Protection +option PANIC_SCR no // Clear screen on panic // Kernel constants setval SCHED_NQUEUE 4 // Number of scheduler queues (for MLFQ) diff --git a/sys/kern/kern_panic.c b/sys/kern/kern_panic.c index 099f620..2df4537 100644 --- a/sys/kern/kern_panic.c +++ b/sys/kern/kern_panic.c @@ -35,6 +35,12 @@ #include #include +#if defined(__PANIC_SCR) +#define PANIC_SCR __PANIC_SCR +#else +#define PANIC_SCR 0 +#endif + /* * Burn and sizzle - the core logic that really ends * things ::) @@ -101,7 +107,9 @@ panic(const char *fmt, ...) md_intoff(); cpu_halt_others(); - panic_screen(); + if (PANIC_SCR) { + panic_screen(); + } va_start(ap, fmt); do_panic(fmt, &ap); __builtin_unreachable(); -- cgit v1.2.3