Enum axmm::Backend

source ·
pub enum Backend {
    Linear {
        pa_va_offset: usize,
    },
    Alloc {
        populate: bool,
    },
}
Expand description

A unified enum type for different memory mapping backends.

Currently, two backends are implemented:

  • Linear: used for linear mappings. The target physical frames are contiguous and their addresses should be known when creating the mapping.
  • Allocation: used in general, or for lazy mappings. The target physical frames are obtained from the global allocator.

Variants§

§

Linear

Linear mapping backend.

The offset between the virtual address and the physical address is constant, which is specified by pa_va_offset. For example, the virtual address vaddr is mapped to the physical address vaddr - pa_va_offset.

Fields

§pa_va_offset: usize

vaddr - paddr.

§

Alloc

Allocation mapping backend.

If populate is true, all physical frames are allocated when the mapping is created, and no page faults are triggered during the memory access. Otherwise, the physical frames are allocated on demand (by handling page faults).

Fields

§populate: bool

Whether to populate the physical frames when creating the mapping.

Implementations§

source§

impl Backend

source

pub const fn new_alloc(populate: bool) -> Self

Creates a new allocation mapping backend.

source§

impl Backend

source

pub const fn new_linear(pa_va_offset: usize) -> Self

Creates a new linear mapping backend.

Trait Implementations§

source§

impl Clone for Backend

source§

fn clone(&self) -> Backend

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl MappingBackend for Backend

§

type Addr = VirtAddr

The address type used in the memory area.
§

type Flags = MappingFlags

The flags type used in the memory area.
§

type PageTable = PageTable64<X64PagingMetaData, X64PTE, PagingHandlerImpl>

The page table type used in the memory area.
source§

fn map( &self, start: VirtAddr, size: usize, flags: MappingFlags, pt: &mut PageTable ) -> bool

What to do when mapping a region within the area with the given flags.
source§

fn unmap(&self, start: VirtAddr, size: usize, pt: &mut PageTable) -> bool

What to do when unmaping a memory region within the area.
source§

fn protect( &self, start: Self::Addr, size: usize, new_flags: Self::Flags, page_table: &mut Self::PageTable ) -> bool

What to do when changing access flags.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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.
source§

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

Performs the conversion.