Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Jan 2008 22:41:15 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 132593 for review
Message-ID:  <200801052241.m05MfF3l042966@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132593

Change 132593 by jb@jb_freebsd1 on 2008/01/05 22:41:03

	Rough update to the current design. It compiles and links.
	
	WIP.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/dev/fbt/fbt.c#5 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/dev/fbt/fbt.c#5 (text+ko) ====

@@ -18,7 +18,7 @@
  *
  * CDDL HEADER END
  *
- * Portions Copyright 2006 John Birrell jb@freebsd.org
+ * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
  *
  * $FreeBSD$
  *
@@ -32,7 +32,6 @@
 #include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/bus.h>
 #include <sys/conf.h>
 #include <sys/cpuvar.h>
 #include <sys/fcntl.h>
@@ -60,7 +59,7 @@
 #include <sys/unistd.h>
 #include <machine/stdarg.h>
 
-#include <contrib/opensolaris/uts/common/sys/dtrace_impl.h>
+#include <sys/dtrace.h>
 
 MALLOC_DECLARE(M_FBT);
 MALLOC_DEFINE(M_FBT, "fbt", "Function Boundary Tracing");
@@ -168,7 +167,7 @@
 static int
 fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval)
 {
-	struct pcpu *cpu = pcpu_find(curcpu);
+	solaris_cpu_t *cpu = &solaris_cpu[curcpu];
 	uintptr_t stack0, stack1, stack2, stack3, stack4;
 	fbt_probe_t *fbt = fbt_probetab[FBT_ADDR2NDX(addr)];
 
@@ -185,7 +184,7 @@
 				 * disabled.
 				 */
 				DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
-				cpu->pc_dtrace_caller = stack[i++];
+				cpu->cpu_dtrace_caller = stack[i++];
 				stack0 = stack[i++];
 				stack1 = stack[i++];
 				stack2 = stack[i++];
@@ -197,11 +196,11 @@
 				dtrace_probe(fbt->fbtp_id, stack0, stack1,
 				    stack2, stack3, stack4);
 
-				cpu->pc_dtrace_caller = 0;
+				cpu->cpu_dtrace_caller = 0;
 			} else {
 				dtrace_probe(fbt->fbtp_id, fbt->fbtp_roffset,
 				    rval, 0, 0, 0);
-				cpu->pc_dtrace_caller = 0;
+				cpu->cpu_dtrace_caller = 0;
 			}
 
 			return (fbt->fbtp_rval);
@@ -232,6 +231,7 @@
 		return (0);
 	}
 
+#ifdef DOODAD
 	/*
 	 * Still trying to narrow down why some of these things are
 	 * being called from the probe context. At the moment I suspect
@@ -269,6 +269,7 @@
 	    strncmp(name, "spinlock", 8) == 0 ||
 	    strcmp(name, "pcpu_find") == 0)	/* used in stack() impl */
 		return (0);
+#endif
 
 	/*
 	 * These filters are set by sysctl to help debugging the initial
@@ -595,6 +596,10 @@
 static void
 fbt_load(void *dummy)
 {
+	/* Create the /dev/dtrace/fbt entry. */
+	fbt_cdev = make_dev(&fbt_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
+	    "dtrace/fbt");
+
 	/* Default the probe table size if not specified. */
 	if (fbt_probetab_size == 0)
 		fbt_probetab_size = FBT_PROBETAB_SIZE;
@@ -644,13 +649,9 @@
 
 	switch (type) {
 	case MOD_LOAD:
-		/* Create the /dev/dtrace/fbt entry. */
-		fbt_cdev = make_dev(&fbt_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
-		    "dtrace/fbt");
 		break;
 
 	case MOD_UNLOAD:
-		error = fbt_unload();
 		break;
 
 	case MOD_SHUTDOWN:
@@ -672,8 +673,10 @@
 	return (0);
 }
 
-SYSINIT(fbt_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, fbt_load, NULL)
+SYSINIT(fbt_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, fbt_load, NULL);
+SYSUNINIT(fbt_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, fbt_unload, NULL);
 
 DEV_MODULE(fbt, fbt_modevent, NULL);
 MODULE_VERSION(fbt, 1);
 MODULE_DEPEND(fbt, dtrace, 1, 1, 1);
+MODULE_DEPEND(fbt, opensolaris, 1, 1, 1);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801052241.m05MfF3l042966>