X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/e0ee3d449aacd33a84cb1f58961e55f9f06acb46..f4aab93debd6eed5115c2328ada3160512027bd2:/lunaix-os/arch/x86/boot.S diff --git a/lunaix-os/arch/x86/boot.S b/lunaix-os/arch/x86/boot.S index 29746ee..b41d24b 100644 --- a/lunaix-os/arch/x86/boot.S +++ b/lunaix-os/arch/x86/boot.S @@ -14,7 +14,9 @@ .section .text .global start_ - .type start_, @function + .type start_, @function /* Optional, this just give the + * linker more knowledge about the label + */ start_: movl $stack_top, %esp /* @@ -24,7 +26,33 @@ 3. Enable paging */ call _kernel_init + + subl $0x6, %esp + movl $_gdt, 2(%esp) + movw _gdt_limit, %ax + movw %ax, (%esp) + lgdt (%esp) + + movl $_idt, 2(%esp) + movw _idt_limit, %ax + movw %ax, (%esp) + lidt (%esp) + + addl $0x6, %esp + + movw $0x10, %cx + movw %cx, %es + movw %cx, %ds + movw %cx, %fs + movw %cx, %gs + movw %cx, %ss + + pushw $0x08 + pushl $_after_gdt + retf + + _after_gdt: pushl %ebx call _kernel_main