Date: Mon, 7 Jan 2008 07:31:37 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 132682 for review Message-ID: <200801070731.m077VbGH029030@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132682 Change 132682 by jb@jb_freebsd1 on 2008/01/07 07:31:22 Remove debugging code from the invop handler. We don't need the ipl function either. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/amd64/dtrace_subr.c#5 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/amd64/dtrace_subr.c#5 (text+ko) ==== @@ -49,44 +49,15 @@ struct dtrace_invop_hdlr *dtih_next; } dtrace_invop_hdlr_t; -dtrace_invop_hdlr_t *dtrace_invop_hdlr; -uintptr_t dtrace_invop_addr; - int dtrace_invop(uintptr_t addr, uintptr_t *stack, uintptr_t eax) { 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) { + for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) if ((rval = hdlr->dtih_func(addr, stack, eax)) != 0) return (rval); - } return (0); } @@ -100,10 +71,6 @@ hdlr->dtih_func = func; hdlr->dtih_next = dtrace_invop_hdlr; dtrace_invop_hdlr = hdlr; - -#ifdef DOODAD - dtrace_invop_func = dtrace_invop; -#endif } void @@ -131,21 +98,6 @@ } kmem_free(hdlr, 0); - -#ifdef DOODAD - if (dtrace_invop_hdlr == NULL) - dtrace_invop_func = NULL; -#endif -} - -int -dtrace_getipl(void) -{ -#ifdef DOODAD - return (CPU->cpu_pri); -#else - return (0); -#endif } /*ARGSUSED*/ @@ -449,6 +401,9 @@ * All the rest will be handled in the usual way. */ switch (type) { + /* Privilieged instruction fault. */ + case T_PRIVINFLT: + break; /* General protection fault. */ case T_PROTFLT: /* Flag an illegal operation. */ @@ -476,6 +431,14 @@ /* Handle all other traps in the usual way. */ break; } + + /* + * Outside the DTrace probe context, a breakpoint fault could be caused by a + * Function Boundary Trace (fbt) or Statically Defined Trace (sdt) provider. + */ + } else if (type == T_BPTFLT) { +printf("T_BPTFLT! tf_rip 0x%lx\n", frame->tf_rip); + dtrace_invop(frame->tf_rip - 1, (uintptr_t *) frame->tf_rsp, frame->tf_rax); } /* Handle the trap in the usual way. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801070731.m077VbGH029030>