diff options
| author | Vivian Wang <[email protected]> | 2022-08-04 22:32:31 +0800 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2022-08-22 08:50:23 +0530 |
| commit | a69eb6cc65a16f26455bfb5b7cab768ac891bc1d (patch) | |
| tree | 6d677f435335bd5912494b704fac50f3971df5b3 /lib | |
| parent | 5a0ca098f176fd5b84d311e82543a05aaab8cafb (diff) | |
lib: sbi_trap: Set hstatus.GVA when going to HS-mode
The privileged spec specifies that on a trap to HS-mode, hstatus.GVA
should be set to 1 if stval is written with a guest virtual address, and
to 0 otherwise. Implement this by setting hstatus.GVA to trap->gva when
redirecting traps to HS-mode.
Signed-off-by: Vivian Wang <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sbi/sbi_trap.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/sbi/sbi_trap.c b/lib/sbi/sbi_trap.c index 1cf2e6fc..925840f1 100644 --- a/lib/sbi/sbi_trap.c +++ b/lib/sbi/sbi_trap.c @@ -128,6 +128,8 @@ int sbi_trap_redirect(struct sbi_trap_regs *regs, } hstatus &= ~HSTATUS_SPV; hstatus |= (prev_virt) ? HSTATUS_SPV : 0; + hstatus &= ~HSTATUS_GVA; + hstatus |= (trap->gva) ? HSTATUS_GVA : 0; csr_write(CSR_HSTATUS, hstatus); csr_write(CSR_HTVAL, trap->tval2); csr_write(CSR_HTINST, trap->tinst); |
