Index: sys/amd64/amd64/mp_machdep.c =================================================================== --- sys/amd64/amd64/mp_machdep.c +++ sys/amd64/amd64/mp_machdep.c @@ -274,7 +274,7 @@ lgdt(&ap_gdt); /* does magic intra-segment return */ /* Get per-cpu data */ - pc = &__pcpu[cpu]; + pc = bootPC; /* prime data page for it to use */ pcpu_init(pc, cpu, sizeof(struct pcpu)); @@ -355,6 +355,7 @@ u_int32_t mpbioswarmvec; int apic_id, cpu, i; u_char mpbiosreason; + struct pcpu *pc; mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); @@ -395,6 +396,7 @@ /* start each AP */ for (cpu = 1; cpu < mp_ncpus; cpu++) { apic_id = cpu_apic_ids[cpu]; + pc = &__pcpu[cpu]; /* allocate and set up an idle stack data page */ bootstacks[cpu] = (void *)kmem_malloc(kernel_arena, @@ -407,11 +409,16 @@ M_WAITOK | M_ZERO); dbg_stack = (char *)kmem_malloc(kernel_arena, PAGE_SIZE, M_WAITOK | M_ZERO); - dpcpu = (void *)kmem_malloc(kernel_arena, DPCPU_SIZE, - M_WAITOK | M_ZERO); + dpcpu = (void *)kmem_malloc_domain(kernel_arena, pc->pc_domain, + DPCPU_SIZE, M_WAITOK | M_ZERO); bootSTK = (char *)bootstacks[cpu] + kstack_pages * PAGE_SIZE - 8; bootAP = cpu; + bootPC = pc; + if (pc->pc_domain) { + bootPC = (void*)kmem_malloc_domain(kernel_arena, pc->pc_domain, sizeof(struct pcpu), M_WAITOK); + memcpy(bootPC, pc, sizeof(struct pcpu)); + } /* attempt to start the Application Processor */ if (!start_ap(apic_id)) { Index: sys/x86/include/x86_smp.h =================================================================== --- sys/x86/include/x86_smp.h +++ sys/x86/include/x86_smp.h @@ -29,6 +29,7 @@ extern struct pcb stoppcbs[]; extern int cpu_apic_ids[]; extern int bootAP; +extern struct pcpu *bootPC; extern void *dpcpu; extern char *bootSTK; extern void *bootstacks[]; Index: sys/x86/x86/mp_x86.c =================================================================== --- sys/x86/x86/mp_x86.c +++ sys/x86/x86/mp_x86.c @@ -85,6 +85,7 @@ /* AP uses this during bootstrap. Do not staticize. */ char *bootSTK; int bootAP; +struct pcpu *bootPC; /* Free these after use */ void *bootstacks[MAXCPU];