Unifying the Lunaix's Physical Memory Model (#28)
[lunaix-os.git] / lunaix-os / arch / i386 / boot / boot.S
1 #define __ASM__ 1
2 #include <sys/boot/multiboot.h>
3
4 #define MB_FLAGS    (MULTIBOOT_MEMORY_INFO | MULTIBOOT_PAGE_ALIGN)
5 #define KPG_SIZE    10*4096
6
7 .section .multiboot
8     .long MULTIBOOT_MAGIC
9     .long MB_FLAGS
10     .long CHECKSUM(MB_FLAGS)
11
12 .section .boot.bss
13     /* 根据System V ABI,栈地址必须16字节对齐 */
14     /* 这里只是一个临时栈,在_hhk_init里面我们会初始化内核专用栈 */
15     .align 16
16         .skip 256, 0
17     __boot_stack_top:
18
19 .section .boot.text
20     .global start_
21     .type start_, @function     /* Optional, this just give the 
22                                  * linker more knowledge about the label 
23                                  */
24     start_: 
25         cld
26         # 确保屏蔽所有外中断,直到我们准备好PIC为止
27         cli
28         movl $__boot_stack_top, %esp
29
30         subl $16, %esp
31
32         movl %ebx, (%esp)
33         call x86_init
34
35         addl $16, %esp
36
37         pushl $hhk_entry_
38         ret