diff options
Diffstat (limited to 'src/kernel/core/kmain.c')
-rw-r--r-- | src/kernel/core/kmain.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/kernel/core/kmain.c b/src/kernel/core/kmain.c index d8f059a..cfb9935 100644 --- a/src/kernel/core/kmain.c +++ b/src/kernel/core/kmain.c @@ -10,7 +10,16 @@ #include <mem/mem.h> #include <linker/elf.h> +/* The kernel's main procedure. This function is called in loader_.asm. + This function calls the initializer functions for all system parts. + It then loads the modules the kernel was given by the bootloader. + This function never returns : once multitasking is started for good, + the execution flow of this function is never returned to. */ void kmain(struct multiboot_info_t* mbd, int32_t magic) { + monitor_clear(); + + ASSERT(magic == MULTIBOOT_BOOTLOADER_MAGIC); + size_t totalRam = 0; uint32_t i; @@ -25,8 +34,6 @@ void kmain(struct multiboot_info_t* mbd, int32_t magic) { mem_placementAddr = (mods[i].mod_end & 0xFFFFF000) + 0x1000; } - monitor_clear(); - if (magic != MULTIBOOT_BOOTLOADER_MAGIC) { PANIC("wrong multiboot magic number."); } @@ -62,4 +69,5 @@ void kmain(struct multiboot_info_t* mbd, int32_t magic) { monitor_write("Modules now RULE THE WORLD !\n"); sti(); tasking_switch(); + PANIC("Should never happen. Something probably went wrong with multitasking."); } |