From e37594f2bf23d2c02e201452fc2911453e5f21b7 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 9 Feb 2024 00:43:11 +0100 Subject: SMP: Fix allocating the apboot page vm_page_grab_contig does not necessarily allocate at the beginning of the DMA segment, so rather allocate by hand very early. --- i386/i386at/biosmem.c | 9 +++++++++ i386/i386at/model_dep.c | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/i386/i386at/biosmem.c b/i386/i386at/biosmem.c index 03736af3..937c0e3d 100644 --- a/i386/i386at/biosmem.c +++ b/i386/i386at/biosmem.c @@ -689,6 +689,15 @@ biosmem_bootstrap_common(void) if (error) boot_panic(biosmem_panic_noseg_msg); +#if !defined(MACH_HYP) && NCPUS > 1 + /* + * Grab an early page for AP boot code which needs to be below 1MB. + */ + assert (phys_start < 0x100000); + apboot_addr = phys_start; + phys_start += PAGE_SIZE; +#endif + biosmem_set_segment(VM_PAGE_SEG_DMA, phys_start, phys_end); phys_start = VM_PAGE_DMA_LIMIT; diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index 789271fd..a8f9b866 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -216,14 +216,6 @@ void machine_init(void) #endif #ifdef APIC - /* - * Grab an early page for AP boot code - */ - /* FIXME: this may not allocate from below 1MB, if within first 16MB */ - apboot_addr = vm_page_to_pa(vm_page_grab_contig(PAGE_SIZE, VM_PAGE_SEL_DMA)); - apboot_addr = 0x3000; - assert (apboot_addr < 0x100000); - /* * Patch the realmode gdt with the correct offset and the first jmp to * protected mode with the correct target. -- cgit v1.2.3