mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-24 22:15:07 +00:00
target/riscv: Generate illegal instruction on WFI when V=1
Backports commit 9d0d11269671646be7475cc01142e9d3ed8ae59c from qemu
This commit is contained in:
parent
4af0dc9a7e
commit
f6b14e146e
|
@ -129,9 +129,10 @@ void helper_wfi(CPURISCVState *env)
|
||||||
{
|
{
|
||||||
CPUState *cs = env_cpu(env);
|
CPUState *cs = env_cpu(env);
|
||||||
|
|
||||||
if (env->priv == PRV_S &&
|
if ((env->priv == PRV_S &&
|
||||||
env->priv_ver >= PRIV_VERSION_1_10_0 &&
|
env->priv_ver >= PRIV_VERSION_1_10_0 &&
|
||||||
get_field(env->mstatus, MSTATUS_TW)) {
|
get_field(env->mstatus, MSTATUS_TW)) ||
|
||||||
|
riscv_cpu_virt_enabled(env)) {
|
||||||
riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC());
|
riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC());
|
||||||
} else {
|
} else {
|
||||||
cs->halted = 1;
|
cs->halted = 1;
|
||||||
|
|
Loading…
Reference in a new issue