X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86_64%2Fstart64.asm;h=33c77d6277330dd39eac664662595542802c6c27;hb=e6d539f85a06fb3d25b985d1a27d8648d23736f0;hp=699c79319398a45b7c3e0b0f1df0bb3bd9076e43;hpb=f186a44f826d17786b464b2fcdc7b88b3c55876a;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86_64/start64.asm b/Kernel/arch/x86_64/start64.asm index 699c7931..33c77d62 100644 --- a/Kernel/arch/x86_64/start64.asm +++ b/Kernel/arch/x86_64/start64.asm @@ -2,6 +2,12 @@ ; Acess2 x86_64 Port ; [bits 64] +KERNEL_BASE equ 0xFFFF800000000000 + +[extern kmain] + +[extern gMultibootPtr] +[extern gMultibootMagic] [section .text] [global start64] @@ -28,6 +34,10 @@ start64: mov rsp, gInitialKernelStack ; Call main + mov edi, [gMultibootMagic - KERNEL_BASE] + mov esi, [gMultibootPtr - KERNEL_BASE] + call kmain + cli .hlt: hlt @@ -40,10 +50,10 @@ GetRIP: [global GetCPUNum] GetCPUNum: - str ax - mov gs, ax xor rax, rax - mov al, [gs:104] ; End of TSS + str ax + sub ax, 0x38 ; TSS Base + shr ax, 4 ; One 16-byte TSS per CPU ret KSTACK_USERSTATE_SIZE equ (16+1+5)*8 ; GPRegs, CPU, IRET @@ -117,6 +127,6 @@ User_Syscall_Exit: [section .bss] [global gInitialKernelStack] - resd 1024*1 ; 1 Page + resd 1024*4 ; 4 Pages gInitialKernelStack: