1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

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>
This commit is contained in:
Gunnar Beutner 2021-07-18 14:47:32 +02:00 committed by Andreas Kling
parent 357ddd393e
commit 7e94b090fe
30 changed files with 1207 additions and 181 deletions

View file

@ -7,21 +7,21 @@
#pragma once
#include <AK/Platform.h>
#ifdef __cplusplus
# include <AK/Types.h>
#endif
#define READONLY_AFTER_INIT __attribute__((section(".ro_after_init")))
#define UNMAP_AFTER_INIT NEVER_INLINE __attribute__((section(".unmap_after_init")))
#define KERNEL_BASE 0xC0000000
#define KERNEL_PD_OFFSET 0x3000000
#define KERNEL_PD_END (KERNEL_BASE + 0x31000000)
#define KERNEL_PT1024_BASE (KERNEL_BASE + 0x3FE00000)
#ifdef __cplusplus
extern "C" FlatPtr kernel_base;
#endif
#define KERNEL_PD_END (kernel_base + 0x31000000)
#define KERNEL_PT1024_BASE (kernel_base + 0x3FE00000)
#define KERNEL_QUICKMAP_PT (KERNEL_PT1024_BASE + 0x6000)
#define KERNEL_QUICKMAP_PD (KERNEL_PT1024_BASE + 0x7000)
#define KERNEL_QUICKMAP_PER_CPU_BASE (KERNEL_PT1024_BASE + 0x8000)
#define KERNEL_PHYSICAL_PAGES_BASE (KERNEL_BASE + KERNEL_PD_OFFSET)
#ifdef __cplusplus
static_assert(KERNEL_BASE % 0x1000000 == 0);
#endif
#define USER_RANGE_CEILING 0xBE000000