Skip to content
Mohamed Anwar edited this page Apr 4, 2018 · 4 revisions

All files relevant for booting should be fully contained in kernel/arch/{ARCH}/boot/

The following are the supported architectures and platforms:

x86

Multiboot

_start is defined in boot/multiboot.S, which is set as the entry point and gets executed by GrUB or any other multiboot compatible bootloader.

movl %eax, (multiboot_signature)
movl %ebx, (multiboot_info)
and $-16, %esp   /* Align Stack Pointer */
cli /* Clear Interrupts */
call early_init

Generic

early_init is a generic bootstrap function that kickstarts kernel boot up. Here is how early_init is defined, it just maps the kernel to VMA (=0xC0000000)

void early_init(void)
{
    /* Set up a basic paging structure so kernel is mapped to VMA */
    switch_to_higher_half();
    /* Fix esp by adding VMA to it */
    asm volatile ("addl %0, %%esp"::"g"(VMA((uintptr_t) 0)):"esp");

    cpu_init();
}

From here Boot Process is done and CPU initialization is started.

Clone this wiki locally