When DTrace is enabled, make sure we don't overwrite the IDT_DTRACE_RET
entry with an IRQ for some hardware component. Reviewed by: jhb Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
de478dd4b4
commit
400dda6646
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212004
@ -89,6 +89,7 @@ CTASSERT(IPI_STOP < APIC_SPURIOUS_INT);
|
||||
/* Magic IRQ values for the timer and syscalls. */
|
||||
#define IRQ_TIMER (NUM_IO_INTS + 1)
|
||||
#define IRQ_SYSCALL (NUM_IO_INTS + 2)
|
||||
#define IRQ_DTRACE_RET (NUM_IO_INTS + 3)
|
||||
|
||||
/*
|
||||
* Support for local APICs. Local APICs manage interrupts on each
|
||||
@ -307,6 +308,10 @@ lapic_create(u_int apic_id, int boot_cpu)
|
||||
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 SMP
|
||||
cpu_add(apic_id, boot_cpu);
|
||||
@ -1028,6 +1033,10 @@ apic_enable_vector(u_int apic_id, u_int vector)
|
||||
KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry"));
|
||||
KASSERT(ioint_handlers[vector / 32] != NULL,
|
||||
("No ISR handler for vector %u", vector));
|
||||
#ifdef KDTRACE_HOOKS
|
||||
KASSERT(vector != IDT_DTRACE_RET,
|
||||
("Attempt to overwrite DTrace entry"));
|
||||
#endif
|
||||
setidt(vector, ioint_handlers[vector / 32], SDT_APIC, SEL_KPL,
|
||||
GSEL_APIC);
|
||||
}
|
||||
@ -1037,6 +1046,10 @@ apic_disable_vector(u_int apic_id, u_int vector)
|
||||
{
|
||||
|
||||
KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry"));
|
||||
#ifdef KDTRACE_HOOKS
|
||||
KASSERT(vector != IDT_DTRACE_RET,
|
||||
("Attempt to overwrite DTrace entry"));
|
||||
#endif
|
||||
KASSERT(ioint_handlers[vector / 32] != NULL,
|
||||
("No ISR handler for vector %u", vector));
|
||||
#ifdef notyet
|
||||
@ -1060,6 +1073,10 @@ apic_free_vector(u_int apic_id, u_int vector, u_int irq)
|
||||
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
|
||||
|
||||
/*
|
||||
* Bind us to the cpu that owned the vector before freeing it so
|
||||
@ -1092,6 +1109,10 @@ apic_idt_to_irq(u_int apic_id, u_int vector)
|
||||
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));
|
||||
#ifdef KDTRACE_HOOKS
|
||||
KASSERT(vector != IDT_DTRACE_RET,
|
||||
("Attempt to overwrite DTrace entry"));
|
||||
#endif
|
||||
irq = lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS];
|
||||
if (irq < 0)
|
||||
irq = 0;
|
||||
@ -1123,6 +1144,10 @@ DB_SHOW_COMMAND(apic, db_show_apic)
|
||||
irq = lapics[apic_id].la_ioint_irqs[i];
|
||||
if (irq == -1 || irq == IRQ_SYSCALL)
|
||||
continue;
|
||||
#ifdef KDTRACE_HOOKS
|
||||
if (irq == IRQ_DTRACE_RET)
|
||||
continue;
|
||||
#endif
|
||||
db_printf("vec 0x%2x -> ", i + APIC_IO_INTS);
|
||||
if (irq == IRQ_TIMER)
|
||||
db_printf("lapic timer\n");
|
||||
|
Loading…
Reference in New Issue
Block a user