Skip to content
Snippets Groups Projects
Commit f9e580c1 authored by Emmanuel Blot's avatar Emmanuel Blot Committed by Alistair Francis
Browse files

target/riscv: fix exception index on instruction access fault


When no MMU is used and the guest code attempts to fetch an instruction
from an invalid memory location, the exception index defaults to a data
load access fault, rather an instruction access fault.

Signed-off-by: default avatarEmmanuel Blot <emmanuel.blot@sifive.com>
Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
Message-id: FB9EA197-B018-4879-AB0F-922C2047A08B@sifive.com
Signed-off-by: default avatarAlistair Francis <alistair.francis@wdc.com>
parent b11e84b8
No related branches found
No related tags found
No related merge requests found
......@@ -694,8 +694,10 @@ void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
if (access_type == MMU_DATA_STORE) {
cs->exception_index = RISCV_EXCP_STORE_AMO_ACCESS_FAULT;
} else {
} else if (access_type == MMU_DATA_LOAD) {
cs->exception_index = RISCV_EXCP_LOAD_ACCESS_FAULT;
} else {
cs->exception_index = RISCV_EXCP_INST_ACCESS_FAULT;
}
env->badaddr = addr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment