summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/amd64/trap.c22
-rw-r--r--sys/i386/i386/trap.c22
-rw-r--r--sys/kern/kern_dtrace.c9
-rw-r--r--sys/mips/mips/trap.c22
-rw-r--r--sys/powerpc/aim/trap.c21
-rw-r--r--sys/sys/dtrace_bsd.h8
6 files changed, 14 insertions, 90 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 1077d48..a57f42e 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -96,28 +96,6 @@ PMC_SOFT_DEFINE( , , page_fault, write);
#ifdef KDTRACE_HOOKS
#include <sys/dtrace_bsd.h>
-
-/*
- * This is a hook which is initialised by the dtrace module
- * to handle traps which might occur during DTrace probe
- * execution.
- */
-dtrace_trap_func_t dtrace_trap_func;
-
-dtrace_doubletrap_func_t dtrace_doubletrap_func;
-
-/*
- * This is a hook which is initialised by the systrace module
- * when it is loaded. This keeps the DTrace syscall provider
- * implementation opaque.
- */
-systrace_probe_func_t systrace_probe_func;
-
-/*
- * These hooks are necessary for the pid and usdt providers.
- */
-dtrace_pid_probe_ptr_t dtrace_pid_probe_ptr;
-dtrace_return_probe_ptr_t dtrace_return_probe_ptr;
#endif
extern void trap(struct trapframe *frame);
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index 7b9ce8c..e654fe0 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -105,28 +105,6 @@ PMC_SOFT_DEFINE( , , page_fault, write);
#ifdef KDTRACE_HOOKS
#include <sys/dtrace_bsd.h>
-
-/*
- * This is a hook which is initialised by the dtrace module
- * to handle traps which might occur during DTrace probe
- * execution.
- */
-dtrace_trap_func_t dtrace_trap_func;
-
-dtrace_doubletrap_func_t dtrace_doubletrap_func;
-
-/*
- * This is a hook which is initialised by the systrace module
- * when it is loaded. This keeps the DTrace syscall provider
- * implementation opaque.
- */
-systrace_probe_func_t systrace_probe_func;
-
-/*
- * These hooks are necessary for the pid and usdt providers.
- */
-dtrace_pid_probe_ptr_t dtrace_pid_probe_ptr;
-dtrace_return_probe_ptr_t dtrace_return_probe_ptr;
#endif
extern void trap(struct trapframe *frame);
diff --git a/sys/kern/kern_dtrace.c b/sys/kern/kern_dtrace.c
index 5582fb9..f5f14b7 100644
--- a/sys/kern/kern_dtrace.c
+++ b/sys/kern/kern_dtrace.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/dtrace_bsd.h>
#include <sys/sysctl.h>
+#include <sys/sysent.h>
#define KDTRACE_PROC_SIZE 64
#define KDTRACE_THREAD_SIZE 256
@@ -47,6 +48,14 @@ FEATURE(kdtrace_hooks,
static MALLOC_DEFINE(M_KDTRACE, "kdtrace", "DTrace hooks");
+/* Hooks used in the machine-dependent trap handlers. */
+dtrace_trap_func_t dtrace_trap_func;
+dtrace_doubletrap_func_t dtrace_doubletrap_func;
+dtrace_pid_probe_ptr_t dtrace_pid_probe_ptr;
+dtrace_return_probe_ptr_t dtrace_return_probe_ptr;
+
+systrace_probe_func_t systrace_probe_func;
+
/* Return the DTrace process data size compiled in the kernel hooks. */
size_t
kdtrace_proc_size()
diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c
index 9e1f9b8..eaa7fb4 100644
--- a/sys/mips/mips/trap.c
+++ b/sys/mips/mips/trap.c
@@ -94,28 +94,6 @@ __FBSDID("$FreeBSD$");
#ifdef KDTRACE_HOOKS
#include <sys/dtrace_bsd.h>
-
-/*
- * This is a hook which is initialised by the dtrace module
- * to handle traps which might occur during DTrace probe
- * execution.
- */
-dtrace_trap_func_t dtrace_trap_func;
-
-dtrace_doubletrap_func_t dtrace_doubletrap_func;
-
-/*
- * This is a hook which is initialised by the systrace module
- * when it is loaded. This keeps the DTrace syscall provider
- * implementation opaque.
- */
-systrace_probe_func_t systrace_probe_func;
-
-/*
- * These hooks are necessary for the pid and usdt providers.
- */
-dtrace_pid_probe_ptr_t dtrace_pid_probe_ptr;
-dtrace_return_probe_ptr_t dtrace_return_probe_ptr;
#endif
#ifdef TRAP_DEBUG
diff --git a/sys/powerpc/aim/trap.c b/sys/powerpc/aim/trap.c
index 055603c..73944d1 100644
--- a/sys/powerpc/aim/trap.c
+++ b/sys/powerpc/aim/trap.c
@@ -97,27 +97,6 @@ struct powerpc_exception {
#ifdef KDTRACE_HOOKS
#include <sys/dtrace_bsd.h>
-/*
- * This is a hook which is initialised by the dtrace module
- * to handle traps which might occur during DTrace probe
- * execution.
- */
-dtrace_trap_func_t dtrace_trap_func;
-
-dtrace_doubletrap_func_t dtrace_doubletrap_func;
-
-/*
- * This is a hook which is initialised by the systrace module
- * when it is loaded. This keeps the DTrace syscall provider
- * implementation opaque.
- */
-systrace_probe_func_t systrace_probe_func;
-
-/*
- * These hooks are necessary for the pid and usdt providers.
- */
-dtrace_pid_probe_ptr_t dtrace_pid_probe_ptr;
-dtrace_return_probe_ptr_t dtrace_return_probe_ptr;
int (*dtrace_invop_jump_addr)(struct trapframe *);
#endif
diff --git a/sys/sys/dtrace_bsd.h b/sys/sys/dtrace_bsd.h
index fa54d7e..de74fda 100644
--- a/sys/sys/dtrace_bsd.h
+++ b/sys/sys/dtrace_bsd.h
@@ -61,11 +61,13 @@ int dtrace_trap(struct trapframe *, u_int);
extern dtrace_trap_func_t dtrace_trap_func;
-/* Used by the machine dependent trap() code. */
+/*
+ * A hook which removes active FBT probes before executing the double fault
+ * handler. We want to ensure that DTrace doesn't trigger another trap, which
+ * would result in a reset.
+ */
typedef int (*dtrace_invop_func_t)(uintptr_t, uintptr_t *, uintptr_t);
typedef void (*dtrace_doubletrap_func_t)(void);
-
-/* Global variables in trap.c */
extern dtrace_invop_func_t dtrace_invop_func;
extern dtrace_doubletrap_func_t dtrace_doubletrap_func;
OpenPOWER on IntegriCloud