1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:38:11 +00:00

Kernel: Make the kernel independent from specific physical addresses

Previously the kernel relied on a fixed offset between virtual and
physical addresses based on the kernel's load address. This allows us
to specify an independent offset.
This commit is contained in:
Gunnar Beutner 2021-07-22 13:05:04 +02:00 committed by Andreas Kling
parent c4887882cc
commit 3c616ae00f
5 changed files with 7 additions and 2 deletions

View file

@ -111,6 +111,7 @@ extern "C" {
READONLY_AFTER_INIT PhysicalAddress start_of_prekernel_image;
READONLY_AFTER_INIT PhysicalAddress end_of_prekernel_image;
READONLY_AFTER_INIT FlatPtr kernel_base;
READONLY_AFTER_INIT size_t physical_to_virtual_offset;
#if ARCH(X86_64)
READONLY_AFTER_INIT PhysicalAddress boot_pml4t;
#endif
@ -128,6 +129,7 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init(BootInfo const& boot_info)
multiboot_info_ptr = (multiboot_info_t*)boot_info.multiboot_info_ptr;
start_of_prekernel_image = PhysicalAddress { boot_info.start_of_prekernel_image };
end_of_prekernel_image = PhysicalAddress { boot_info.end_of_prekernel_image };
physical_to_virtual_offset = boot_info.physical_to_virtual_offset;
kernel_base = boot_info.kernel_base;
#if ARCH(X86_64)
gdt64ptr = boot_info.gdt64ptr;