Browse Source
Merge pull request #2182 from mmhus/mmhus/reorder_hstateen0_check_smcdeleg
#2082 Reorder hstateen0 check for smcdeleg
pull/2186/head
Andrew Waterman
8 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
5 deletions
-
riscv/csrs.cc
|
|
|
@ -1854,17 +1854,15 @@ void sscsrind_reg_csr_t::verify_permissions(insn_t insn, bool write) const { |
|
|
|
if (proc->extension_enabled(EXT_SMSTATEEN)) { |
|
|
|
if ((state->prv < PRV_M) && !(state->mstateen[0]->read() & MSTATEEN0_CSRIND)) |
|
|
|
throw trap_illegal_instruction(insn.bits()); |
|
|
|
|
|
|
|
if (state->v && !(state->hstateen[0]->read() & HSTATEEN0_CSRIND)) |
|
|
|
throw trap_virtual_instruction(insn.bits()); |
|
|
|
} |
|
|
|
|
|
|
|
// Don't call base verify_permission for VS registers remapped to S-mode
|
|
|
|
if (insn.csr() == address) |
|
|
|
csr_t::verify_permissions(insn, write); |
|
|
|
|
|
|
|
if (proc->extension_enabled(EXT_SMSTATEEN)) { |
|
|
|
if (state->v && !(state->hstateen[0]->read() & HSTATEEN0_CSRIND)) |
|
|
|
throw trap_virtual_instruction(insn.bits()); |
|
|
|
} |
|
|
|
|
|
|
|
if (proc->extension_enabled(EXT_SMCDELEG)) { |
|
|
|
if (address >= CSR_VSIREG && address <= CSR_VSIREG6) { |
|
|
|
if (!state->v) { |
|
|
|
|