PERFORCE change 99102 for review
John Birrell
jb at FreeBSD.org
Tue Jun 13 00:59:15 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=99102
Change 99102 by jb at jb_freebsd2 on 2006/06/13 00:55:58
Save the invop address in a global variable for ease of access from
kdb when system go kaboom gracefully. Ungraceful kabooms cause a
reboot. Grumble.
Also check a flag to see if a probe is already in progress and save
the address just in case we have a chance to look at it before the
system go kaboom. This shouldn't happen, but until the port is
complete on FreeBSD and the functions called from the probe context
meet Sun's design, it can happen. At the moment I think that it is
witness in something that makes a bunch of functions uninstrumentable
(is that a word?) by fbt reliably.
Affected files ...
.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/i386/dtrace_subr.c#2 edit
Differences ...
==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/i386/dtrace_subr.c#2 (text+ko) ====
@@ -36,7 +36,9 @@
#include <sys/dtrace_impl.h>
#include <machine/dtrace.h>
-extern uintptr_t kernelbase;
+extern uintptr_t kernelbase;
+extern uintptr_t dtrace_in_probe_addr;
+extern int dtrace_in_probe;
int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t);
@@ -47,7 +49,8 @@
struct dtrace_invop_hdlr *dtih_next;
} dtrace_invop_hdlr_t;
-dtrace_invop_hdlr_t *dtrace_invop_hdlr;
+dtrace_invop_hdlr_t *dtrace_invop_hdlr;
+uintptr_t dtrace_invop_addr;
int
dtrace_invop(uintptr_t addr, uintptr_t *stack, uintptr_t eax)
@@ -55,6 +58,31 @@
dtrace_invop_hdlr_t *hdlr;
int rval;
+ /*
+ * Save the address in a global variable which can be
+ * read via the kernel debugger in the event that a
+ * double fault occurs.
+ *
+ * From kdb: p *dtrace_invop_addr
+ *
+ * Then look up the value in an objdump of the kernel.
+ */
+ dtrace_invop_addr = addr;
+
+ /*
+ * An invalid opcode fault should not occur while executing
+ * a probe because only dtrace_ functions are supposed to
+ * be called by design. Check here if dtrace_probe() is
+ * in-progress. If so, that's very bad. Very, very bad. We
+ * can't call any non-dtrace functions to report this, so
+ * just save the invalid opcode address and hope that the
+ * dtrace_ioctl will report it. If the DTrace port is
+ * working according to Sun's design, this should never
+ * occur.
+ */
+ if (dtrace_in_probe)
+ dtrace_in_probe_addr = addr;
+
for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) {
if ((rval = hdlr->dtih_func(addr, stack, eax)) != 0)
return (rval);
More information about the p4-projects
mailing list