kernel: mem: actually free unmapped pages

Previously we would only free a page if it was valid. Now we
unconditionally free it.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-09-27 19:40:39 +08:00
parent 956d5f0866
commit 1ef4c0d87d
2 changed files with 1 additions and 5 deletions

View file

@ -525,10 +525,6 @@ pub fn pagetable_entry(addr: usize) -> Result<&'static mut usize, xous_kernel::E
pub fn unmap_page_inner(_mm: &mut MemoryManager, virt: usize) -> Result<usize, xous_kernel::Error> {
let entry = pagetable_entry(virt)?;
// Ensure the entry hasn't already been mapped.
if *entry & 1 == 0 {
return Err(xous_kernel::Error::BadAddress);
}
let phys = (*entry >> 10) << 12;
*entry = 0;
unsafe { flush_mmu() };

View file

@ -534,7 +534,7 @@ impl MemoryManager {
// If the virtual address has an assigned physical address, release that
// address from this process.
if let Ok(phys) = crate::arch::mem::virt_to_phys(virt as usize) {
self.release_page(phys as *mut usize, pid)?;
self.release_page(phys as *mut usize, pid).ok();
};
// Free the virtual address.