From owner-svn-src-head@freebsd.org Sat Jul 30 03:11:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90F29BA7810; Sat, 30 Jul 2016 03:11:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 4F54E173D; Sat, 30 Jul 2016 03:11:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6U3BrAb008962; Sat, 30 Jul 2016 03:11:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6U3Brr9008960; Sat, 30 Jul 2016 03:11:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607300311.u6U3Brr9008960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 30 Jul 2016 03:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303535 - in head/sys/cddl/contrib/opensolaris/uts: common/dtrace intel/dtrace 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.22 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: Sat, 30 Jul 2016 03:11:54 -0000 Author: markj Date: Sat Jul 30 03:11:53 2016 New Revision: 303535 URL: https://svnweb.freebsd.org/changeset/base/303535 Log: Include fasttrap handling for DATAMODEL_ILP32 when compiling for amd64. MFC after: 1 month Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Jul 30 03:09:57 2016 (r303534) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Jul 30 03:11:53 2016 (r303535) @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -930,6 +931,13 @@ again: ASSERT(0); } +#ifdef __FreeBSD__ + if (SV_PROC_FLAG(p, SV_LP64)) + p->p_model = DATAMODEL_LP64; + else + p->p_model = DATAMODEL_ILP32; +#endif + /* * If the ISA-dependent initialization goes to plan, go back to the * beginning and try to install this freshly made tracepoint. Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Sat Jul 30 03:09:57 2016 (r303534) +++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Sat Jul 30 03:11:53 2016 (r303535) @@ -43,11 +43,11 @@ #include #include #else -#include #include +#include #include #include -#include +#include #include #include #include @@ -283,12 +283,10 @@ fasttrap_anarg(struct reg *rp, int funct DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | CPU_DTRACE_BADADDR); } else { #endif -#ifdef __i386 - uint32_t *stack = (uint32_t *)rp->r_esp; + uint32_t *stack = (uint32_t *)rp->r_rsp; DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); value = dtrace_fuword32(&stack[argno + shift]); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | CPU_DTRACE_BADADDR); -#endif #ifdef __amd64 } #endif @@ -716,7 +714,6 @@ fasttrap_fulword_noerr(const void *uaddr } #endif -#ifdef __i386__ static uint32_t fasttrap_fuword32_noerr(const void *uaddr) { @@ -727,7 +724,6 @@ fasttrap_fuword32_noerr(const void *uadd return (0); } -#endif static void fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid, @@ -842,7 +838,6 @@ fasttrap_usdt_args64(fasttrap_probe_t *p } #endif -#ifdef __i386__ static void fasttrap_usdt_args32(fasttrap_probe_t *probe, struct reg *rp, int argc, uint32_t *argv) @@ -860,7 +855,6 @@ fasttrap_usdt_args32(fasttrap_probe_t *p argv[i] = 0; } } -#endif static int fasttrap_do_seg(fasttrap_tracepoint_t *tp, struct reg *rp, uintptr_t *addr) @@ -1094,7 +1088,6 @@ fasttrap_pid_probe(struct reg *rp) if (tp->ftt_ids != NULL) { fasttrap_id_t *id; -#ifdef __amd64 if (p->p_model == DATAMODEL_LP64) { for (id = tp->ftt_ids; id != NULL; id = id->fti_next) { fasttrap_probe_t *probe = id->fti_probe; @@ -1136,9 +1129,8 @@ fasttrap_pid_probe(struct reg *rp) } } } else { -#else /* __amd64 */ uintptr_t s0, s1, s2, s3, s4, s5; - uint32_t *stack = (uint32_t *)rp->r_esp; + uint32_t *stack = (uint32_t *)rp->r_rsp; /* * In 32-bit mode, all arguments are passed on the @@ -1191,10 +1183,7 @@ fasttrap_pid_probe(struct reg *rp) t[2], t[3], t[4]); } } -#endif /* __amd64 */ -#ifdef __amd64 } -#endif } /* @@ -1259,12 +1248,10 @@ fasttrap_pid_probe(struct reg *rp) addr = rp->r_rsp + sizeof (uintptr_t); } else { #endif -#ifdef __i386__ uint32_t dst32; - ret = dst32 = fasttrap_fuword32((void *)rp->r_esp); + ret = dst32 = fasttrap_fuword32((void *)rp->r_rsp); dst = dst32; - addr = rp->r_esp + sizeof (uint32_t); -#endif + addr = rp->r_rsp + sizeof (uint32_t); #ifdef __amd64 } #endif @@ -1409,10 +1396,8 @@ fasttrap_pid_probe(struct reg *rp) ret = fasttrap_sulword((void *)rp->r_rsp, rp->r_rbp); } else { #endif -#ifdef __i386__ rp->r_rsp -= sizeof (uint32_t); ret = fasttrap_suword32((void *)rp->r_rsp, rp->r_rbp); -#endif #ifdef __amd64 } #endif @@ -1732,7 +1717,6 @@ fasttrap_pid_probe(struct reg *rp) i += sizeof (uint64_t); } else { #endif -#ifdef __i386__ /* * Set up the jmp to the next instruction; note that * the size of the traced instruction cancels out. @@ -1741,7 +1725,6 @@ fasttrap_pid_probe(struct reg *rp) /* LINTED - alignment */ *(uint32_t *)&scratch[i] = pc - addr - 5; i += sizeof (uint32_t); -#endif #ifdef __amd64 } #endif