fatal exception handler: Only dump "registers" from stack for fatal user exceptions
This commit is contained in:
parent
36886412e6
commit
efedd24624
3 changed files with 13 additions and 6 deletions
|
@ -23,7 +23,7 @@
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
static void IRAM fatal_handler_prelude(void);
|
static void IRAM fatal_handler_prelude(void);
|
||||||
/* Inner parts of crash handlers marked noinline to ensure they don't inline into IRAM. */
|
/* Inner parts of crash handlers marked noinline to ensure they don't inline into IRAM. */
|
||||||
static void __attribute__((noinline)) __attribute__((noreturn)) fatal_exception_handler_inner(uint32_t *sp);
|
static void __attribute__((noinline)) __attribute__((noreturn)) fatal_exception_handler_inner(uint32_t *sp, bool registers_saved_on_stack);
|
||||||
static void __attribute__((noinline)) __attribute__((noreturn)) abort_handler_inner(uint32_t *caller, uint32_t *sp);
|
static void __attribute__((noinline)) __attribute__((noreturn)) abort_handler_inner(uint32_t *caller, uint32_t *sp);
|
||||||
|
|
||||||
/* fatal_exception_handler called from any unhandled user exception
|
/* fatal_exception_handler called from any unhandled user exception
|
||||||
|
@ -34,9 +34,9 @@ static void __attribute__((noinline)) __attribute__((noreturn)) abort_handler_in
|
||||||
* runs from flash after fatal_handler_prelude ensures it is mapped
|
* runs from flash after fatal_handler_prelude ensures it is mapped
|
||||||
* safely.
|
* safely.
|
||||||
*/
|
*/
|
||||||
void IRAM __attribute__((noreturn)) fatal_exception_handler(uint32_t *sp) {
|
void IRAM __attribute__((noreturn)) fatal_exception_handler(uint32_t *sp, bool registers_saved_on_stack) {
|
||||||
fatal_handler_prelude();
|
fatal_handler_prelude();
|
||||||
fatal_exception_handler_inner(sp);
|
fatal_exception_handler_inner(sp, registers_saved_on_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Abort implementation
|
/* Abort implementation
|
||||||
|
@ -148,10 +148,12 @@ static void IRAM fatal_handler_prelude(void) {
|
||||||
/* Main part of fatal exception handler, is run from flash to save
|
/* Main part of fatal exception handler, is run from flash to save
|
||||||
some IRAM.
|
some IRAM.
|
||||||
*/
|
*/
|
||||||
static void fatal_exception_handler_inner(uint32_t *sp) {
|
static void fatal_exception_handler_inner(uint32_t *sp, bool registers_saved_on_stack) {
|
||||||
dump_excinfo();
|
dump_excinfo();
|
||||||
if (sp) {
|
if (sp) {
|
||||||
|
if (registers_saved_on_stack) {
|
||||||
dump_registers_in_exception_handler(sp);
|
dump_registers_in_exception_handler(sp);
|
||||||
|
}
|
||||||
dump_stack(sp);
|
dump_stack(sp);
|
||||||
}
|
}
|
||||||
uart_flush_txfifo(0);
|
uart_flush_txfifo(0);
|
||||||
|
|
|
@ -69,6 +69,7 @@ DebugExceptionVector:
|
||||||
|
|
||||||
wsr a0, excsave2
|
wsr a0, excsave2
|
||||||
mov a2, a1
|
mov a2, a1
|
||||||
|
movi a3, 0
|
||||||
call0 fatal_exception_handler
|
call0 fatal_exception_handler
|
||||||
rfi 2
|
rfi 2
|
||||||
|
|
||||||
|
@ -83,6 +84,7 @@ KernelExceptionVector:
|
||||||
|
|
||||||
break 1, 0
|
break 1, 0
|
||||||
mov a2, a1
|
mov a2, a1
|
||||||
|
movi a3, 0
|
||||||
call0 fatal_exception_handler
|
call0 fatal_exception_handler
|
||||||
rfe
|
rfe
|
||||||
|
|
||||||
|
@ -101,6 +103,7 @@ DoubleExceptionVector:
|
||||||
|
|
||||||
break 1, 4
|
break 1, 4
|
||||||
mov a2, a1
|
mov a2, a1
|
||||||
|
movi a3, 0
|
||||||
call0 fatal_exception_handler
|
call0 fatal_exception_handler
|
||||||
|
|
||||||
/* Reset vector at offset 0x80 is unused, as vecbase gets reset to mask ROM
|
/* Reset vector at offset 0x80 is unused, as vecbase gets reset to mask ROM
|
||||||
|
@ -259,6 +262,7 @@ LoadStoreErrorHandler:
|
||||||
l32i a4, sp, 0x10
|
l32i a4, sp, 0x10
|
||||||
rsr a1, excsave1
|
rsr a1, excsave1
|
||||||
mov a2, a1
|
mov a2, a1
|
||||||
|
movi a3, 0
|
||||||
call0 fatal_exception_handler
|
call0 fatal_exception_handler
|
||||||
|
|
||||||
.balign 4
|
.balign 4
|
||||||
|
@ -520,6 +524,7 @@ UserExceptionHandler:
|
||||||
.LUserFailOtherExceptionCause:
|
.LUserFailOtherExceptionCause:
|
||||||
break 1, 1
|
break 1, 1
|
||||||
addi a2, a1, 0x50 /* UserExceptionHandler pushes stack down 0x50 */
|
addi a2, a1, 0x50 /* UserExceptionHandler pushes stack down 0x50 */
|
||||||
|
movi a3, 1
|
||||||
call0 fatal_exception_handler
|
call0 fatal_exception_handler
|
||||||
|
|
||||||
/* _xt_user_exit is pushed onto the stack as part of the user exception handler,
|
/* _xt_user_exit is pushed onto the stack as part of the user exception handler,
|
||||||
|
|
|
@ -17,6 +17,6 @@ void dump_stack(uint32_t *sp);
|
||||||
|
|
||||||
Probably not useful to be called in other contexts.
|
Probably not useful to be called in other contexts.
|
||||||
*/
|
*/
|
||||||
void __attribute__((noreturn)) fatal_exception_handler(uint32_t *sp);
|
void __attribute__((noreturn)) fatal_exception_handler(uint32_t *sp, bool registers_saved_on_stack);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue