FreeBSD/sys/x86/x86/local_apic.c
/*
 * Create a local APIC instance.
 */
Create a local APIC instance.
Create a local APIC instance .
static void
native_lapic_create(u_int apic_id, int boot_cpu)
{
	int i;
	if (apic_id > MAX_APIC_ID) {
		printf("APIC: Ignoring local APIC with ID %d\n", apic_id);
		if (boot_cpu)
			panic("Can't ignore BSP");
		return;
	}
	KASSERT(!lapics[apic_id].la_present, ("duplicate local APIC %u",
	    apic_id));
	lapics[apic_id].la_present = 1;
	lapics[apic_id].la_id = apic_id;
	for (i = 0; i <= APIC_LVT_MAX; i++) {
		lapics[apic_id].la_lvts[i] = lvts[i];
		lapics[apic_id].la_lvts[i].lvt_active = 0;
	}
	for (i = 0; i <= APIC_NUM_IOINTS; i++)
	    lapics[apic_id].la_ioint_irqs[i] = -1;
	lapics[apic_id].la_ioint_irqs[IDT_SYSCALL - APIC_IO_INTS] = IRQ_SYSCALL;
	lapics[apic_id].la_ioint_irqs[APIC_TIMER_INT - APIC_IO_INTS] =
	    IRQ_TIMER;
#ifdef KDTRACE_HOOKS
	lapics[apic_id].la_ioint_irqs[IDT_DTRACE_RET - APIC_IO_INTS] =
	    IRQ_DTRACE_RET;
#endif
#ifdef XENHVM
	lapics[apic_id].la_ioint_irqs[IDT_EVTCHN - APIC_IO_INTS] = IRQ_EVTCHN;
#endif
#ifdef SMP
	cpu_add(apic_id, boot_cpu);
#endif
}
static void native_lapic_create ( u_int apic_id , int boot_cpu ) { int i ; if ( apic_id > MAX_APIC_ID ) { printf ( " \n " , apic_id ) ; if ( boot_cpu ) panic ( " " ) ; return ; } KASSERT ( ! lapics [ apic_id ] . la_present , ( " " , apic_id ) ) ; lapics [ apic_id ] . la_present = 1 ; lapics [ apic_id ] . la_id = apic_id ; for ( i = 0 ; i <= APIC_LVT_MAX ; i ++ ) { lapics [ apic_id ] . la_lvts [ i ] = lvts [ i ] ; lapics [ apic_id ] . la_lvts [ i ] . lvt_active = 0 ; } for ( i = 0 ; i <= APIC_NUM_IOINTS ; i ++ ) lapics [ apic_id ] . la_ioint_irqs [ i ] = -1 ; lapics [ apic_id ] . la_ioint_irqs [ IDT_SYSCALL - APIC_IO_INTS ] = IRQ_SYSCALL ; lapics [ apic_id ] . la_ioint_irqs [ APIC_TIMER_INT - APIC_IO_INTS ] = IRQ_TIMER ; #ifdef KDTRACE_HOOKS lapics [ apic_id ] . la_ioint_irqs [ IDT_DTRACE_RET - APIC_IO_INTS ] = IRQ_DTRACE_RET ; #endif #ifdef XENHVM lapics [ apic_id ] . la_ioint_irqs [ IDT_EVTCHN - APIC_IO_INTS ] = IRQ_EVTCHN ; #endif #ifdef SMP cpu_add ( apic_id , boot_cpu ) ; #endif }
Create a local APIC instance.
Create a local APIC instance .
/*
	 * Assume no local LVT overrides and a cluster of 0 and
	 * intra-cluster ID of 0.
	 */