From patchwork Tue Jul 4 19:53:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 107025 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1362283qge; Tue, 4 Jul 2017 12:56:37 -0700 (PDT) X-Received: by 10.98.91.71 with SMTP id p68mr10567123pfb.209.1499198196971; Tue, 04 Jul 2017 12:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499198196; cv=none; d=google.com; s=arc-20160816; b=qSqz3h/5VClj9r17aasqhg6srd7iOAOdUe0OVSc7MrT9spLhab7Kz9gwx7Ihu/+1bS JvTiQ4Y7Pg6aeXNFMcv9GXpNHKuK8ffoU8TzUf/nrR4VMYtPNwsja7gmYbxeLaJ/V4yF JExOH23wUVb36zFoTTIaY8+bDOY4c0A1GSp1p5VSv/3lwzs0Jr+Gvs7lXpMpPoqtFF0b ifSmTh4QAxgzoqtAh//w6wL0mrOARo1Ac4Ur9Zx+ZXngzP6MsIEGooryjI50fb/W/Xtn MrfFH7RVbSxyfcRke06U/MqxKomNd0XsOrjsXWcFes8559BoY1UqQaYEFHeoj0ayEWEC 0MdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :delivered-to:sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=W24tHI8gG2Z1A1AqEHyvV0EOPPwe0D8zXJ0r7k81zRY=; b=jVN0yHDMutdudzuUz0kQdjS8vqQuQBQOE4yyLwyxyE9YG/OOPc43Ddfacm2XV1tvoH MRb/kXisi9aBI7fDCQsrOsrM1MtgCY1LUXSep2Iorrkj1Xrl4nhyaqJX5pm5Sb163O7J 0tRZct0DBlV6iBSyOjnAqWdb5Ed5JqAOrvAHjO+yUo6SO9ItXANibo3ZE6EDtjOFXiM2 TqYMyioxo4ggjigk+hREeDyyutRti3R97AXKUjithQYCCW8+RJtuMctuKmOgFDcYnnDV sCUSrjXZ71gRXjiWYmvlfnP30SOhtc7d+RllYFcCKVx/kfQmVZiaXdxRLJcpXGOQDbRw g9Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.b=Vld92pad; spf=pass (google.com: domain of libc-alpha-return-81674-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-81674-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z44si16483598plh.218.2017.07.04.12.56.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 12:56:36 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-81674-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.b=Vld92pad; spf=pass (google.com: domain of libc-alpha-return-81674-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-81674-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=eepOuFGSucbTCSmVlq0Jz2RC7S0ST6f TQWq/aVfe9Cnk3z29u+VhIEclI5+977e53N4Iore4o5WE/3ruwaHanJ3MTIPp0RQ 3Hezo0fnsSpzdgzunbeXDfZBEnh+Xpby0As1tHsqXElKy3R1wyFcH1ScbGTexCY0 bNyaUXtrKU+4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=saWoEP/iM1iYwytu8+84I31EN9w=; b=Vld92 pad79X2E71J/NuVUYwkDFpbpqDaLppws6ty97TELvA2n6EFopg9YlI295JBX9IM7 xRFKqXsK430vZDjhEB21Ex7Unmqkrsw7HhuCA0Hb5Z1cI7wG5Hyn7rsZfM3fYMKL 4yn/7yOhtd4I5rUppjRsb0v3mLjxwZc+UavbtE= Received: (qmail 75418 invoked by alias); 4 Jul 2017 19:54:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 74877 invoked by uid 89); 4 Jul 2017 19:54:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qk0-f179.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=W24tHI8gG2Z1A1AqEHyvV0EOPPwe0D8zXJ0r7k81zRY=; b=KQnWoHbvCqw9Tk41EVqGGTIZBOFYBs9VltTmWCY9/vcIkHZPKXnJQnGfkiC+OrY4Cf LXDn73/+SgGe72SjXiXJ4r6nulft9NSGWUD8iA68qdz6Cy3QP8l0FKSlxmUc1IjhE6Zd 1k3llT3xqMluPmuu6q09H2ke1wSdQh2v/zWtO4nSrlTgMmpV6Z6XZecHaGTCe4bs+UYP 7lYhFebIsE8m3XIziFxj/HbUuIzDjL+UjoEYr9FAlx7DjBe3382+E04H6ojM6r4nqa/T y6u5AoB5xsBOtSP9WldtPrvTGofois25uCSd74qKDNkDw9x612o6AFf1DUsG2hSQCHoZ WlAw== X-Gm-Message-State: AKS2vOwmTlHSmsLOibcoVo0hNJEce5O1DBc2rKB6HBZfqC6xikri1EbA NxPsz/N9iFIY5amhfhMZ+A== X-Received: by 10.55.33.80 with SMTP id h77mr45671270qkh.86.1499198059751; Tue, 04 Jul 2017 12:54:19 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Adhemerval Zanella Subject: [PATCH 12/14] Fix {INLINE,INTERNAL}_SYSCALL macros for x32 Date: Tue, 4 Jul 2017 16:53:52 -0300 Message-Id: <1499198034-5837-13-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1499198034-5837-1-git-send-email-adhemerval.zanella@linaro.org> References: <1499198034-5837-1-git-send-email-adhemerval.zanella@linaro.org> From: Adhemerval Zanella The problem for x32 is the {INTERNAL,INLINE}_SYSCALL C macros explicit cast the arguments to 'long int', thus passing as 32 bits arguments that should be passed to 64 bits. Previous x32 implementation uses the auto-generated syscalls from assembly macros (syscalls.list), so the {INTERNAL,INLINE}_SYSCALL macros are never used with 64 bit argument in x32 (which are internally broken for this ILP). To fix it I used a strategy similar to MIPS64n32 (although both ABI differs for some syscalls on how top pass 64-bits arguments) where argument types for kernel call are defined using GCC extension 'typeof' with a arithmetic operation. This allows 64-bits arguments to be defined while 32-bits argument will still passed as 32-bits. I also cleanup the {INLINE,INTERNAL}_SYSCALL definition by defining 'inline_syscallX' instead of constructing the argument passing using macros (it adds some readability) and removed the ununsed INTERNAL_SYSCALL_NCS_TYPES define (since the patch idea is exactly to avoid requiric explicit types passing). Tested on x86_64 and x32. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (INTERNAL_SYSCALL_NCS_TYPES): Remove define. (LOAD_ARGS_0): Likewise. (LOAD_ARGS_1): Likewise. (LOAD_ARGS_2): Likewise. (LOAD_ARGS_3): Likewise. (LOAD_ARGS_4): Likewise. (LOAD_ARGS_5): Likewise. (LOAD_ARGS_6): Likewise. (LOAD_REGS_0): Likewise. (LOAD_REGS_1): Likewise. (LOAD_REGS_2): Likewise. (LOAD_REGS_3): Likewise. (LOAD_REGS_4): Likewise. (LOAD_REGS_5): Likewise. (LOAD_REGS_6): Likewise. (ASM_ARGS_0): Likewise. (ASM_ARGS_1): Likewise. (ASM_ARGS_2): Likewise. (ASM_ARGS_3): Likewise. (ASM_ARGS_4): Likewise. (ASM_ARGS_5): Likewise. (ASM_ARGS_6): Likewise. (LOAD_ARGS_TYPES_1): Likewise. (LOAD_ARGS_TYPES_2): Likewise. (LOAD_ARGS_TYPES_3): Likewise. (LOAD_ARGS_TYPES_4): Likewise. (LOAD_ARGS_TYPES_5): Likewise. (LOAD_ARGS_TYPES_6): Likewise. (LOAD_REGS_TYPES_1): Likewise. (LOAD_REGS_TYPES_2): Likewise. (LOAD_REGS_TYPES_3): Likewise. (LOAD_REGS_TYPES_4): Likewise. (LOAD_REGS_TYPES_5): Likewise. (LOAD_REGS_TYPES_6): Likewise. (TYPEFY): New define. (ARGIFY): Likewise. (internal_syscall0): Likewise. (internal_syscall1): Likewise. (internal_syscall2): Likewise. (internal_syscall3): Likewise. (internal_syscall4): Likewise. (internal_syscall5): Likewise. (internal_syscall6): Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/times.c (INTERNAL_SYSCALL_NCS): Remove define. (internal_syscall1): Add define. --- ChangeLog | 48 ++++++ sysdeps/unix/sysv/linux/x86_64/sysdep.h | 251 ++++++++++++++++------------- sysdeps/unix/sysv/linux/x86_64/x32/times.c | 24 +-- 3 files changed, 203 insertions(+), 120 deletions(-) -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 880e496..f299bf2 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -221,33 +221,148 @@ /* Registers clobbered by syscall. */ # define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx" -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - unsigned long int resultvar; \ - LOAD_ARGS_##nr (args) \ - LOAD_REGS_##nr \ - asm volatile ( \ - "syscall\n\t" \ - : "=a" (resultvar) \ - : "0" (name) ASM_ARGS_##nr : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ - (long int) resultvar; }) -# undef INTERNAL_SYSCALL -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) - -# define INTERNAL_SYSCALL_NCS_TYPES(name, err, nr, args...) \ - ({ \ - unsigned long int resultvar; \ - LOAD_ARGS_TYPES_##nr (args) \ - LOAD_REGS_TYPES_##nr (args) \ - asm volatile ( \ - "syscall\n\t" \ - : "=a" (resultvar) \ - : "0" (name) ASM_ARGS_##nr : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ - (long int) resultvar; }) -# undef INTERNAL_SYSCALL_TYPES -# define INTERNAL_SYSCALL_TYPES(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS_TYPES (__NR_##name, err, nr, ##args) +/* Create a variable 'name' based on type 'X' to avoid explicit types. + This is mainly used set use 64-bits arguments in x32. */ +#define TYPEFY(X, name) __typeof__ ((X) - (X)) name +/* Explicit cast the argument to avoid integer from pointer warning on + x32. */ +#define ARGIFY(X) ((__typeof__ ((X) - (X))) (X)) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, err, nr, args...) \ + internal_syscall##nr (SYS_ify (name), err, args) + +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ + internal_syscall##nr (number, err, args) + +#undef internal_syscall0 +#define internal_syscall0(number, err, dummy...) \ +({ \ + unsigned long int resultvar; \ + asm volatile ( \ + "syscall\n\t" \ + : "=a" (resultvar) \ + : "0" (number) \ + : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ + (long int) resultvar; \ +}) + +#undef internal_syscall1 +#define internal_syscall1(number, err, arg1) \ +({ \ + unsigned long int resultvar; \ + TYPEFY (arg1, __arg1) = ARGIFY (arg1); \ + register TYPEFY (arg1, _a1) asm ("rdi") = __arg1; \ + asm volatile ( \ + "syscall\n\t" \ + : "=a" (resultvar) \ + : "0" (number), "r" (_a1) \ + : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ + (long int) resultvar; \ +}) + +#undef internal_syscall2 +#define internal_syscall2(number, err, arg1, arg2) \ +({ \ + unsigned long int resultvar; \ + TYPEFY (arg2, __arg2) = ARGIFY (arg2); \ + TYPEFY (arg1, __arg1) = ARGIFY (arg1); \ + register TYPEFY (arg2, _a2) asm ("rsi") = __arg2; \ + register TYPEFY (arg1, _a1) asm ("rdi") = __arg1; \ + asm volatile ( \ + "syscall\n\t" \ + : "=a" (resultvar) \ + : "0" (number), "r" (_a1), "r" (_a2) \ + : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ + (long int) resultvar; \ +}) + +#undef internal_syscall3 +#define internal_syscall3(number, err, arg1, arg2, arg3) \ +({ \ + unsigned long int resultvar; \ + TYPEFY (arg3, __arg3) = ARGIFY (arg3); \ + TYPEFY (arg2, __arg2) = ARGIFY (arg2); \ + TYPEFY (arg1, __arg1) = ARGIFY (arg1); \ + register TYPEFY (arg3, _a3) asm ("rdx") = __arg3; \ + register TYPEFY (arg2, _a2) asm ("rsi") = __arg2; \ + register TYPEFY (arg1, _a1) asm ("rdi") = __arg1; \ + asm volatile ( \ + "syscall\n\t" \ + : "=a" (resultvar) \ + : "0" (number), "r" (_a1), "r" (_a2), "r" (_a3) \ + : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ + (long int) resultvar; \ +}) + +#undef internal_syscall4 +#define internal_syscall4(number, err, arg1, arg2, arg3, arg4) \ +({ \ + unsigned long int resultvar; \ + TYPEFY (arg4, __arg4) = ARGIFY (arg4); \ + TYPEFY (arg3, __arg3) = ARGIFY (arg3); \ + TYPEFY (arg2, __arg2) = ARGIFY (arg2); \ + TYPEFY (arg1, __arg1) = ARGIFY (arg1); \ + register TYPEFY (arg4, _a4) asm ("r10") = __arg4; \ + register TYPEFY (arg3, _a3) asm ("rdx") = __arg3; \ + register TYPEFY (arg2, _a2) asm ("rsi") = __arg2; \ + register TYPEFY (arg1, _a1) asm ("rdi") = __arg1; \ + asm volatile ( \ + "syscall\n\t" \ + : "=a" (resultvar) \ + : "0" (number), "r" (_a1), "r" (_a2), "r" (_a3), "r" (_a4) \ + : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ + (long int) resultvar; \ +}) + +#undef internal_syscall5 +#define internal_syscall5(number, err, arg1, arg2, arg3, arg4, arg5) \ +({ \ + unsigned long int resultvar; \ + TYPEFY (arg5, __arg5) = ARGIFY (arg5); \ + TYPEFY (arg4, __arg4) = ARGIFY (arg4); \ + TYPEFY (arg3, __arg3) = ARGIFY (arg3); \ + TYPEFY (arg2, __arg2) = ARGIFY (arg2); \ + TYPEFY (arg1, __arg1) = ARGIFY (arg1); \ + register TYPEFY (arg5, _a5) asm ("r8") = __arg5; \ + register TYPEFY (arg4, _a4) asm ("r10") = __arg4; \ + register TYPEFY (arg3, _a3) asm ("rdx") = __arg3; \ + register TYPEFY (arg2, _a2) asm ("rsi") = __arg2; \ + register TYPEFY (arg1, _a1) asm ("rdi") = __arg1; \ + asm volatile ( \ + "syscall\n\t" \ + : "=a" (resultvar) \ + : "0" (number), "r" (_a1), "r" (_a2), "r" (_a3), "r" (_a4), \ + "r" (_a5) \ + : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ + (long int) resultvar; \ +}) + +#undef internal_syscall6 +#define internal_syscall6(number, err, arg1, arg2, arg3, arg4, arg5, arg6) \ +({ \ + unsigned long int resultvar; \ + TYPEFY (arg6, __arg6) = ARGIFY (arg6); \ + TYPEFY (arg5, __arg5) = ARGIFY (arg5); \ + TYPEFY (arg4, __arg4) = ARGIFY (arg4); \ + TYPEFY (arg3, __arg3) = ARGIFY (arg3); \ + TYPEFY (arg2, __arg2) = ARGIFY (arg2); \ + TYPEFY (arg1, __arg1) = ARGIFY (arg1); \ + register TYPEFY (arg6, _a6) asm ("r9") = __arg6; \ + register TYPEFY (arg5, _a5) asm ("r8") = __arg5; \ + register TYPEFY (arg4, _a4) asm ("r10") = __arg4; \ + register TYPEFY (arg3, _a3) asm ("rdx") = __arg3; \ + register TYPEFY (arg2, _a2) asm ("rsi") = __arg2; \ + register TYPEFY (arg1, _a1) asm ("rdi") = __arg1; \ + asm volatile ( \ + "syscall\n\t" \ + : "=a" (resultvar) \ + : "0" (number), "r" (_a1), "r" (_a2), "r" (_a3), "r" (_a4), \ + "r" (_a5), "r" (_a6) \ + : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ + (long int) resultvar; \ +}) # undef INTERNAL_SYSCALL_ERROR_P # define INTERNAL_SYSCALL_ERROR_P(val, err) \ @@ -261,88 +376,6 @@ # define HAVE_GETTIMEOFDAY_VSYSCALL 1 # define HAVE_GETCPU_VSYSCALL 1 -# define LOAD_ARGS_0() -# define LOAD_REGS_0 -# define ASM_ARGS_0 - -# define LOAD_ARGS_TYPES_1(t1, a1) \ - t1 __arg1 = (t1) (a1); \ - LOAD_ARGS_0 () -# define LOAD_REGS_TYPES_1(t1, a1) \ - register t1 _a1 asm ("rdi") = __arg1; \ - LOAD_REGS_0 -# define ASM_ARGS_1 ASM_ARGS_0, "r" (_a1) -# define LOAD_ARGS_1(a1) \ - LOAD_ARGS_TYPES_1 (long int, a1) -# define LOAD_REGS_1 \ - LOAD_REGS_TYPES_1 (long int, a1) - -# define LOAD_ARGS_TYPES_2(t1, a1, t2, a2) \ - t2 __arg2 = (t2) (a2); \ - LOAD_ARGS_TYPES_1 (t1, a1) -# define LOAD_REGS_TYPES_2(t1, a1, t2, a2) \ - register t2 _a2 asm ("rsi") = __arg2; \ - LOAD_REGS_TYPES_1(t1, a1) -# define ASM_ARGS_2 ASM_ARGS_1, "r" (_a2) -# define LOAD_ARGS_2(a1, a2) \ - LOAD_ARGS_TYPES_2 (long int, a1, long int, a2) -# define LOAD_REGS_2 \ - LOAD_REGS_TYPES_2 (long int, a1, long int, a2) - -# define LOAD_ARGS_TYPES_3(t1, a1, t2, a2, t3, a3) \ - t3 __arg3 = (t3) (a3); \ - LOAD_ARGS_TYPES_2 (t1, a1, t2, a2) -# define LOAD_REGS_TYPES_3(t1, a1, t2, a2, t3, a3) \ - register t3 _a3 asm ("rdx") = __arg3; \ - LOAD_REGS_TYPES_2(t1, a1, t2, a2) -# define ASM_ARGS_3 ASM_ARGS_2, "r" (_a3) -# define LOAD_ARGS_3(a1, a2, a3) \ - LOAD_ARGS_TYPES_3 (long int, a1, long int, a2, long int, a3) -# define LOAD_REGS_3 \ - LOAD_REGS_TYPES_3 (long int, a1, long int, a2, long int, a3) - -# define LOAD_ARGS_TYPES_4(t1, a1, t2, a2, t3, a3, t4, a4) \ - t4 __arg4 = (t4) (a4); \ - LOAD_ARGS_TYPES_3 (t1, a1, t2, a2, t3, a3) -# define LOAD_REGS_TYPES_4(t1, a1, t2, a2, t3, a3, t4, a4) \ - register t4 _a4 asm ("r10") = __arg4; \ - LOAD_REGS_TYPES_3(t1, a2, t2, a2, t3, a3) -# define ASM_ARGS_4 ASM_ARGS_3, "r" (_a4) -# define LOAD_ARGS_4(a1, a2, a3, a4) \ - LOAD_ARGS_TYPES_4 (long int, a1, long int, a2, long int, a3, \ - long int, a4) -# define LOAD_REGS_4 \ - LOAD_REGS_TYPES_4 (long int, a1, long int, a2, long int, a3, \ - long int, a4) - -# define LOAD_ARGS_TYPES_5(t1, a1, t2, a2, t3, a3, t4, a4, t5, a5) \ - t5 __arg5 = (t5) (a5); \ - LOAD_ARGS_TYPES_4 (t1, a1, t2, a2, t3, a3, t4, a4) -# define LOAD_REGS_TYPES_5(t1, a1, t2, a2, t3, a3, t4, a4, t5, a5) \ - register t5 _a5 asm ("r8") = __arg5; \ - LOAD_REGS_TYPES_4 (t1, a1, t2, a2, t3, a3, t4, a4) -# define ASM_ARGS_5 ASM_ARGS_4, "r" (_a5) -# define LOAD_ARGS_5(a1, a2, a3, a4, a5) \ - LOAD_ARGS_TYPES_5 (long int, a1, long int, a2, long int, a3, \ - long int, a4, long int, a5) -# define LOAD_REGS_5 \ - LOAD_REGS_TYPES_5 (long int, a1, long int, a2, long int, a3, \ - long int, a4, long int, a5) - -# define LOAD_ARGS_TYPES_6(t1, a1, t2, a2, t3, a3, t4, a4, t5, a5, t6, a6) \ - t6 __arg6 = (t6) (a6); \ - LOAD_ARGS_TYPES_5 (t1, a1, t2, a2, t3, a3, t4, a4, t5, a5) -# define LOAD_REGS_TYPES_6(t1, a1, t2, a2, t3, a3, t4, a4, t5, a5, t6, a6) \ - register t6 _a6 asm ("r9") = __arg6; \ - LOAD_REGS_TYPES_5 (t1, a1, t2, a2, t3, a3, t4, a4, t5, a5) -# define ASM_ARGS_6 ASM_ARGS_5, "r" (_a6) -# define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \ - LOAD_ARGS_TYPES_6 (long int, a1, long int, a2, long int, a3, \ - long int, a4, long int, a5, long int, a6) -# define LOAD_REGS_6 \ - LOAD_REGS_TYPES_6 (long int, a1, long int, a2, long int, a3, \ - long int, a4, long int, a5, long int, a6) - #endif /* __ASSEMBLER__ */ diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/times.c b/sysdeps/unix/sysv/linux/x86_64/x32/times.c index d56106e..8763047 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/times.c +++ b/sysdeps/unix/sysv/linux/x86_64/x32/times.c @@ -19,17 +19,19 @@ #include /* Linux times system call returns 64-bit integer. */ -#undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - unsigned long long int resultvar; \ - LOAD_ARGS_##nr (args) \ - LOAD_REGS_##nr \ - asm volatile ( \ - "syscall\n\t" \ - : "=a" (resultvar) \ - : "0" (name) ASM_ARGS_##nr : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ - (long long int) resultvar; }) +#undef internal_syscall1 +#define internal_syscall1(number, err, arg1) \ +({ \ + unsigned long long int resultvar; \ + TYPEFY (arg1, __arg1) = ARGIFY (arg1); \ + register TYPEFY (arg1, _a1) asm ("rdi") = __arg1; \ + asm volatile ( \ + "syscall\n\t" \ + : "=a" (resultvar) \ + : "0" (number), "r" (_a1) \ + : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \ + (long long int) resultvar; \ +}) #undef INTERNAL_SYSCALL_ERROR_P #define INTERNAL_SYSCALL_ERROR_P(val, err) \