X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/cd09c4b222e4ddf45a42522563ae2471a829d1c8..86a9cfeadbbe180abf6c8bd8c64c86957fdacfeb:/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 4e114e9..ef559bb 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,14 +35,17 @@ movw %cx, %ss /* 更新 CS:EIP */ - pushw $0x08 + pushw $KCODE_SEG pushl $_after_gdt retf _after_gdt: - movl $mb_info, (%esp) - call _kernel_init + movl $mb_info, _k_init_mb_info + + call _kernel_pre_init + + subl $6, %esp # 加载 IDT movl $_idt, 2(%esp) @@ -47,17 +53,18 @@ movw %ax, (%esp) lidt (%esp) - /* - 加载新的栈指针,位于0xffbfffff,但因为16字节对齐的需求,低四位清零。 - 为什么不是0xffffffff? 因为0xffc00000 - 0xffffffff 这4MiB的空间用于 - 对页表与页目录的循环映射。 - */ - mov $0xffbffff0, %esp + /* 加载TSS段选择器 */ + movw $TSS_SEG, %ax + ltr %ax + + addl $6, %esp + + call _kernel_init + + movl $KSTACK_TOP, %esp - /* 进入内核 */ - call _kernel_main + call _kernel_post_init - cli - j_: + 1: hlt - jmp j_ \ No newline at end of file + jmp 1b \ No newline at end of file