Create a new ActivePageTable struct that derefs to Mapper

toolchain_update
Philipp Oppermann 8 years ago
parent ce9c4d6e43
commit 2f30b0f7cf

@ -1,4 +1,6 @@
pub use self::entry::*; pub use self::entry::*;
pub use self::mapper::Mapper;
use core::ops::{Deref, DerefMut};
use core::ptr::Unique; use core::ptr::Unique;
use memory::{PAGE_SIZE, Frame, FrameAllocator}; use memory::{PAGE_SIZE, Frame, FrameAllocator};
use self::table::{Table, Level4}; use self::table::{Table, Level4};
@ -45,6 +47,32 @@ impl Page {
} }
} }
pub struct ActivePageTable {
mapper: Mapper,
}
impl Deref for ActivePageTable {
type Target = Mapper;
fn deref(&self) -> &Mapper {
&self.mapper
}
}
impl DerefMut for ActivePageTable {
fn deref_mut(&mut self) -> &mut Mapper {
&mut self.mapper
}
}
impl ActivePageTable {
unsafe fn new() -> ActivePageTable {
ActivePageTable {
mapper: Mapper::new(),
}
}
}
pub struct InactivePageTable { pub struct InactivePageTable {
p4_frame: Frame, p4_frame: Frame,
} }

Loading…
Cancel
Save