basic process support and some syscalls
[lunaix-os.git] / lunaix-os / arch / x86 / boot.S
index bc1eec2758345b99b985c6a86f138480a72d9dbc..9c86bbc6bed8081695dcb00a58b33b100403b73e 100644 (file)
@@ -2,7 +2,7 @@
 #include <arch/x86/boot/multiboot.h>
 
 #define MB_FLAGS    MULTIBOOT_MEMORY_INFO | MULTIBOOT_PAGE_ALIGN
-#define KPG_SIZE    24*1024
+#define KPG_SIZE    10*4096
 
 .section .multiboot
     .long MULTIBOOT_MAGIC
     /* 根据System V ABI,栈地址必须16字节对齐 */
     /* 这里只是一个临时栈,在_hhk_init里面我们会初始化内核专用栈 */
     stack_bottom:
-        .skip 16318, 0
+        .skip 16318 * 2, 0
     stack_top:
 
 
 /* 
     1 page directory, 
-    5 page tables:
+    9 page tables:
         1. Mapping reserved area and hhk_init
-        2-5. Remapping the kernels
+        2-9. Remapping the kernels
 */
 
 .section .kpg
@@ -41,6 +41,9 @@
                                  * linker more knowledge about the label 
                                  */
     start_: 
+        cld
+        # 确保屏蔽所有外中断,直到我们准备好PIC为止
+        cli
         movl $stack_top, %esp
 
         subl $16, %esp
@@ -57,9 +60,7 @@
 
         /*
             _hhk_init用来初始化我们高半核:
-                    1. 设置GDT表
-                    2. 设置IDT表(暂时,以后会拿到 kernel_init 里面)
-                    3. 初始化最简单的PTD与PT(重新映射我们的内核至3GiB处,以及对相应的地方进行Identity Map)
+                1. 初始化最简单的PD与PT(重新映射我们的内核至3GiB处,以及对相应的地方进行Identity Map)
         */
 
         movl $(KPG_SIZE), 4(%esp)
@@ -76,9 +77,9 @@
         andl $0xfffff000, %eax      # 有点多余,但写上还算明白一点
         movl %eax, %cr3
 
-        /* 开启分页与地址转换 (CR0.PG=1) */
+        /* 开启分页与地址转换 (CR0.PG=1, PG.WP=1) */
         movl %cr0, %eax
-        orl $0x80000000, %eax
+        orl $0x80010000, %eax
         movl %eax, %cr0
 
         addl $16, %esp