course 1 and project setup
[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     start_:
17         movl $stack_top, %esp
18         /* 
19             TODO: kernel init
20                 1. Load GDT
21                 2. Load IDT
22                 3. Enable paging
23         */
24         call _kernel_init
25
26         pushl %ebx
27         call _kernel_main
28
29         cli
30     j_:
31         hlt
32         jmp j_