kern

view 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
line source
1 #define MAGIC 0x1badb002
2 #define FLAGS 0
3 #define STACK_SIZE 0x4000
5 .text
6 .globl _start
7 _start:
8 /* jump over the multiboot header onto the startup code */
9 jmp kentry
11 .align 4
12 /* multiboot header */
13 mboot_hdr:
14 .long MAGIC
15 .long FLAGS
16 .long -(MAGIC + FLAGS) /* checksum */
17 .fill 5, 4 /* fill out the rest with zeroes */
19 kentry:
20 /* setup a temporary kernel stack */
21 movl $(stack + STACK_SIZE), %esp
22 /* reset eflags register */
23 pushl $0
24 popf
25 /* call the kernel main function */
26 call kmain
27 /* we dropped out of main, halt the CPU */
28 cli
29 hlt
31 /* space for the temporary kernel stack */
32 .comm stack, STACK_SIZE