Struct Config

1.1.0 · Source
pub struct Config<'physical_allocator, A: AddressSpaceTy = Kernel> {
    physical_location: Location<Frame>,
    virtual_location: Location<Page>,
    _laziness: Laziness,
    length: NonZero<usize>,
    physical_allocator: &'physical_allocator dyn PhysicalAllocator,
    address_space: A,
    protection: Protection,
}
Available on non-crate feature use_std only.
Expand description

Configuration for creating a mapping

By default, it will allocate memory anywhere that is valid, using the kernel AddressSpace, and the highmem physical allocator. It will lazily allocate physical memory, and map it with read, write and execute permissions.

Fields§

§physical_location: Location<Frame>§virtual_location: Location<Page>§_laziness: Laziness§length: NonZero<usize>§physical_allocator: &'physical_allocator dyn PhysicalAllocator§address_space: A§protection: Protection

Implementations§

Source§

impl Config<'static, Kernel>

1.1.0 · Source

pub fn new(length: NonZero<usize>) -> Self

Creates a new mapping configuration with default options

length is specified in pages

The default options are not guaranteed, but at the moment are:

  • physical and virtual locations: anywhere
  • lazily allocated
  • Highmem physical allocator
  • Kernel address space
  • Readable, writable and executable
Source§

impl Config<'static, Userspace>

1.1.0 · Source

pub fn new_in(length: NonZero<usize>, address_space: &AddressSpace) -> Self

Creates a new mapping configuration with default options, but in the specified address space

length is specified in pages

The default options are not guaranteed, but at the moment are:

  • physical and virtual locations: anywhere
  • lazily allocated
  • Highmem physical allocator
  • Readable, writable and executable
Source§

impl<'physical_allocator, A: AddressSpaceTy> Config<'physical_allocator, A>

Source

pub fn physical_allocator<'a>( self, allocator: &'a dyn PhysicalAllocator, ) -> Config<'a, A>

🔬This is a nightly-only experimental API. (kernel_mmap_config #24)

Set the physical allocator to use

This is used for both the underlying memory and any page tables that need creating

Source

pub fn protection(self, protection: Protection) -> Self

🔬This is a nightly-only experimental API. (kernel_mmap_config #24)
1.1.0 · Source

pub fn physical_location(self, location: Location<Frame>) -> Self

Set the physical location of the low address of the mapping

Source

pub fn virtual_location(self, location: Location<Page>) -> Self

🔬This is a nightly-only experimental API. (kernel_mmap_config #24)

Set the virtual location of the low address of the mapping

This is currently ignored

Auto Trait Implementations§

§

impl<'physical_allocator, A> Freeze for Config<'physical_allocator, A>
where A: Freeze,

§

impl<'physical_allocator, A = Kernel> !RefUnwindSafe for Config<'physical_allocator, A>

§

impl<'physical_allocator, A> Send for Config<'physical_allocator, A>
where A: Send,

§

impl<'physical_allocator, A> Sync for Config<'physical_allocator, A>
where A: Sync,

§

impl<'physical_allocator, A> Unpin for Config<'physical_allocator, A>
where A: Unpin,

§

impl<'physical_allocator, A = Kernel> !UnwindSafe for Config<'physical_allocator, A>

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 = Infallible

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

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

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.