target/riscv: Fix update of hstatus.GVA in riscv_cpu_do_interrupt
The hstatus.GVA bit was not set if the faulting guest virtual address was zero. Signed-off-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 20201013173054.451135-1-georg.kotheimer@kernkonzept.com Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
ace544532c
commit
4aeb9e26c2
@ -852,6 +852,7 @@ void riscv_cpu_do_interrupt(CPUState *cs)
|
|||||||
bool async = !!(cs->exception_index & RISCV_EXCP_INT_FLAG);
|
bool async = !!(cs->exception_index & RISCV_EXCP_INT_FLAG);
|
||||||
target_ulong cause = cs->exception_index & RISCV_EXCP_INT_MASK;
|
target_ulong cause = cs->exception_index & RISCV_EXCP_INT_MASK;
|
||||||
target_ulong deleg = async ? env->mideleg : env->medeleg;
|
target_ulong deleg = async ? env->mideleg : env->medeleg;
|
||||||
|
bool write_tval = false;
|
||||||
target_ulong tval = 0;
|
target_ulong tval = 0;
|
||||||
target_ulong htval = 0;
|
target_ulong htval = 0;
|
||||||
target_ulong mtval2 = 0;
|
target_ulong mtval2 = 0;
|
||||||
@ -873,6 +874,7 @@ void riscv_cpu_do_interrupt(CPUState *cs)
|
|||||||
case RISCV_EXCP_INST_PAGE_FAULT:
|
case RISCV_EXCP_INST_PAGE_FAULT:
|
||||||
case RISCV_EXCP_LOAD_PAGE_FAULT:
|
case RISCV_EXCP_LOAD_PAGE_FAULT:
|
||||||
case RISCV_EXCP_STORE_PAGE_FAULT:
|
case RISCV_EXCP_STORE_PAGE_FAULT:
|
||||||
|
write_tval = true;
|
||||||
tval = env->badaddr;
|
tval = env->badaddr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -910,7 +912,7 @@ void riscv_cpu_do_interrupt(CPUState *cs)
|
|||||||
target_ulong hdeleg = async ? env->hideleg : env->hedeleg;
|
target_ulong hdeleg = async ? env->hideleg : env->hedeleg;
|
||||||
|
|
||||||
if ((riscv_cpu_virt_enabled(env) ||
|
if ((riscv_cpu_virt_enabled(env) ||
|
||||||
riscv_cpu_two_stage_lookup(env)) && tval) {
|
riscv_cpu_two_stage_lookup(env)) && write_tval) {
|
||||||
/*
|
/*
|
||||||
* If we are writing a guest virtual address to stval, set
|
* If we are writing a guest virtual address to stval, set
|
||||||
* this to 1. If we are trapping to VS we will set this to 0
|
* this to 1. If we are trapping to VS we will set this to 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user