Date: Wed, 4 Apr 2012 19:36:57 +0000 (UTC) From: Olivier Houchard <cognet@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r233880 - in projects/armv6: lib/libc/arm/gen lib/libthr/arch/arm/include share/mk Message-ID: <201204041936.q34JavJG021819@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204041936.q34JavJG021819>