FreeBSD/sys/x86/x86/mp_x86.c
/*
 * Add a logical CPU to the topology.
 */
Add a logical CPU to the topology.
Add a logical CPU to the topology .
void
cpu_add(u_int apic_id, char boot_cpu)
{
	if (apic_id > MAX_APIC_ID) {
		panic("SMP: APIC ID %d too high", apic_id);
		return;
	}
	KASSERT(cpu_info[apic_id].cpu_present == 0, ("CPU %d added twice",
	    apic_id));
	cpu_info[apic_id].cpu_present = 1;
	if (boot_cpu) {
		KASSERT(boot_cpu_id == -1,
		    ("CPU %d claims to be BSP, but CPU %d already is", apic_id,
		    boot_cpu_id));
		boot_cpu_id = apic_id;
		cpu_info[apic_id].cpu_bsp = 1;
	}
	if (mp_ncpus < MAXCPU) {
		mp_ncpus++;
		mp_maxid = mp_ncpus - 1;
	}
	if (bootverbose)
		printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" :
		    "AP");
}
void cpu_add ( u_int apic_id , char boot_cpu ) { if ( apic_id > MAX_APIC_ID ) { panic ( " " , apic_id ) ; return ; } KASSERT ( cpu_info [ apic_id ] . cpu_present == 0 , ( " " , apic_id ) ) ; cpu_info [ apic_id ] . cpu_present = 1 ; if ( boot_cpu ) { KASSERT ( boot_cpu_id == -1 , ( " " , apic_id , boot_cpu_id ) ) ; boot_cpu_id = apic_id ; cpu_info [ apic_id ] . cpu_bsp = 1 ; } if ( mp_ncpus < MAXCPU ) { mp_ncpus ++ ; mp_maxid = mp_ncpus - 1 ; } if ( bootverbose ) printf ( " \n " , apic_id , boot_cpu ? " " : " " ) ; }
Add a logical CPU to the topology.
Add a logical CPU to the topology .