diff --git a/src/memory/paging/mod.rs b/src/memory/paging/mod.rs
index f541910e..f977b513 100644
--- a/src/memory/paging/mod.rs
+++ b/src/memory/paging/mod.rs
@@ -1,5 +1,7 @@
pub use self::entry::*;
use memory::{PAGE_SIZE, Frame, FrameAllocator};
+use self::table::{Table, Level4};
+use core::ptr::Unique;
mod entry;
mod table;
@@ -39,6 +41,24 @@ impl Page {
}
}
+pub struct RecursivePageTable {
+ p4: Unique
>,
+}
+
+impl RecursivePageTable {
+ pub unsafe fn new() -> RecursivePageTable {
+ RecursivePageTable { p4: Unique::new(table::P4) }
+ }
+
+ fn p4(&self) -> &Table {
+ unsafe { self.p4.get() }
+ }
+
+ fn p4_mut(&mut self) -> &mut Table {
+ unsafe { self.p4.get_mut() }
+ }
+}
+
pub unsafe fn translate(virtual_address: VirtualAddress) -> Option {
let offset = virtual_address % PAGE_SIZE;
translate_page(Page::containing_address(virtual_address))