sfence before writing satp, as well as after

This commit is contained in:
Robert Morris 2022-08-24 13:24:24 -04:00
parent 96047832c6
commit 9c1b8a4eb0
3 changed files with 6 additions and 3 deletions

View file

@ -194,7 +194,7 @@ static struct inode* iget(uint dev, uint inum);
// Allocate an inode on device dev.
// Mark it as allocated by giving it type type.
// Returns an unlocked but allocated and referenced inode,
// or NULL if there is no free inode..
// or NULL if there is no free inode.
struct inode*
ialloc(uint dev, short type)
{

View file

@ -82,6 +82,7 @@ uservec:
# load the kernel page table, from p->trapframe->kernel_satp
ld t1, 0(a0)
sfence.vma zero, zero
csrw satp, t1
sfence.vma zero, zero
@ -96,6 +97,7 @@ userret:
# a0: user page table, for satp.
# switch to the user page table.
sfence.vma zero, zero
csrw satp, a0
sfence.vma zero, zero