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: elf loading
[lunaix-os.git]
/
lunaix-os
/
kernel
/
asm
/
x86
/
prologue.S
diff --git
a/lunaix-os/kernel/asm/x86/prologue.S
b/lunaix-os/kernel/asm/x86/prologue.S
index cbfd414765ed0cfa3086f3b1fb21cb1002ed7be6..6cdab40490e2c0e08a524412ca6021d1f6f4d812 100644
(file)
--- a/
lunaix-os/kernel/asm/x86/prologue.S
+++ b/
lunaix-os/kernel/asm/x86/prologue.S
@@
-1,5
+1,8
@@
/* 高半核入口点 - 0xC0000000 */
/* 高半核入口点 - 0xC0000000 */
+#define __ASM__
+#include <lunaix/common.h>
+
.section .text
.global hhk_entry_
hhk_entry_:
.section .text
.global hhk_entry_
hhk_entry_:
@@
-24,7
+27,7
@@
lgdt (%esp)
/* 更新段寄存器 */
lgdt (%esp)
/* 更新段寄存器 */
- movw $
0x10
, %cx
+ movw $
KDATA_SEG
, %cx
movw %cx, %es
movw %cx, %ds
movw %cx, %fs
movw %cx, %es
movw %cx, %ds
movw %cx, %fs
@@
-32,13
+35,13
@@
movw %cx, %ss
/* 更新 CS:EIP */
movw %cx, %ss
/* 更新 CS:EIP */
- pushw $
0x08
+ pushw $
KCODE_SEG
pushl $_after_gdt
retf
_after_gdt:
pushl $_after_gdt
retf
_after_gdt:
- movl $mb_info,
(%esp)
+ movl $mb_info,
_k_init_mb_info
call _kernel_pre_init
call _kernel_pre_init
@@
-50,23
+53,14
@@
movw %ax, (%esp)
lidt (%esp)
movw %ax, (%esp)
lidt (%esp)
+ /* 加载TSS段选择器 */
+ movw $TSS_SEG, %ax
+ ltr %ax
+
addl $6, %esp
call _kernel_init
addl $6, %esp
call _kernel_init
- /*
- 加载新的栈指针,位于0xffbfffff,但因为16字节对齐的需求,低四位清零。
- 为什么不是0xffffffff? 因为0xffc00000 - 0xffffffff 这4MiB的空间用于
- 对页表与页目录的循环映射。
- */
- mov $0xffbffff0, %esp
-
- call _kernel_post_init
-
- /* 进入内核 */
- call _kernel_main
-
- cli
- j_:
+ 1:
hlt
hlt
- jmp
j_
\ No newline at end of file
+ jmp
1b
\ No newline at end of file