target/riscv: make mnstatus.MNPELP writable with Zicfilp
PATCH 1/1 target/riscv: make mnstatus.MNPELP writable with Zicfilp
Zicfilp adds MNPELP to mnstatus, and MNRET consumes it when restoring ELP. Include the field in write_mnstatus() when Zicfilp is implemented.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4222
--- target/riscv/tcg/csr.c | 4 ++++ 1 file changed, 4 insertions(+)
target/riscv/tcg/csr.c +4 -0
@@ -5584,6 +5584,10 @@ static RISCVException write_mnstatus(CPURISCVState *env, int csrno, mask |=MNSTATUS_MNPV ; } +if (env_archcpu (env)->cfg.ext_zicfilp) { + mask |=MNSTATUS_MNPELP ; + } +/* mnstatus.mnie can only be cleared by hardware. */ env->mnstatus = (env->mnstatus &MNSTATUS_NMIE ) | (val & mask);return RISCV_EXCP_NONE ;
Signature · 1 line
2.43.0
Alistair Francis
AppliedQuoted 6 lines · wangyang
Zicfilp adds MNPELP to mnstatus, and MNRET consumes it when restoring ELP.
Include the field inwrite_mnstatus()when Zicfilp is implemented.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4222Reviewed-by Alistair Francis <[email protected]>Signed-off-by wangyang <[email protected]>
Thanks!
Applied to riscv-to-apply.next
Alistair
Quoted 20 lines
---
target/riscv/tcg/csr.c | 4 ++++1 file changed, 4 insertions(+)target/riscv/tcg/csr.c +0
-0@@ -5584,6 +5584,10 @@ static RISCVException write_mnstatus(CPURISCVState *env, int csrno, mask |= MNSTATUS_MNPV; }
+ if (env_archcpu(env)->cfg.ext_zicfilp) {
+ mask |=MNSTATUS_MNPELP;
+ }
+
/* mnstatus.mnie can only be cleared by hardware. */env->mnstatus= (env->mnstatus&MNSTATUS_NMIE) | (val & mask); returnRISCV_EXCP_NONE;