target/riscv: Generate illegal instruction on WFI when V=1
Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Palmer Dabbelt <palmer@sifive.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
This commit is contained in:
parent
eccc5a12c2
commit
9d0d112696
|
@ -130,9 +130,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