Gunnar Beutner
412ce31f7f
Prekernel: Don't build the prekernel as a PIE image
...
This is unnecessary because the prekernel is always loaded at a known
base address.
2021-07-23 19:06:51 +02:00
Gunnar Beutner
4fdee56ba3
Prekernel: Make sure to reload CR3 after modifying the page tables
2021-07-20 15:12:19 +02:00
Gunnar Beutner
05fc75f994
Prekernel: Don't wrap around the PTE index improperly
...
The boot_pd0_pts variable contains more than 512 PTEs so we shouldn't
wrap the index here.
2021-07-20 15:12:19 +02:00
Gunnar Beutner
d29981e4a1
Prekernel: Properly initialize variables
2021-07-20 15:12:19 +02:00
Gunnar Beutner
56f952a5f2
Prekernel: Don't assume that PT_LOAD headers are ordered by address
...
These headers are ordered by virtual address - at least with GCC - but
that might not always be the case.
2021-07-20 15:12:19 +02:00
Gunnar Beutner
be795d5812
Prekernel: Use physical addresses for some of the BootInfo parameters
...
The kernel would just turn those virtual addresses into physical
addresses later on, so let's just use physical addresses right from the
start.
2021-07-20 15:12:19 +02:00
Gunnar Beutner
dd42093b93
Kernel: Move boot info declarations to a header file
...
Instead of manually redeclaring those variables in various files this
now adds a header file for them.
2021-07-20 15:12:19 +02:00
Gunnar Beutner
69fd68b1c8
Prekernel: Make sure we're not overwriting the ELF header
...
This copies the ELF header because we might end up overwriting when
loading the ELF sections.
2021-07-20 01:50:55 +02:00
Gunnar Beutner
3678f78bfb
Prekernel: Make sure the last few bytes of the kernel image are mapped
...
Depending on the exact layout of the .ksyms section the kernel would
fail to boot because the kernel_load_end variable didn't account for the
section's size.
2021-07-19 17:47:54 +02:00
Gunnar Beutner
b6ddb4b70f
Kernel: Simplify the linker script for the prekernel
2021-07-19 11:29:09 +02:00
Gunnar Beutner
7e94b090fe
Kernel: Introduce basic pre-kernel environment
...
This implements a simple bootloader that is capable of loading ELF64
kernel images. It does this by using QEMU/GRUB to load the kernel image
from disk and pass it to our bootloader as a Multiboot module.
The bootloader then parses the ELF image and sets it up appropriately.
The kernel's entry point is a C++ function with architecture-native
code.
Co-authored-by: Liav A <liavalb@gmail.com>
2021-07-18 17:31:13 +02:00