Files
blog_os/src/memory/mod.rs
2015-11-15 12:00:03 +01:00

22 lines
473 B
Rust

pub use self::area_frame_allocator::AreaFrameAllocator;
mod area_frame_allocator;
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 }
}
}
pub trait FrameAllocator {
fn allocate_frame(&mut self) -> Option<Frame>;
fn deallocate_frame(&mut self, frame: Frame);
}