Allow the page table un-mapper to flush the TLB precisely

This commit is contained in:
Zhang Junyang
2024-08-08 03:14:37 +00:00
committed by Tate, Hongliang Tian
parent e597a10088
commit 9a6e1b03e3
7 changed files with 167 additions and 104 deletions

View File

@ -103,18 +103,11 @@ pub(super) struct Vmar_ {
impl Drop for Vmar_ {
fn drop(&mut self) {
if self.is_root_vmar() {
self.vm_space.clear();
}
// Drop the child VMAR.
// FIXME: This branch can be removed once removing child VMAR usage from the code base.
else {
let mut cursor = self
.vm_space
.cursor_mut(&(self.base..self.base + self.size))
.unwrap();
cursor.unmap(self.size);
}
let mut cursor = self
.vm_space
.cursor_mut(&(self.base..self.base + self.size))
.unwrap();
cursor.unmap(self.size);
}
}
@ -302,7 +295,12 @@ impl Vmar_ {
if !self.is_root_vmar() {
return_errno_with_message!(Errno::EACCES, "The vmar is not root vmar");
}
self.vm_space.clear();
let mut cursor = self
.vm_space
.cursor_mut(&(self.base..self.base + self.size))
.unwrap();
cursor.unmap(self.size);
drop(cursor);
let mut inner = self.inner.lock();
inner.child_vmar_s.clear();
inner.vm_mappings.clear();