[−][src]Struct kernel::mem::Allocator
Frame allocator gives out one or more pages.
Fields
page_allocated: [usize; 32768]
A bool array records whether a page is handed out
base_addr: usize
Pages are handed out from base_addr
, which is the start address
of HEAP.
Implementations
impl Allocator
[src]
pub const fn new() -> Self
[src]
Returns a new allocator instance
base_addr
should be intialized later.
fn offset_addr_of(&self, id: usize) -> usize
[src]
unsafe fn offset_id_of(&self, id: usize) -> *mut u8
[src]
fn offset_page_of(&self, page: *mut u8) -> usize
[src]
pub fn allocate(&mut self, size: usize) -> *mut u8
[src]
pub fn deallocate(&mut self, addr: *mut u8)
[src]
pub fn debug(&self)
[src]
Print page allocation status