mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 08:26:52 +00:00
target/riscv: Raise the new execptions when 2nd stage translation fails
Backports commit b2ef6ab9fee6948cf016f9e741feecdfb333fcbe from qemu
This commit is contained in:
parent
773757a919
commit
141c47a286
|
@ -581,16 +581,28 @@ static void raise_mmu_exception(CPURISCVState *env, target_ulong address,
|
|||
}
|
||||
switch (access_type) {
|
||||
case MMU_INST_FETCH:
|
||||
cs->exception_index = page_fault_exceptions ?
|
||||
RISCV_EXCP_INST_PAGE_FAULT : RISCV_EXCP_INST_ACCESS_FAULT;
|
||||
if (riscv_cpu_virt_enabled(env) && !first_stage) {
|
||||
cs->exception_index = RISCV_EXCP_INST_GUEST_PAGE_FAULT;
|
||||
} else {
|
||||
cs->exception_index = page_fault_exceptions ?
|
||||
RISCV_EXCP_INST_PAGE_FAULT : RISCV_EXCP_INST_ACCESS_FAULT;
|
||||
}
|
||||
break;
|
||||
case MMU_DATA_LOAD:
|
||||
cs->exception_index = page_fault_exceptions ?
|
||||
RISCV_EXCP_LOAD_PAGE_FAULT : RISCV_EXCP_LOAD_ACCESS_FAULT;
|
||||
if (riscv_cpu_virt_enabled(env) && !first_stage) {
|
||||
cs->exception_index = RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT;
|
||||
} else {
|
||||
cs->exception_index = page_fault_exceptions ?
|
||||
RISCV_EXCP_LOAD_PAGE_FAULT : RISCV_EXCP_LOAD_ACCESS_FAULT;
|
||||
}
|
||||
break;
|
||||
case MMU_DATA_STORE:
|
||||
cs->exception_index = page_fault_exceptions ?
|
||||
RISCV_EXCP_STORE_PAGE_FAULT : RISCV_EXCP_STORE_AMO_ACCESS_FAULT;
|
||||
if (riscv_cpu_virt_enabled(env) && !first_stage) {
|
||||
cs->exception_index = RISCV_EXCP_STORE_GUEST_AMO_ACCESS_FAULT;
|
||||
} else {
|
||||
cs->exception_index = page_fault_exceptions ?
|
||||
RISCV_EXCP_STORE_PAGE_FAULT : RISCV_EXCP_STORE_AMO_ACCESS_FAULT;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
|
|
Loading…
Reference in a new issue