summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/boot/apboot.asm
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-11-17 21:15:55 -0500
committerIan Moffett <ian@osmora.org>2025-11-17 21:15:55 -0500
commita9d1f332d91a801ff04e2b9f2475d733b2898134 (patch)
tree9e9d7269831db7e15f5a3e00ddad53208e7fd9e8 /sys/arch/amd64/boot/apboot.asm
parent36c81aeaef9c633f80374f9107d3c0116b0cafdb (diff)
kern/amd64: mp: Make AP bring up more stable
- Move BUDA to 0x9000 - Move the BUA to 0x8000 - Serialize bring up with is_booted flag - Map whole 2 megs of lower address space Signed-off-by: Ian Moffett <ian@osmora.org>
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