FreeBSD/sys/x86/x86/local_apic.c
/* Release an APIC vector when it's no longer in use. */
Release an APIC vector when it's no longer in use.
Release an APIC vector when it ' s no longer in use .
static void
native_apic_free_vector(u_int apic_id, u_int vector, u_int irq)
{
	struct thread *td;
	KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL &&
	    vector <= APIC_IO_INTS + APIC_NUM_IOINTS,
	    ("Vector %u does not map to an IRQ line", vector));
	KASSERT(irq < NUM_IO_INTS, ("Invalid IRQ %u", irq));
	KASSERT(lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] ==
	    irq, ("IRQ mismatch"));
#ifdef KDTRACE_HOOKS
	KASSERT(vector != IDT_DTRACE_RET,
	    ("Attempt to overwrite DTrace entry"));
#endif
	td = curthread;
	if (!rebooting) {
		thread_lock(td);
		if (sched_is_bound(td))
			panic("apic_free_vector: Thread already bound.\n");
		sched_bind(td, apic_cpuid(apic_id));
		thread_unlock(td);
	}
	mtx_lock_spin(&icu_lock);
	lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = -1;
	mtx_unlock_spin(&icu_lock);
	if (!rebooting) {
		thread_lock(td);
		sched_unbind(td);
		thread_unlock(td);
	}
}
static void native_apic_free_vector ( u_int apic_id , u_int vector , u_int irq ) { struct thread * td ; KASSERT ( vector >= APIC_IO_INTS && vector != IDT_SYSCALL && vector <= APIC_IO_INTS + APIC_NUM_IOINTS , ( " " , vector ) ) ; KASSERT ( irq < NUM_IO_INTS , ( " " , irq ) ) ; KASSERT ( lapics [ apic_id ] . la_ioint_irqs [ vector - APIC_IO_INTS ] == irq , ( " " ) ) ; #ifdef KDTRACE_HOOKS KASSERT ( vector != IDT_DTRACE_RET , ( " " ) ) ; #endif td = curthread ; if ( ! rebooting ) { thread_lock ( td ) ; if ( sched_is_bound ( td ) ) panic ( " \n " ) ; sched_bind ( td , apic_cpuid ( apic_id ) ) ; thread_unlock ( td ) ; } mtx_lock_spin ( & icu_lock ) ; lapics [ apic_id ] . la_ioint_irqs [ vector - APIC_IO_INTS ] = -1 ; mtx_unlock_spin ( & icu_lock ) ; if ( ! rebooting ) { thread_lock ( td ) ; sched_unbind ( td ) ; thread_unlock ( td ) ; } }
Release an APIC vector when it's no longer in use.
Release an APIC vector when it ' s no longer in use .
/*
	 * Bind us to the cpu that owned the vector before freeing it so
	 * we don't lose an interrupt delivery race.
	 */