summaryrefslogtreecommitdiff
path: root/kc/core/panic.c
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2022-02-17 13:40:55 +0000
committerAda Christine <adachristine18@gmail.com>2022-02-17 13:40:55 +0000
commit9b63c0000b2e0d9d0a306e56dbc7bc28403e5549 (patch)
tree17ef5aa53d37c4232f8efcca97c5f118a96fb96f /kc/core/panic.c
parentb8ef8b401d9dd1e15f2703eb997fb79a70ae531a (diff)
many changes have happned
- updates to panic() interface - genericized timer interface - (yet unused) additions to task management
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");
}
+