kern

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/mboot.S	Wed Dec 01 22:02:42 2010 +0200
     1.3 @@ -0,0 +1,32 @@
     1.4 +#define MAGIC		0x1badb002
     1.5 +#define FLAGS		0
     1.6 +#define STACK_SIZE	0x4000
     1.7 +
     1.8 +	.text
     1.9 +	.globl _start
    1.10 +_start:
    1.11 +	/* jump over the multiboot header onto the startup code */
    1.12 +	jmp kentry
    1.13 +
    1.14 +	.align 4
    1.15 +	/* multiboot header */
    1.16 +mboot_hdr:
    1.17 +	.long MAGIC
    1.18 +	.long FLAGS
    1.19 +	.long -(MAGIC + FLAGS)	/* checksum */
    1.20 +	.fill 5, 4	/* fill out the rest with zeroes */
    1.21 +
    1.22 +kentry:
    1.23 +	/* setup a temporary kernel stack */
    1.24 +	movl $(stack + STACK_SIZE), %esp
    1.25 +	/* reset eflags register */
    1.26 +	pushl $0
    1.27 +	popf
    1.28 +	/* call the kernel main function */
    1.29 +	call kmain
    1.30 +	/* we dropped out of main, halt the CPU */
    1.31 +	cli
    1.32 +	hlt
    1.33 +
    1.34 +	/* space for the temporary kernel stack */
    1.35 +	.comm stack, STACK_SIZE