lib: sbi_trap: Fix hstatus.SPVP update in sbi_trap_redirect()
When redirecting from VS/VU-mode to HS-mode, hstatus.SPVP was set to the value of mstatus.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@tu-dresden.de> Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
parent
4b18a2acc2
commit
9d56961b23
|
@ -123,7 +123,7 @@ int sbi_trap_redirect(struct sbi_trap_regs *regs,
|
|||
/* Update HSTATUS SPVP and SPV bits */
|
||||
hstatus = csr_read(CSR_HSTATUS);
|
||||
hstatus &= ~HSTATUS_SPVP;
|
||||
hstatus |= (regs->mstatus & MSTATUS_SPP) ? HSTATUS_SPVP : 0;
|
||||
hstatus |= (prev_mode == PRV_S) ? HSTATUS_SPVP : 0;
|
||||
hstatus &= ~HSTATUS_SPV;
|
||||
hstatus |= (prev_virt) ? HSTATUS_SPV : 0;
|
||||
csr_write(CSR_HSTATUS, hstatus);
|
||||
|
|
Loading…
Reference in New Issue