#[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
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
impl Mappings
Sourcepub const fn new_default() -> Self
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.