Skip to main content

Mm

Struct Mm 

Source
#[repr(align(64))]
pub struct Mm { hhdm_offset: AtomicU64, pmm: UncheckedCell<IrqMutex<Pmm>>, kernel_addr_space: UncheckedCell<IrqMutex<AddressSpace>>, next_kernel_stack: AtomicU64, }
Expand description

Holds memory management state such as slab allocators and virtual memory areas

Fields§

§hhdm_offset: AtomicU64§pmm: UncheckedCell<IrqMutex<Pmm>>§kernel_addr_space: UncheckedCell<IrqMutex<AddressSpace>>§next_kernel_stack: AtomicU64

Implementations§

Source§

impl Mm

Source

pub const fn new() -> Self

Constructor; initializes all values zeroed or uninited

Source

pub fn init(&self)

Initialize Mm’s default values

Source

pub fn set_hhdm_offset(&self, offset: u64)

Sets the HHDM offset

Source

pub unsafe fn init_pmm(&self, pmm: Pmm)

Move the given Pmm into Mm::pmm

§Safety

The caller must guarantee the following:

  • That this method has never been called before and will never be called again
  • That at the time of calling this method, no references or pointers to this data exist
  • While this method is being called, no other CPU is working with the given data
Source

pub unsafe fn init_kernel_addr_space(&self, kernel_addr_space: AddressSpace)

Move the given AddressSpace into Mm::kernel_addr_space

§Safety

The caller must guarantee the following:

  • That this method has never been called before and will never be called again
  • That at the time of calling this method, no references or pointers to this data exist
  • While this method is being called, no other CPU is working with the given data
Source

pub fn hhdm_offset(&self) -> u64

Getter for the hhdm offset

Source

pub unsafe fn pmm(&self) -> &IrqMutex<Pmm>

Getter for Mm::pmm

§Safety

The caller must guarantee the following:

  • That this value’s init method has already been called before
  • That at this method’s entire execution time, no mutable references or pointers to this data exist or will exist
Source

pub unsafe fn kernel_addr_space(&self) -> &IrqMutex<AddressSpace>

Getter for Mm::kernel_address_space

§Safety

The caller must guarantee the following:

  • That this value’s init method has already been called before
  • That at this method’s entire execution time, no mutable references or pointers to this data exist or will exist
Source

pub fn alloc_kernel_stack_slot(&self) -> VirtAddr

Get the starting address of the next kernel stack and increment it

Auto Trait Implementations§

§

impl !Freeze for Mm

§

impl !RefUnwindSafe for Mm

§

impl Send for Mm

§

impl Sync for Mm

§

impl Unpin for Mm

§

impl UnsafeUnpin for Mm

§

impl UnwindSafe for Mm

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.