X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86_64%2Fstart64.asm;h=d0cc503fc1cbf8a2760aa85b4aad65987667bab3;hb=18b264927674c480481466c40368554fb72f560f;hp=9302c0522fdacedb6eb0305b7b1d32c3ee0a1c56;hpb=eecce4b7a55315f6c385ad8be35c25dbb12d43d8;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86_64/start64.asm b/Kernel/arch/x86_64/start64.asm index 9302c052..d0cc503f 100644 --- a/Kernel/arch/x86_64/start64.asm +++ b/Kernel/arch/x86_64/start64.asm @@ -2,9 +2,14 @@ ; Acess2 x86_64 Port ; [bits 64] +;KERNEL_BASE equ 0xFFFF800000000000 +KERNEL_BASE equ 0xFFFFFFFF80000000 [extern kmain] +[extern gMultibootPtr] +[extern gMultibootMagic] + [section .text] [global start64] start64: @@ -20,6 +25,9 @@ start64: jmp rax .himem: + xor rax, rax + mov dr0, rax ; Set CPU0 + ; Clear the screen mov rax, 0x1F201F201F201F20 ; Set the screen to White on blue, space (4 characters) mov edi, 0xB8000 @@ -30,6 +38,8 @@ start64: mov rsp, gInitialKernelStack ; Call main + mov edi, [gMultibootMagic - KERNEL_BASE] + mov esi, [gMultibootPtr - KERNEL_BASE] call kmain cli @@ -44,10 +54,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