We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b44a5af commit 42896f1Copy full SHA for 42896f1
src/emulate.c
@@ -1138,10 +1138,8 @@ static void __trap_handler(riscv_t *rv)
1138
1139
static void _trap_handler(riscv_t *rv)
1140
{
1141
- uint32_t cause =
1142
- rv->priv_mode == RV_PRIV_S_MODE ? rv->csr_scause : rv->csr_mcause;
1143
- uint32_t tval =
1144
- rv->priv_mode == RV_PRIV_S_MODE ? rv->csr_stval : rv->csr_mtval;
+ uint32_t cause = RV_PRIV_IS_U_OR_S_MODE() ? rv->csr_scause : rv->csr_mcause;
+ uint32_t tval = RV_PRIV_IS_U_OR_S_MODE() ? rv->csr_stval : rv->csr_mtval;
1145
1146
switch (cause) {
1147
#if !RV32_HAS(EXT_C)
0 commit comments