From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id DE67E384840A for ; Sat, 25 Mar 2023 14:08:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE67E384840A Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1679753338; bh=ICSrnImR6KDBWSkwPdtoyZz4MBS4A7X9ue1HRjE48hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I9qtgUpnX+KEMt7IjK+s8E+f8PLuDpRSYktGLrlbvkJmyzAWaA5N/BFHqeOAfoBKU gqbz+n1hrsosBJWfTMBK36N9cvLy6U2MMhsHCsrdfZUOiVkn3H324UQ4uJ7IGdFrik FAHuEY1Ycw7/lh5Wt6xICdpx6yqW///3/Nvh53oU= 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 1A38866479; Sat, 25 Mar 2023 10:08:51 -0400 (EDT) From: Xi Ruoyao To: libc-alpha@sourceware.org Cc: caiyinyu , Wang Xuerui , Adhemerval Zanella Netto , Andreas Schwab , Florian Weimer , Xi Ruoyao Subject: [PATCH v2 4/5] x86_64: Define __ASSUME_SYSCALL_NAMED_WORKS for Linux Date: Sat, 25 Mar 2023 22:08:14 +0800 Message-Id: <20230325140815.4170296-5-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 Content-Transfer-Encoding: 8bit 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,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 List-Id: x86_64 calling convention treats the variable arguments same as named ones (it sets %al to the number of floating-point variable arguments but it's simply ignored because our syscall wrappers don't take floating-point arguments), and when each argument is an integer not wider than 8 bytes, the ith argument is in registers %rdi, %rsi, %rdx, %rcx, %r8, and %r9 (0 <= i < 6), or the stack slot at (%rsp + 8 * (i - 6)) (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. --- sysdeps/unix/sysv/linux/x86_64/kernel-features.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sysdeps/unix/sysv/linux/x86_64/kernel-features.h b/sysdeps/unix/sysv/linux/x86_64/kernel-features.h index 68322ff476..7783a0eebc 100644 --- a/sysdeps/unix/sysv/linux/x86_64/kernel-features.h +++ b/sysdeps/unix/sysv/linux/x86_64/kernel-features.h @@ -23,4 +23,13 @@ # define __ASSUME_WORDSIZE64_ILP32 1 #endif +/* 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 + #include_next -- 2.40.0