target/riscv: Fix exception type when VU accesses supervisor CSRs
When supervisor CSRs are accessed from VU-mode, a virtual instruction
exception should be raised instead of an illegal instruction.
Fixes: c1fbcecb3a (target/riscv: Fix csr number based privilege checking)
Signed-off-by: Xu Lu <luxu.kernel@bytedance.com>
Reviewed-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Nutty Liu <liujingqi@lanxincomputing.com>
Message-ID: <20250708060720.7030-1-luxu.kernel@bytedance.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
09ac27a9b5
commit
30ef718423
1 changed files with 1 additions and 1 deletions
|
|
@ -5577,7 +5577,7 @@ static inline RISCVException riscv_csrrw_check(CPURISCVState *env,
|
|||
|
||||
csr_priv = get_field(csrno, 0x300);
|
||||
if (!env->debugger && (effective_priv < csr_priv)) {
|
||||
if (csr_priv == (PRV_S + 1) && env->virt_enabled) {
|
||||
if (csr_priv <= (PRV_S + 1) && env->virt_enabled) {
|
||||
return RISCV_EXCP_VIRT_INSTRUCTION_FAULT;
|
||||
}
|
||||
return RISCV_EXCP_ILLEGAL_INST;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue