git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
regression: mmap for fd
[lunaix-os.git]
/
lunaix-os
/
arch
/
x86
/
boot.S
diff --git
a/lunaix-os/arch/x86/boot.S
b/lunaix-os/arch/x86/boot.S
index 5f832aa34038364f2f202e084b379d779a8c1116..d1d14ba7e8af8ded3708aab9aa81fb330d65f62a 100644
(file)
--- a/
lunaix-os/arch/x86/boot.S
+++ b/
lunaix-os/arch/x86/boot.S
@@
-2,7
+2,7
@@
#include <arch/x86/boot/multiboot.h>
#define MB_FLAGS MULTIBOOT_MEMORY_INFO | MULTIBOOT_PAGE_ALIGN
#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
.section .multiboot
.long MULTIBOOT_MAGIC
@@
-18,15
+18,15
@@
/* 根据System V ABI,栈地址必须16字节对齐 */
/* 这里只是一个临时栈,在_hhk_init里面我们会初始化内核专用栈 */
stack_bottom:
/* 根据System V ABI,栈地址必须16字节对齐 */
/* 这里只是一个临时栈,在_hhk_init里面我们会初始化内核专用栈 */
stack_bottom:
- .skip
16318
, 0
- stack_top:
+ .skip
4096
, 0
+
__
stack_top:
/*
1 page directory,
/*
1 page directory,
-
5
page tables:
+
9
page tables:
1. Mapping reserved area and hhk_init
1. Mapping reserved area and hhk_init
- 2-
5
. Remapping the kernels
+ 2-
9
. Remapping the kernels
*/
.section .kpg
*/
.section .kpg
@@
-41,7
+41,10
@@
* linker more knowledge about the label
*/
start_:
* linker more knowledge about the label
*/
start_:
- movl $stack_top, %esp
+ cld
+ # 确保屏蔽所有外中断,直到我们准备好PIC为止
+ cli
+ movl $__stack_top, %esp
subl $16, %esp
subl $16, %esp
@@
-74,11
+77,17
@@
andl $0xfffff000, %eax # 有点多余,但写上还算明白一点
movl %eax, %cr3
andl $0xfffff000, %eax # 有点多余,但写上还算明白一点
movl %eax, %cr3
- /* 开启分页与地址转换 (CR0.PG=1) */
movl %cr0, %eax
movl %cr0, %eax
- orl $0x80000000, %eax
+ orl $0x80000000, %eax /* 开启分页与地址转换 (CR0.PG=1, CR0.WP=0) */
+ andl $0xfffffffb, %eax
+ orl $0x2, %eax /* 启用x87 FPU (CR0.MP=1, CR0.EM=0) */
movl %eax, %cr0
movl %eax, %cr0
+ movl %cr4, %eax
+ orl $0x600, %eax
+ movl %eax, %cr4 /* CR4.OSFXSR=1, CR4.OSXMMEXCPT=1 */
+ /* x87 FPU 已配置 */
+
addl $16, %esp
/* 进入高半核! */
addl $16, %esp
/* 进入高半核! */