From owner-svn-src-projects@FreeBSD.ORG Wed Apr 4 19:36:57 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F63C1065670; Wed, 4 Apr 2012 19:36:57 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 507D38FC08; Wed, 4 Apr 2012 19:36:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q34Jav6l021823; Wed, 4 Apr 2012 19:36:57 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q34JavJG021819; Wed, 4 Apr 2012 19:36:57 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201204041936.q34JavJG021819@svn.freebsd.org> From: Olivier Houchard Date: Wed, 4 Apr 2012 19:36:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233880 - in projects/armv6: lib/libc/arm/gen lib/libthr/arch/arm/include share/mk X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2012 19:36:57 -0000 Author: cognet Date: Wed Apr 4 19:36:56 2012 New Revision: 233880 URL: http://svn.freebsd.org/changeset/base/233880 Log: Bring support for the new arm TLS model. Submitted by: Mark Tinguely Modified: projects/armv6/lib/libc/arm/gen/__aeabi_read_tp.c projects/armv6/lib/libthr/arch/arm/include/pthread_md.h projects/armv6/share/mk/bsd.cpu.mk Modified: projects/armv6/lib/libc/arm/gen/__aeabi_read_tp.c ============================================================================== --- projects/armv6/lib/libc/arm/gen/__aeabi_read_tp.c Wed Apr 4 17:27:13 2012 (r233879) +++ projects/armv6/lib/libc/arm/gen/__aeabi_read_tp.c Wed Apr 4 19:36:56 2012 (r233880) @@ -36,7 +36,13 @@ __FBSDID("$FreeBSD$"); void * __aeabi_read_tp() { +#ifdef ARM_TP_ADDRESS void **_tp = (void **)ARM_TP_ADDRESS; - return (*_tp); +#else + void *_tp;; + __asm __volatile("mrc p15, 0, %0, c13, c0, 3" \ + : "=r" (_tp)); + return (_tp); +#endif } Modified: projects/armv6/lib/libthr/arch/arm/include/pthread_md.h ============================================================================== --- projects/armv6/lib/libthr/arch/arm/include/pthread_md.h Wed Apr 4 17:27:13 2012 (r233879) +++ projects/armv6/lib/libthr/arch/arm/include/pthread_md.h Wed Apr 4 19:36:56 2012 (r233880) @@ -57,7 +57,11 @@ void _tcb_dtor(struct tcb *); static __inline void _tcb_set(struct tcb *tcb) { +#ifdef ARM_TP_ADDRESS + *((struct tcb **)ARM_TP_ADDRESS) = tcb; /* avoids a system call */ +#else sysarch(ARM_SET_TP, tcb); +#endif } /* @@ -66,10 +70,15 @@ _tcb_set(struct tcb *tcb) static __inline struct tcb * _tcb_get(void) { +#ifdef ARM_TP_ADDRESS + return (*((struct tcb **)ARM_TP_ADDRESS)); +#else struct tcb *tcb; - tcb = (void*)sysarch(ARM_GET_TP, NULL); + __asm __volatile("mrc p15, 0, %0, c13, c0, 3" \ + : "=r" (tcb)); return (tcb); +#endif } extern struct pthread *_thr_initial; Modified: projects/armv6/share/mk/bsd.cpu.mk ============================================================================== --- projects/armv6/share/mk/bsd.cpu.mk Wed Apr 4 17:27:13 2012 (r233879) +++ projects/armv6/share/mk/bsd.cpu.mk Wed Apr 4 19:36:56 2012 (r233880) @@ -97,11 +97,13 @@ _CPUCFLAGS = -march=${CPUTYPE} . if ${CPUTYPE} == "xscale" #XXX: gcc doesn't seem to like -mcpu=xscale, and dies while rebuilding itself #_CPUCFLAGS = -mcpu=xscale -_CPUCFLAGS = -march=armv5te -D__XSCALE__ +_CPUCFLAGS = -march=armv5te -D__XSCALE__ -DARM_WANT_TP_ADDRESS . elif ${CPUTYPE} == "armv6" _CPUCFLAGS = -march=${CPUTYPE} -DARM_ARCH_6=1 +. elif ${CPUTYPE} == "cortexa" +_CPUCFLAGS = -march=armv6 -DARM_ARCH_6=1 -mfpu=vfp . else -_CPUCFLAGS = -mcpu=${CPUTYPE} +_CPUCFLAGS = -mcpu=${CPUTYPE} -DARM_WANT_TP_ADDRESS . endif . elif ${MACHINE_ARCH} == "powerpc" . if ${CPUTYPE} == "e500"