Browse Source

when AIA throw virt intruction exception and V=1 & vs-mode, otherwise throw illegal instruction exception

pull/2204/head
muhammad.moiz.hussain 7 months ago
parent
commit
2e7042897d
  1. 11
      riscv/csrs.cc

11
riscv/csrs.cc

@ -1919,7 +1919,16 @@ void sscsrind_reg_csr_t::verify_permissions(insn_t insn, bool write) const {
csr_t_p proxy_csr = get_reg();
if (proxy_csr == nullptr) {
throw trap_illegal_instruction(insn.bits());
// An attempt from VS-mode to access any inaccessible sireg* causes virtual instruction exception when AIA is enabled
if (proc->extension_enabled_const(EXT_SMAIA)) {
if (state->prv == PRV_S && state->v) {
throw trap_virtual_instruction(insn.bits());
} else {
throw trap_illegal_instruction(insn.bits());
}
} else {
throw trap_illegal_instruction(insn.bits());
}
}
proxy_csr->verify_permissions(insn, write);
}

Loading…
Cancel
Save