riscv/riscv_exception.c: Print the EPC value always
The value printed by assert() cannot always be trusted to be correct, as it relies on the stack / stack pointer not being corrupt. The CPU register always points to the faulting instruction so print it out in the exception handler.
This commit is contained in:
parent
8bf693b362
commit
9b88f8ea5c
1 changed files with 3 additions and 2 deletions
|
|
@ -74,9 +74,10 @@ int riscv_exception(int mcause, void *regs, void *args)
|
|||
{
|
||||
uintptr_t cause = mcause & RISCV_IRQ_MASK;
|
||||
|
||||
_alert("EXCEPTION: %s. MCAUSE: %" PRIxREG ", MTVAL: %" PRIxREG "\n",
|
||||
_alert("EXCEPTION: %s. MCAUSE: %" PRIxREG ", EPC: %" PRIxREG
|
||||
", MTVAL: %" PRIxREG "\n",
|
||||
mcause > RISCV_MAX_EXCEPTION ? "Unknown" : g_reasons_str[cause],
|
||||
cause, READ_CSR(CSR_TVAL));
|
||||
cause, READ_CSR(CSR_EPC), READ_CSR(CSR_TVAL));
|
||||
|
||||
_alert("PANIC!!! Exception = %" PRIxREG "\n", cause);
|
||||
up_irq_save();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue