diff --git a/src/page/mapper.rs b/src/page/mapper.rs index 0d8618a7b4..33b700f35e 100644 --- a/src/page/mapper.rs +++ b/src/page/mapper.rs @@ -136,12 +136,11 @@ impl PageMapper { Some(flush) } - pub unsafe fn unmap_phys(&mut self, virt: VirtualAddress, _unmap_parents: bool) -> Option<(PhysicalAddress, PageFlags, PageFlush)> { + pub unsafe fn unmap_phys(&mut self, virt: VirtualAddress, unmap_parents: bool) -> Option<(PhysicalAddress, PageFlags, PageFlush)> { //TODO: verify virt is aligned let mut table = self.table(); let level = table.level(); - //TODO: use unmap_parents? - unmap_phys_inner(virt, &mut table, level, false, &mut self.allocator).map(|(pa, pf)| (pa, pf, PageFlush::new(virt))) + unmap_phys_inner(virt, &mut table, level, unmap_parents, &mut self.allocator).map(|(pa, pf)| (pa, pf, PageFlush::new(virt))) } } unsafe fn unmap_phys_inner(virt: VirtualAddress, table: &mut PageTable, initial_level: usize, unmap_parents: bool, allocator: &mut impl FrameAllocator) -> Option<(PhysicalAddress, PageFlags)> { @@ -166,7 +165,7 @@ unsafe fn unmap_phys_inner(virt: VirtualAddress, table: &mut PageTable< let is_still_populated = (0..A::PAGE_ENTRIES).map(|j| subtable.entry(j).expect("must be within bounds")).any(|e| e.present()); if !is_still_populated { - allocator.free_one(table.phys()); + allocator.free_one(subtable.phys()); table.set_entry(i, PageEntry::new(0)); } }