Author: rpaulo
Date: Sat Aug 28 08:03:29 2010
New Revision: 211924
URL: http://svn.freebsd.org/changeset/base/211924

Log:
  Register an interrupt vector for DTrace return probes. There is some
  code missing in lapic to make sure that we don't overwrite this entry,
  but this will be done on a sequent commit.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/amd64/amd64/exception.S
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/include/segments.h
  head/sys/i386/i386/exception.s
  head/sys/i386/i386/machdep.c
  head/sys/i386/include/segments.h

Modified: head/sys/amd64/amd64/exception.S
==============================================================================
--- head/sys/amd64/amd64/exception.S    Sat Aug 28 07:58:10 2010        
(r211923)
+++ head/sys/amd64/amd64/exception.S    Sat Aug 28 08:03:29 2010        
(r211924)
@@ -108,6 +108,10 @@ IDTVEC(dbg)
        TRAP_NOEN(T_TRCTRAP)
 IDTVEC(bpt)
        TRAP_NOEN(T_BPTFLT)
+#ifdef KDTRACE_HOOKS
+IDTVEC(dtrace_ret)
+       TRAP_NOEN(T_DTRACE_RET)
+#endif
 
 /* Regular traps; The cpu does not supply tf_err for these. */
 #define        TRAP(a)  \

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c      Sat Aug 28 07:58:10 2010        
(r211923)
+++ head/sys/amd64/amd64/machdep.c      Sat Aug 28 08:03:29 2010        
(r211924)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_msgbuf.h"
 #include "opt_perfmon.h"
 #include "opt_sched.h"
+#include "opt_kdtrace.h"
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -1089,6 +1090,9 @@ extern inthand_t
        IDTVEC(tss), IDTVEC(missing), IDTVEC(stk), IDTVEC(prot),
        IDTVEC(page), IDTVEC(mchk), IDTVEC(rsvd), IDTVEC(fpu), IDTVEC(align),
        IDTVEC(xmm), IDTVEC(dblfault),
+#ifdef KDTRACE_HOOKS
+       IDTVEC(dtrace_ret),
+#endif
        IDTVEC(fast_syscall), IDTVEC(fast_syscall32);
 
 #ifdef DDB
@@ -1617,6 +1621,9 @@ hammer_time(u_int64_t modulep, u_int64_t
        setidt(IDT_AC, &IDTVEC(align), SDT_SYSIGT, SEL_KPL, 0);
        setidt(IDT_MC, &IDTVEC(mchk),  SDT_SYSIGT, SEL_KPL, 0);
        setidt(IDT_XF, &IDTVEC(xmm), SDT_SYSIGT, SEL_KPL, 0);
+#ifdef KDTRACE_HOOKS
+       setidt(IDT_DTRACE_RET, &IDTVEC(dtrace_ret), SDT_SYSIGT, SEL_UPL, 0);
+#endif
 
        r_idt.rd_limit = sizeof(idt0) - 1;
        r_idt.rd_base = (long) idt;

Modified: head/sys/amd64/include/segments.h
==============================================================================
--- head/sys/amd64/include/segments.h   Sat Aug 28 07:58:10 2010        
(r211923)
+++ head/sys/amd64/include/segments.h   Sat Aug 28 08:03:29 2010        
(r211924)
@@ -214,6 +214,7 @@ struct region_descriptor {
 #define        IDT_XF          19      /* #XF: SIMD Floating-Point Exception */
 #define        IDT_IO_INTS     NRSVIDT /* Base of IDT entries for I/O 
interrupts. */
 #define        IDT_SYSCALL     0x80    /* System Call Interrupt Vector */
+#define        IDT_DTRACE_RET  0x92    /* DTrace pid provider Interrupt Vector 
*/
 
 /*
  * Entries in the Global Descriptor Table (GDT)

Modified: head/sys/i386/i386/exception.s
==============================================================================
--- head/sys/i386/i386/exception.s      Sat Aug 28 07:58:10 2010        
(r211923)
+++ head/sys/i386/i386/exception.s      Sat Aug 28 08:03:29 2010        
(r211924)
@@ -108,6 +108,8 @@ IDTVEC(nmi)
        pushl $0; TRAP(T_NMI)
 IDTVEC(bpt)
        pushl $0; TRAP(T_BPTFLT)
+IDTVEC(dtrace_ret)
+       pushl $0; TRAP(T_DTRACE_RET)
 IDTVEC(ofl)
        pushl $0; TRAP(T_OFLOW)
 IDTVEC(bnd)

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c        Sat Aug 28 07:58:10 2010        
(r211923)
+++ head/sys/i386/i386/machdep.c        Sat Aug 28 08:03:29 2010        
(r211924)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_npx.h"
 #include "opt_perfmon.h"
 #include "opt_xbox.h"
+#include "opt_kdtrace.h"
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -1876,7 +1877,11 @@ extern inthand_t
        IDTVEC(bnd), IDTVEC(ill), IDTVEC(dna), IDTVEC(fpusegm),
        IDTVEC(tss), IDTVEC(missing), IDTVEC(stk), IDTVEC(prot),
        IDTVEC(page), IDTVEC(mchk), IDTVEC(rsvd), IDTVEC(fpu), IDTVEC(align),
-       IDTVEC(xmm), IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall);
+       IDTVEC(xmm),
+#ifdef KDTRACE_HOOKS
+       IDTVEC(dtrace_ret),
+#endif
+       IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall);
 
 #ifdef DDB
 /*
@@ -2825,6 +2830,10 @@ init386(first)
            GSEL(GCODE_SEL, SEL_KPL));
        setidt(IDT_SYSCALL, &IDTVEC(int0x80_syscall), SDT_SYS386TGT, SEL_UPL,
            GSEL(GCODE_SEL, SEL_KPL));
+#ifdef KDTRACE_HOOKS
+       setidt(IDT_DTRACE_RET, &IDTVEC(dtrace_ret), SDT_SYS386TGT, SEL_UPL,
+           GSEL(GCODE_SEL, SEL_KPL));
+#endif
 
        r_idt.rd_limit = sizeof(idt0) - 1;
        r_idt.rd_base = (int) idt;

Modified: head/sys/i386/include/segments.h
==============================================================================
--- head/sys/i386/include/segments.h    Sat Aug 28 07:58:10 2010        
(r211923)
+++ head/sys/i386/include/segments.h    Sat Aug 28 08:03:29 2010        
(r211924)
@@ -207,6 +207,7 @@ struct region_descriptor {
 #define        IDT_XF          19      /* #XF: SIMD Floating-Point Exception */
 #define        IDT_IO_INTS     NRSVIDT /* Base of IDT entries for I/O 
interrupts. */
 #define        IDT_SYSCALL     0x80    /* System Call Interrupt Vector */
+#define        IDT_DTRACE_RET  0x92    /* DTrace pid provider Interrupt Vector 
*/
 
 /*
  * Entries in the Global Descriptor Table (GDT)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to