Skip to content

Commit 4fe12b2

Browse files
binnochihminchao
authored andcommitted
ssqosid: modify permission check condition for srmcfg
The srmcfg csr number is 0x181 which is a S-mode csr The patche uses independant permission check to make the csr available even there is no S-mode
1 parent f7d0dba commit 4fe12b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

riscv/csrs.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,8 +1752,6 @@ srmcfg_csr_t::srmcfg_csr_t(processor_t* const proc, const reg_t addr, const reg_
17521752
}
17531753

17541754
void srmcfg_csr_t::verify_permissions(insn_t insn, bool write) const {
1755-
csr_t::verify_permissions(insn, write);
1756-
17571755
if (!proc->extension_enabled(EXT_SSQOSID))
17581756
throw trap_illegal_instruction(insn.bits());
17591757

@@ -1764,6 +1762,10 @@ void srmcfg_csr_t::verify_permissions(insn_t insn, bool write) const {
17641762

17651763
if (state->v)
17661764
throw trap_virtual_instruction(insn.bits());
1765+
1766+
if (state->prv < PRV_S) {
1767+
throw trap_illegal_instruction(insn.bits());
1768+
}
17671769
}
17681770

17691771
hvip_csr_t::hvip_csr_t(processor_t* const proc, const reg_t addr, const reg_t init):

0 commit comments

Comments
 (0)