mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Create a new ActivePageTable struct that derefs to Mapper
This commit is contained in:
@@ -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,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user