From owner-svn-src-head@FreeBSD.ORG Mon Aug 30 18:12:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A5A61065670; Mon, 30 Aug 2010 18:12:21 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 500618FC17; Mon, 30 Aug 2010 18:12:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UICLtq002930; Mon, 30 Aug 2010 18:12:21 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UICLsq002928; Mon, 30 Aug 2010 18:12:21 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201008301812.o7UICLsq002928@svn.freebsd.org> From: Rui Paulo Date: Mon, 30 Aug 2010 18:12:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212004 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 18:12:21 -0000 Author: rpaulo Date: Mon Aug 30 18:12:21 2010 New Revision: 212004 URL: http://svn.freebsd.org/changeset/base/212004 Log: 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 Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Mon Aug 30 17:34:59 2010 (r212003) +++ head/sys/x86/x86/local_apic.c Mon Aug 30 18:12:21 2010 (r212004) @@ -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 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 { 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 ve 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 vec 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");