From patchwork Wed Nov 18 14:47:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matheus Castanho X-Patchwork-Id: 41095 X-Patchwork-Delegate: tuliom@linux.vnet.ibm.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 589263987503; Wed, 18 Nov 2020 14:47:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 589263987503 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605710835; bh=8p2w4Y87dkfCYk2KjT56R1cu76IVAXi7PskQH7N4vjU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ELmtpcOJKKCAZ8/jijMJMs5hNNw3Qgwt58LC7jFcf+eKSLkCDray2uOVpl8QScYG4 GgFBP08syRyqOMBBEyQjotAXIeZWTyG67pNGJYpJpt7+QVuVvHuwSpItb/I9qvPUFu AkSVICdFGZaVzBL1c4crhAFTETeQyT7/qTbtpHNc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id E9A9C3898035 for ; Wed, 18 Nov 2020 14:47:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E9A9C3898035 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AIEVr2F079029 for ; Wed, 18 Nov 2020 09:47:12 -0500 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 34w31vdyx3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 18 Nov 2020 09:47:12 -0500 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0AIEkjGC003512 for ; Wed, 18 Nov 2020 14:47:11 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma01dal.us.ibm.com with ESMTP id 34uttrkjf7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 18 Nov 2020 14:47:11 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0AIEl9Iv10355422 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Nov 2020 14:47:10 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DF27AAE064; Wed, 18 Nov 2020 14:47:09 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 632ECAE05F; Wed, 18 Nov 2020 14:47:09 +0000 (GMT) Received: from localhost (unknown [9.160.22.117]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 18 Nov 2020 14:47:09 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH 2/4] powerpc: Make PT_THREAD_POINTER available to assembly code Date: Wed, 18 Nov 2020 11:47:01 -0300 Message-Id: <20201118144703.75569-3-msc@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201118144703.75569-1-msc@linux.ibm.com> References: <20201118144703.75569-1-msc@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-18_04:2020-11-17, 2020-11-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180100 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Matheus Castanho via Libc-alpha From: Matheus Castanho Reply-To: Matheus Castanho Cc: tuliom@linux.ibm.com Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" PT_THREAD_POINTER is currenty defined inside a #ifndef __ASSEMBLER__ block, but its usage should not be limited to C code, as it can be useful when accessing the TLS from assembly code as well. Reviewed-by: Tulio Magno Quites Machado Filho --- sysdeps/powerpc/nptl/tls.h | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/sysdeps/powerpc/nptl/tls.h b/sysdeps/powerpc/nptl/tls.h index 261eecfd18..d585968d04 100644 --- a/sysdeps/powerpc/nptl/tls.h +++ b/sysdeps/powerpc/nptl/tls.h @@ -29,8 +29,24 @@ #else /* __ASSEMBLER__ */ # include +# define __ASSEMBLY__ +# include #endif /* __ASSEMBLER__ */ +#ifndef __powerpc64__ +/* Register r2 (tp) is reserved by the ABI as "thread pointer". */ +# define PT_THREAD_POINTER PT_R2 +# ifndef __ASSEMBLER__ +register void *__thread_register __asm__ ("r2"); +# endif + +#else /* __powerpc64__ */ +/* Register r13 (tp) is reserved by the ABI as "thread pointer". */ +# define PT_THREAD_POINTER PT_R13 +# ifndef __ASSEMBLER__ +register void *__thread_register __asm__ ("r13"); +# endif +#endif /* __powerpc64__ */ #ifndef __ASSEMBLER__ @@ -106,16 +122,6 @@ typedef struct (sizeof (struct pthread) \ + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1))) -# ifndef __powerpc64__ -/* Register r2 (tp) is reserved by the ABI as "thread pointer". */ -register void *__thread_register __asm__ ("r2"); -# define PT_THREAD_POINTER PT_R2 -# else -/* Register r13 (tp) is reserved by the ABI as "thread pointer". */ -register void *__thread_register __asm__ ("r13"); -# define PT_THREAD_POINTER PT_R13 -# endif - /* The following assumes that TP (R2 or R13) points to the end of the TCB + 0x7000 (per the ABI). This implies that TCB address is TP - 0x7000. As we define TLS_DTV_AT_TP we can