On Sun, Aug 8, 2021 at 12:10 AM Bin Meng <bmeng...@gmail.com> wrote: > > When privilege check fails, RISCV_EXCP_ILLEGAL_INST is returned, > not -1 (RISCV_EXCP_NONE). > > Signed-off-by: Bin Meng <bmeng...@gmail.com>
Reviewed-by: Alistair Francis <alistair.fran...@wdc.com> Alistair > --- > > target/riscv/csr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/target/riscv/csr.c b/target/riscv/csr.c > index 9a4ed18ac5..e747fbe0e9 100644 > --- a/target/riscv/csr.c > +++ b/target/riscv/csr.c > @@ -1423,7 +1423,7 @@ RISCVException riscv_csrrw(CPURISCVState *env, int > csrno, > target_ulong old_value; > RISCVCPU *cpu = env_archcpu(env); > > - /* check privileges and return -1 if check fails */ > + /* check privileges and return RISCV_EXCP_ILLEGAL_INST if check fails */ > #if !defined(CONFIG_USER_ONLY) > int effective_priv = env->priv; > int read_only = get_field(csrno, 0xC00) == 3; > -- > 2.25.1 > >