X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Fstart.asm;h=d504a5df5f5df718196e11011eab2c01a122e4ee;hb=b68b764267d33a45539b4c910db13fbdae48f193;hp=737ff2e77a65a26058a7d19d342ac2248e7e74aa;hpb=310d4fe3f4d96ef804a27463bc43df9acb28757a;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/start.asm b/Kernel/arch/x86/start.asm index 737ff2e7..d504a5df 100644 --- a/Kernel/arch/x86/start.asm +++ b/Kernel/arch/x86/start.asm @@ -59,6 +59,8 @@ mboot: [extern kmain] [global start] start: + ; Just show we're here + mov WORD [0xB8000], 0x0741 ; 'A' ; Set up stack mov esp, Kernel_Stack_Top @@ -68,16 +70,23 @@ start: mov cr3, ecx mov ecx, cr0 - or ecx, 0x80010000 ; PG and WP + or ecx, 0x80010000 ; PG and WP mov cr0, ecx + mov WORD [0xB8002], 0x0763 ; 'c' + mov WORD [0xB8004], 0x0765 ; 'e' + lea ecx, [.higherHalf] jmp ecx .higherHalf: + + mov WORD [0xB8006], 0x0773 ; 's' + mov WORD [0xB8008], 0x0773 ; 's' ; Call the kernel push ebx ; Multiboot Info push eax ; Multiboot Magic Value + mov WORD [0xB800A], 0x0732 ; '2' call kmain ; Halt the Machine @@ -87,7 +96,7 @@ start: jmp .hlt ; -; Multiprocessing AP Startup Code (Must be within 0x10FFF0) +; Multiprocessing AP Startup Code (Must be within 0 - 0x10FFF0) ; %if USE_MP [extern gGDT] @@ -114,12 +123,15 @@ APWait: [global APStartup] APStartup: ;xchg bx, bx ; MAGIC BREAK! + ; Load initial GDT mov ax, 0xFFFF mov ds, ax lgdt [DWORD ds:lGDTPtr-KERNEL_BASE-0xFFFF0] + ; Enable PMode in CR0 mov eax, cr0 or al, 1 mov cr0, eax + ; Jump into PMode jmp 08h:DWORD .ProtectedMode-KERNEL_BASE [bits 32] .ProtectedMode: @@ -219,15 +231,15 @@ CallWithArgArray: [section .initpd] [global gaInitPageDir] [global gaInitPageTable] -align 0x1000 +align 4096 gaInitPageDir: dd gaInitPageTable-KERNEL_BASE+3 ; 0x000 - Low kernel - times 0x300-1 dd 0 + times 0x300-0x000-1 dd 0 dd gaInitPageTable-KERNEL_BASE+3 ; 0xC00 - High kernel times 0x3F0-0x300-1 dd 0 dd gaInitPageDir-KERNEL_BASE+3 ; 0xFC0 - Fractal times 0x400-0x3F0-1 dd 0 -align 0x1000 +align 4096 gaInitPageTable: %assign i 0 %rep 1024 @@ -235,7 +247,7 @@ gaInitPageTable: %assign i i+1 %endrep [global Kernel_Stack_Top] -ALIGN 0x1000 +ALIGN 4096 times 1024 dd 0 Kernel_Stack_Top: gInitAPStacks: