From ed101befeefe470e49bec32b9f4efd600bdbda46 Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Wed, 24 Aug 2022 13:47:47 -0400 Subject: [PATCH] comment the sfences --- kernel/trampoline.S | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/trampoline.S b/kernel/trampoline.S index 7fb0b36..d7308cc 100644 --- a/kernel/trampoline.S +++ b/kernel/trampoline.S @@ -80,10 +80,18 @@ uservec: # load the address of usertrap(), from p->trapframe->kernel_trap ld t0, 16(a0) - # load the kernel page table, from p->trapframe->kernel_satp + + # fetch the kernel page table address, from p->trapframe->kernel_satp. ld t1, 0(a0) + + # wait for any previous memory operations to complete, so that + # they use the user page table. sfence.vma zero, zero + + # install the kernel page table. csrw satp, t1 + + # flush now-stale user entries from the TLB. sfence.vma zero, zero # jump to usertrap(), which does not return