global _start global stack_ptr extern kernel_main ; declare some constants MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries MEMINFO equ 1<<1 ; provide memory map FLAGS equ MODULEALIGN | MEMINFO ; this is the Multiboot 'flag' field MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header CHECKSUM equ -(MAGIC + FLAGS) ; checksum of above, to prove we are multiboot ; the bootloader will search for this magic sequence ; and recognize us as a multiboot kernel section .multiboot align 4 MultiBootHeader: dd MAGIC dd FLAGS dd CHECKSUM section .code ; setup the stack STACKSIZE equ 0x16384 _start: mov esp, stack+STACKSIZE push eax push ebx call kernel_main cli hang: hlt jmp hang section .bss align 4 stack: resb STACKSIZE stack_ptr: