Struct Mappings

Source
#[non_exhaustive]
pub struct Mappings { pub kernel_stack: Mapping, pub boot_info: Mapping, pub framebuffer: Mapping, pub physical_memory: Option<Mapping>, pub page_table_recursive: Option<Mapping>, pub aslr: bool, pub dynamic_range_start: Option<u64>, pub dynamic_range_end: Option<u64>, pub ramdisk_memory: Mapping, }
Expand description

Allows to configure the virtual memory mappings created by the bootloader.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§kernel_stack: Mapping

Configures how the kernel stack should be mapped.

If a fixed address is set, it must be page aligned.

Note that the first page of the kernel stack is intentionally left unmapped to act as a guard page. This ensures that a page fault occurs on a stack overflow. For example, setting the kernel stack address to FixedAddress(0xf_0000_0000) will result in a guard page at address 0xf_0000_0000 and the kernel stack starting at address 0xf_0000_1000.

§boot_info: Mapping

Specifies where the crate::BootInfo struct should be placed in virtual memory.

§framebuffer: Mapping

Specifies the mapping of the frame buffer memory region.

§physical_memory: Option<Mapping>

The bootloader supports to map the whole physical memory into the virtual address space at some offset. This is useful for accessing and modifying the page tables set up by the bootloader.

Defaults to None, i.e. no mapping of the physical memory.

§page_table_recursive: Option<Mapping>

As an alternative to mapping the whole physical memory (see Self::physical_memory), the bootloader also has support for setting up a recursive level 4 page table.

Defaults to None, i.e. no recursive mapping.

§aslr: bool

Whether to randomize non-statically configured addresses. The kernel base address will be randomized when it’s compiled as a position independent executable.

Defaults to false.

§dynamic_range_start: Option<u64>

The lowest virtual address for dynamic addresses.

Defaults to 0.

§dynamic_range_end: Option<u64>

The highest virtual address for dynamic addresses.

Defaults to 0xffff_ffff_ffff_f000.

§ramdisk_memory: Mapping

Virtual address to map ramdisk image, if present on disk Defaults to dynamic

Implementations§

Source§

impl Mappings

Source

pub const fn new_default() -> Self

Creates a new mapping configuration with dynamic mapping for kernel, boot info and frame buffer. Neither physical memory mapping nor recursive page table creation are enabled.

Trait Implementations§

Source§

impl Clone for Mappings

Source§

fn clone(&self) -> Mappings

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 Debug for Mappings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Mappings

Source§

fn default() -> Mappings

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Mappings

Source§

fn eq(&self, other: &Mappings) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Mappings

Source§

impl Eq for Mappings

Source§

impl StructuralPartialEq for Mappings

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.