Skip to content

Commit 948faa7

Browse files
authored
Merge pull request #399 from TornaxO7/add_page_table_empty_check
Adding `is_empty` to PageTable
2 parents ddcd68f + 20ba9c2 commit 948faa7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/structures/paging/page_table.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ impl PageTable {
216216
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut PageTableEntry> {
217217
self.entries.iter_mut()
218218
}
219+
220+
/// Checks if the page table is empty (all entries are zero).
221+
#[inline]
222+
pub fn is_empty(&self) -> bool {
223+
self.entries.iter().all(|entry| entry.is_unused())
224+
}
219225
}
220226

221227
impl Index<usize> for PageTable {

0 commit comments

Comments
 (0)