Skip to main content

Pmm

Struct Pmm 

Source
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: u64

Implementations§

Source§

impl Pmm

Source

pub fn init(entries: &[&Entry]) -> Self

Initialize the PMM from the Limine memory map, coalescing usable frames into the buddy free lists.

Source

pub fn get_total_mem(&self) -> u64

Getter for the length of total memory, returns the highest physical address given by the memmap

Source

pub fn alloc(&mut self, order: usize) -> Option<PhysAddr>

Allocate a block of FRAME_SIZE << order bytes

Source

pub fn alloc_frame(&mut self) -> Option<PhysAddr>

Wrapper for alloc(0), allocates exactly one frame (order 0)

Source

pub fn alloc_frame_zeroed(&mut self) -> Option<PhysAddr>

Wrapper for [alloc_frame] which zeroes the frame before returning it

Source

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

Source

pub fn free_frame(&mut self, addr: PhysAddr)

Wrapper for free(addr, 0), frees exactly one frame (order 0)

Source

fn pop(&mut self, order: usize) -> Option<PhysAddr>

Remove and return the head block from the order-order free list, or None if empty.

Source

fn push(&mut self, order: usize, addr: PhysAddr)

Prepend addr onto the order-order free list.

Auto Trait Implementations§

§

impl Freeze for Pmm

§

impl RefUnwindSafe for Pmm

§

impl Send for Pmm

§

impl Sync for Pmm

§

impl Unpin for Pmm

§

impl UnsafeUnpin for Pmm

§

impl UnwindSafe for Pmm

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = !

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.