From owner-svn-src-head@FreeBSD.ORG Mon Jun 23 02:00:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A88BEC6; Mon, 23 Jun 2014 02:00:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFBF72E43; Mon, 23 Jun 2014 02:00:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5N20F89011468; Mon, 23 Jun 2014 02:00:15 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5N20Fwt011463; Mon, 23 Jun 2014 02:00:15 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201406230200.s5N20Fwt011463@svn.freebsd.org> From: Mark Johnston Date: Mon, 23 Jun 2014 02:00:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267761 - in head/sys/cddl: contrib/opensolaris/uts/common/sys dev/dtrace/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2014 02:00:16 -0000 Author: markj Date: Mon Jun 23 02:00:14 2014 New Revision: 267761 URL: http://svnweb.freebsd.org/changeset/base/267761 Log: Fix some bugs when fetching probe arguments in i386. Firstly ensure that the 4 byte-aligned dtrace_invop_callsite can be found and that it immediately follows the call to dtrace_invop(). Secondly, fix some pointer arithmetic to account for differences between struct i386_frame and illumos' struct frame. Finally, ensure that dtrace_getarg() isn't inlined. It works by following a fixed number of frame pointers to the probe site, so inlining breaks it. MFC after: 3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h head/sys/cddl/dev/dtrace/i386/dtrace_asm.S head/sys/cddl/dev/dtrace/i386/dtrace_isa.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Mon Jun 23 01:28:18 2014 (r267760) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Mon Jun 23 02:00:14 2014 (r267761) @@ -1268,7 +1268,11 @@ typedef struct dtrace_toxrange { uintptr_t dtt_limit; /* limit of toxic range */ } dtrace_toxrange_t; +#if defined(sun) extern uint64_t dtrace_getarg(int, int); +#else +extern uint64_t __noinline dtrace_getarg(int, int); +#endif extern greg_t dtrace_getfp(void); extern int dtrace_getipl(void); extern uintptr_t dtrace_caller(int); Modified: head/sys/cddl/dev/dtrace/i386/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_asm.S Mon Jun 23 01:28:18 2014 (r267760) +++ head/sys/cddl/dev/dtrace/i386/dtrace_asm.S Mon Jun 23 02:00:14 2014 (r267761) @@ -49,14 +49,8 @@ * dtrace_invop wants us to do. */ call dtrace_invop - - /* - * We pushed 3 times for the arguments to dtrace_invop, - * so we need to increment the stack pointer to get rid of - * those values. - */ - addl $12, %esp ALTENTRY(dtrace_invop_callsite) + addl $12, %esp cmpl $DTRACE_INVOP_PUSHL_EBP, %eax je invop_push cmpl $DTRACE_INVOP_POPL_EBP, %eax Modified: head/sys/cddl/dev/dtrace/i386/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_isa.c Mon Jun 23 01:28:18 2014 (r267760) +++ head/sys/cddl/dev/dtrace/i386/dtrace_isa.c Mon Jun 23 02:00:14 2014 (r267761) @@ -413,7 +413,8 @@ dtrace_getarg(int arg, int aframes) for (i = 1; i <= aframes; i++) { fp = fp->f_frame; - if (fp->f_retaddr == (long)dtrace_invop_callsite) { + if (P2ROUNDUP(fp->f_retaddr, 4) == + (long)dtrace_invop_callsite) { /* * If we pass through the invalid op handler, we will * use the pointer that it passed to the stack as the @@ -422,7 +423,7 @@ dtrace_getarg(int arg, int aframes) * beyond the EIP/RIP that was pushed when the trap was * taken -- hence the "+ 1" below. */ - stack = ((uintptr_t **)&fp[1])[1] + 1; + stack = ((uintptr_t **)&fp[1])[0] + 1; goto load; } @@ -438,7 +439,7 @@ dtrace_getarg(int arg, int aframes) */ arg++; - stack = (uintptr_t *)&fp[1]; + stack = (uintptr_t *)fp + 2; load: DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);