feat: add support for process to conduct Intel x87 and MMX related task.
[lunaix-os.git] / lunaix-os / arch / x86 / boot.S
index 8ba78cc39ab8443004b394545a786061c7995369..938db876514333b8a8f0dec1b1d598590b51f80d 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
@@ -24,9 +24,9 @@
 
 /* 
     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
         andl $0xfffff000, %eax      # 有点多余,但写上还算明白一点
         movl %eax, %cr3
 
-        /* 开启分页与地址转换 (CR0.PG=1) */
         movl %cr0, %eax
-        orl $0x80000000, %eax
+        orl $0x80010000, %eax   /* 开启分页与地址转换 (CR0.PG=1, CR0.WP=1) */
+        andl $0xfffffffb, %eax
+        orl $0x2, %eax          /* 启用x87 FPU (CR0.MP=1, CR0.EM=0) */
         movl %eax, %cr0
 
+        movl %cr4, %eax
+        orl $0x600, %eax
+        movl %eax, %cr4         /* CR4.OSFXSR=1, CR4.OSXMMEXCPT=1 */
+                                /* x87 FPU 已配置 */
+
         addl $16, %esp
 
         /* 进入高半核! */