From owner-svn-src-all@FreeBSD.ORG Tue Aug 24 20:50:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C67E106566C; Tue, 24 Aug 2010 20:50:09 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1031A8FC15; Tue, 24 Aug 2010 20:50:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7OKo8YK087467; Tue, 24 Aug 2010 20:50:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7OKo8mA087463; Tue, 24 Aug 2010 20:50:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008242050.o7OKo8mA087463@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 24 Aug 2010 20:50:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211773 - in head/lib/libthr: . arch/powerpc arch/powerpc/include arch/powerpc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2010 20:50:09 -0000 Author: nwhitehorn Date: Tue Aug 24 20:50:08 2010 New Revision: 211773 URL: http://svn.freebsd.org/changeset/base/211773 Log: Unify 32-bit and 64-bit PowerPC libthr support. This reduces code duplication, and simplifies the TBEMD import. Requested by: imp Deleted: head/lib/libthr/arch/powerpc64/ Modified: head/lib/libthr/Makefile head/lib/libthr/arch/powerpc/Makefile.inc head/lib/libthr/arch/powerpc/include/pthread_md.h Modified: head/lib/libthr/Makefile ============================================================================== --- head/lib/libthr/Makefile Tue Aug 24 20:45:21 2010 (r211772) +++ head/lib/libthr/Makefile Tue Aug 24 20:50:08 2010 (r211773) @@ -19,7 +19,7 @@ WARNS?= 3 CFLAGS+=-DPTHREAD_KERNEL CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}/thread \ -I${.CURDIR}/../../include -CFLAGS+=-I${.CURDIR}/arch/${MACHINE_ARCH}/include +CFLAGS+=-I${.CURDIR}/arch/${MACHINE_CPUARCH}/include CFLAGS+=-I${.CURDIR}/sys CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf/${MACHINE_ARCH} @@ -38,7 +38,7 @@ CFLAGS+=-D_PTHREADS_INVARIANTS PRECIOUSLIB= -.include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc" +.include "${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" .include "${.CURDIR}/thread/Makefile.inc" Modified: head/lib/libthr/arch/powerpc/Makefile.inc ============================================================================== --- head/lib/libthr/arch/powerpc/Makefile.inc Tue Aug 24 20:45:21 2010 (r211772) +++ head/lib/libthr/arch/powerpc/Makefile.inc Tue Aug 24 20:50:08 2010 (r211773) @@ -1,5 +1,5 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH} +.PATH: ${.CURDIR}/arch/${MACHINE_CPUARCH}/${MACHINE_CPUARCH} SRCS+= pthread_md.c Modified: head/lib/libthr/arch/powerpc/include/pthread_md.h ============================================================================== --- head/lib/libthr/arch/powerpc/include/pthread_md.h Tue Aug 24 20:45:21 2010 (r211772) +++ head/lib/libthr/arch/powerpc/include/pthread_md.h Tue Aug 24 20:50:08 2010 (r211773) @@ -39,12 +39,16 @@ #define CPU_SPINWAIT #define DTV_OFFSET offsetof(struct tcb, tcb_dtv) +#ifdef __powerpc64__ +#define TP_OFFSET 0x7010 +#else #define TP_OFFSET 0x7008 +#endif /* * Variant I tcb. The structure layout is fixed, don't blindly * change it. - * %r2 points to end of the structure. + * %r2 (32-bit) or %r13 (64-bit) points to end of the structure. */ struct tcb { void *tcb_dtv; @@ -57,7 +61,11 @@ void _tcb_dtor(struct tcb *); static __inline void _tcb_set(struct tcb *tcb) { +#ifdef __powerpc64__ + register uint8_t *_tp __asm__("%r13"); +#else register uint8_t *_tp __asm__("%r2"); +#endif __asm __volatile("mr %0,%1" : "=r"(_tp) : "r"((uint8_t *)tcb + TP_OFFSET)); @@ -66,7 +74,11 @@ _tcb_set(struct tcb *tcb) static __inline struct tcb * _tcb_get(void) { +#ifdef __powerpc64__ + register uint8_t *_tp __asm__("%r13"); +#else register uint8_t *_tp __asm__("%r2"); +#endif return ((struct tcb *)(_tp - TP_OFFSET)); }