summaryrefslogtreecommitdiff
path: root/kc/core/panic.c
diff options
context:
space:
mode:
Diffstat (limited to 'kc/core/panic.c')
-rw-r--r--kc/core/panic.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kc/core/panic.c b/kc/core/panic.c
index b0d9daf..6fd5581 100644
--- a/kc/core/panic.c
+++ b/kc/core/panic.c
@@ -12,9 +12,11 @@ static char const *reason_strings[] = {
noreturn void panic(enum panic_reason reason)
{
// TODO: kprintf() and friends
- kputs("kernel panic: ");
- kputs(reason_strings[reason]);
- kputs("\n");
+ if (reason > sizeof(reason_strings) / sizeof(*reason_strings))
+ {
+ reason = 0;
+ }
+ kprintf("kernel panic: %s\n", reason_strings[reason]);
halt();
}