# boot.S (x86, i386) — multiboot header + entry. # The Multiboot1 header lets QEMU -kernel (and GRUB) load us directly. # We set a stack and call kmain(). Irreducible asm part for x86. .set MB_MAGIC, 0x1BADB002 .set MB_FLAGS, 0x0 .set MB_CHECKSUM, -(MB_MAGIC + MB_FLAGS) .section .multiboot, "a" .align 4 .long MB_MAGIC .long MB_FLAGS .long MB_CHECKSUM .section .bss .align 16 stack_bottom: .skip 0x4000 # 16 KiB stack stack_top: .section .text.boot .globl _start .type _start, @function _start: mov $stack_top, %esp # set up the stack call kmain 1: hlt # kmain shouldn't return; if it does, halt jmp 1b