X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/7b0dccbab69e806a63c4504c3ddb82e45241985b..707c6653985f55463e8a59a58b248ba8af3b44b2:/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 cbfd414..6cdab40 100644 --- a/lunaix-os/kernel/asm/x86/prologue.S +++ b/lunaix-os/kernel/asm/x86/prologue.S @@ -1,5 +1,8 @@ /* 高半核入口点 - 0xC0000000 */ +#define __ASM__ +#include + .section .text .global hhk_entry_ hhk_entry_: @@ -24,7 +27,7 @@ lgdt (%esp) /* 更新段寄存器 */ - movw $0x10, %cx + movw $KDATA_SEG, %cx movw %cx, %es movw %cx, %ds movw %cx, %fs @@ -32,13 +35,13 @@ movw %cx, %ss /* 更新 CS:EIP */ - pushw $0x08 + pushw $KCODE_SEG pushl $_after_gdt retf _after_gdt: - movl $mb_info, (%esp) + movl $mb_info, _k_init_mb_info call _kernel_pre_init @@ -50,23 +53,14 @@ movw %ax, (%esp) lidt (%esp) + /* 加载TSS段选择器 */ + movw $TSS_SEG, %ax + ltr %ax + 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 - jmp j_ \ No newline at end of file + jmp 1b \ No newline at end of file