Skip to content

Commit abb0d98

Browse files
authored
Merge pull request #2166 from Steven-Li-Xiaogang/master
Fix VS-mode check for sireg* (really vsireg*) CSRs
2 parents 59bf546 + b4854c1 commit abb0d98

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
@@ -1866,7 +1866,7 @@ void sscsrind_reg_csr_t::verify_permissions(insn_t insn, bool write) const {
18661866
}
18671867

18681868
if (proc->extension_enabled(EXT_SMCDELEG)) {
1869-
if (insn.csr() >= CSR_VSIREG && insn.csr() <= CSR_VSIREG6) {
1869+
if (address >= CSR_VSIREG && address <= CSR_VSIREG6) {
18701870
if (!state->v) {
18711871
// An attempt to access any vsireg* from M or S mode raises an illegal instruction exception.
18721872
throw trap_illegal_instruction(insn.bits());
@@ -1884,7 +1884,7 @@ void sscsrind_reg_csr_t::verify_permissions(insn_t insn, bool write) const {
18841884
}
18851885
}
18861886
}
1887-
if (insn.csr() >= CSR_SIREG && insn.csr() <= CSR_SIREG6) {
1887+
if (address >= CSR_SIREG && address <= CSR_SIREG6) {
18881888
// attempts to access any sireg* when menvcfg.CDE = 0;
18891889
if ((state->menvcfg->read() & MENVCFG_CDE) != MENVCFG_CDE) {
18901890
if (!state->v) {

0 commit comments

Comments
 (0)