paging: fix free unused pte
This commit is contained in:
parent
ea9e5f7f23
commit
ac64b124da
@ -103,8 +103,8 @@ int pagingSetup(paddr_t upperKernelAddr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pt[ptEntry].present = 1;
|
pt[ptEntry].present = 1;
|
||||||
pt[ptEntry].write = 1; // TODO set Kernel code as RO
|
pt[ptEntry].write = 1; // TODO set Kernel code as RO
|
||||||
pt[ptEntry].paddr = i >> PAGE_SHIFT;
|
pt[ptEntry].paddr = i >> PAGE_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup mirroring
|
// Setup mirroring
|
||||||
@ -150,14 +150,15 @@ int pageMap(vaddr_t vaddr, paddr_t paddr, int flags)
|
|||||||
|
|
||||||
__native_flush_tlb_single((vaddr_t)pt);
|
__native_flush_tlb_single((vaddr_t)pt);
|
||||||
memset((void *)pt, 0, PAGE_SIZE);
|
memset((void *)pt, 0, PAGE_SIZE);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// Already mapped ? Remove old mapping
|
// Already mapped ? Remove old mapping
|
||||||
if (pt[ptEntry].present) {
|
if (pt[ptEntry].present) {
|
||||||
unrefPhyPage(pt[ptEntry].paddr << PAGE_SHIFT);
|
unrefPhyPage(pt[ptEntry].paddr << PAGE_SHIFT);
|
||||||
} // PTE not already used ? We will use it ! So increase the PT ref count
|
} // PTE not already used ? We will use it ! So increase the PT ref count
|
||||||
else {
|
else {
|
||||||
refPhyPage(pd[pdEntry].pt_addr << PAGE_SHIFT);
|
refPhyPage(pd[pdEntry].pt_addr << PAGE_SHIFT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pt[ptEntry].user = (flags & PAGING_MEM_USER) ? 1 : 0;
|
pt[ptEntry].user = (flags & PAGING_MEM_USER) ? 1 : 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user