x86: Fixes bug in pml callbacks
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 10 Jan 2014 20:12:00 +0000 (12:12 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 17 Jan 2014 22:57:12 +0000 (14:57 -0800)
Was leaking internal page tables for every process.

kern/arch/x86/pmap64.c

index 87d4ac1..456f6f9 100644 (file)
@@ -329,7 +329,7 @@ int unmap_segment(pde_t *pgdir, uintptr_t va, size_t size)
        {
                if (!(*pte & PTE_P))
                        return 0;
-               if ((shift == PML1_SHIFT) || (*pte * PTE_PS)) {
+               if ((shift == PML1_SHIFT) || (*pte & PTE_PS)) {
                        *pte = 0;
                        return 0;
                }
@@ -343,7 +343,7 @@ int unmap_segment(pde_t *pgdir, uintptr_t va, size_t size)
                                        return 0;
                        }
                }
-               page_decref(ppn2page(LA2PPN(pte)));
+               page_decref(ppn2page(LA2PPN(*pte)));
                *pte = 0;
                return 0;
        }
@@ -509,9 +509,9 @@ void env_pagetable_free(struct proc *p)
        {
                if (!(*pte & PTE_P))
                        return 0;
-               if ((shift == PML1_SHIFT) || (*pte * PTE_PS))
+               if ((shift == PML1_SHIFT) || (*pte & PTE_PS))
                        return 0;
-               page_decref(ppn2page(LA2PPN(pte)));
+               page_decref(ppn2page(LA2PPN(*pte)));
                return 0;
        }