Message ID | 20240708131645.1345-4-zhiwei_liu@linux.alibaba.com |
---|---|
State | New |
Headers | show |
Series | target/riscv: Expose RV32 cpu to RV64 QEMU | expand |
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 87742047ce..49de81be7e 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -693,8 +693,11 @@ static inline RISCVMXL riscv_cpu_sxl(CPURISCVState *env) #ifdef CONFIG_USER_ONLY return env->misa_mxl; #else - return get_field(env->mstatus, MSTATUS64_SXL); + if (env->misa_mxl != MXL_RV32) { + return get_field(env->mstatus, MSTATUS64_SXL); + } #endif + return MXL_RV32; } #endif