diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2020-11-24 16:41:49 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2020-11-24 16:41:49 -0700 |
commit | c29e0323020e0f96932d0f9b09747d5b2e28e5a6 (patch) | |
tree | c6100f1a4702d14548f5b82d72afb85340711a68 /src/kern/panic.c | |
parent | 0c0f5c3d8397ba5168f0cd01b25ba70c238b36e0 (diff) | |
download | stm32l4-c29e0323020e0f96932d0f9b09747d5b2e28e5a6.tar.gz stm32l4-c29e0323020e0f96932d0f9b09747d5b2e28e5a6.tar.bz2 stm32l4-c29e0323020e0f96932d0f9b09747d5b2e28e5a6.zip |
Changes to painic. It now prints the stack at the time of failure (if logging is initialized).
Diffstat (limited to 'src/kern/panic.c')
-rw-r--r-- | src/kern/panic.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/kern/panic.c b/src/kern/panic.c index 8708456..3e67b90 100644 --- a/src/kern/panic.c +++ b/src/kern/panic.c @@ -12,6 +12,8 @@ #ifdef ARCH_STM32L4 _Noreturn void panic(const char* fmt, ...) { + uint32_t base[0]; + disable_all_interrupts(); if (get_system_init_level() > INIT_LEVEL_2) { va_list l; @@ -19,6 +21,13 @@ _Noreturn void panic(const char* fmt, ...) kerr_logf("** Kernel Panic! **\n"); kerr_vlogf(fmt, l); + kerr_logf("** Stack:\n"); + + int i = 0; + for (; i < 20 && &base[i] != (void*)STACK_TOP; ++ i) { + kerr_logf(" (%p) %p\n", &base[i], base[i]); + } + set_system_clock_MHz(4); /* reduce power usage while we do nothing. */ for(;;); |