Set up initial page tables for both the offset-mapped area and the loaded kernel code and data. * Got rid of the `loaded_elf` struct - the loader now runs after the initial PML4 is created and maps the ELF sections itself. * Copied in the `page_table` and `page_table_indices` from the kernel, still need to clean this up and extract it into shared code. * Added `page_table_cache` to the kernel args to pass along free pages that can be used for initial page tables. Tags: paging
24 lines
616 B
C++
24 lines
616 B
C++
/// \file loader.h
|
|
/// Definitions for loading the kernel into memory
|
|
#pragma once
|
|
|
|
#include <uefi/boot_services.h>
|
|
|
|
#include "kernel_args.h"
|
|
|
|
namespace boot {
|
|
namespace loader {
|
|
|
|
/// Parse and load an ELF file in memory into a loaded image.
|
|
/// \arg data The start of the ELF file in memory
|
|
/// \arg size The size of the ELF file in memory
|
|
/// \arg args The kernel args, used for modifying page tables
|
|
/// \returns A descriptor defining the loaded image
|
|
kernel::entrypoint load(
|
|
const void *data, size_t size,
|
|
kernel::args::header *args,
|
|
uefi::boot_services *bs);
|
|
|
|
} // namespace loader
|
|
} // namespace boot
|