riscv: Dump trap val in exception handler
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
a0ee5d3747
commit
f93964ad3c
@ -41,6 +41,7 @@
|
||||
# define CSR_EPC sepc /* Exception program counter */
|
||||
# define CSR_IE sie /* Interrupt enable register */
|
||||
# define CSR_CAUSE scause /* Interrupt cause register */
|
||||
# define CSR_TVAL stval /* Trap value register */
|
||||
|
||||
/* In status register */
|
||||
|
||||
@ -74,6 +75,7 @@
|
||||
# define CSR_EPC mepc /* Exception program counter */
|
||||
# define CSR_IE mie /* Interrupt enable register */
|
||||
# define CSR_CAUSE mcause /* Interrupt cause register */
|
||||
# define CSR_TVAL mtval /* Trap value register */
|
||||
|
||||
/* In status register */
|
||||
|
||||
|
@ -73,15 +73,9 @@ int riscv_exception(int mcause, void *regs, void *args)
|
||||
{
|
||||
uintptr_t cause = mcause & RISCV_IRQ_MASK;
|
||||
|
||||
if (mcause > RISCV_MAX_EXCEPTION)
|
||||
{
|
||||
_alert("EXCEPTION: Unknown. MCAUSE: %" PRIxREG "\n", cause);
|
||||
}
|
||||
else
|
||||
{
|
||||
_alert("EXCEPTION: %s. MCAUSE: %" PRIxREG "\n",
|
||||
g_reasons_str[cause], cause);
|
||||
}
|
||||
_alert("EXCEPTION: %s. MCAUSE: %" PRIxREG ", MTVAL: %" PRIxREG "\n",
|
||||
mcause > RISCV_MAX_EXCEPTION ? "Unknown" : g_reasons_str[cause],
|
||||
cause, READ_CSR(CSR_TVAL));
|
||||
|
||||
_alert("PANIC!!! Exception = %" PRIxREG "\n", cause);
|
||||
up_irq_save();
|
||||
|
Loading…
x
Reference in New Issue
Block a user