diff options
author | Georg Kotheimer <georg.kotheimer@kernkonzept.com> | 2020-10-13 17:10:54 +0200 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2020-10-22 12:00:22 -0700 |
commit | ace544532c4064e995ef69ec9dc93aad62e19988 (patch) | |
tree | add9c6a1cb7b2fef5ff4ab304ee68bf4648249a2 | |
parent | 801da1701cbc3f904639706e830ba20098d0ab5f (diff) | |
download | qemu-ace544532c4064e995ef69ec9dc93aad62e19988.zip qemu-ace544532c4064e995ef69ec9dc93aad62e19988.tar.gz qemu-ace544532c4064e995ef69ec9dc93aad62e19988.tar.bz2 |
target/riscv: Fix update of hstatus.SPVP
When trapping from virt into HS mode, hstatus.SPVP was set to
the value of sstatus.SPP, as according to the specification both
flags should be set to the same value.
However, the assignment of SPVP takes place before SPP itself is
updated, which results in SPVP having an outdated value.
Signed-off-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20201013151054.396481-1-georg.kotheimer@kernkonzept.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
-rw-r--r-- | target/riscv/cpu_helper.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 6c68239..47d05fe 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -938,7 +938,7 @@ void riscv_cpu_do_interrupt(CPUState *cs) /* Trap into HS mode, from virt */ riscv_cpu_swap_hypervisor_regs(env); env->hstatus = set_field(env->hstatus, HSTATUS_SPVP, - get_field(env->mstatus, SSTATUS_SPP)); + env->priv); env->hstatus = set_field(env->hstatus, HSTATUS_SPV, riscv_cpu_virt_enabled(env)); |