pub struct Pmm {
head: [Option<PhysAddr>; 11],
total_mem: u64,
}Expand description
Buddy-Allocator based tracker of free and head physical frames.
Fields§
§head: [Option<PhysAddr>; 11]§total_mem: u64Implementations§
Source§impl Pmm
impl Pmm
Sourcepub fn init(entries: &[&Entry]) -> Self
pub fn init(entries: &[&Entry]) -> Self
Initialize the PMM from the Limine memory map, coalescing usable frames into the buddy free lists.
Sourcepub fn get_total_mem(&self) -> u64
pub fn get_total_mem(&self) -> u64
Getter for the length of total memory, returns the highest physical address given by the memmap
Sourcepub fn alloc(&mut self, order: usize) -> Option<PhysAddr>
pub fn alloc(&mut self, order: usize) -> Option<PhysAddr>
Allocate a block of FRAME_SIZE << order bytes
Sourcepub fn alloc_frame(&mut self) -> Option<PhysAddr>
pub fn alloc_frame(&mut self) -> Option<PhysAddr>
Wrapper for alloc(0), allocates exactly one frame (order 0)
Sourcepub fn alloc_frame_zeroed(&mut self) -> Option<PhysAddr>
pub fn alloc_frame_zeroed(&mut self) -> Option<PhysAddr>
Wrapper for [alloc_frame] which zeroes the frame before returning it
Sourcepub fn free(&mut self, addr: PhysAddr, order: usize)
pub fn free(&mut self, addr: PhysAddr, order: usize)
Return a block of FRAME_SIZE << order bytes to the free lists, merging with available buddies
Sourcepub fn free_frame(&mut self, addr: PhysAddr)
pub fn free_frame(&mut self, addr: PhysAddr)
Wrapper for free(addr, 0), frees exactly one frame (order 0)