From: LIU Zhiwei Date: Thu, 20 Jan 2022 12:20:33 +0000 (+0800) Subject: target/riscv: Ignore the pc bits above XLEN X-Git-Tag: v7.0.0-rc0~78^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c796f1a15d0fca41c4f3e985bfbd33a5afb9ddc;p=thirdparty%2Fqemu.git target/riscv: Ignore the pc bits above XLEN The read from PC for translation is in cpu_get_tb_cpu_state, before translation. Signed-off-by: LIU Zhiwei Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis Message-id: 20220120122050.41546-7-zhiwei_liu@c-sky.com Signed-off-by: Alistair Francis --- diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 8ebcd57af00..d73925a8235 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -43,7 +43,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, uint32_t flags = 0; - *pc = env->pc; + *pc = env->xl == MXL_RV32 ? env->pc & UINT32_MAX : env->pc; *cs_base = 0; if (riscv_has_ext(env, RVV) || cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) {