summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/boot/apboot.asm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/amd64/boot/apboot.asm')
-rw-r--r--sys/arch/amd64/boot/apboot.asm12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/arch/amd64/boot/apboot.asm b/sys/arch/amd64/boot/apboot.asm
index 8c16319..1bae9aa 100644
--- a/sys/arch/amd64/boot/apboot.asm
+++ b/sys/arch/amd64/boot/apboot.asm
@@ -28,9 +28,9 @@
;;
[bits 16]
-[org 0x1000]
+[org 0x8000]
-%define AP_BUDA 0x3000
+%define AP_BUDA 0x9000
%define IA32_EFER 0xC0000080
[bits 16]
@@ -39,13 +39,13 @@ _start:
out 0x21, al ;; Disable master PIC
out 0xA1, al ;; Disable slave PIC
- mov eax, dword [AP_BUDA] ;; BUDA.CR3 -> EAX
- mov cr3, eax ;; EAX -> CR3
-
mov eax, cr4 ;; CR4 -> EAX
or eax, 0xA0 ;; Enable physical address extension + PGE
mov cr4, eax ;; Write it back
+ mov eax, dword [AP_BUDA] ;; BUDA.CR3 -> EAX
+ mov cr3, eax ;; EAX -> CR3
+
mov ecx, IA32_EFER ;; Read IA32_EFER
rdmsr ;; -> EAX
or eax, 0xD00 ;; Set EFER.LME + defaults
@@ -80,6 +80,8 @@ thunk64:
mov gs, ax
mov rsp, qword [AP_BUDA + 0x08]
mov rbx, qword [AP_BUDA + 0x10]
+ mov rax, 1
+ xchg qword [AP_BUDA + 0x18], rax
cld
jmp rbx