course 3 (vga and linker config)
[lunaix-os.git] / lunaix-os / arch / x86 / boot.S
1 #include "multiboot.h"
2
3 .section .multiboot
4     .long MB_MAGIC
5     .long MB_ALIGNED_4K_MEM_MAP
6     .long CHECKSUM(MB_ALIGNED_4K_MEM_MAP)
7
8 .section .bss
9     /* According to System V ABI, the stack must be aligned at 16 bytes boundary */
10     .align 16
11     stack_bottom:
12         .skip 16318, 0
13     stack_top:
14
15 .section .text
16     .global start_
17     .type start_, @function
18     start_:
19         movl $stack_top, %esp
20         /* 
21             TODO: kernel init
22                 1. Load GDT
23                 2. Load IDT
24                 3. Enable paging
25         */
26         call _kernel_init
27
28         pushl %ebx
29         call _kernel_main
30
31         cli
32     j_:
33         hlt
34         jmp j_