Skip to content

Commit b4854c1

Browse files
author
steven
committed
Fix VS-mode check for sireg* (really vsireg*) CSRs
1 parent 65e41ba commit b4854c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

riscv/csrs.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ void sscsrind_reg_csr_t::verify_permissions(insn_t insn, bool write) const {
18601860
}
18611861

18621862
if (proc->extension_enabled(EXT_SMCDELEG)) {
1863-
if (insn.csr() >= CSR_VSIREG && insn.csr() <= CSR_VSIREG6) {
1863+
if (address >= CSR_VSIREG && address <= CSR_VSIREG6) {
18641864
if (!state->v) {
18651865
// An attempt to access any vsireg* from M or S mode raises an illegal instruction exception.
18661866
throw trap_illegal_instruction(insn.bits());
@@ -1878,7 +1878,7 @@ void sscsrind_reg_csr_t::verify_permissions(insn_t insn, bool write) const {
18781878
}
18791879
}
18801880
}
1881-
if (insn.csr() >= CSR_SIREG && insn.csr() <= CSR_SIREG6) {
1881+
if (address >= CSR_SIREG && address <= CSR_SIREG6) {
18821882
// attempts to access any sireg* when menvcfg.CDE = 0;
18831883
if ((state->menvcfg->read() & MENVCFG_CDE) != MENVCFG_CDE) {
18841884
if (!state->v) {

0 commit comments

Comments
 (0)