summaryrefslogtreecommitdiff
path: root/sys/src/9/pc64
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-07-16 03:11:27 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2020-07-16 03:11:27 +0200
commite7e6f4fc9061190720b7a67adfff49f2546843aa (patch)
treebfba8d2f685d20a670dbdd111d40a9bc9ef6455c /sys/src/9/pc64
parent77ddc8c654824962149160af822f849b78cc6cc0 (diff)
pc64: disable interrupts in mmuwalk() for checkmmu()
we have to disable interrupts during mmuwalk() of user pages as we can get preempted during mmu walk and the original m->pml4 might become one of a different process.
Diffstat (limited to 'sys/src/9/pc64')
-rw-r--r--sys/src/9/pc64/mmu.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/src/9/pc64/mmu.c b/sys/src/9/pc64/mmu.c
index 58663a9f1..936955d4b 100644
--- a/sys/src/9/pc64/mmu.c
+++ b/sys/src/9/pc64/mmu.c
@@ -517,12 +517,17 @@ putmmu(uintptr va, uintptr pa, Page *)
void
checkmmu(uintptr va, uintptr pa)
{
- uintptr *pte;
+ uintptr *pte, old;
+ int x;
+ x = splhi();
pte = mmuwalk(m->pml4, va, 0, 0);
- if(pte != 0 && (*pte & PTEVALID) != 0 && PPN(*pte) != pa)
- print("%ld %s: va=%#p pa=%#p pte=%#p\n",
- up->pid, up->text, va, pa, *pte);
+ if(pte == 0 || ((old = *pte) & PTEVALID) == 0 || PPN(old) == pa){
+ splx(x);
+ return;
+ }
+ splx(x);
+ print("%ld %s: va=%#p pa=%#p pte=%#p\n", up->pid, up->text, va, pa, old);
}
uintptr