From owner-p4-projects@FreeBSD.ORG Mon Jan 7 07:31:38 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D94B316A41B; Mon, 7 Jan 2008 07:31:37 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EB2516A417 for ; Mon, 7 Jan 2008 07:31:37 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 7F09813C447 for ; Mon, 7 Jan 2008 07:31:37 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m077Vbqu029035 for ; Mon, 7 Jan 2008 07:31:37 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m077VbGH029030 for perforce@freebsd.org; Mon, 7 Jan 2008 07:31:37 GMT (envelope-from jb@freebsd.org) Date: Mon, 7 Jan 2008 07:31:37 GMT Message-Id: <200801070731.m077VbGH029030@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 132682 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2008 07:31:38 -0000 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. */