New entries are set to zero

This commit is contained in:
Robert Węcławski
2017-12-17 19:46:19 +01:00
parent 2d041bbb51
commit 08a4c33b77
2 changed files with 6 additions and 1 deletions

View File

@@ -27,6 +27,11 @@ pub const ADDRESS_MASK: usize = 0x000f_ffff_ffff_f000;
pub const COUNTER_MASK: u64 = 0x3ff00000_00000000;
impl Entry {
/// Zero entry
pub fn set_zero(&mut self) {
self.0 = 0;
}
/// Is the entry unused?
pub fn is_unused(&self) -> bool {
self.0 == (self.0 & COUNTER_MASK)

View File

@@ -55,7 +55,7 @@ impl<L> Table<L> where L: TableLevel {
pub fn zero(&mut self) {
for entry in self.entries.iter_mut() {
entry.set_unused();
entry.set_zero();
}
}