sfence before writing satp, as well as after
This commit is contained in:
parent
96047832c6
commit
9c1b8a4eb0
|
@ -194,7 +194,7 @@ static struct inode* iget(uint dev, uint inum);
|
||||||
// Allocate an inode on device dev.
|
// Allocate an inode on device dev.
|
||||||
// Mark it as allocated by giving it type type.
|
// Mark it as allocated by giving it type type.
|
||||||
// Returns an unlocked but allocated and referenced inode,
|
// 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*
|
struct inode*
|
||||||
ialloc(uint dev, short type)
|
ialloc(uint dev, short type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,6 +82,7 @@ uservec:
|
||||||
|
|
||||||
# load the kernel page table, from p->trapframe->kernel_satp
|
# load the kernel page table, from p->trapframe->kernel_satp
|
||||||
ld t1, 0(a0)
|
ld t1, 0(a0)
|
||||||
|
sfence.vma zero, zero
|
||||||
csrw satp, t1
|
csrw satp, t1
|
||||||
sfence.vma zero, zero
|
sfence.vma zero, zero
|
||||||
|
|
||||||
|
@ -96,6 +97,7 @@ userret:
|
||||||
# a0: user page table, for satp.
|
# a0: user page table, for satp.
|
||||||
|
|
||||||
# switch to the user page table.
|
# switch to the user page table.
|
||||||
|
sfence.vma zero, zero
|
||||||
csrw satp, a0
|
csrw satp, a0
|
||||||
sfence.vma zero, zero
|
sfence.vma zero, zero
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ iter()
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if(pid1 == 0){
|
if(pid1 == 0){
|
||||||
rand_next = 31;
|
rand_next ^= 31;
|
||||||
go(0);
|
go(0);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ iter()
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if(pid2 == 0){
|
if(pid2 == 0){
|
||||||
rand_next = 7177;
|
rand_next ^= 7177;
|
||||||
go(1);
|
go(1);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -346,5 +346,6 @@ main()
|
||||||
wait(0);
|
wait(0);
|
||||||
}
|
}
|
||||||
sleep(20);
|
sleep(20);
|
||||||
|
rand_next += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue