From patchwork Sat Sep 14 14:27:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 1985647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=LX5fqZvr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X5YSC4pCGz1y2N for ; Sun, 15 Sep 2024 00:28:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 849533858C78 for ; Sat, 14 Sep 2024 14:28:09 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by sourceware.org (Postfix) with ESMTPS id B2DA83858C98 for ; Sat, 14 Sep 2024 14:27:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B2DA83858C98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B2DA83858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726324074; cv=none; b=RxLG6lbDKLE7KPQCcfRHPU9EQmTGxJ5S8eQHtFu+HZJHWcOiez37ctAuQitj5fFLm3fZjCNCGI89GTxaiVz1gJvfrNZwJ9xdFn/XChGj5v79NMMpshbrDs4Lz/mjY8YmJYUkKQkzJ8iNk9oi3360N3sodoH+uTby8zx2XibamDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726324074; c=relaxed/simple; bh=Xh4NTMZ4p7KFDL78yJI5yXF/y3EoVl4XCUKKopAMnQg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=LMvffyTozT1pZKE0LBPZkrs158p5KfeqEke/lOutfn6E0Ls6ixdWaxM6WKuZmiuo3PlwRBSUHmSLCm6WYTwVz51FgFiDbRdPPeBfEaCCCpO00wmGfHAZJxzBoCVUhsRJqUke/c+p4L9pTR96WsUktn98iMoQo018cXYzzMdzgSQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1726324071; bh=Xh4NTMZ4p7KFDL78yJI5yXF/y3EoVl4XCUKKopAMnQg=; h=From:To:Cc:Subject:Date:From; b=LX5fqZvrIhyPCJS+s6DxhtA3G09NYoTaDuXQHNCRuWo5koADS6LuTHaEQLFYAIr7t Lf2PR3RNhouKGsKtEplvw49B2UOUZB7LstGc/DoZuqyu7vnbqltgJXCfPyPdzFwTLs GkEqph49m8d1SZEbsLCQdQGZh+VxhBg+2vZuLMLe38ugXxM5wAmTn51tSikQhaqEuE M5nmPYhxB3H4u4M7XMnWNa+o2T9+BdCCXgereRYWkqdDGzvW7XbIcOyK8E9prcy3xM Baq3tqCRS2ndtBRWjHLLfTQ7OdmcwlhCRNbFNM539UlYXIrNbQkwVob/g6BYN4eCxQ u+2+oFtRRA8DA== Received: from mj-deb12-aarch64-glibc.internal.efficios.com (96-127-217-162.qc.cable.ebox.net [96.127.217.162]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4X5YRq2YbNz1LHW; Sat, 14 Sep 2024 10:27:51 -0400 (EDT) From: Michael Jeanson To: libc-alpha@sourceware.org Cc: Michael Jeanson , Florian Weimer , Palmer Dabbelt , Darius Rad Subject: [PATCH] nptl: Add for RISC-V Date: Sat, 14 Sep 2024 10:27:42 -0400 Message-Id: <20240914142742.9592-1-mjeanson@efficios.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the '__rseq_size' and '__rseq_offset' symbols to set the initial value of the 'cpu_id' field which can be used by applications to test if rseq is available and registered. As long as the symbols are exposed it is valid for an application to perform this test even if rseq is not yet implemented in libc for this architecture. Signed-off-by: Michael Jeanson --- Cc: Florian Weimer Cc: Palmer Dabbelt Cc: Darius Rad --- sysdeps/riscv/nptl/thread_pointer.h | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sysdeps/riscv/nptl/thread_pointer.h diff --git a/sysdeps/riscv/nptl/thread_pointer.h b/sysdeps/riscv/nptl/thread_pointer.h new file mode 100644 index 0000000000..e7f6296e7d --- /dev/null +++ b/sysdeps/riscv/nptl/thread_pointer.h @@ -0,0 +1,34 @@ +/* __thread_pointer definition. riscv version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_THREAD_POINTER_H +#define _SYS_THREAD_POINTER_H + +static inline void * +__thread_pointer (void) +{ +#if __GNUC_PREREQ (10, 3) + return __builtin_thread_pointer (); +#else + void *__result; + __asm__ ("mv %0, tp" : "=r" (__result)); + return __result; +#endif /* !GCC 10.3 */ +} + +#endif /* _SYS_THREAD_POINTER_H */