bootloader_x86_64_common

Function set_up_mappings

Source
pub fn set_up_mappings<I, D>(
    kernel: Kernel<'_>,
    frame_allocator: &mut LegacyFrameAllocator<I, D>,
    page_tables: &mut PageTables,
    framebuffer: Option<&RawFrameBufferInfo>,
    config: &BootloaderConfig,
    system_info: &SystemInfo,
) -> Mappings
where I: ExactSizeIterator<Item = D> + Clone, D: LegacyMemoryRegion,
Expand description

Sets up mappings for a kernel stack and the framebuffer.

The kernel_bytes slice should contain the raw bytes of the kernel ELF executable. The frame_allocator argument should be created from the memory map. The page_tables argument should point to the bootloader and kernel page tables. The function tries to parse the ELF file and create all specified mappings in the kernel-level page table.

The framebuffer_addr and framebuffer_size fields should be set to the start address and byte length the pixel-based framebuffer. These arguments are required because the functions maps this framebuffer in the kernel-level page table, unless the map_framebuffer config option is disabled.

This function reacts to unexpected situations (e.g. invalid kernel ELF file) with a panic, so errors are not recoverable.