Skip to contentSkip to conversation

target/riscv: make cbo helpers [ms]envcfg gating in user-mode

PATCH New Abhigyan Kumar 1 participant 1 message Aug 14 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/riscv: make cbo helpers [ms]envcfg gating in user-mode

Current implementation of check_zicbo_envcfg is wrapped in an if-else macro that eliminates the function during compilation for user-modde. But, the zicbo spec states that [ms]envcfg gating is to be used.

---
 target/riscv/tcg/op_helper.c | 5 +++++
 1 file changed, 5 insertions(+)
target/riscv/tcg/op_helper.c +5 -0
index ba3c7da..bc899c4 100644
@@ -160,6 +160,11 @@ static void check_zicbo_envcfg(CPURISCVState *env, target_ulong envbits,
     if ((env->priv < PRV_S) && !get_field(env->senvcfg, envbits)) {
         riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, ra);
     }
+#else
+    if (!get_field(env->senvcfg, envbits) ||
+        !get_field(env->menvcfg, envbits)) {
+        riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, ra);
+    }
 #endif
 }
 
Signature · 1 line
2.55.0