On Sun, 2026-08-23 at 21:14 +0800, [email protected] wrote:
> 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
> 
> Signed-off-by: wangyang <[email protected]>

Reviewed-by: Alistair Francis <[email protected]>

Alistair

> ---
>  target/riscv/tcg/csr.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/target/riscv/tcg/csr.c b/target/riscv/tcg/csr.c
> index 36f2004..5ffd858 100644
> --- a/target/riscv/tcg/csr.c
> +++ b/target/riscv/tcg/csr.c
> @@ -5563,6 +5563,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;

Reply via email to