feat: vspace: entry: add clear api

This commit is contained in:
Paul Pan 2024-06-14 16:23:20 +08:00
parent 8fe47c5728
commit 03aa0edcc8
2 changed files with 5 additions and 0 deletions

View File

@ -117,6 +117,10 @@ impl EntryOps for Entry {
self.0 = (self.0 & !PTEFlags::all().bits()) | flags.bits();
}
fn clear(&mut self) {
self.0 = 0;
}
fn is_valid(&self) -> bool {
self.0 & PTEFlags::VALID.bits() != 0
}

View File

@ -23,6 +23,7 @@ pub trait EntryOps: Clone + Copy + Debug {
fn set_paddr(&mut self, addr: PhysAddr);
fn set_attr(&mut self, attr: MapAttr);
fn clear(&mut self);
fn is_valid(&self) -> bool;
fn is_leaf(&self) -> bool;