Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion arch/riscv/core/fatal.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,21 @@ void _Fault(z_arch_esf_t *esf)
}
}
#endif /* CONFIG_USERSPACE */
ulong_t mcause, mtval;
ulong_t mcause;

__asm__ volatile("csrr %0, mcause" : "=r" (mcause));

#ifndef CONFIG_SOC_OPENISA_RV32M1_RISCV32
ulong_t mtval;
__asm__ volatile("csrr %0, mtval" : "=r" (mtval));
#endif

mcause &= SOC_MCAUSE_EXP_MASK;
LOG_ERR("");
LOG_ERR(" mcause: %ld, %s", mcause, cause_str(mcause));
#ifndef CONFIG_SOC_OPENISA_RV32M1_RISCV32
LOG_ERR(" mtval: %lx", mtval);
#endif

z_riscv_fatal_error(K_ERR_CPU_EXCEPTION, esf);
}
Expand Down