From c4c27c10e68b0de502e123c1139d3cf69bf0777a Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 13 Apr 2017 18:24:27 +0200 Subject: [PATCH] Create a memory::paging::entry submodule with an Entry struct --- src/memory/paging/entry.rs | 13 +++++++++++++ src/memory/paging/mod.rs | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 src/memory/paging/entry.rs diff --git a/src/memory/paging/entry.rs b/src/memory/paging/entry.rs new file mode 100644 index 0000000..6470195 --- /dev/null +++ b/src/memory/paging/entry.rs @@ -0,0 +1,13 @@ +use memory::Frame; + +pub struct Entry(u64); + +impl Entry { + pub fn is_unused(&self) -> bool { + self.0 == 0 + } + + pub fn set_unused(&mut self) { + self.0 = 0; + } +} diff --git a/src/memory/paging/mod.rs b/src/memory/paging/mod.rs index a06c073..9bcddfb 100644 --- a/src/memory/paging/mod.rs +++ b/src/memory/paging/mod.rs @@ -1,5 +1,7 @@ use memory::PAGE_SIZE; +mod entry; + const ENTRY_COUNT: usize = 512; pub type PhysicalAddress = usize;