arch/x86_64/efi/prep.c
/**
 * Perform necessary prep to establish a kernel baseline
 *
 * When the UEFI loader jumps into the kernel, it leaves has loaded the image in
 * an effectively random location. While the actual *physical* location does not really
 * matter, the virtual location does.
 *
 * The state is currently identity mapping, which is not ideal. This function sets up
 * the kernel's own page tables and moves itself to the higher half. The actual magic
 * of fixing the instruction pointer is done back in boot/boot.S
 */
Perform necessary prep to establish a kernel baseline
When the UEFI loader jumps into the kernel, it leaves has loaded the image in
an effectively random location. While the actual *physical* location does not really
matter, the virtual location does.

The state is currently identity mapping, which is not ideal. This function sets up
the kernel's own page tables and moves itself to the higher half. The actual magic
of fixing the instruction pointer is done back in boot/boot.S
Perform necessary prep to establish a kernel baseline When the UEFI loader jumps into the kernel it leaves has loaded the image in an effectively random location . While the actual * physical * location does not really matter the virtual location does . The state is currently identity mapping which is not ideal . This function sets up the kernel ' s own page tables and moves itself to the higher half . The actual magic of fixing the instruction pointer is done back in boot / boot . S
void* low_level_prep(unsigned long kern_base, kern_img_t* kern_img, mem_map_t* mem_map, const uint64_t* prev_pml4)
{
    setup_kernel_tables(kern_base, kern_img);
    setup_memory_map(mem_map);
    setup_stack(mem_map);
    pml4e[0] = prev_pml4[0];
    return &pml4e;
}
void * low_level_prep ( unsigned long kern_base , kern_img_t * kern_img , mem_map_t * mem_map , const uint64_t * prev_pml4 ) { setup_kernel_tables ( kern_base , kern_img ) ; setup_memory_map ( mem_map ) ; setup_stack ( mem_map ) ; pml4e [ 0 ] = prev_pml4 [ 0 ] ; return & pml4e ; }
Perform necessary prep to establish a kernel baseline
 When the UEFI loader jumps into the kernel, it leaves has loaded the image in
 an effectively random location.
Perform necessary prep to establish a kernel baseline When the UEFI loader jumps into the kernel it leaves has loaded the image in an effectively random location .
// Setup current address space mapping -- this is just temporary, but needed // otherwise we'll get an immediate page-fault when %cr3 is modified.