mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 19:45:29 +00:00
target/riscv: Add support for the new execption numbers
The v0.5 Hypervisor spec add new execption numbers, let's add support for those. Backports commit ab67a1d07a4f6f1b4d577c5c47013273b9804551 from qemu
This commit is contained in:
parent
870603305d
commit
0198a09698
|
@ -58,7 +58,15 @@ const char * const riscv_excp_names[] = {
|
|||
"exec_page_fault",
|
||||
"load_page_fault",
|
||||
"reserved",
|
||||
"store_page_fault"
|
||||
"store_page_fault",
|
||||
"reserved",
|
||||
"reserved",
|
||||
"reserved",
|
||||
"reserved",
|
||||
"guest_exec_page_fault",
|
||||
"guest_load_page_fault",
|
||||
"reserved",
|
||||
"guest_store_page_fault"
|
||||
};
|
||||
|
||||
const char * const riscv_intr_names[] = {
|
||||
|
|
|
@ -500,11 +500,14 @@
|
|||
#define RISCV_EXCP_STORE_AMO_ACCESS_FAULT 0x7
|
||||
#define RISCV_EXCP_U_ECALL 0x8
|
||||
#define RISCV_EXCP_S_ECALL 0x9
|
||||
#define RISCV_EXCP_H_ECALL 0xa
|
||||
#define RISCV_EXCP_VS_ECALL 0xa
|
||||
#define RISCV_EXCP_M_ECALL 0xb
|
||||
#define RISCV_EXCP_INST_PAGE_FAULT 0xc /* since: priv-1.10.0 */
|
||||
#define RISCV_EXCP_LOAD_PAGE_FAULT 0xd /* since: priv-1.10.0 */
|
||||
#define RISCV_EXCP_STORE_PAGE_FAULT 0xf /* since: priv-1.10.0 */
|
||||
#define RISCV_EXCP_INST_GUEST_PAGE_FAULT 0x14
|
||||
#define RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT 0x15
|
||||
#define RISCV_EXCP_STORE_GUEST_AMO_ACCESS_FAULT 0x17
|
||||
|
||||
#define RISCV_EXCP_INT_FLAG 0x80000000
|
||||
#define RISCV_EXCP_INT_MASK 0x7fffffff
|
||||
|
|
|
@ -500,13 +500,16 @@ void riscv_cpu_do_interrupt(CPUState *cs)
|
|||
static const int ecall_cause_map[] = {
|
||||
[PRV_U] = RISCV_EXCP_U_ECALL,
|
||||
[PRV_S] = RISCV_EXCP_S_ECALL,
|
||||
[PRV_H] = RISCV_EXCP_H_ECALL,
|
||||
[PRV_H] = RISCV_EXCP_VS_ECALL,
|
||||
[PRV_M] = RISCV_EXCP_M_ECALL
|
||||
};
|
||||
|
||||
if (!async) {
|
||||
/* set tval to badaddr for traps with address information */
|
||||
switch (cause) {
|
||||
case RISCV_EXCP_INST_GUEST_PAGE_FAULT:
|
||||
case RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT:
|
||||
case RISCV_EXCP_STORE_GUEST_AMO_ACCESS_FAULT:
|
||||
case RISCV_EXCP_INST_ADDR_MIS:
|
||||
case RISCV_EXCP_INST_ACCESS_FAULT:
|
||||
case RISCV_EXCP_LOAD_ADDR_MIS:
|
||||
|
|
|
@ -242,11 +242,14 @@ static const target_ulong delegable_excps =
|
|||
(1ULL << (RISCV_EXCP_STORE_AMO_ACCESS_FAULT)) |
|
||||
(1ULL << (RISCV_EXCP_U_ECALL)) |
|
||||
(1ULL << (RISCV_EXCP_S_ECALL)) |
|
||||
(1ULL << (RISCV_EXCP_H_ECALL)) |
|
||||
(1ULL << (RISCV_EXCP_VS_ECALL)) |
|
||||
(1ULL << (RISCV_EXCP_M_ECALL)) |
|
||||
(1ULL << (RISCV_EXCP_INST_PAGE_FAULT)) |
|
||||
(1ULL << (RISCV_EXCP_LOAD_PAGE_FAULT)) |
|
||||
(1ULL << (RISCV_EXCP_STORE_PAGE_FAULT));
|
||||
(1ULL << (RISCV_EXCP_STORE_PAGE_FAULT)) |
|
||||
(1ULL << (RISCV_EXCP_INST_GUEST_PAGE_FAULT)) |
|
||||
(1ULL << (RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT)) |
|
||||
(1ULL << (RISCV_EXCP_STORE_GUEST_AMO_ACCESS_FAULT));
|
||||
static const target_ulong sstatus_v1_9_mask = SSTATUS_SIE | SSTATUS_SPIE |
|
||||
SSTATUS_UIE | SSTATUS_UPIE | SSTATUS_SPP | SSTATUS_FS | SSTATUS_XS |
|
||||
SSTATUS_SUM | SSTATUS_SD;
|
||||
|
|
Loading…
Reference in a new issue