#[non_exhaustive]pub struct Mappings {
pub kernel_stack: Mapping,
pub kernel_base: 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: MappingConfigures 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.
kernel_base: MappingConfigures the base address of the kernel.
If a fixed address is set, it must be paged aligned and the kernel must be a position-independent exectuable.
boot_info: MappingSpecifies where the crate::BootInfo struct should be placed in virtual memory.
framebuffer: MappingSpecifies the mapping of the frame buffer memory region.
physical_memory: Option<Mapping>The bootloader supports mapping 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.
This mapping will go from physical address 0x0 to whichever is larger:
- The end of the last region in the BIOS/UEFI memory map
- The address
0x1_0000_0000(such that at least 4 GiB of physical memory are always mapped). This is to ensure that useful MMIO regions (local APIC, I/O APIC, PCI bars) are accessible to the kernel even if less physical memory than that is on the system.
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: boolWhether 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: MappingVirtual 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.