From e50d70c02e49e4b7f9c62cd0d013692247cc09d2 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 13 Apr 2017 18:33:26 +0200 Subject: [PATCH] Add a Table::zero method to clear all entries --- src/memory/paging/table.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/memory/paging/table.rs b/src/memory/paging/table.rs index 4ce7991..adfc0b8 100644 --- a/src/memory/paging/table.rs +++ b/src/memory/paging/table.rs @@ -6,6 +6,14 @@ pub struct Table { entries: [Entry; ENTRY_COUNT], } +impl Table { + pub fn zero(&mut self) { + for entry in self.entries.iter_mut() { + entry.set_unused(); + } + } +} + impl Index for Table { type Output = Entry;