Skip to content

Commit 3124a81

Browse files
refactor
Signed-off-by: Andy-Python-Programmer <[email protected]>
1 parent be6cf89 commit 3124a81

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

src/aero_kernel/src/mem/vmalloc.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ impl Vmalloc {
8686
log::warn!("todo: implement this")
8787
}
8888

89-
log::debug!("{:?}", address);
90-
9189
let mut address_space = AddressSpace::this();
9290
let mut offset_table = address_space.offset_page_table();
9391

src/aero_kernel/src/userland/vm.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -909,20 +909,10 @@ impl VmProtected {
909909
})
910910
}
911911

912+
/// Clears all of the mappings without unmapping them. The caller is responsible
913+
/// for going through the page table and unmapping all of the pages.
912914
fn clear(&mut self) {
913-
let mut cursor = self.mappings.cursor_front_mut();
914-
915-
let mut address_space = AddressSpace::this();
916-
let mut offset_table = address_space.offset_page_table();
917-
918-
while let Some(map) = cursor.current() {
919-
// now this should automatically free the physical page backed by this mapping
920-
// if the reference count of that frame is 0 since we have now unmapped it.
921-
map.unmap(&mut offset_table, map.start_addr, map.end_addr)
922-
.expect("vm_clear: unexpected error while unmapping");
923-
924-
cursor.remove_current();
925-
}
915+
self.mappings.clear()
926916
}
927917

928918
fn munmap(&mut self, address: VirtAddr, size: usize) -> bool {

0 commit comments

Comments
 (0)