Kernel: Panic early if the kernel gets too big for its memory slot

Let's help our future selves find this problem sooner next time it
happens. Hopefully we'll come up with a nicer loader before then,
but who knows. :^)
This commit is contained in:
Andreas Kling 2021-02-24 20:57:47 +01:00
parent c7cf56421a
commit 98f08a8bad
Notes: sideshowbarker 2024-07-18 21:57:09 +09:00

View file

@ -88,6 +88,8 @@ extern "C" u8* end_of_safemem_text;
extern "C" u8* start_of_safemem_atomic_text;
extern "C" u8* end_of_safemem_atomic_text;
extern "C" FlatPtr end_of_kernel_image;
multiboot_module_entry_t multiboot_copy_boot_modules_array[16];
size_t multiboot_copy_boot_modules_count;
@ -120,6 +122,11 @@ static Processor s_bsp_processor; // global but let's keep it "private"
extern "C" UNMAP_AFTER_INIT [[noreturn]] void init()
{
if ((FlatPtr)&end_of_kernel_image >= 0xc1000000u) {
// The kernel has grown too large again!
asm volatile("cli;hlt");
}
setup_serial_debug();
// We need to copy the command line before kmalloc is initialized,