kern

annotate src/mboot.S @ 0:662ff2170531

starting the kernel
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 01 Dec 2010 22:02:42 +0200
parents
children ebe5e0e44a9d
rev   line source
nuclear@0 1 #define MAGIC 0x1badb002
nuclear@0 2 #define FLAGS 0
nuclear@0 3 #define STACK_SIZE 0x4000
nuclear@0 4
nuclear@0 5 .text
nuclear@0 6 .globl _start
nuclear@0 7 _start:
nuclear@0 8 /* jump over the multiboot header onto the startup code */
nuclear@0 9 jmp kentry
nuclear@0 10
nuclear@0 11 .align 4
nuclear@0 12 /* multiboot header */
nuclear@0 13 mboot_hdr:
nuclear@0 14 .long MAGIC
nuclear@0 15 .long FLAGS
nuclear@0 16 .long -(MAGIC + FLAGS) /* checksum */
nuclear@0 17 .fill 5, 4 /* fill out the rest with zeroes */
nuclear@0 18
nuclear@0 19 kentry:
nuclear@0 20 /* setup a temporary kernel stack */
nuclear@0 21 movl $(stack + STACK_SIZE), %esp
nuclear@0 22 /* reset eflags register */
nuclear@0 23 pushl $0
nuclear@0 24 popf
nuclear@0 25 /* call the kernel main function */
nuclear@0 26 call kmain
nuclear@0 27 /* we dropped out of main, halt the CPU */
nuclear@0 28 cli
nuclear@0 29 hlt
nuclear@0 30
nuclear@0 31 /* space for the temporary kernel stack */
nuclear@0 32 .comm stack, STACK_SIZE