From patchwork Sat Mar 25 14:08:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 1761147 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=DD0iUMaN; dkim-atps=neutral Received: from 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PkLYh5TLPz1yYB for ; Sun, 26 Mar 2023 01:09:44 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B3C78387088C for ; Sat, 25 Mar 2023 14:09:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3C78387088C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679753382; bh=+hE3u+rAXTn7npK4KKZCjLkGlskwAanG6AwvzXwCoNc=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=DD0iUMaN+K9RsiYg3LYuX0JpIAXvloUUooDVEK2XXmHhWKbewdaK5Jln6rMDWJPpQ whcG7Qyj1A9NBg0I3FJ/6ffpmAhSaVD7k1rmw97MpgzfZE/GLBU2ur/L0F/rSZOPLV JFUmci3cK9sodBVlpjUwvpS64FLU9WcywVD8Udnc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 1A4B9384F01A for ; Sat, 25 Mar 2023 14:08:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A4B9384F01A Received: from stargazer.. (unknown [IPv6:240e:358:1172:ca00:dc73:854d:832e:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id AE2136647A; Sat, 25 Mar 2023 10:08:46 -0400 (EDT) To: libc-alpha@sourceware.org Cc: caiyinyu , Wang Xuerui , Adhemerval Zanella Netto , Andreas Schwab , Florian Weimer , Xi Ruoyao Subject: [PATCH v2 3/5] LoongArch: Define __ASSUME_SYSCALL_NAMED_WORKS for Linux Date: Sat, 25 Mar 2023 22:08:13 +0800 Message-Id: <20230325140815.4170296-4-xry111@xry111.site> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230325140815.4170296-1-xry111@xry111.site> References: <20230325140815.4170296-1-xry111@xry111.site> MIME-Version: 1.0 X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, LIKELY_SPAM_FROM, SPF_HELO_PASS, 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.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xi Ruoyao via Libc-alpha From: Xi Ruoyao Reply-To: Xi Ruoyao Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" LoongArch calling convention treats the non-floating-point variable arguments same as named ones, and when each argument is an integer not wider than long or a pointer, the ith argument is in register $ai (0 <= i < 8) or the stack slot at ($sp + sizeof(long) * (i - 8)) (i >= 8) no matter how many arguments are passed. So we can define __ASSUME_SYSCALL_NAMED_WORKS to avoid unnecessary stack stores in the syscall wrappers caused by va_start. --- .../sysv/linux/loongarch/kernel-features.h | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/loongarch/kernel-features.h diff --git a/sysdeps/unix/sysv/linux/loongarch/kernel-features.h b/sysdeps/unix/sysv/linux/loongarch/kernel-features.h new file mode 100644 index 0000000000..f862d0623f --- /dev/null +++ b/sysdeps/unix/sysv/linux/loongarch/kernel-features.h @@ -0,0 +1,29 @@ +/* Set flags signalling availability of kernel features based on given + kernel version number. + Copyright (C) 2023 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 + . */ + +#include_next + +/* Define this if the calling convention for passing x named arguments and y + variable arguments is same as passing (x + y) named arguments, while each + argument is either an integer of which the width is less than or equal to + "long", or a pointer; and an argument can be fetched from the same register + or the same offset from the stack pointer no matter how many (maybe zero) + arguments are passed after it. It avoids useless stack stores caused by + usage of va_start. */ +#define __ASSUME_SYSCALL_NAMED_WORKS 1