summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-07-13 00:17:38 +0000
committerIan Moffett <ian@osmora.org>2025-07-13 00:17:38 +0000
commit85ddd63bddfa20bedce3a387c69dcf66f882a8ea (patch)
tree3c3fe6ee0e7bf616b3be91e81e12fe7c550b86b3
parent7981f440aae9c9f88227f26eae10211277db9623 (diff)
kernel: Make panic screen configurable
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/arch/amd64/conf/GENERIC1
-rw-r--r--sys/kern/kern_panic.c10
2 files changed, 10 insertions, 1 deletions
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 <machine/cdefs.h>
#include <machine/cpu.h>
+#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();