summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index c717baf..181b376 100644
--- a/vm.c
+++ b/vm.c
@@ -261,7 +261,9 @@ deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
pte = walkpgdir(pgdir, (char*)a, 0);
- if(pte && (*pte & PTE_P) != 0){
+ if(!pte)
+ a += (NPTENTRIES - 1) * PGSIZE;
+ else if((*pte & PTE_P) != 0){
pa = PTE_ADDR(*pte);
if(pa == 0)
panic("kfree");