Create a memory module with a Frame struct

This commit is contained in:
Philipp Oppermann
2015-11-14 11:41:16 +01:00
parent ccaa2ed645
commit 6f8a21eba6
3 changed files with 37 additions and 1 deletions

12
src/memory/mod.rs Normal file
View File

@@ -0,0 +1,12 @@
pub const PAGE_SIZE: usize = 4096;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Frame {
number: usize,
}
impl Frame {
fn containing_address(address: usize) -> Frame {
Frame{ number: address / PAGE_SIZE }
}
}