unicorn/qemu
Jose Martins 58f1a612e8 target/riscv: fix wfi exception behavior
The wfi exception trigger behavior should take into account user mode,
hstatus.vtw, and the fact the an wfi might raise different types of
exceptions depending on various factors:

If supervisor mode is not present:

- an illegal instruction exception should be generated if user mode
executes and wfi instruction and mstatus.tw = 1.

If supervisor mode is present:

- when a wfi instruction is executed, an illegal exception should be triggered
if either the current mode is user or the mode is supervisor and mstatus.tw is
set.

Plus, if the hypervisor extensions are enabled:

- a virtual instruction exception should be raised when a wfi is executed from
virtual-user or virtual-supervisor and hstatus.vtw is set.

Signed-off-by: Jose Martins <josemartins90@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20210420213656.85148-1-josemartins90@gmail.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2024-09-03 13:44:55 -07:00
..
accel/tcg Respect users' decision for UC_ERR_INSN_INVALID 2024-03-08 17:31:27 +08:00
crypto import Unicorn2 2021-10-03 22:14:44 +08:00
fpu import Unicorn2 2021-10-03 22:14:44 +08:00
hw Don't cache S390SkeyState and S390SkeysClass 2022-01-10 19:18:52 +01:00
include gcc compiler warning fixes (#1977) 2024-07-19 11:09:57 +08:00
libdecnumber import Unicorn2 2021-10-03 22:14:44 +08:00
scripts import Unicorn2 2021-10-03 22:14:44 +08:00
softmmu Save jit state before/after callback 2024-02-13 11:13:01 +08:00
target target/riscv: fix wfi exception behavior 2024-09-03 13:44:55 -07:00
tcg Backport qemu/qemu@852f933 2024-01-24 23:41:30 +01:00
trace import Unicorn2 2021-10-03 22:14:44 +08:00
util Fix clang/mingw - missing getpagesize 2023-04-03 11:08:27 -03:00
.editorconfig import Unicorn2 2021-10-03 22:14:44 +08:00
aarch64.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
arm.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
CODING_STYLE.rst import Unicorn2 2021-10-03 22:14:44 +08:00
configure Define HAVE_SPRR 2024-02-13 19:09:35 +08:00
COPYING import 2015-08-21 15:04:50 +08:00
COPYING.LIB import Unicorn2 2021-10-03 22:14:44 +08:00
exec-vary.c Fix the undefined shift 2022-02-12 18:22:56 +01:00
exec.c find_ram_offset optimization 2023-07-11 11:51:44 +02:00
LICENSE import Unicorn2 2021-10-03 22:14:44 +08:00
m68k.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
MAINTAINERS import Unicorn2 2021-10-03 22:14:44 +08:00
memory_ldst.inc.c compile warning: remove some unused vars 2024-05-02 16:26:41 +08:00
mips64.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
mips64el.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
mips.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
mipsel.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
ppc64.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
ppc.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
riscv32.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
riscv64.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
rules.mak import Unicorn2 2021-10-03 22:14:44 +08:00
s390x.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
sparc64.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
sparc.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
tricore.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
unicorn_common.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00
VERSION import Unicorn2 2021-10-03 22:14:44 +08:00
vl.h import 2015-08-21 15:04:50 +08:00
x86_64.h implement uc_mem_unmap with snapshots 2023-07-11 11:51:44 +02:00