From a9d1f332d91a801ff04e2b9f2475d733b2898134 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 17 Nov 2025 21:15:55 -0500 Subject: 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 --- sys/arch/amd64/boot/apboot.asm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sys/arch/amd64/boot/apboot.asm') 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 -- cgit v1.2.3