aboutsummaryrefslogtreecommitdiff
path: root/pk/entry.S
diff options
context:
space:
mode:
Diffstat (limited to 'pk/entry.S')
-rw-r--r--pk/entry.S11
1 files changed, 11 insertions, 0 deletions
diff --git a/pk/entry.S b/pk/entry.S
index 48db0d9..8a4cdd8 100644
--- a/pk/entry.S
+++ b/pk/entry.S
@@ -76,6 +76,17 @@ start_user:
csrw sstatus, t0
csrw sepc, t1
+ # If hypervisor present, use VU-mode in place of U-mode
+ lw t2, have_hypervisor
+ beqz t2, 1f
+ li t1, HSTATUS_SPV
+ andi t0, t0, SSTATUS_SPP
+ beqz t0, 2f
+ li t1, 0
+2:
+ csrw CSR_HSTATUS, t1
+1:
+
# restore x registers
LOAD x1,1*REGBYTES(a0)
LOAD x2,2*REGBYTES(a0)