PERFORCE change 100918 for review

John Birrell jb at FreeBSD.org
Fri Jul 7 18:53:56 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=100918

Change 100918 by jb at jb_freebsd2 on 2006/07/07 18:53:37

	Add system call trace support for the 'systrace' DTrace
	provider on sun4v.

Affected files ...

.. //depot/projects/dtrace/src/sys/sun4v/sun4v/trap.c#3 edit

Differences ...

==== //depot/projects/dtrace/src/sys/sun4v/sun4v/trap.c#3 (text+ko) ====

@@ -42,6 +42,7 @@
 
 #include "opt_ddb.h"
 #include "opt_ktr.h"
+#include "opt_kdtrace.h"
 #include "opt_ktrace.h"
 
 #include <sys/param.h>
@@ -92,6 +93,22 @@
 #include <machine/md_var.h>
 #include <machine/hypervisor_api.h>
 
+#ifdef KDTRACE
+#include <sys/cpuvar.h>
+#include <sparc64/dtrace.h>
+
+/*
+ * These are hooks which are  initialised by the dtrace module
+ * when it is loaded. This keeps the DTrace implementation
+ * opaque.
+ *
+ * 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;
+#endif
+
 void trap(struct trapframe *tf, int64_t type, uint64_t data);
 void syscall(struct trapframe *tf);
 
@@ -624,8 +641,33 @@
 
 		PTRACESTOP_SC(p, td, S_PT_SCE);
 
+#ifdef KDTRACE
+		/*
+		 * If the systrace module has registered it's probe
+		 * callback and if there is a probe active for the
+		 * syscall 'entry', process the probe.
+		 */
+		if (systrace_probe_func != NULL && callp->sy_entry != 0)
+			(*systrace_probe_func)(callp->sy_entry, code, callp,
+			    args);
+#endif
+
 		error = (*callp->sy_call)(td, argp);
 
+#ifdef KDTRACE
+		/* Save the error return variable for DTrace to reference. */
+		td->td_errno = error;
+
+		/*
+		 * If the systrace module has registered it's probe
+		 * callback and if there is a probe active for the
+		 * syscall 'return', process the probe.
+		 */
+		if (systrace_probe_func != NULL && callp->sy_return != 0)
+			(*systrace_probe_func)(callp->sy_return, code, callp,
+			    args);
+#endif
+
 		CTR5(KTR_SYSC, "syscall: p=%p error=%d %s return %#lx %#lx ", p,
 		    error, syscallnames[code], td->td_retval[0],
 		    td->td_retval[1]);


More information about the p4-projects mailing list