X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86_64%2Fstart32.asm;h=d38c993ee52f109bbdb2af49594bb001908902d3;hb=d710f435ed0d2b804ea82dba2dd122c4d6e5d08d;hp=86c90a571d99f21834e3b762a4cbf275ce3f31f8;hpb=37eb4d555b07704870b7dc87591d72b5b2539dec;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86_64/start32.asm b/Kernel/arch/x86_64/start32.asm index 86c90a57..d38c993e 100644 --- a/Kernel/arch/x86_64/start32.asm +++ b/Kernel/arch/x86_64/start32.asm @@ -1,3 +1,8 @@ +; +; Acess2 x86_64 port +; + +%include "arch/x86_64/include/common.inc.asm" [BITS 32] @@ -65,7 +70,7 @@ start: ; Enable paging mov eax, cr0 - or eax, 0x80000000 + or eax, 0x80010000 ; PG & WP mov cr0, eax ; Load GDT @@ -89,14 +94,15 @@ start: [section .data] [global gGDT] +[global gGDTPtr] gGDT: dd 0,0 dd 0x00000000, 0x00209A00 ; 0x08: 64-bit Code dd 0x00000000, 0x00009200 ; 0x10: 64-bit Data - dd 0x00000000, 0x0020FA00 ; 0x18: 64-bit User Code - dd 0x00000000, 0x0000F200 ; 0x20: 64-bit User Data - dd 0x00000000, 0x0040FA00 ; 0x38: 32-bit User Code - dd 0x00000000, 0x0040F200 ; 0x30: 32-bit User Data + dd 0x00000000, 0x0040FA00 ; 0x18: 32-bit User Code + dd 0x00000000, 0x0040F200 ; 0x20: User Data + dd 0x00000000, 0x0020FA00 ; 0x28: 64-bit User Code + dd 0x00000000, 0x0000F200 ; 0x30: User Data (64 version) times MAX_CPUS dd 0, 0x00008900, 0, 0 ; 0x38+16*n: TSS 0 gGDTPtr: dw $-gGDT-1 @@ -113,7 +119,9 @@ gMultibootPtr: [global gInitialPML4] gInitialPML4: ; Covers 256 TiB (Full 48-bit Virtual Address Space) dd gInitialPDP - KERNEL_BASE + 3, 0 ; Identity Map Low 4Mb - times 512-4-1 dq 0 + times 0xA0*2-1 dq 0 + dd gStackPDP - KERNEL_BASE + 3, 0 + times 512-4-($-gInitialPML4)/8 dq 0 dd gInitialPML4 - KERNEL_BASE + 3, 0 ; Fractal Mapping dq 0 dq 0 @@ -123,6 +131,10 @@ gInitialPDP: ; Covers 512 GiB dd gInitialPD - KERNEL_BASE + 3, 0 times 511 dq 0 +gStackPDP: + dd gStackPD - KERNEL_BASE + 3, 0 + times 511 dq 0 + gHighPDP: ; Covers 512 GiB times 510 dq 0 ;dq 0 + 0x143 ; 1 GiB Page from zero @@ -130,11 +142,25 @@ gHighPDP: ; Covers 512 GiB dq 0 gInitialPD: ; Covers 1 GiB +; dq 0 + 0x143 ; 1 GiB Page from zero dd gInitialPT1 - KERNEL_BASE + 3, 0 dd gInitialPT2 - KERNEL_BASE + 3, 0 times 510 dq 0 -gInitialPT1: ; Covers 2 MiB +gStackPD: + dd gKStackPT - KERNEL_BASE + 3, 0 + times 511 dq 0 + +gKStackPT: ; Covers 2 MiB + ; Initial stack - 64KiB + dq 0 + %assign i 0 + %rep INITIAL_KSTACK_SIZE-1 + dd gInitialKernelStack - KERNEL_BASE + i*0x1000 + 0x103, 0 + %assign i i+1 + %endrep + times 512-INITIAL_KSTACK_SIZE dq 0 +gInitialPT1: ; 2 MiB %assign i 0 %rep 512 dq i*4096+0x103 @@ -147,7 +173,13 @@ gInitialPT2: ; 2 MiB %assign i i+1 %endrep +[section .padata] +[global gInitialKernelStack] +gInitialKernelStack: + times 0x1000*(INITIAL_KSTACK_SIZE-1) db 0 ; 8 Pages [section .rodata] csNot64BitCapable: db "Not 64-bit Capable",0 + +; vim: ft=nasm