[boot] Do address virtualization in the bootloader

More and more places in the kernel init code are taking addresses from
the bootloader and translating them to offset-mapped addresses. The
bootloader can do this, so it should.
This commit is contained in:
Justin C. Miller
2021-02-10 01:23:50 -08:00
parent 2d4a65c654
commit 793bba95b5
3 changed files with 26 additions and 11 deletions

View File

@@ -93,6 +93,8 @@ add_module(args::header *args, args::mod_type type, buffer &data)
m.type = type;
m.location = data.data;
m.size = data.size;
change_pointer(m.location);
}
/// Check that all required cpu features are supported
@@ -198,12 +200,15 @@ efi_main(uefi::handle image, uefi::system_table *st)
reinterpret_cast<kernel::entrypoint>(kernel.entrypoint);
status.next();
hw::setup_control_regs();
memory::virtualize(args->pml4, map, st->runtime_services);
status.next();
change_pointer(args);
change_pointer(args->pml4);
change_pointer(args->modules);
change_pointer(args->programs);
status.next();
kentry(args);