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.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/kc/core/panic.c b/kc/core/panic.c
index 6fd5581..2f46a6a 100644
--- a/kc/core/panic.c
+++ b/kc/core/panic.c
@@ -6,17 +6,22 @@
static char const *reason_strings[] = {
"general panic",
"unhandled fault",
- "out of memory"
+ "out of memory",
+ "dead-end routine"
};
-noreturn void panic(enum panic_reason reason)
+noreturn void panic(const char *file, int line, enum panic_reason reason)
{
// TODO: kprintf() and friends
if (reason > sizeof(reason_strings) / sizeof(*reason_strings))
{
reason = 0;
}
- kprintf("kernel panic: %s\n", reason_strings[reason]);
+ kprintf(
+ "kernel panic:%s:%u %s\n",
+ file,
+ line,
+ reason_strings[reason]);
halt();
}
@@ -25,3 +30,4 @@ noreturn void halt(void)
__asm__ ("cli\n\t");
while (true) __asm__ ("hlt\n\t");
}
+