From owner-svn-src-head@FreeBSD.ORG Mon Jun 23 01:10:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 026AA42E; Mon, 23 Jun 2014 01:10:57 +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 C9CDE2B2C; Mon, 23 Jun 2014 01:10:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5N1Auqq090290; Mon, 23 Jun 2014 01:10:56 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5N1Auem090289; Mon, 23 Jun 2014 01:10:56 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201406230110.s5N1Auem090289@svn.freebsd.org> From: Mark Johnston Date: Mon, 23 Jun 2014 01:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267759 - head/sys/cddl/dev/dtrace/amd64 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 01:10:57 -0000 Author: markj Date: Mon Jun 23 01:10:56 2014 New Revision: 267759 URL: http://svnweb.freebsd.org/changeset/base/267759 Log: Fix a couple of bugs on amd64 when fetching probe arguments beyond the first five for probes entered through a UD fault (i.e. FBT probes). Specifically, handle the fact that dtrace_invop_callsite must be 16 byte-aligned and thus may not immediately follow the call to dtrace_invop() in dtrace_invop_start(). Also fetch register arguments and the stack pointer through a struct trapframe instead of a struct reg. PR: 191260 Submitted by: luke.tw@gmail.com MFC after: 3 weeks Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Mon Jun 23 00:54:56 2014 (r267758) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Mon Jun 23 01:10:56 2014 (r267759) @@ -349,7 +349,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, 16) == + (long)dtrace_invop_callsite) { /* * In the case of amd64, we will use the pointer to the * regs structure that was pushed when we took the @@ -363,33 +364,33 @@ dtrace_getarg(int arg, int aframes) * we're seeking is passed in regsiters, we can just * load it directly. */ - struct reg *rp = (struct reg *)((uintptr_t)&fp[1] + - sizeof (uintptr_t)); + struct trapframe *tf = + (struct trapframe *)((uintptr_t)&fp[1]); if (arg <= inreg) { switch (arg) { case 0: - stack = (uintptr_t *)&rp->r_rdi; + stack = (uintptr_t *)&tf->tf_rdi; break; case 1: - stack = (uintptr_t *)&rp->r_rsi; + stack = (uintptr_t *)&tf->tf_rsi; break; case 2: - stack = (uintptr_t *)&rp->r_rdx; + stack = (uintptr_t *)&tf->tf_rdx; break; case 3: - stack = (uintptr_t *)&rp->r_rcx; + stack = (uintptr_t *)&tf->tf_rcx; break; case 4: - stack = (uintptr_t *)&rp->r_r8; + stack = (uintptr_t *)&tf->tf_r8; break; case 5: - stack = (uintptr_t *)&rp->r_r9; + stack = (uintptr_t *)&tf->tf_r9; break; } arg = 0; } else { - stack = (uintptr_t *)(rp->r_rsp); + stack = (uintptr_t *)(tf->tf_rsp); arg -= inreg; } goto load;