From patchwork Mon Feb 10 19:20:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183251 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4416844ile; Mon, 10 Feb 2020 11:21:19 -0800 (PST) X-Google-Smtp-Source: APXvYqyjczttVoroGMFTftyJYtpLUU3tzxOBsMdbDtvWAdNp/I83GmIB0FY7zEJCXfRqRRzU6Ivv X-Received: by 2002:a05:6830:1305:: with SMTP id p5mr2072408otq.124.1581362479025; Mon, 10 Feb 2020 11:21:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362479; cv=none; d=google.com; s=arc-20160816; b=Ai/epWRYCyTit/cs0lQqRBGmVFtrE5zmO1qbKEzwH3P6ZBTAx41BieXHMBgjC/GB2G 9+TJMg/z0F0gjNLOkwzQZIeRwssu7/frsxVn07KpWYE/geL+2qGfwOqkNhe9lkPT7eOF 30Bhn1Zk/NjqTXUuWJ2lUGAgC9tE75THLYeEj764gJx4C73LK99AdOu3sezMDPIO1ZYB HGNAKLs2BhjV5ahU+cQpAqLTvfaUYfx+ZfFTAW14qdkLaHVGU5gDcgqXNhHNI28na16d kntHF4N0x+wXCRqi+17ogfkCceyuvnqvnu7Y1cMBd6pd/qvu6M/koJjCW/bR8RCIuLrv eu8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature:delivered-to:sender :list-help:list-post:list-archive:list-subscribe:list-unsubscribe :list-id:precedence:mailing-list:dkim-signature:domainkey-signature; bh=5DpbgibumsybrBMR8bTtpuKRy9yioza++hB1BcAkIBw=; b=KxmCjgb1tPiec5Kz3I7vnS5blHgsg9CF4zZNzFfLV1WZSQ8+GQQGVZ37KqvB2b5yhp K1TgvnxbiS5VZWWcgZAvtGegcrfay5yvlLVkVpPB/z5okN/kAqphU7Ud+F7fo2WYZOh9 UsMT/dsi3Hpkc5Cv+CyELIgzzZ+vGxOG6HhV1qqsVo338djkIkOO/GiYeX4EANaRpQ7g xQVAm+nrpyj4240iwsSkW6p6MEG4KSRA85XGHUA0L3ANl9RaxckTFUPQb2h6OQRksgHK Yrh2rZjqXgIBRNYdYWvLMPUuOOTEkZSnZcNpduJFg6fesdXQ9sp+GkGASqLaBX0s9zv4 P10A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=HhLTSbtT; dkim=pass header.i=@linaro.org header.s=google header.b=mFnB++a4; spf=pass (google.com: domain of libc-alpha-return-109388-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109388-patch=linaro.org@sourceware.org"; dmarc=pass (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 w197si569621oia.101.2020.02.10.11.21.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:21:19 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109388-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.s=default header.b=HhLTSbtT; dkim=pass header.i=@linaro.org header.s=google header.b=mFnB++a4; spf=pass (google.com: domain of libc-alpha-return-109388-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109388-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id; q=dns; s= default; b=R0tkugkVBzKD1FH5dfAd3KB8FttzTeq8DmoPrEVrIY3pl3VVUUTfT GPB6G5H314eqzZoVUWrkFpu7GVy8Hj9544r22U9CW7Ha2S5C98ZtTbXuTTILcYf8 RObap1+vu6DkfiqleoErgJr8+61NsiVyEmmX89DXHw/YaJ6Zc7/DBs= 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:subject:date:message-id; s=default; bh=nhmqzwLikYNTo5L4dS96DtZn5YI=; b=HhLTSbtTByyTdE1/6nVU4A0sG1KR 3aR831uPMiEfVL46X1p36ljjAxTEgjfeCPSj0q1S1c+lPHbH9+Q45s6s48dnaPBy 1WcVXSFmDr1srRCaqrsDuTQqw+pUiS+2x1gTsFTj5Os8aB4KDfbpJUrpay2X1ukm jR5V6ZOnPAnt1ck= Received: (qmail 99524 invoked by alias); 10 Feb 2020 19:20:52 -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 99241 invoked by uid 89); 10 Feb 2020 19:20:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=consolidate, rewrote, 19922020, 1992-2020 X-HELO: mail-qt1-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=5DpbgibumsybrBMR8bTtpuKRy9yioza++hB1BcAkIBw=; b=mFnB++a40xihxxgGMB7tWEoBfnCsoJ+dI/wV0L073CoN6zuwChfDhjtR3dlSAfZ/oP HwZ2ex97GaHmRuNoTVRJlfMh4NfUuJoKjdXGDK4szU3AhVrNQhDkdK2SkO90bXSyPXOc 4RpPTv474mPAEjhKAqfN9hySknY4atzqzvEHnbXteIAXWPrhk16qT3Vxk3RMU2GsHoHf iwLzIdoq7jcHA4d5POrty/Jx+2mAuXqxh6NczzwyFEwsjzrXV/wTSUc9t1a+BrHePSOj xfrN4thVHIAPBdRUJPVrf9H53ejchKGif/spDZEwGweYOX1sl2YfjlsnlHStgdjnB0Px uHXw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 01/15] powerpc: Consolidate Linux syscall definition Date: Mon, 10 Feb 2020 16:20:24 -0300 Message-Id: <20200210192038.23588-1-adhemerval.zanella@linaro.org> The diferences between powerpc64{le} and powerpc32 Linux sysdep.h are: 1. On both vDSO and syscall macros the volatile registers r9, r10, r11, and r12 are used as input operands on powerpc32 and as clobber registers on powerpc64. However the outcome is essentially the same, it advertise the register might be clobbered by the kernel (although Linux won't leak register information to userland in such case). 2. The LOADARGS* macros uses a different size to check for invalid types. 3. The pointer mangling support guard pointer loading uses ABI specific instruction and register. This patch consolidates on only one sysdep by using the the powerpc64 version as default and add the adjustments required for powerpc32. Checked on powerpc64-linux-gnu, powerpc64le-linux-gnu, and powerpc-linux-gnu-power4. --- .../sysv/linux/powerpc/powerpc32/sysdep.h | 214 ------------------ .../sysv/linux/powerpc/powerpc64/sysdep.h | 196 +--------------- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 212 ++++++++++++++++- 3 files changed, 213 insertions(+), 409 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h deleted file mode 100644 index 725dfafde8..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ /dev/null @@ -1,214 +0,0 @@ -/* Copyright (C) 1992-2020 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 _LINUX_POWERPC_SYSDEP_H -#define _LINUX_POWERPC_SYSDEP_H 1 - -#include -#include -#include -#include - -/* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h - of the kernel. But these symbols do not follow the SYS_* syntax - so we have to redefine the `SYS_ify' macro here. */ -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - -#ifndef __ASSEMBLER__ - -# include - -/* Define a macro which expands inline into the wrapper code for a VDSO - call. This use is for internal calls that do not need to handle errors - normally. It will never touch errno. - On powerpc a system call basically clobbers the same registers like a - function call, with the exception of LR (which is needed for the - "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal - an error return status). */ -# define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ - ({ \ - register void *r0 __asm__ ("r0"); \ - register long int r3 __asm__ ("r3"); \ - register long int r4 __asm__ ("r4"); \ - register long int r5 __asm__ ("r5"); \ - register long int r6 __asm__ ("r6"); \ - register long int r7 __asm__ ("r7"); \ - register long int r8 __asm__ ("r8"); \ - register long int r9 __asm__ ("r9"); \ - register long int r10 __asm__ ("r10"); \ - register long int r11 __asm__ ("r11"); \ - register long int r12 __asm__ ("r12"); \ - register type rval __asm__ ("r3"); \ - LOADARGS_##nr (funcptr, args); \ - __asm__ __volatile__ \ - ("mtctr %0\n\t" \ - "bctrl\n\t" \ - "mfcr %0" \ - : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), \ - "+r" (r8), "+r" (r9), "+r" (r10), "+r" (r11), "+r" (r12) \ - : : "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ - __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3), "r" (r4)); \ - rval; \ - }) - -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) - -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ - sc_ret = -1L; \ - } \ - sc_ret; \ - }) - -/* Define a macro which expands inline into the wrapper code for a system - call. This use is for internal calls that do not need to handle errors - normally. It will never touch errno. - On powerpc a system call basically clobbers the same registers like a - function call, with the exception of LR (which is needed for the - "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal - an error return status). */ - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) - -# undef INTERNAL_SYSCALL -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register long int r0 __asm__ ("r0"); \ - register long int r3 __asm__ ("r3"); \ - register long int r4 __asm__ ("r4"); \ - register long int r5 __asm__ ("r5"); \ - register long int r6 __asm__ ("r6"); \ - register long int r7 __asm__ ("r7"); \ - register long int r8 __asm__ ("r8"); \ - register long int r9 __asm__ ("r9"); \ - register long int r10 __asm__ ("r10"); \ - register long int r11 __asm__ ("r11"); \ - register long int r12 __asm__ ("r12"); \ - LOADARGS_##nr(name, args); \ - __asm__ __volatile__ \ - ("sc \n\t" \ - "mfcr %0" \ - : "=&r" (r0), \ - "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \ - "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \ - : ASM_INPUT_##nr \ - : "cr0", "ctr", "memory"); \ - err = r0; \ - (int) r3; \ - }) -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) - -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (val) - -# define LOADARGS_0(name, dummy) \ - r0 = name -# define LOADARGS_1(name, __arg1) \ - long int arg1 = (long int) (__arg1); \ - LOADARGS_0(name, 0); \ - extern void __illegally_sized_syscall_arg1 (void); \ - if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \ - __illegally_sized_syscall_arg1 (); \ - r3 = arg1 -# define LOADARGS_2(name, __arg1, __arg2) \ - long int arg2 = (long int) (__arg2); \ - LOADARGS_1(name, __arg1); \ - extern void __illegally_sized_syscall_arg2 (void); \ - if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 4) \ - __illegally_sized_syscall_arg2 (); \ - r4 = arg2 -# define LOADARGS_3(name, __arg1, __arg2, __arg3) \ - long int arg3 = (long int) (__arg3); \ - LOADARGS_2(name, __arg1, __arg2); \ - extern void __illegally_sized_syscall_arg3 (void); \ - if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 4) \ - __illegally_sized_syscall_arg3 (); \ - r5 = arg3 -# define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ - long int arg4 = (long int) (__arg4); \ - LOADARGS_3(name, __arg1, __arg2, __arg3); \ - extern void __illegally_sized_syscall_arg4 (void); \ - if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 4) \ - __illegally_sized_syscall_arg4 (); \ - r6 = arg4 -# define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ - long int arg5 = (long int) (__arg5); \ - LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ - extern void __illegally_sized_syscall_arg5 (void); \ - if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 4) \ - __illegally_sized_syscall_arg5 (); \ - r7 = arg5 -# define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ - long int arg6 = (long int) (__arg6); \ - LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ - extern void __illegally_sized_syscall_arg6 (void); \ - if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 4) \ - __illegally_sized_syscall_arg6 (); \ - r8 = arg6 - -# define ASM_INPUT_0 "0" (r0) -# define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) -# define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) -# define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) -# define ASM_INPUT_4 ASM_INPUT_3, "4" (r6) -# define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) -# define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) - -#endif /* __ASSEMBLER__ */ - - -/* Pointer mangling support. */ -#if IS_IN (rtld) -/* We cannot use the thread descriptor because in ld.so we use setjmp - earlier than the descriptor is initialized. */ -#else -# ifdef __ASSEMBLER__ -# define PTR_MANGLE(reg, tmpreg) \ - lwz tmpreg,POINTER_GUARD(r2); \ - xor reg,tmpreg,reg -# define PTR_MANGLE2(reg, tmpreg) \ - xor reg,tmpreg,reg -# define PTR_MANGLE3(destreg, reg, tmpreg) \ - lwz tmpreg,POINTER_GUARD(r2); \ - xor destreg,tmpreg,reg -# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) -# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg) -# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg) -# else -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# endif -#endif - -#endif /* linux/powerpc/powerpc32/sysdep.h */ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index ee7f43653d..0d6b98518b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -17,202 +17,10 @@ /* Alan Modra rewrote the INLINE_SYSCALL macro */ -#ifndef _LINUX_POWERPC_SYSDEP_H -#define _LINUX_POWERPC_SYSDEP_H 1 +#ifndef _LINUX_POWERPC64_SYSDEP_H +#define _LINUX_POWERPC64_SYSDEP_H 1 #include -#include -#include -#include - -/* Define __set_errno() for INLINE_SYSCALL macro below. */ -#ifndef __ASSEMBLER__ -#include -#endif - -/* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h - of the kernel. But these symbols do not follow the SYS_* syntax - so we have to redefine the `SYS_ify' macro here. */ -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - -#ifdef __ASSEMBLER__ - -/* This seems to always be the case on PPC. */ -# define ALIGNARG(log2) log2 -# define ASM_SIZE_DIRECTIVE(name) .size name,.-name - -#endif /* __ASSEMBLER__ */ - -/* Define a macro which expands inline into the wrapper code for a system - call. This use is for internal calls that do not need to handle errors - normally. It will never touch errno. This returns just what the kernel - gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) - the negation of the return value in the kernel gets reverted. */ - -#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ - ({ \ - register void *r0 __asm__ ("r0"); \ - register long int r3 __asm__ ("r3"); \ - register long int r4 __asm__ ("r4"); \ - register long int r5 __asm__ ("r5"); \ - register long int r6 __asm__ ("r6"); \ - register long int r7 __asm__ ("r7"); \ - register long int r8 __asm__ ("r8"); \ - register type rval __asm__ ("r3"); \ - LOADARGS_##nr (funcptr, args); \ - __asm__ __volatile__ \ - ("mtctr %0\n\t" \ - "bctrl\n\t" \ - "mfcr %0\n\t" \ - "0:" \ - : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ - "+r" (r7), "+r" (r8) \ - : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ - __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ - rval; \ - }) - -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) - -/* This version is for kernels that implement system calls that - behave like function calls as far as register saving. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ - sc_ret = -1L; \ - } \ - sc_ret; \ - }) - -/* Define a macro which expands inline into the wrapper code for a system - call. This use is for internal calls that do not need to handle errors - normally. It will never touch errno. This returns just what the kernel - gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) - the negation of the return value in the kernel gets reverted. */ - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register long int r0 __asm__ ("r0"); \ - register long int r3 __asm__ ("r3"); \ - register long int r4 __asm__ ("r4"); \ - register long int r5 __asm__ ("r5"); \ - register long int r6 __asm__ ("r6"); \ - register long int r7 __asm__ ("r7"); \ - register long int r8 __asm__ ("r8"); \ - LOADARGS_##nr (name, ##args); \ - __asm__ __volatile__ \ - ("sc\n\t" \ - "mfcr %0\n\t" \ - "0:" \ - : "=&r" (r0), \ - "=&r" (r3), "=&r" (r4), "=&r" (r5), \ - "=&r" (r6), "=&r" (r7), "=&r" (r8) \ - : ASM_INPUT_##nr \ - : "r9", "r10", "r11", "r12", \ - "cr0", "ctr", "memory"); \ - err = r0; \ - r3; \ - }) -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (val) - -#define LOADARGS_0(name, dummy) \ - r0 = name -#define LOADARGS_1(name, __arg1) \ - long int arg1 = (long int) (__arg1); \ - LOADARGS_0(name, 0); \ - extern void __illegally_sized_syscall_arg1 (void); \ - if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 8) \ - __illegally_sized_syscall_arg1 (); \ - r3 = arg1 -#define LOADARGS_2(name, __arg1, __arg2) \ - long int arg2 = (long int) (__arg2); \ - LOADARGS_1(name, __arg1); \ - extern void __illegally_sized_syscall_arg2 (void); \ - if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 8) \ - __illegally_sized_syscall_arg2 (); \ - r4 = arg2 -#define LOADARGS_3(name, __arg1, __arg2, __arg3) \ - long int arg3 = (long int) (__arg3); \ - LOADARGS_2(name, __arg1, __arg2); \ - extern void __illegally_sized_syscall_arg3 (void); \ - if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 8) \ - __illegally_sized_syscall_arg3 (); \ - r5 = arg3 -#define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ - long int arg4 = (long int) (__arg4); \ - LOADARGS_3(name, __arg1, __arg2, __arg3); \ - extern void __illegally_sized_syscall_arg4 (void); \ - if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 8) \ - __illegally_sized_syscall_arg4 (); \ - r6 = arg4 -#define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ - long int arg5 = (long int) (__arg5); \ - LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ - extern void __illegally_sized_syscall_arg5 (void); \ - if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 8) \ - __illegally_sized_syscall_arg5 (); \ - r7 = arg5 -#define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ - long int arg6 = (long int) (__arg6); \ - LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ - extern void __illegally_sized_syscall_arg6 (void); \ - if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 8) \ - __illegally_sized_syscall_arg6 (); \ - r8 = arg6 - -#define ASM_INPUT_0 "0" (r0) -#define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) -#define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) -#define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) -#define ASM_INPUT_4 ASM_INPUT_3, "4" (r6) -#define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) -#define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) - - -/* Pointer mangling support. */ -#if IS_IN (rtld) -/* We cannot use the thread descriptor because in ld.so we use setjmp - earlier than the descriptor is initialized. */ -#else -# ifdef __ASSEMBLER__ -# define PTR_MANGLE(reg, tmpreg) \ - ld tmpreg,POINTER_GUARD(r13); \ - xor reg,tmpreg,reg -# define PTR_MANGLE2(reg, tmpreg) \ - xor reg,tmpreg,reg -# define PTR_MANGLE3(destreg, reg, tmpreg) \ - ld tmpreg,POINTER_GUARD(r13); \ - xor destreg,tmpreg,reg -# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) -# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg) -# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg) -# else -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# endif -#endif /* In the PowerPC64 ABI, the unadorned F_GETLK* opcodes should be used even by largefile64 code. */ diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index 1f477a945d..01c26be24b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -16,10 +16,218 @@ License along with the GNU C Library; if not, see . */ +#ifndef _LINUX_POWERPC_SYSDEP_H +#define _LINUX_POWERPC_SYSDEP_H 1 + +#include +#include +#include + +/* Define __set_errno() for INLINE_SYSCALL macro below. */ +#ifndef __ASSEMBLER__ +#include +#endif + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +/* Define a macro which expands inline into the wrapper code for a system + call. This use is for internal calls that do not need to handle errors + normally. It will never touch errno. This returns just what the kernel + gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) + the negation of the return value in the kernel gets reverted. */ + +#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ + ({ \ + register void *r0 __asm__ ("r0"); \ + register long int r3 __asm__ ("r3"); \ + register long int r4 __asm__ ("r4"); \ + register long int r5 __asm__ ("r5"); \ + register long int r6 __asm__ ("r6"); \ + register long int r7 __asm__ ("r7"); \ + register long int r8 __asm__ ("r8"); \ + register type rval __asm__ ("r3"); \ + LOADARGS_##nr (funcptr, args); \ + __asm__ __volatile__ \ + ("mtctr %0\n\t" \ + "bctrl\n\t" \ + "mfcr %0\n\t" \ + "0:" \ + : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ + "+r" (r7), "+r" (r8) \ + : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ + err = (long int) r0; \ + __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ + rval; \ + }) + +#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ + INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) + +/* This version is for kernels that implement system calls that + behave like function calls as far as register saving. */ +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + INTERNAL_SYSCALL_DECL (sc_err); \ + long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ + if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ + sc_ret = -1L; \ + } \ + sc_ret; \ + }) + +/* Define a macro which expands inline into the wrapper code for a system + call. This use is for internal calls that do not need to handle errors + normally. It will never touch errno. This returns just what the kernel + gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) + the negation of the return value in the kernel gets reverted. */ + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ + ({ \ + register long int r0 __asm__ ("r0"); \ + register long int r3 __asm__ ("r3"); \ + register long int r4 __asm__ ("r4"); \ + register long int r5 __asm__ ("r5"); \ + register long int r6 __asm__ ("r6"); \ + register long int r7 __asm__ ("r7"); \ + register long int r8 __asm__ ("r8"); \ + LOADARGS_##nr (name, ##args); \ + __asm__ __volatile__ \ + ("sc\n\t" \ + "mfcr %0\n\t" \ + "0:" \ + : "=&r" (r0), \ + "=&r" (r3), "=&r" (r4), "=&r" (r5), \ + "=&r" (r6), "=&r" (r7), "=&r" (r8) \ + : ASM_INPUT_##nr \ + : "r9", "r10", "r11", "r12", \ + "cr0", "ctr", "memory"); \ + err = r0; \ + r3; \ + }) +#define INTERNAL_SYSCALL(name, err, nr, args...) \ + INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) + +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val, err) (val) + +#if defined(__PPC64__) || defined(__powerpc64__) +# define SYSCALL_ARG_SIZE 8 +#else +# define SYSCALL_ARG_SIZE 4 +#endif + +#define LOADARGS_0(name, dummy) \ + r0 = name +#define LOADARGS_1(name, __arg1) \ + long int arg1 = (long int) (__arg1); \ + LOADARGS_0(name, 0); \ + extern void __illegally_sized_syscall_arg1 (void); \ + if (__builtin_classify_type (__arg1) != 5 \ + && sizeof (__arg1) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg1 (); \ + r3 = arg1 +#define LOADARGS_2(name, __arg1, __arg2) \ + long int arg2 = (long int) (__arg2); \ + LOADARGS_1(name, __arg1); \ + extern void __illegally_sized_syscall_arg2 (void); \ + if (__builtin_classify_type (__arg2) != 5 \ + && sizeof (__arg2) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg2 (); \ + r4 = arg2 +#define LOADARGS_3(name, __arg1, __arg2, __arg3) \ + long int arg3 = (long int) (__arg3); \ + LOADARGS_2(name, __arg1, __arg2); \ + extern void __illegally_sized_syscall_arg3 (void); \ + if (__builtin_classify_type (__arg3) != 5 \ + && sizeof (__arg3) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg3 (); \ + r5 = arg3 +#define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ + long int arg4 = (long int) (__arg4); \ + LOADARGS_3(name, __arg1, __arg2, __arg3); \ + extern void __illegally_sized_syscall_arg4 (void); \ + if (__builtin_classify_type (__arg4) != 5 \ + && sizeof (__arg4) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg4 (); \ + r6 = arg4 +#define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ + long int arg5 = (long int) (__arg5); \ + LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ + extern void __illegally_sized_syscall_arg5 (void); \ + if (__builtin_classify_type (__arg5) != 5 \ + && sizeof (__arg5) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg5 (); \ + r7 = arg5 +#define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ + long int arg6 = (long int) (__arg6); \ + LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ + extern void __illegally_sized_syscall_arg6 (void); \ + if (__builtin_classify_type (__arg6) != 5 \ + && sizeof (__arg6) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg6 (); \ + r8 = arg6 + +#define ASM_INPUT_0 "0" (r0) +#define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) +#define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) +#define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) +#define ASM_INPUT_4 ASM_INPUT_3, "4" (r6) +#define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) +#define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) + + +/* Pointer mangling support. */ +#if defined(__PPC64__) || defined(__powerpc64__) +# define LOAD ld +# define TPREG r13 +#else +# define LOAD lwz +# define TPREG r2 +#endif + +#if IS_IN (rtld) +/* We cannot use the thread descriptor because in ld.so we use setjmp + earlier than the descriptor is initialized. */ +#else +# ifdef __ASSEMBLER__ +# define PTR_MANGLE(reg, tmpreg) \ + LOAD tmpreg,POINTER_GUARD(TPREG); \ + xor reg,tmpreg,reg +# define PTR_MANGLE2(reg, tmpreg) \ + xor reg,tmpreg,reg +# define PTR_MANGLE3(destreg, reg, tmpreg) \ + LOAD tmpreg,POINTER_GUARD(TPREG); \ + xor destreg,tmpreg,reg +# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) +# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg) +# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg) +# else +# define PTR_MANGLE(var) \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) +# define PTR_DEMANGLE(var) PTR_MANGLE (var) +# endif +#endif + +/* List of system calls which are supported as vsyscalls. */ #define VDSO_NAME "LINUX_2.6.15" #define VDSO_HASH 123718565 -/* List of system calls which are supported as vsyscalls. */ #if defined(__PPC64__) || defined(__powerpc64__) #define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres" #define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime" @@ -38,3 +246,5 @@ # define HAVE_SIGTRAMP_32 "__kernel_sigtramp32" # define HAVE_SIGTRAMP_RT32 "__kernel_sigtramp_rt32" #endif + +#endif /* _LINUX_POWERPC_SYSDEP_H */ From patchwork Mon Feb 10 19:20:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183249 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4416503ile; Mon, 10 Feb 2020 11:20:58 -0800 (PST) X-Google-Smtp-Source: APXvYqxW9htCPYXbXVcupAYqGWfOmWkjsnO+Ek0hTbsapI6WW/RrZmjax4Zdmj5uzlHwcxvKvMaO X-Received: by 2002:a05:6808:191:: with SMTP id w17mr373028oic.29.1581362458451; Mon, 10 Feb 2020 11:20:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362458; cv=none; d=google.com; s=arc-20160816; b=XEKZpLcqrtxZR/TV/2rk8Er73UcwPLWPw/r3kLE2TBGosB/YkjhYigBd1oWIFdu5va sc16SpmVhbrkLnn2JG6l+hxq+JdHUFl3j6vDs74RDx59zIc+wcpOifGoadjEZvHxFulc Ynimy/Cs9t0e+G703/EeLF4QzOCiJ1vwghdwxuxqADgvbeX8UgqTmRmMmc5oNCuWcTv+ 0NiIRXrUABSdYeBPzR8H9hW4TJNz5kQ5COzdiOP/jK4LuUlBmBOKla3CDQuCf6m2prR8 v7557699xmOkQqsUgwq0bYooSfVoOnR5xJgQoxVuG8FVCXvVV97RrtbKHXSUXWioP3z+ ALkw== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=bbY4FoCzx/kaR2OsmjBIfJemZ3C3lpEsAI/yK4576Hc=; b=lloMQPTCrk+FuHGD6VzbVLJKgCxKFdCwVKjLiFRiREIX+WkoLLxbBTxhhsKxuvjVpX YaRrhy1M3A4P0g/1WUEue9pSZRe/8YzAMStRdpi8pCXMev4KmTijnkpB/9PAoOomkLmR XGCvmCEbF+a7wsWdGnSfnYjzWR/jxsl8uMKxU5e03A4k0STtW/f5ff5UnIWDEFYWQyr8 +CSswwWYT8LbTJfliVcqN+td/tBaL7o87oj+Cgu0Hydu3yfDExPVt61zSkqLhfc9a5xl 4Z+3YxwjSCKnDXJoEXJMeP5Kj9RPEHyZsb2TvxgTiaAHoz1bVkB7A9Pvk+QcpIeBSgBf HAHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="P+k/YKsm"; dkim=pass header.i=@linaro.org header.s=google header.b=x9nk1cnx; spf=pass (google.com: domain of libc-alpha-return-109386-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109386-patch=linaro.org@sourceware.org"; dmarc=pass (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 y73si533839oia.246.2020.02.10.11.20.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:20:58 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109386-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.s=default header.b="P+k/YKsm"; dkim=pass header.i=@linaro.org header.s=google header.b=x9nk1cnx; spf=pass (google.com: domain of libc-alpha-return-109386-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109386-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Z7mYXmRoUI/pdCCU3igTu0qS3uobgQq lrJYbx41osYu9FK+8ic2t9VSGifxUlw7SK7jINwO5ovEBwMoVCiJkUbGc8SaVGME LRqdiiMxy2M7q6E91HNs3CtiDvjcYmRrzfHzeDA4sdFZJ/x0r4GFs5ejr8mJzK3N CjnDLYapWXuo= 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:subject:date:message-id:in-reply-to :references; s=default; bh=l2klbaUs0w1o9qUgOfXA7a8i8+g=; b=P+k/Y KsmG6vz8ulLKX03VjEyy/BwIlpBNx78CAxD/2/Rvk4y3LMBVSBLslDFBmPhYxCZZ eFGqvi8h5tx1HYLYNRMRUFdLcdvSfRQHSWzecSA4Pk65p2e6F0hPhgUGeKFVZoLb PT68qvmiZ9MYcmmhGf5ld1mTkqX1cbGnExeNM0= Received: (qmail 99001 invoked by alias); 10 Feb 2020 19:20:48 -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 98993 invoked by uid 89); 10 Feb 2020 19:20:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qt1-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=bbY4FoCzx/kaR2OsmjBIfJemZ3C3lpEsAI/yK4576Hc=; b=x9nk1cnxCJO42RQx9Ee6lBJDwW20LwV16K0ZoHVw+pNChXH8ueeWqq5+s9Bog1I+mt X6oysTYaNEtF7XO1kqNOQRrqszyCSar0tHwlLB+fwyqBN0/J9HHwOHpHjU0kiv5fP+4P oHSw8Jxyo7D0c6PbOiUyfew+nBkwfKd5NJcxO/mv9hWtZRU3QSmGImpL1+BKEyEKBq52 s+YORhMAIbHlbMhNWpJe+U5oXO/e4A3ylHxxbXwVf6EBYyCiv6CtHc4vzB0j1nk0FJED coQJxP+Le/5UVcLjikEtXGcrMHUBo44K0TRDRK6i6M3Tka33EAUM2DIvS7MakBLA0Xrj lklQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 02/15] powerpc: Use Linux kABI for syscall return Date: Mon, 10 Feb 2020 16:20:25 -0300 Message-Id: <20200210192038.23588-2-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> It changes the powerpc INTERNAL_VSYSCALL_CALL and INTERNAL_SYSCALL_NCS to return a negative value instead of returning the CR value on 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P follows the other Linux kABIS. Checked on powerpc64-linux-gnu, powerpc64le-linux-gnu, and powerpc-linux-gnu-power4. --- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index 01c26be24b..abdcfd4a63 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -60,9 +60,8 @@ : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ "+r" (r7), "+r" (r8) \ : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ - rval; \ + (long int) r0 & (1 << 28) ? -rval : rval; \ }) #define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ @@ -110,21 +109,20 @@ : ASM_INPUT_##nr \ : "r9", "r10", "r11", "r12", \ "cr0", "ctr", "memory"); \ - err = r0; \ - r3; \ + r0 & (1 << 28) ? -r3 : r3; \ }) #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) #undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL_ERROR_P #define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) + ((unsigned long) (val) >= (unsigned long) -4095) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (val) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #if defined(__PPC64__) || defined(__powerpc64__) # define SYSCALL_ARG_SIZE 8 From patchwork Mon Feb 10 19:20:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183250 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4416661ile; Mon, 10 Feb 2020 11:21:08 -0800 (PST) X-Google-Smtp-Source: APXvYqzktqDZZIJflce0rsBajCfkR6ODPItHyPf4/RLLAhuXANyJEygWF9Kha5Aapj8K7A7+CVlk X-Received: by 2002:aca:f354:: with SMTP id r81mr383753oih.90.1581362468879; Mon, 10 Feb 2020 11:21:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362468; cv=none; d=google.com; s=arc-20160816; b=B1LcuEIQuD+kCcDltnFUthVBKnfl8c6HNY9lAEsmWC2M3wL2o3hrcEKGD3sI+0ZNdH WE1334OBrYvAKIL1hLjCMG+4NTnx8V+IFr2wgNf9lTBCQPOnTQnUMkryj82Psoxy/D/t OmvLOMPQjEsFjhdD0+ID2pyLhhuquGSFRTgaW8sGe6DM/1/K3END2xyJlSnU4iJb3yPl hLYftfPWLWZRTJBFwz6i3w57GxZTDs/2TIzKmC5eCzYtxbjsvlU15IBr7frhDb+7mmmg SOJQmp6jEq6T2uyihoOJjpGZqo3qwt3NQl8zoGALA2Qt+/I+n2Rdd9tX0oO1UO6AZurf VvoQ== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=vBtaGkQvdEdfNfvZZN5eJFVDqdGpx0vyoU9rJahnsDE=; b=d8n2FbvC8IqMwc5l+pzTn1jGrL1DBSgOkByIrjkuqTaVX3aZ+utwM1LMGnZGD3RWWu 3wGqD1SYAivPzYyFBYyOeoD9rNej3jqYHMgh2yy7/F5XdQ9Jcca3d9IxxuuuLfI2VAYx V1BlTnTh6EjE98kLJwYg8ARv8EDUK9+MS8OZpW4EB36fMgK5bfW1HrbhinaVGh9vKNES bf/BNm7Mnz+fud81DCqH5H6f3O0piIoaM7bJtkR/RZcUa2nNgLM3iLJMzU0uCsLz71m/ X0BUZXBaO7dYTNR3IXWFpvfYKtNYkhWfKge+T/lkZABs0cbeU0/RPQ7srJLE5KmGt4Xp mIXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=PqDMn5EX; dkim=pass header.i=@linaro.org header.s=google header.b=vi3Cmu5s; spf=pass (google.com: domain of libc-alpha-return-109387-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109387-patch=linaro.org@sourceware.org"; dmarc=pass (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 m4si624733otn.281.2020.02.10.11.21.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:21:08 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109387-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.s=default header.b=PqDMn5EX; dkim=pass header.i=@linaro.org header.s=google header.b=vi3Cmu5s; spf=pass (google.com: domain of libc-alpha-return-109387-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109387-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=sbd1ILQAvYttrmx9PMTbG4m5teYjC53 4ulqX/5AaMPw6tU31nFtH1eiXGs59QeGfMJR1+kPA2ELaN9MQAS1ci3j5dm4AJpe 9MoBmE5fSZ6628nNmDZJmeEN9wW+gl7oP4xcUmY7+cPKxplol+SrWNXeWd9xBPaO vHI3Vb4BgvQM= 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:subject:date:message-id:in-reply-to :references; s=default; bh=Oc2kfW4qQ+Xp8rT9ErE9w7De8I4=; b=PqDMn 5EXJ8YTYHB/dw6PiMyc0hjNgpvnG39zqFVBctwrptnsCQ61KxoX7S15CUgs9B0/Q HwPysIgr2Y1aTO14aopyCETwg3UPpUQStN2zCPwh2EXvSWPXxWMO1hmnAQmS6o+F a1F1OQKZYeBaTEwRxdTLnMckSQynZu830IlUEE= Received: (qmail 99247 invoked by alias); 10 Feb 2020 19:20:50 -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 99133 invoked by uid 89); 10 Feb 2020 19:20:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=act X-HELO: mail-qk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=vBtaGkQvdEdfNfvZZN5eJFVDqdGpx0vyoU9rJahnsDE=; b=vi3Cmu5sUGLl64PpvLIfnBSSXyJpHeEBjsXTR8OTSNwcCwy0YE5S6SboC19IZZNICZ jqYdTq/UIwofNuozIOqrAsiZKgkDjYR/r/XpE9EVv1NocTD25cBVNJE3eqerIRHEzl0j vj0kY7uwMHHU14DoLotxMPk0nxvsQfaGr/GbvFP1rk45i5UQjbMtk7KsJFEO2Nb9yozo +IiTl6sc2qmyleSy6Q4iAS3xxy9pYYBZz2WEyWa7nxONEJK0y41b3hxwrNx7VLVP2s/V 9IjUms/YZ472WKaz2TLMC6toeS00Xq952/Ft+ODsieR70Cxymnml4w/uRoZiCJtt/yw0 JDIw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 03/15] sparc: Use Linux kABI for syscall return Date: Mon, 10 Feb 2020 16:20:26 -0300 Message-Id: <20200210192038.23588-3-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> It changes the sparc internal_syscall* macros to a negative value instead the 'g1' register value on 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P follows the other Linux kABIS. The redefinition of INTERNAL_VSYSCALL_CALL is also no longer required. Checked on sparc64-linux-gnu and sparcv9-linux-gnu. It fixes the sporadic issues on sparc32 where clock_nanosleep does not act as cancellation entrypoint. --- sysdeps/unix/sysv/linux/sparc/sysdep.h | 90 ++++++++++++-------------- 1 file changed, 41 insertions(+), 49 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index 0c32780d9c..67efa6f029 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -34,13 +34,6 @@ #else /* __ASSEMBLER__ */ -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - ({ \ - long _ret = funcptr (args); \ - err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \ - _ret; \ - }) - # define VDSO_NAME "LINUX_2.6" # define VDSO_HASH 61765110 @@ -65,112 +58,111 @@ }) #undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) \ - register long err __asm__("g1"); +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ - inline_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args) + internal_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args) #undef INTERNAL_SYSCALL_NCS #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - inline_syscall##nr(__SYSCALL_STRING, err, name, args) + internal_syscall##nr(__SYSCALL_STRING, err, name, args) #undef INTERNAL_SYSCALL_ERROR_P #define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((void) (val), __builtin_expect((err) != 0, 0)) + ((unsigned long) (val) >= (unsigned long) -4095) #undef INTERNAL_SYSCALL_ERRNO #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) -#define inline_syscall0(string,err,name,dummy...) \ +#define internal_syscall0(string,err,name,dummy...) \ ({ \ + register long __err __asm__("g1") = (name); \ register long __o0 __asm__ ("o0"); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err) : \ + __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ + "0" (__err) : \ __SYSCALL_CLOBBERS); \ - __o0; \ + __err == -1 ? -__o0 : __o0; \ }) -#define inline_syscall1(string,err,name,arg1) \ +#define internal_syscall1(string,err,name,arg1) \ ({ \ + register long __err __asm__("g1") = (name); \ register long __o0 __asm__ ("o0") = (long)(arg1); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0) : \ + __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ + "0" (__err), "1" (__o0) : \ __SYSCALL_CLOBBERS); \ - __o0; \ + __err == -1 ? -__o0 : __o0; \ }) -#define inline_syscall2(string,err,name,arg1,arg2) \ +#define internal_syscall2(string,err,name,arg1,arg2) \ ({ \ + register long __err __asm__("g1") = (name); \ register long __o0 __asm__ ("o0") = (long)(arg1); \ register long __o1 __asm__ ("o1") = (long)(arg2); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0), "r" (__o1) : \ + __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ + "0" (__err), "1" (__o0), "r" (__o1) : \ __SYSCALL_CLOBBERS); \ - __o0; \ + __err == -1 ? -__o0 : __o0; \ }) -#define inline_syscall3(string,err,name,arg1,arg2,arg3) \ +#define internal_syscall3(string,err,name,arg1,arg2,arg3) \ ({ \ + register long __err __asm__("g1") = (name); \ register long __o0 __asm__ ("o0") = (long)(arg1); \ register long __o1 __asm__ ("o1") = (long)(arg2); \ register long __o2 __asm__ ("o2") = (long)(arg3); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0), "r" (__o1), \ + __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ + "0" (__err), "1" (__o0), "r" (__o1), \ "r" (__o2) : \ __SYSCALL_CLOBBERS); \ - __o0; \ + __err == -1 ? -__o0 : __o0; \ }) -#define inline_syscall4(string,err,name,arg1,arg2,arg3,arg4) \ +#define internal_syscall4(string,err,name,arg1,arg2,arg3,arg4) \ ({ \ + register long __err __asm__("g1") = (name); \ register long __o0 __asm__ ("o0") = (long)(arg1); \ register long __o1 __asm__ ("o1") = (long)(arg2); \ register long __o2 __asm__ ("o2") = (long)(arg3); \ register long __o3 __asm__ ("o3") = (long)(arg4); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0), "r" (__o1), \ + __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ + "0" (__err), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3) : \ __SYSCALL_CLOBBERS); \ - __o0; \ + __err == -1 ? -__o0 : __o0; \ }) -#define inline_syscall5(string,err,name,arg1,arg2,arg3,arg4,arg5) \ +#define internal_syscall5(string,err,name,arg1,arg2,arg3,arg4,arg5) \ ({ \ + register long __err __asm__("g1") = (name); \ register long __o0 __asm__ ("o0") = (long)(arg1); \ register long __o1 __asm__ ("o1") = (long)(arg2); \ register long __o2 __asm__ ("o2") = (long)(arg3); \ register long __o3 __asm__ ("o3") = (long)(arg4); \ register long __o4 __asm__ ("o4") = (long)(arg5); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0), "r" (__o1), \ + __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ + "0" (__err), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4) : \ __SYSCALL_CLOBBERS); \ - __o0; \ + __err == -1 ? -__o0 : __o0; \ }) -#define inline_syscall6(string,err,name,arg1,arg2,arg3,arg4,arg5,arg6) \ +#define internal_syscall6(string,err,name,arg1,arg2,arg3,arg4,arg5,arg6)\ ({ \ + register long __err __asm__("g1") = (name); \ register long __o0 __asm__ ("o0") = (long)(arg1); \ register long __o1 __asm__ ("o1") = (long)(arg2); \ register long __o2 __asm__ ("o2") = (long)(arg3); \ register long __o3 __asm__ ("o3") = (long)(arg4); \ register long __o4 __asm__ ("o4") = (long)(arg5); \ register long __o5 __asm__ ("o5") = (long)(arg6); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0), "r" (__o1), \ + __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ + "0" (__err), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4), \ "r" (__o5) : \ __SYSCALL_CLOBBERS); \ - __o0; \ + __err == -1 ? -__o0 : __o0; \ }) #define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \ @@ -186,9 +178,9 @@ "0" (__g1), "1" (__o0), "2" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4) : \ __SYSCALL_CLOBBERS); \ - if (INTERNAL_SYSCALL_ERROR_P (__o0, __g1)) \ + if (__glibc_unlikely (__g1 != 0)) \ { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (__o0, __g1)); \ + __set_errno (__o0); \ __o0 = -1L; \ } \ else \ From patchwork Mon Feb 10 19:20:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183253 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4417187ile; Mon, 10 Feb 2020 11:21:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxGExFcvXqqQeoTQ42Ga4Z4k1l/fmiaPok3l8r3neVbkYKuE1PHtMKmDzqvAjlXBEVwuFaP X-Received: by 2002:aca:aa05:: with SMTP id t5mr375955oie.93.1581362503138; Mon, 10 Feb 2020 11:21:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362503; cv=none; d=google.com; s=arc-20160816; b=U3EO16fKp9C4Nb6G4akYWiX105fs0MOknmDNBmke+q/spA6hWx7KLmMaTkdrjs8Szm ZR65lirOwcFyK7bckd46fXki2cuixfVuOEOyWtftzQ0V34ioUdHiaJWYFzWhQP+KJSLe R1Q6792ptz7xpe3X4wQxuU/fScY0OaaXlmEJkSErI3jVCiMEPyfGdSo3Uqt//FOw2Fk/ 3RjqEE8BIqM0AnTLEo530SyKia8Kj2lkMpLvqBMdAXmCVYjubEy+1iC8GjQNaZPX7qtw VOKJ4ZVjTSm6Cbp2ugRQMOgvH5+NvofjKgE0MOpajaxPmkjzr32+5mtalQ2cwDEwEG/K wd5Q== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=KKIsM6K+Sw9tL8/EQUjrldtm1V1EpjjLWkg7S/EJcsU=; b=xzFEglS88yxYP7/eNtX0tfRW85F41y7C7+raK5ptV1fSrdt3yPQyzpo594/EaFL/ao GswzlHCs/vCLsNPcQSAIr7AEDXRg7G2eckThusVTN8UFF8+aYD0yqfKqGKhbu5SCxQ8o 8/Oq/5oB1R4hOWndH78YCWpJYr26jN/WH1xPqIk5EzGRQvCOozA0W5xKH97IDWBMBNMH Y0WDbao04zawxQ4KOJnTNikkxloDFpe+S+f7dQKG+i/FptDlCmaY8oqt6eUCp1pm9vYq X8UFcGVvGHLK+eqQ7oqFF47GZxMhxFX2l1wGKK2pnV3TPgZpORo9wjcTy9ePBW443kkD 4ZGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=ct8c5urR; dkim=pass header.i=@linaro.org header.s=google header.b=zLkPGL0v; spf=pass (google.com: domain of libc-alpha-return-109390-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109390-patch=linaro.org@sourceware.org"; dmarc=pass (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 n25si572794oij.175.2020.02.10.11.21.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:21:43 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109390-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.s=default header.b=ct8c5urR; dkim=pass header.i=@linaro.org header.s=google header.b=zLkPGL0v; spf=pass (google.com: domain of libc-alpha-return-109390-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109390-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=luZB3zwKXdx2aJOdDXzV4cneF+sNau0 yVoiNaCRSaBCcNgDtm1kbGcNhiwRQpZKbPLvUx4UY5FqC4nFNFufpuXBzqi6p/jx XWo2LJ9R9disaQJHR4SXwgGriOBLrnKpWshVnSVmqm5mse8evIuL1QZgyu2HUGmi Um3qPn4f1rkI= 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:subject:date:message-id:in-reply-to :references; s=default; bh=fH43JH9qHv6JpJFVMGOnqZ0Fs+8=; b=ct8c5 urRghuZqEP349iLRHSd+w96PdOsTc9zyk+ckulNTrN+EWTgJcFU3KBqrUbD2ilQ8 sVOD+hgagotMbe+mggbYUHgS8ney2chzCS2w/Zwezd4huUDdhebuu7mXLcLEqxxi hXIc8vr9DiE22xqVELdrQubNVbA0+p5FyN83L8= Received: (qmail 99984 invoked by alias); 10 Feb 2020 19:20:55 -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 99888 invoked by uid 89); 10 Feb 2020 19:20:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=$20, prof, signextends, sign-extends X-HELO: mail-qk1-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=KKIsM6K+Sw9tL8/EQUjrldtm1V1EpjjLWkg7S/EJcsU=; b=zLkPGL0vSnNz5Gyk9NNBh9Ozk4poLIoY9rRXKvBQcrIchoYILz2wvV044sfskwuk0T kB8lQUeH0NezU/V3K8tK4Z7cJbjGtxhH8JlQVNSU0t+al2TJ/VmRXPicSNyrI/2128xO NWwAJ7KU/a1p+EbtFmvnZl4gzBvwusSfz7HFauQUfkoUmp49mbnvDLGdZHiDpXmlUVyO WnSCHvDq5eKSNdqJtTvNf5yNWkgl71HoPw2iYt8WUpf9Q3UP64J1wP76kzqrJq41LcpX nDWdJnesbnTQdbzHiCv+ngz9sOd4ejrrQ+EAC0GQ+SBQxuzThDO/usItIWB+t3mzK/ds OMqQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 04/15] alpha: Refactor syscall and Use Linux kABI for syscall return Date: Mon, 10 Feb 2020 16:20:27 -0300 Message-Id: <20200210192038.23588-4-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> It highly unlikely that alpha will be ported to anything else than Linux, so this patch moves the generic unix syscall definition to Linux and adapt it to Linux kernel ABI. It changes the internal_syscall* macros to return a negative value instead of '$19' register value on 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P follows the other Linux kABIS. Checked on alpha-linux-gnu. --- sysdeps/unix/alpha/sysdep.h | 382 ------------------------- sysdeps/unix/sysv/linux/alpha/ioperm.c | 7 +- sysdeps/unix/sysv/linux/alpha/sysdep.h | 354 ++++++++++++++++++++++- 3 files changed, 348 insertions(+), 395 deletions(-) delete mode 100644 sysdeps/unix/alpha/sysdep.h -- 2.17.1 diff --git a/sysdeps/unix/alpha/sysdep.h b/sysdeps/unix/alpha/sysdep.h deleted file mode 100644 index 74db6b02b2..0000000000 --- a/sysdeps/unix/alpha/sysdep.h +++ /dev/null @@ -1,382 +0,0 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Brendan Kehoe (brendan@zen.org). - - 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 -#include /* Defines RTLD_PRIVATE_ERRNO. */ - -#ifdef __ASSEMBLER__ - -#ifdef __linux__ -# include -#else -# include -#endif - -#define __LABEL(x) x##: - -#define LEAF(name, framesize) \ - .globl name; \ - .align 4; \ - .ent name, 0; \ - __LABEL(name) \ - .frame sp, framesize, ra - -#define ENTRY(name) \ - .globl name; \ - .align 4; \ - .ent name, 0; \ - __LABEL(name) \ - .frame sp, 0, ra - -/* Mark the end of function SYM. */ -#undef END -#define END(sym) .end sym - -#ifdef PROF -# define PSEUDO_PROF \ - .set noat; \ - lda AT, _mcount; \ - jsr AT, (AT), _mcount; \ - .set at -#else -# define PSEUDO_PROF -#endif - -#ifdef PROF -# define PSEUDO_PROLOGUE \ - .frame sp, 0, ra; \ - ldgp gp,0(pv); \ - PSEUDO_PROF; \ - .prologue 1 -#elif defined PIC -# define PSEUDO_PROLOGUE \ - .frame sp, 0, ra; \ - .prologue 0 -#else -# define PSEUDO_PROLOGUE \ - .frame sp, 0, ra; \ - ldgp gp,0(pv); \ - .prologue 1 -#endif /* PROF */ - -#ifdef PROF -# define USEPV_PROF std -#else -# define USEPV_PROF no -#endif - -#if RTLD_PRIVATE_ERRNO -# define SYSCALL_ERROR_LABEL $syscall_error -# define SYSCALL_ERROR_HANDLER \ -$syscall_error: \ - stl v0, rtld_errno(gp) !gprel; \ - lda v0, -1; \ - ret -# define SYSCALL_ERROR_FALLTHRU -#elif defined(PIC) -# define SYSCALL_ERROR_LABEL __syscall_error !samegp -# define SYSCALL_ERROR_HANDLER -# define SYSCALL_ERROR_FALLTHRU br SYSCALL_ERROR_LABEL -#else -# define SYSCALL_ERROR_LABEL $syscall_error -# define SYSCALL_ERROR_HANDLER \ -$syscall_error: \ - jmp $31, __syscall_error -# define SYSCALL_ERROR_FALLTHRU -#endif /* RTLD_PRIVATE_ERRNO */ - -/* Overridden by specific syscalls. */ -#undef PSEUDO_PREPARE_ARGS -#define PSEUDO_PREPARE_ARGS /* Nothing. */ - -#define PSEUDO(name, syscall_name, args) \ - .globl name; \ - .align 4; \ - .ent name,0; \ -__LABEL(name) \ - PSEUDO_PROLOGUE; \ - PSEUDO_PREPARE_ARGS \ - lda v0, SYS_ify(syscall_name); \ - call_pal PAL_callsys; \ - bne a3, SYSCALL_ERROR_LABEL - -#undef PSEUDO_END -#define PSEUDO_END(sym) \ - SYSCALL_ERROR_HANDLER; \ - END(sym) - -#define PSEUDO_NOERRNO(name, syscall_name, args) \ - .globl name; \ - .align 4; \ - .ent name,0; \ -__LABEL(name) \ - PSEUDO_PROLOGUE; \ - PSEUDO_PREPARE_ARGS \ - lda v0, SYS_ify(syscall_name); \ - call_pal PAL_callsys; - -#undef PSEUDO_END_NOERRNO -#define PSEUDO_END_NOERRNO(sym) END(sym) - -#define ret_NOERRNO ret - -#define PSEUDO_ERRVAL(name, syscall_name, args) \ - .globl name; \ - .align 4; \ - .ent name,0; \ -__LABEL(name) \ - PSEUDO_PROLOGUE; \ - PSEUDO_PREPARE_ARGS \ - lda v0, SYS_ify(syscall_name); \ - call_pal PAL_callsys; - -#undef PSEUDO_END_ERRVAL -#define PSEUDO_END_ERRVAL(sym) END(sym) - -#define ret_ERRVAL ret - -#define r0 v0 -#define r1 a4 - -#define MOVE(x,y) mov x,y - -#else /* !ASSEMBLER */ - -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#include - -/* ??? Linux needs to be able to override INLINE_SYSCALL for one - particular special case. Make this easy. */ - -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - INLINE_SYSCALL1(name, nr, args) - -#define INLINE_SYSCALL1(name, nr, args...) \ -({ \ - long _sc_ret, _sc_err; \ - inline_syscall##nr(__NR_##name, args); \ - if (__builtin_expect (_sc_err, 0)) \ - { \ - __set_errno (_sc_ret); \ - _sc_ret = -1L; \ - } \ - _sc_ret; \ -}) - -#define INTERNAL_SYSCALL(name, err_out, nr, args...) \ - INTERNAL_SYSCALL1(name, err_out, nr, args) - -#define INTERNAL_SYSCALL1(name, err_out, nr, args...) \ - INTERNAL_SYSCALL_NCS(__NR_##name, err_out, nr, args) - -#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \ -({ \ - long _sc_ret, _sc_err; \ - inline_syscall##nr(name, args); \ - err_out = _sc_err; \ - _sc_ret; \ -}) - -#define INTERNAL_SYSCALL_DECL(err) \ - long int err __attribute__((unused)) - -/* The normal Alpha calling convention sign-extends 32-bit quantties - no matter what the "real" sign of the 32-bit type. We want to - preserve that when filling in values for the kernel. */ -#define syscall_promote(arg) \ - (sizeof (arg) == 4 ? (long)(int)(long)(arg) : (long)(arg)) - -/* Make sure and "use" the variable that we're not returning, - in order to suppress unused variable warnings. */ -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void)val, err) -#define INTERNAL_SYSCALL_ERRNO(val, err) ((void)err, val) - -#define inline_syscall_clobbers \ - "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ - "$22", "$23", "$24", "$25", "$27", "$28", "memory" - -/* It is moderately important optimization-wise to limit the lifetime - of the hard-register variables as much as possible. Thus we copy - in/out as close to the asm as possible. */ - -#define inline_syscall0(name, args...) \ -{ \ - register long _sc_19 __asm__("$19"); \ - register long _sc_0 = name; \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2" \ - : "+v"(_sc_0), "=r"(_sc_19) \ - : : inline_syscall_clobbers, \ - "$16", "$17", "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall1(name,arg1) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_19 __asm__("$19"); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3" \ - : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \ - : : inline_syscall_clobbers, \ - "$17", "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall2(name,arg1,arg2) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _tmp_17 = syscall_promote (arg2); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_17 __asm__("$17") = _tmp_17; \ - register long _sc_19 __asm__("$19"); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4" \ - : "+v"(_sc_0), "=r"(_sc_19), \ - "+r"(_sc_16), "+r"(_sc_17) \ - : : inline_syscall_clobbers, \ - "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall3(name,arg1,arg2,arg3) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _tmp_17 = syscall_promote (arg2); \ - register long _tmp_18 = syscall_promote (arg3); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_17 __asm__("$17") = _tmp_17; \ - register long _sc_18 __asm__("$18") = _tmp_18; \ - register long _sc_19 __asm__("$19"); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5" \ - : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \ - "+r"(_sc_17), "+r"(_sc_18) \ - : : inline_syscall_clobbers, "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall4(name,arg1,arg2,arg3,arg4) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _tmp_17 = syscall_promote (arg2); \ - register long _tmp_18 = syscall_promote (arg3); \ - register long _tmp_19 = syscall_promote (arg4); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_17 __asm__("$17") = _tmp_17; \ - register long _sc_18 __asm__("$18") = _tmp_18; \ - register long _sc_19 __asm__("$19") = _tmp_19; \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \ - : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ - "+r"(_sc_17), "+r"(_sc_18) \ - : : inline_syscall_clobbers, "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _tmp_17 = syscall_promote (arg2); \ - register long _tmp_18 = syscall_promote (arg3); \ - register long _tmp_19 = syscall_promote (arg4); \ - register long _tmp_20 = syscall_promote (arg5); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_17 __asm__("$17") = _tmp_17; \ - register long _sc_18 __asm__("$18") = _tmp_18; \ - register long _sc_19 __asm__("$19") = _tmp_19; \ - register long _sc_20 __asm__("$20") = _tmp_20; \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \ - : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ - "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \ - : : inline_syscall_clobbers, "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _tmp_17 = syscall_promote (arg2); \ - register long _tmp_18 = syscall_promote (arg3); \ - register long _tmp_19 = syscall_promote (arg4); \ - register long _tmp_20 = syscall_promote (arg5); \ - register long _tmp_21 = syscall_promote (arg6); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_17 __asm__("$17") = _tmp_17; \ - register long _sc_18 __asm__("$18") = _tmp_18; \ - register long _sc_19 __asm__("$19") = _tmp_19; \ - register long _sc_20 __asm__("$20") = _tmp_20; \ - register long _sc_21 __asm__("$21") = _tmp_21; \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \ - : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ - "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \ - "+r"(_sc_21) \ - : : inline_syscall_clobbers); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} -#endif /* ASSEMBLER */ - -/* Pointer mangling support. Note that tls access is slow enough that - we don't deoptimize things by placing the pointer check value there. */ - -#ifdef __ASSEMBLER__ -# if IS_IN (rtld) -# define PTR_MANGLE(dst, src, tmp) \ - ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ - ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ - xor src, tmp, dst -# define PTR_MANGLE2(dst, src, tmp) \ - xor src, tmp, dst -# elif defined SHARED -# define PTR_MANGLE(dst, src, tmp) \ - ldq tmp, __pointer_chk_guard; \ - xor src, tmp, dst -# else -# define PTR_MANGLE(dst, src, tmp) \ - ldq tmp, __pointer_chk_guard_local; \ - xor src, tmp, dst -# endif -# define PTR_MANGLE2(dst, src, tmp) \ - xor src, tmp, dst -# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) -# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) -#else -# include -# if (IS_IN (rtld) \ - || (!defined SHARED && (IS_IN (libc) \ - || IS_IN (libpthread)))) -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - (var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard) -# endif -# define PTR_DEMANGLE(var) PTR_MANGLE(var) -#endif /* ASSEMBLER */ diff --git a/sysdeps/unix/sysv/linux/alpha/ioperm.c b/sysdeps/unix/sysv/linux/alpha/ioperm.c index 086c782b9f..cf775674b4 100644 --- a/sysdeps/unix/sysv/linux/alpha/ioperm.c +++ b/sysdeps/unix/sysv/linux/alpha/ioperm.c @@ -196,12 +196,7 @@ stl_mb(unsigned int val, unsigned long addr) static inline void __sethae(unsigned long value) { - register unsigned long r16 __asm__("$16") = value; - register unsigned long r0 __asm__("$0") = __NR_sethae; - __asm__ __volatile__ ("callsys" - : "=r"(r0) - : "0"(r0), "r" (r16) - : inline_syscall_clobbers, "$19"); + INLINE_SYSCALL_CALL (sethae, value); } extern long __pciconfig_iobase(enum __pciconfig_iobase_which __which, diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h index f8c9e589ec..ca0b4e475c 100644 --- a/sysdeps/unix/sysv/linux/alpha/sysdep.h +++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h @@ -19,14 +19,10 @@ #ifndef _LINUX_ALPHA_SYSDEP_H #define _LINUX_ALPHA_SYSDEP_H 1 -#ifdef __ASSEMBLER__ -#include -#include -#endif - /* There is some commonality. */ #include -#include +#include +#include /* Defines RTLD_PRIVATE_ERRNO. */ #include @@ -39,4 +35,348 @@ #define SINGLE_THREAD_BY_GLOBAL 1 -#endif /* _LINUX_ALPHA_SYSDEP_H */ +#ifdef __ASSEMBLER__ +#include +#include + +#define __LABEL(x) x##: + +#define LEAF(name, framesize) \ + .globl name; \ + .align 4; \ + .ent name, 0; \ + __LABEL(name) \ + .frame sp, framesize, ra + +#define ENTRY(name) \ + .globl name; \ + .align 4; \ + .ent name, 0; \ + __LABEL(name) \ + .frame sp, 0, ra + +/* Mark the end of function SYM. */ +#undef END +#define END(sym) .end sym + +#ifdef PROF +# define PSEUDO_PROF \ + .set noat; \ + lda AT, _mcount; \ + jsr AT, (AT), _mcount; \ + .set at +#else +# define PSEUDO_PROF +#endif + +#ifdef PROF +# define PSEUDO_PROLOGUE \ + .frame sp, 0, ra; \ + ldgp gp,0(pv); \ + PSEUDO_PROF; \ + .prologue 1 +#elif defined PIC +# define PSEUDO_PROLOGUE \ + .frame sp, 0, ra; \ + .prologue 0 +#else +# define PSEUDO_PROLOGUE \ + .frame sp, 0, ra; \ + ldgp gp,0(pv); \ + .prologue 1 +#endif /* PROF */ + +#ifdef PROF +# define USEPV_PROF std +#else +# define USEPV_PROF no +#endif + +#if RTLD_PRIVATE_ERRNO +# define SYSCALL_ERROR_LABEL $syscall_error +# define SYSCALL_ERROR_HANDLER \ +$syscall_error: \ + stl v0, rtld_errno(gp) !gprel; \ + lda v0, -1; \ + ret +# define SYSCALL_ERROR_FALLTHRU +#elif defined(PIC) +# define SYSCALL_ERROR_LABEL __syscall_error !samegp +# define SYSCALL_ERROR_HANDLER +# define SYSCALL_ERROR_FALLTHRU br SYSCALL_ERROR_LABEL +#else +# define SYSCALL_ERROR_LABEL $syscall_error +# define SYSCALL_ERROR_HANDLER \ +$syscall_error: \ + jmp $31, __syscall_error +# define SYSCALL_ERROR_FALLTHRU +#endif /* RTLD_PRIVATE_ERRNO */ + +/* Overridden by specific syscalls. */ +#undef PSEUDO_PREPARE_ARGS +#define PSEUDO_PREPARE_ARGS /* Nothing. */ + +#define PSEUDO(name, syscall_name, args) \ + .globl name; \ + .align 4; \ + .ent name,0; \ +__LABEL(name) \ + PSEUDO_PROLOGUE; \ + PSEUDO_PREPARE_ARGS \ + lda v0, SYS_ify(syscall_name); \ + call_pal PAL_callsys; \ + bne a3, SYSCALL_ERROR_LABEL + +#undef PSEUDO_END +#define PSEUDO_END(sym) \ + SYSCALL_ERROR_HANDLER; \ + END(sym) + +#define PSEUDO_NOERRNO(name, syscall_name, args) \ + .globl name; \ + .align 4; \ + .ent name,0; \ +__LABEL(name) \ + PSEUDO_PROLOGUE; \ + PSEUDO_PREPARE_ARGS \ + lda v0, SYS_ify(syscall_name); \ + call_pal PAL_callsys; + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO(sym) END(sym) + +#define ret_NOERRNO ret + +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + .globl name; \ + .align 4; \ + .ent name,0; \ +__LABEL(name) \ + PSEUDO_PROLOGUE; \ + PSEUDO_PREPARE_ARGS \ + lda v0, SYS_ify(syscall_name); \ + call_pal PAL_callsys; + +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(sym) END(sym) + +#define ret_ERRVAL ret + +#define r0 v0 +#define r1 a4 + +#define MOVE(x,y) mov x,y + +#else /* !ASSEMBLER */ + +/* In order to get __set_errno() definition in INLINE_SYSCALL. */ +#include + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ +({ \ + INTERNAL_SYSCALL_DECL (_sc_err); \ + long int _sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ + if (INTERNAL_SYSCALL_ERROR_P (_sc_ret, _sc_err)) \ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_sc_ret, _sc_err)); \ + _sc_ret = -1L; \ + } \ + _sc_ret; \ +}) + +#define INTERNAL_SYSCALL(name, err_out, nr, args...) \ + internal_syscall##nr(__NR_##name, args) + +#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \ + internal_syscall##nr(name, args) + +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + +/* The normal Alpha calling convention sign-extends 32-bit quantties + no matter what the "real" sign of the 32-bit type. We want to + preserve that when filling in values for the kernel. */ +#define syscall_promote(arg) \ + (sizeof (arg) == 4 ? (long)(int)(long)(arg) : (long)(arg)) + +/* Make sure and "use" the variable that we're not returning, + in order to suppress unused variable warnings. */ +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= (unsigned long) -4095) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) + +#define internal_syscall_clobbers \ + "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ + "$22", "$23", "$24", "$25", "$27", "$28", "memory" + +/* It is moderately important optimization-wise to limit the lifetime + of the hard-register variables as much as possible. Thus we copy + in/out as close to the asm as possible. */ + +#define internal_syscall0(name, args...) \ +({ \ + register long _sc_19 __asm__("$19"); \ + register long _sc_0 = name; \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2" \ + : "+v"(_sc_0), "=r"(_sc_19) \ + : : internal_syscall_clobbers, \ + "$16", "$17", "$18", "$20", "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall1(name,arg1) \ +({ \ + register long _tmp_16 = syscall_promote (arg1); \ + register long _sc_0 = name; \ + register long _sc_16 __asm__("$16") = _tmp_16; \ + register long _sc_19 __asm__("$19"); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3" \ + : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \ + : : internal_syscall_clobbers, \ + "$17", "$18", "$20", "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall2(name,arg1,arg2) \ +({ \ + register long _tmp_16 = syscall_promote (arg1); \ + register long _tmp_17 = syscall_promote (arg2); \ + register long _sc_0 = name; \ + register long _sc_16 __asm__("$16") = _tmp_16; \ + register long _sc_17 __asm__("$17") = _tmp_17; \ + register long _sc_19 __asm__("$19"); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4" \ + : "+v"(_sc_0), "=r"(_sc_19), \ + "+r"(_sc_16), "+r"(_sc_17) \ + : : internal_syscall_clobbers, \ + "$18", "$20", "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall3(name,arg1,arg2,arg3) \ +({ \ + register long _tmp_16 = syscall_promote (arg1); \ + register long _tmp_17 = syscall_promote (arg2); \ + register long _tmp_18 = syscall_promote (arg3); \ + register long _sc_0 = name; \ + register long _sc_16 __asm__("$16") = _tmp_16; \ + register long _sc_17 __asm__("$17") = _tmp_17; \ + register long _sc_18 __asm__("$18") = _tmp_18; \ + register long _sc_19 __asm__("$19"); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5" \ + : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \ + "+r"(_sc_17), "+r"(_sc_18) \ + : : internal_syscall_clobbers, "$20", "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall4(name,arg1,arg2,arg3,arg4) \ +({ \ + register long _tmp_16 = syscall_promote (arg1); \ + register long _tmp_17 = syscall_promote (arg2); \ + register long _tmp_18 = syscall_promote (arg3); \ + register long _tmp_19 = syscall_promote (arg4); \ + register long _sc_0 = name; \ + register long _sc_16 __asm__("$16") = _tmp_16; \ + register long _sc_17 __asm__("$17") = _tmp_17; \ + register long _sc_18 __asm__("$18") = _tmp_18; \ + register long _sc_19 __asm__("$19") = _tmp_19; \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \ + : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ + "+r"(_sc_17), "+r"(_sc_18) \ + : : internal_syscall_clobbers, "$20", "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ +({ \ + register long _tmp_16 = syscall_promote (arg1); \ + register long _tmp_17 = syscall_promote (arg2); \ + register long _tmp_18 = syscall_promote (arg3); \ + register long _tmp_19 = syscall_promote (arg4); \ + register long _tmp_20 = syscall_promote (arg5); \ + register long _sc_0 = name; \ + register long _sc_16 __asm__("$16") = _tmp_16; \ + register long _sc_17 __asm__("$17") = _tmp_17; \ + register long _sc_18 __asm__("$18") = _tmp_18; \ + register long _sc_19 __asm__("$19") = _tmp_19; \ + register long _sc_20 __asm__("$20") = _tmp_20; \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \ + : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ + "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \ + : : internal_syscall_clobbers, "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ +({ \ + register long _tmp_16 = syscall_promote (arg1); \ + register long _tmp_17 = syscall_promote (arg2); \ + register long _tmp_18 = syscall_promote (arg3); \ + register long _tmp_19 = syscall_promote (arg4); \ + register long _tmp_20 = syscall_promote (arg5); \ + register long _tmp_21 = syscall_promote (arg6); \ + register long _sc_0 = name; \ + register long _sc_16 __asm__("$16") = _tmp_16; \ + register long _sc_17 __asm__("$17") = _tmp_17; \ + register long _sc_18 __asm__("$18") = _tmp_18; \ + register long _sc_19 __asm__("$19") = _tmp_19; \ + register long _sc_20 __asm__("$20") = _tmp_20; \ + register long _sc_21 __asm__("$21") = _tmp_21; \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \ + : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ + "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \ + "+r"(_sc_21) \ + : : internal_syscall_clobbers); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) +#endif /* ASSEMBLER */ + +/* Pointer mangling support. Note that tls access is slow enough that + we don't deoptimize things by placing the pointer check value there. */ + +#ifdef __ASSEMBLER__ +# if IS_IN (rtld) +# define PTR_MANGLE(dst, src, tmp) \ + ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ + ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ + xor src, tmp, dst +# define PTR_MANGLE2(dst, src, tmp) \ + xor src, tmp, dst +# elif defined SHARED +# define PTR_MANGLE(dst, src, tmp) \ + ldq tmp, __pointer_chk_guard; \ + xor src, tmp, dst +# else +# define PTR_MANGLE(dst, src, tmp) \ + ldq tmp, __pointer_chk_guard_local; \ + xor src, tmp, dst +# endif +# define PTR_MANGLE2(dst, src, tmp) \ + xor src, tmp, dst +# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) +# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) +#else +# include +# if (IS_IN (rtld) \ + || (!defined SHARED && (IS_IN (libc) \ + || IS_IN (libpthread)))) +extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; +# define PTR_MANGLE(var) \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) +# else +extern uintptr_t __pointer_chk_guard attribute_relro; +# define PTR_MANGLE(var) \ + (var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard) +# endif +# define PTR_DEMANGLE(var) PTR_MANGLE(var) +#endif /* ASSEMBLER */ + +#endif /* _LINUX_ALPHA_SYSDEP_H */ From patchwork Mon Feb 10 19:20:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183252 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4417032ile; Mon, 10 Feb 2020 11:21:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwNNyH74M4p2KU6Z14FUS86SUgWkvdwWxrcUNW8Ouj+YoXhggjWwRBKgANT62syhCNvoFmW X-Received: by 2002:a9d:5784:: with SMTP id q4mr2276398oth.278.1581362492232; Mon, 10 Feb 2020 11:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362492; cv=none; d=google.com; s=arc-20160816; b=cME8JRJ3z7ipZuIzP0rV0Lq5cn6yfLLG5dlG7x5BmpiuOB+KH+3jT19d6DrMAmq+ku zHzv21ntMZqSsad3bUqEld+I2LrzawlD/pTv8PHZskyhh1N+qqht9gfkmtoYjqn5utXr KTtQTO5hOL0/xFsXfTnHoz4ulWHIYA0Qx6rwrMa0gsaM02TqrUDLbrlFM7A3Q7VNrG9W TbaxutVb2puWWy+BjOkWP+HvHVfv3s1LH/VhBSq7v1IIo497IZpqqtuNHV8lA3436zAq uGE9+Z4eCSCuaghYeIS1ZwRnXnQSuMe3ijg2fLi8GUA4wscRxxK/hRczxK992rL7T7vB 8EsA== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=S43wVYPdux/smuBWSJYWugyZ1VbDkDBXM8i/9Kb3fcw=; b=PnKHCuWvzVCCYRBkAc3j5fPMihQy78Wi39FZl6wwpuoL8FSEorqkAb29GDUS1+ZEAO kOzfNDNz7jOS1dkUl9kI1+xIwBP+VGC7rMeNBkttVedtILex6WTNtmdOqAhRwfnScLpp 51DJgkPReKLiztQDRwo/bSNhWYN35TjvQT9UHjEYc80tCV1dTpeokcXr6mGCCHabV5uH 8qdwo9aHwIgKPDoic8FKX4AtbMxo8EzWJ0ESHs0mR0lSmT31UroPUD7VQ177iOm0m1HJ LN3oQdwo/3Bn7jF8ZGtJcSrVMVlOGko9KFrIw3QyJxRnXxq7Dhl4P+3ZB1WUD6bwO5Cy zDPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Wk5OBYDJ; dkim=pass header.i=@linaro.org header.s=google header.b=m50Mv1jm; spf=pass (google.com: domain of libc-alpha-return-109389-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109389-patch=linaro.org@sourceware.org"; dmarc=pass (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 j1si647852otn.53.2020.02.10.11.21.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:21:32 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109389-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.s=default header.b=Wk5OBYDJ; dkim=pass header.i=@linaro.org header.s=google header.b=m50Mv1jm; spf=pass (google.com: domain of libc-alpha-return-109389-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109389-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=gsh4Xinfbos31/q4mHGpBcdH9pU5XCs pWC7IiPKvqsulsUy2m7dBv78WeSyRAYaBrxxw2mSsHgpzzJUM6Xr3XcNBB1JIrtU /H8lxNPrcgqdacw03MeFUsanN8vpfEKZ6Sx4hG3YrzZ7DBn8/vVqHoxV3YgWip7k tUDNKIoRGGdA= 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:subject:date:message-id:in-reply-to :references; s=default; bh=um4P7/eHqqKyol8xPe0Nq4xF8ls=; b=Wk5OB YDJe+naZO+S3WAfs3wHdPXeP/PTFQfHnQidpvrKbZ0dn5JoLdKFWK1qN4mGIDIMB D4h31u5ebI66gg8UDYNbd3RoY7h6jr34qcJeoNMvnl9koZARceXivcP4NX+zgxxf 5LkRGy4iZRLLwF06COpThaNWWIa8mESsKwoZwE= Received: (qmail 99676 invoked by alias); 10 Feb 2020 19:20:53 -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 99489 invoked by uid 89); 10 Feb 2020 19:20:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qt1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=S43wVYPdux/smuBWSJYWugyZ1VbDkDBXM8i/9Kb3fcw=; b=m50Mv1jmTzPbr2pJprQfi7iTIxdSW8nl9y0A+z1mchg2n15+p6QVx8GbPKYebo0Fbs bBefwIqhqurMOMejl/t0Do/owqXrhoN5lAeZqOBTdA9ni1DWh01IgNNmKNsl2qZs++xZ nuUtE1YgH8HFLAM3nOG3u2b5FxN0DmVZ69rgTQ6HZ/xtaLmfbfVRH6OdcJersE7NNrjz VJotgs3YgprY4gDr/2yVtB6gzkfxRkvaTYsU64sY6uMmf3bCOCQQbTMAqh4iJSOTCbX4 /zWlK1ucOqFZ+tkKrbGDuJtfySJVXHP9UAeR8eIJlm/UUEIhjVuD70K1EpZyu1IE7qnc j0aQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 05/15] ia64: Use Linux kABI for syscall return Date: Mon, 10 Feb 2020 16:20:28 -0300 Message-Id: <20200210192038.23588-5-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> It changes the ia64 INTERNAL_SYSCALL_NCS macro to return a negative value instead of 'r10' register value on 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P follows the other Linux kABIS. Checked on ia64-linux-gnu. --- sysdeps/unix/sysv/linux/ia64/sysdep.h | 58 +++++++++++---------------- 1 file changed, 24 insertions(+), 34 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h index 59442c50e9..729bfadad0 100644 --- a/sysdeps/unix/sysv/linux/ia64/sysdep.h +++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h @@ -191,13 +191,13 @@ #ifdef IA64_USE_NEW_STUB -# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +({ \ LOAD_ARGS_##nr (args) \ register long _r8 __asm ("r8"); \ register long _r10 __asm ("r10"); \ register long _r15 __asm ("r15") = name; \ register void *_b7 __asm ("b7") = ((tcbhead_t *)__thread_self)->__private;\ - long _retval; \ LOAD_REGS_##nr \ /* \ * Don't specify any unwind info here. We mark ar.pfs as \ @@ -209,60 +209,50 @@ ASM_OUTARGS_##nr \ : "0" (_b7), "3" (_r15) ASM_ARGS_##nr \ : "memory", "ar.pfs" ASM_CLOBBERS_##nr); \ - _retval = _r8; + _r10 == -1 ? -_r8 : _r8; \ +}) #else /* !IA64_USE_NEW_STUB */ -# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +({ \ LOAD_ARGS_##nr (args) \ register long _r8 asm ("r8"); \ register long _r10 asm ("r10"); \ register long _r15 asm ("r15") = name; \ - long _retval; \ LOAD_REGS_##nr \ __asm __volatile (BREAK_INSN (__IA64_BREAK_SYSCALL) \ : "=r" (_r8), "=r" (_r10), "=r" (_r15) \ ASM_OUTARGS_##nr \ : "2" (_r15) ASM_ARGS_##nr \ : "memory" ASM_CLOBBERS_##nr); \ - _retval = _r8; + _r10 == -1 ? -_r8 : _r8; \ +}) #endif /* !IA64_USE_NEW_STUB */ -#define DO_INLINE_SYSCALL(name, nr, args...) \ - DO_INLINE_SYSCALL_NCS (__NR_##name, nr, ##args) - -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - DO_INLINE_SYSCALL_NCS (__NR_##name, nr, args) \ - if (_r10 == -1) \ - { \ - __set_errno (_retval); \ - _retval = -1; \ - } \ - _retval; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - DO_INLINE_SYSCALL_NCS (name, nr, args) \ - err = _r10; \ - _retval; }) +# undef INLINE_SYSCALL +# define INLINE_SYSCALL(name, nr, args...) \ + ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ + _sys_result = (unsigned long) -1; \ + } \ + (long) _sys_result; }) + +# undef INTERNAL_SYSCALL_DECL +# define INTERNAL_SYSCALL_DECL(err) do { } while (0) + #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ({ (void) (val); \ - (err == -1); \ - }) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= (unsigned long) -4095) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (val) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #define LOAD_ARGS_0() #define LOAD_REGS_0 From patchwork Mon Feb 10 19:20:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183256 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4417668ile; Mon, 10 Feb 2020 11:22:14 -0800 (PST) X-Google-Smtp-Source: APXvYqyzglGafmtjc3wCD0NjVOYzQdzfD2gT3uz3IgqBlQvdfVud7nOCCiQwUwTMK3P03DW0qnLs X-Received: by 2002:a9d:7757:: with SMTP id t23mr2314846otl.315.1581362534240; Mon, 10 Feb 2020 11:22:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362534; cv=none; d=google.com; s=arc-20160816; b=GhkmRbOrJDmEy0ZzTY8HgO8lWyMt9hTDSAevwSdp1iTaGN9dN58fsr96AOwUr4NyaI SVRyjOl0WqmCGG1FruEv2ijJNf9BPx6Ae31W4xdo0US8bNoiXd3ZW0Dt6By53+XtR/wB eJmwSPvLPCvLqEouBwXAI6f9W+a5zcEZGGCqDDUy15shou4Qs1arzbr8PO4jj+7NPglw dzs9E5AgPD84j9jPDFEZpl4xFhw6CyvbbS8ey0HRajOsw1zHUKeeM9MXOj7AXDG+FsDh n51/oa6jt8Scffk61gK93It4hhCZHn3QDpFV0zWQMiZXRaRLwNSSBdxDknk1AptaYhnQ qg9Q== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=07wctxsSPNja3hl9EH981qPUTU1ifNJlKFWmvxfYZqw=; b=0kW9//0Vc9AKO+7enTQxkc5vSCgUpLdiXvtLUQjHNYHS6714Fb5uiUM3KMYwmSswF5 iC6Iz5R6CbnWcM8A3apywJr9kSuXdBc3Nv22gi4D1dzd92zaCoOdDDgG/0DkSYgA2Mca eemAJUxFG29uFgj19SazXOLsJeIwmbsPyd8yyxZRecBW0ly6HPPH6hIKAhRAxVv4CThb C6jFRRlTqJ7e+x/64y24CeXDNzzsjnTA6mDK1pP904OsXo8bucsUvIczI07WqTK9c7/C B8eYKcEgpo4NR8nZe6dzN983qxpVTwPg1ByArbElSTilRlbAegaP+vTdBkgiqB+XNG7g zRuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=gPBO5jA8; dkim=pass header.i=@linaro.org header.s=google header.b=Lp4iZCAq; spf=pass (google.com: domain of libc-alpha-return-109393-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109393-patch=linaro.org@sourceware.org"; dmarc=pass (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 r8si617046ota.288.2020.02.10.11.22.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:22:14 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109393-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.s=default header.b=gPBO5jA8; dkim=pass header.i=@linaro.org header.s=google header.b=Lp4iZCAq; spf=pass (google.com: domain of libc-alpha-return-109393-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109393-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=RBg3ZKuDn7BK+dRaabtDW3v5kUBOjDJ P1Psp2VWA1j4Czd8kf0LAlRUtKSAOPadJn/rKkgo6HhNvxvXRJgwZWaOljzl9Ai3 T7avmTd9kF2WNUAGBgQvefTWfADFS5XgXv2cnGoWDUxrtE9mbXSOoVjDK+WSvOjx coL7Vvapqs3I= 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:subject:date:message-id:in-reply-to :references; s=default; bh=MiB1e7wJcV1K8Wj0SuN6/gobsW8=; b=gPBO5 jA876lShpD7qKePBF6+bH/CI56jaE5vJ/hmm9KvQBaQH4ydxm1QC5XdhNB8iKmYe 6WaV81TXLCm2bOmhr3fhZhOVojmzvDfsPB6L0w7crPCu6sW0QAwdJju+o5k1zvjV ocSj+DrBR3tnfYhNqSBBsSmMmp5V2AL19/EQzE= Received: (qmail 100359 invoked by alias); 10 Feb 2020 19:20:57 -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 100253 invoked by uid 89); 10 Feb 2020 19:20:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=arrangement, U*aoliva X-HELO: mail-qk1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=07wctxsSPNja3hl9EH981qPUTU1ifNJlKFWmvxfYZqw=; b=Lp4iZCAqKC6BKcN9YbOt+T3PpyaedZLuQ4Mwdf3qrGpuODCYTtbKjoF9zrmbauFe+p yZJhPxufk+0bdaBfHVnyUajgkCw/Erkt//8ouhTVfToIDHl3spnAdL3ClCx40P1MtFND Vv6GuoZrc0X8W10cVmzS+Ad7OCeKbkpgXzQwL+wONa6xScpFi/Tna1redJwPUuSynvgR o5LVHv0lT8UmckUMjOiIXIARCWxdORXZruksMLgosKP5iSIh33IxZrUtzzeEwb/PTZFh 6jXD7gHGoEhNa+yu45QTOvX3bJlbQr2sheENsrkXVMe2s7ZCQS1I+TmzRI0IpyIBqzTf BJKQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 06/15] mips64: Consolidate Linux sysdep.h Date: Mon, 10 Feb 2020 16:20:29 -0300 Message-Id: <20200210192038.23588-6-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> The mips64 Linux syscall macros only differs argument type and the requirement of zero-extending values on n32. The headers are consolidate by parameterizing the arguments with a new type, __syscall_arg_t, and by defining the ARGIFY for n64. Also, the generic unix mips64 sysdep is essentially the same, only the load instruction need to be adjusted depending of the ABI. Checked on mips64-linux-gnu and mips64n32-linux-gnu. --- sysdeps/unix/mips/mips64/n64/sysdep.h | 64 ---- sysdeps/unix/mips/mips64/{n32 => }/sysdep.h | 3 +- .../unix/sysv/linux/mips/mips64/n64/sysdep.h | 307 ------------------ .../sysv/linux/mips/mips64/{n32 => }/sysdep.h | 88 ++--- 4 files changed, 49 insertions(+), 413 deletions(-) delete mode 100644 sysdeps/unix/mips/mips64/n64/sysdep.h rename sysdeps/unix/mips/mips64/{n32 => }/sysdep.h (97%) delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h rename sysdeps/unix/sysv/linux/mips/mips64/{n32 => }/sysdep.h (76%) -- 2.17.1 diff --git a/sysdeps/unix/mips/mips64/n64/sysdep.h b/sysdeps/unix/mips/mips64/n64/sysdep.h deleted file mode 100644 index 3d8b254017..0000000000 --- a/sysdeps/unix/mips/mips64/n64/sysdep.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Alexandre Oliva . - - 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 - -#ifdef __ASSEMBLER__ - -/* Note that while it's better structurally, going back to call __syscall_error - can make things confusing if you're debugging---it looks like it's jumping - backwards into the previous fn. */ -#ifdef __PIC__ -#define PSEUDO(name, syscall_name, args) \ - .align 2; \ - .set nomips16; \ - cfi_startproc; \ - 99:; \ - .set noat; \ - .cpsetup t9, $1, name; \ - cfi_register (gp, $1); \ - .set at; \ - dla t9,__syscall_error; \ - .cpreturn; \ - cfi_restore (gp); \ - jr t9; \ - cfi_endproc; \ - ENTRY(name) \ - li v0, SYS_ify(syscall_name); \ - syscall; \ - bne a3, zero, 99b; \ -L(syse1): -#else -#define PSEUDO(name, syscall_name, args) \ - .set noreorder; \ - .align 2; \ - .set nomips16; \ - cfi_startproc; \ - 99: j __syscall_error; \ - nop; \ - cfi_endproc; \ - ENTRY(name) \ - .set noreorder; \ - li v0, SYS_ify(syscall_name); \ - syscall; \ - .set reorder; \ - bne a3, zero, 99b; \ -L(syse1): -#endif - -#endif diff --git a/sysdeps/unix/mips/mips64/n32/sysdep.h b/sysdeps/unix/mips/mips64/sysdep.h similarity index 97% rename from sysdeps/unix/mips/mips64/n32/sysdep.h rename to sysdeps/unix/mips/mips64/sysdep.h index 65ce7c5406..fb5f27daf3 100644 --- a/sysdeps/unix/mips/mips64/n32/sysdep.h +++ b/sysdeps/unix/mips/mips64/sysdep.h @@ -19,6 +19,7 @@ #include #ifdef __ASSEMBLER__ +#include /* Note that while it's better structurally, going back to call __syscall_error can make things confusing if you're debugging---it looks like it's jumping @@ -33,7 +34,7 @@ .cpsetup t9, $1, name; \ cfi_register (gp, $1); \ .set at; \ - la t9,__syscall_error; \ + PTR_LA t9,__syscall_error; \ .cpreturn; \ cfi_restore (gp); \ jr t9; \ diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h deleted file mode 100644 index 9d30291f84..0000000000 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h +++ /dev/null @@ -1,307 +0,0 @@ -/* Copyright (C) 2000-2020 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 _LINUX_MIPS_SYSDEP_H -#define _LINUX_MIPS_SYSDEP_H 1 - -/* There is some commonality. */ -#include -#include -#include - -#include - -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - -/* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h - of the kernel. But these symbols do not follow the SYS_* syntax - so we have to redefine the `SYS_ify' macro here. */ -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - -#ifdef __ASSEMBLER__ - -/* We don't want the label for the error handler to be visible in the symbol - table when we define it here. */ -# define SYSCALL_ERROR_LABEL 99b - -#else /* ! __ASSEMBLER__ */ - -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (_sc_err); \ - long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \ - result_var = -1L; \ - } \ - result_var; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) - -/* Note that the original Linux syscall restart convention required the - instruction immediately preceding SYSCALL to initialize $v0 with the - syscall number. Then if a restart triggered, $v0 would have been - clobbered by the syscall interrupted, and needed to be reinititalized. - The kernel would decrement the PC by 4 before switching back to the - user mode so that $v0 had been reloaded before SYSCALL was executed - again. This implied the place $v0 was loaded from must have been - preserved across a syscall, e.g. an immediate, static register, stack - slot, etc. - - The convention was relaxed in Linux with a change applied to the kernel - GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that - first appeared in the 2.6.36 release. Since then the kernel has had - code that reloads $v0 upon syscall restart and resumes right at the - SYSCALL instruction, so no special arrangement is needed anymore. - - For backwards compatibility with existing kernel binaries we support - the old convention by choosing the instruction preceding SYSCALL - carefully. This also means we have to force a 32-bit encoding of the - microMIPS MOVE instruction if one is used. */ - -#ifdef __mips_micromips -# define MOVE32 "move32" -#else -# define MOVE32 "move" -#endif - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \ - "IK" (SYS_ify (name)), \ - 0, err, args) - -#undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \ - "r" (__s0), \ - number, err, args) - -#define internal_syscall0(v0_init, input, number, err, dummy...) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a3 asm ("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set reorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall1(v0_init, input, number, err, arg1) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a3 asm ("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set reorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input, "r" (__a0) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a3 asm ("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input, "r" (__a0), "r" (__a1) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall3(v0_init, input, number, err, \ - arg1, arg2, arg3) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a2 asm ("$6") = (long) (arg3); \ - register long __a3 asm ("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall4(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a2 asm ("$6") = (long) (arg3); \ - register long __a3 asm ("$7") = (long) (arg4); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "+r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall5(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4, arg5) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a2 asm ("$6") = (long) (arg3); \ - register long __a3 asm ("$7") = (long) (arg4); \ - register long __a4 asm ("$8") = (long) (arg5); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "+r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall6(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4, arg5, arg6) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a2 asm ("$6") = (long) (arg3); \ - register long __a3 asm ("$7") = (long) (arg4); \ - register long __a4 asm ("$8") = (long) (arg5); \ - register long __a5 asm ("$9") = (long) (arg6); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "+r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \ - "r" (__a5) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#if __mips_isa_rev >= 6 -# define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \ - "$14", "$15", "$24", "$25", "memory" -#else -# define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \ - "$14", "$15", "$24", "$25", "hi", "lo", "memory" -#endif - -#endif /* __ASSEMBLER__ */ - -/* Pointer mangling is not yet supported for MIPS. */ -#define PTR_MANGLE(var) (void) (var) -#define PTR_DEMANGLE(var) (void) (var) - -#endif /* linux/mips/sysdep.h */ diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h similarity index 76% rename from sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h rename to sysdeps/unix/sysv/linux/mips/mips64/sysdep.h index f96636538a..617e229a67 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h @@ -21,7 +21,7 @@ /* There is some commonality. */ #include #include -#include +#include #include @@ -45,9 +45,15 @@ #else /* ! __ASSEMBLER__ */ +#if _MIPS_SIM == _ABIN32 /* Convert X to a long long, without losing any bits if it is one already or warning if it is a 32-bit pointer. */ -#define ARGIFY(X) ((long long) (__typeof__ ((X) - (X))) (X)) +# define ARGIFY(X) ((long long int) (__typeof__ ((X) - (X))) (X)) +typedef long long int __syscall_arg_t; +#else +# define ARGIFY(X) ((long int) (X)) +typedef long int __syscall_arg_t; +#endif /* Define a macro which expands into the inline wrapper code for a system call. */ @@ -115,10 +121,10 @@ long _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a3 asm ("$7"); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -138,11 +144,11 @@ long _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a3 asm ("$7"); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = ARGIFY (arg1); \ + register __syscall_arg_t __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -162,12 +168,12 @@ long _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a1 asm ("$5") = ARGIFY (arg2); \ - register long long __a3 asm ("$7"); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = ARGIFY (arg1); \ + register __syscall_arg_t __a1 asm ("$5") = ARGIFY (arg2); \ + register __syscall_arg_t __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -188,13 +194,13 @@ long _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a1 asm ("$5") = ARGIFY (arg2); \ - register long long __a2 asm ("$6") = ARGIFY (arg3); \ - register long long __a3 asm ("$7"); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = ARGIFY (arg1); \ + register __syscall_arg_t __a1 asm ("$5") = ARGIFY (arg2); \ + register __syscall_arg_t __a2 asm ("$6") = ARGIFY (arg3); \ + register __syscall_arg_t __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -215,13 +221,13 @@ long _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a1 asm ("$5") = ARGIFY (arg2); \ - register long long __a2 asm ("$6") = ARGIFY (arg3); \ - register long long __a3 asm ("$7") = ARGIFY (arg4); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = ARGIFY (arg1); \ + register __syscall_arg_t __a1 asm ("$5") = ARGIFY (arg2); \ + register __syscall_arg_t __a2 asm ("$6") = ARGIFY (arg3); \ + register __syscall_arg_t __a3 asm ("$7") = ARGIFY (arg4); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -242,14 +248,14 @@ long _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a1 asm ("$5") = ARGIFY (arg2); \ - register long long __a2 asm ("$6") = ARGIFY (arg3); \ - register long long __a3 asm ("$7") = ARGIFY (arg4); \ - register long long __a4 asm ("$8") = ARGIFY (arg5); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = ARGIFY (arg1); \ + register __syscall_arg_t __a1 asm ("$5") = ARGIFY (arg2); \ + register __syscall_arg_t __a2 asm ("$6") = ARGIFY (arg3); \ + register __syscall_arg_t __a3 asm ("$7") = ARGIFY (arg4); \ + register __syscall_arg_t __a4 asm ("$8") = ARGIFY (arg5); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -270,15 +276,15 @@ long _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a1 asm ("$5") = ARGIFY (arg2); \ - register long long __a2 asm ("$6") = ARGIFY (arg3); \ - register long long __a3 asm ("$7") = ARGIFY (arg4); \ - register long long __a4 asm ("$8") = ARGIFY (arg5); \ - register long long __a5 asm ("$9") = ARGIFY (arg6); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = ARGIFY (arg1); \ + register __syscall_arg_t __a1 asm ("$5") = ARGIFY (arg2); \ + register __syscall_arg_t __a2 asm ("$6") = ARGIFY (arg3); \ + register __syscall_arg_t __a3 asm ("$7") = ARGIFY (arg4); \ + register __syscall_arg_t __a4 asm ("$8") = ARGIFY (arg5); \ + register __syscall_arg_t __a5 asm ("$9") = ARGIFY (arg6); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ From patchwork Mon Feb 10 19:20:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183254 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4417332ile; Mon, 10 Feb 2020 11:21:53 -0800 (PST) X-Google-Smtp-Source: APXvYqzzkWKl1UHrxHXT2Sv3k+8rYN7Ybjz3RCh8gYHUy48cqFxW26idQJrItAnEeON2i6AjEiwt X-Received: by 2002:a05:6830:1047:: with SMTP id b7mr2327946otp.77.1581362513849; Mon, 10 Feb 2020 11:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362513; cv=none; d=google.com; s=arc-20160816; b=yYe//wAecn6SR5Ud0b198ljo2/TMhNa+wgk4xUx6fhEq8RrG51/qMHNKgxwc+LtIdZ hIj82Ecfnqbc0eN6iquHtLE/1Tdmlp9t4NC4ShBtpnHLIA5qlGcnkIjbgTqw4k9cQbYN tNbGDB1kqqCJI74CNaWqo62Qd79izn03Y91Jhgg1v4N1Fa1VsFxWZiNBlYdDNMa/dHL7 Llv2Mnul/PrhsJkBxQoVO5B2WbWATrNtDTePyOheEMcnLQ9K2qjGlcb7+dZv77D0sVj0 oqsuu48Ksf+R7/ZFfUC8Lixy83en9nZ5nHHgPJLV9vrFJbH6PpHcm521mDAJY4Y3JvCe j+XQ== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=00Usgue9kav1exiPt1vt3OwI2iREsWGpuCq1RfxXffU=; b=Wm9Z9uvNxfDIYkFJ/UT9A8uKA9u0JuPEDHqqGpQ6SyRrbWye2DAY5O7luUAQM7o+45 oXv5POEOEESMMQxQgLsXi+rHMY6B0oiINDwM4yc/nKhm/6BP/6U882gdQcETzsdDyYFp pYsiYlC0+gA0SRfh9VCanpDgN4Oa1fexk6UUCOTZ+MJeueU62Wx8RV7oNHofMEPzl/bK zE73TwM8CH2NhS35rhjK9Y5yVDVyhHFeutP/7VrJflQTRSOMRlMwK0h6Q6jGrxCEAEft LarY75iK1+YhUiLH6AfRSvn3qfn6LJ++8uqP9XfS/tnPhmkzpydR+junHW9YtCNQzJKM tWSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=ZPT94NQG; dkim=pass header.i=@linaro.org header.s=google header.b=FUpBzcKu; spf=pass (google.com: domain of libc-alpha-return-109391-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109391-patch=linaro.org@sourceware.org"; dmarc=pass (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 n20si586455oig.53.2020.02.10.11.21.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:21:53 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109391-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.s=default header.b=ZPT94NQG; dkim=pass header.i=@linaro.org header.s=google header.b=FUpBzcKu; spf=pass (google.com: domain of libc-alpha-return-109391-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109391-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=hBxN4lMedUVvBduW/gioh2Nn1PmRaIb hdb3ldZJg4vhKM5QGiMQ1Gtiwno+/XSdScyhCnJAfrV2sYDBG3H2IMK5ipPE13ur pt3U70JOgkzlsBAH0yjSyVipyV3O3wsl2+m1cGMK3Zx7FzEI2OTsI2FbkF5L93qo dijbdp+X3bXU= 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:subject:date:message-id:in-reply-to :references; s=default; bh=FLbULjimT9DjZYl5jmFcpNikHLQ=; b=ZPT94 NQGN9COqSZvDk7C5ahlJmAFQJ5oTDHL0VEnghXyBf8WXHYFFYymN2vfEkD8UELgC poWh7n9Y5/ayzFmiNK26KqQnZsYL93PHttFoGwLafPNo4DVtq5Cl6R0/WBhtb3q+ xiK436/8uvHZNYR3wXHD6OZUbqFjcjc7q4yyno= Received: (qmail 100060 invoked by alias); 10 Feb 2020 19:20:56 -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 99948 invoked by uid 89); 10 Feb 2020 19:20:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qt1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=00Usgue9kav1exiPt1vt3OwI2iREsWGpuCq1RfxXffU=; b=FUpBzcKu8pzMsYZCbL1TNcYlF1oXyv4eVAY/EUQPrx9myNOyyYVVU0mIHSS86W0rav BH7TqRxCr7pJcQFOiGLCjBVlDpBnBb9bmE8Xz2kJvbDj+d3ZFLuXhCIY7970HE7KMuvn WE4YzBAl2YEynLR68Xvnfv4fvt7xXXupuTHhUzh7lXODEAVFHXm7yDRQPdlDjtHzbk+y 7XuSbWqs9mRVctuQI+8BqqiypxU2F3CXzZRlXhJzetJvMKmLvkhbD4BwoONXq4u1iXVN yF9hsgBzeIl1fdx8gHbmbzkMglDOeXvNaX+PVU2YqQQ06Fe24WWV/Sn/08CGgMOM5iMy zBfA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 07/15] mips: Use Linux kABI for syscall return Date: Mon, 10 Feb 2020 16:20:30 -0300 Message-Id: <20200210192038.23588-7-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> It changes the mips INTERNAL_SYSCALL* and internal_syscall* macros to return a negative value instead of 'a3' register value on 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P follows the other Linux kABIS. The redefinition of INTERNAL_VSYSCALL_CALL is also no longer required. Checked on mips64-linux-gnu, mips64n32-linux-gnu, and mips-linux-gnu. --- sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 32 ++++++++------------ sysdeps/unix/sysv/linux/mips/mips64/sysdep.h | 28 +++++++---------- sysdeps/unix/sysv/linux/mips/sysdep.h | 16 ---------- 3 files changed, 23 insertions(+), 53 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index beefcf284b..6842ff5211 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -61,13 +61,14 @@ result_var; }) #undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= (unsigned long) -4095) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the @@ -128,7 +129,6 @@ union __mips_syscall_return ({ \ union __mips_syscall_return _sc_ret; \ _sc_ret.val = __mips16_syscall##nr (args, number); \ - err = _sc_ret.reg.v1; \ _sc_ret.reg.v0; \ }) @@ -167,8 +167,7 @@ union __mips_syscall_return : "=r" (__v0), "=r" (__a3) \ : input \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -191,8 +190,7 @@ union __mips_syscall_return : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -216,8 +214,7 @@ union __mips_syscall_return : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0), "r" (__a1) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -243,8 +240,7 @@ union __mips_syscall_return : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -270,8 +266,7 @@ union __mips_syscall_return : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -300,8 +295,7 @@ libc_hidden_proto (__mips_syscall5, nomips16) (long) (arg4), \ (long) (arg5), \ (long) (number)); \ - err = _sc_ret.reg.v1; \ - _sc_ret.reg.v0; \ + _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \ }) long long __nomips16 __mips_syscall6 (long arg1, long arg2, long arg3, @@ -320,8 +314,7 @@ libc_hidden_proto (__mips_syscall6, nomips16) (long) (arg5), \ (long) (arg6), \ (long) (number)); \ - err = _sc_ret.reg.v1; \ - _sc_ret.reg.v0; \ + _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \ }) long long __nomips16 __mips_syscall7 (long arg1, long arg2, long arg3, @@ -342,8 +335,7 @@ libc_hidden_proto (__mips_syscall7, nomips16) (long) (arg6), \ (long) (arg7), \ (long) (number)); \ - err = _sc_ret.reg.v1; \ - _sc_ret.reg.v0; \ + _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \ }) #if __mips_isa_rev >= 6 diff --git a/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h index 617e229a67..072016f07e 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h @@ -69,13 +69,14 @@ typedef long int __syscall_arg_t; result_var; }) #undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= (unsigned long) -4095) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the @@ -133,8 +134,7 @@ typedef long int __syscall_arg_t; : "=r" (__v0), "=r" (__a3) \ : input \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -157,8 +157,7 @@ typedef long int __syscall_arg_t; : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -182,8 +181,7 @@ typedef long int __syscall_arg_t; : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0), "r" (__a1) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -209,8 +207,7 @@ typedef long int __syscall_arg_t; : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -236,8 +233,7 @@ typedef long int __syscall_arg_t; : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -264,8 +260,7 @@ typedef long int __syscall_arg_t; : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -294,8 +289,7 @@ typedef long int __syscall_arg_t; : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \ "r" (__a5) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) diff --git a/sysdeps/unix/sysv/linux/mips/sysdep.h b/sysdeps/unix/sysv/linux/mips/sysdep.h index cdfc0b1b58..877768a249 100644 --- a/sysdeps/unix/sysv/linux/mips/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/sysdep.h @@ -28,19 +28,3 @@ #endif #define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" #define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" - -#ifndef __ASSEMBLER__ - -/* Standard MIPS syscalls have an error flag, and return a positive errno - when the error flag is set. Emulate this behaviour for vsyscalls so that - the INTERNAL_SYSCALL_{ERROR_P,ERRNO} macros work correctly. */ -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - ({ \ - long _ret = funcptr (args); \ - err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \ - if (err) \ - _ret = -_ret; \ - _ret; \ - }) - -#endif /* __ASSEMBLER__ */ From patchwork Mon Feb 10 19:20:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183255 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4417479ile; Mon, 10 Feb 2020 11:22:03 -0800 (PST) X-Google-Smtp-Source: APXvYqw4p78fVqgfRhlaBaIehk7aqeE3i1Vq1v8eJ28Dk+8xJ64yZzrAOcuPHzOkEpAhTt5+vBr3 X-Received: by 2002:a9d:7ccc:: with SMTP id r12mr2328378otn.22.1581362523264; Mon, 10 Feb 2020 11:22:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362523; cv=none; d=google.com; s=arc-20160816; b=gif4j3zzcS6oLQQo32LOZi9jzhTOqyE+rSJax2VP9eHR13Ks5i8/npSbVHDDNN0rfr 80TlA1uTfHcONQM5utAKiPSqkeb5joEKJNH9h6pZ2yuAz9dkTmBLii1ojcSsBQ+kDIvP U/b2w6H4eHjIaesbkqxROdUcamK0Qv9eYBzvnBk9wsofwH3tK+wddYvfE43oTrzgfeJI jthH3Pdq/9xeckJFBrqPhWk3tfjpvPdkQTlCrCpaOosq4efgm8ttJcxM0YynLWet/rBe cPMMOAlTayGiDZ1NobbhV8A+nOA4Jxp6h224xovia6P87QYQDv8PNpPjaMqcAonOyWyu S4WA== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=gcRlSIUfDZNzDXLhQXEXcrQpCXiBWs/Mt0pzBbJG87Y=; b=rSKlwnb6zz9qLiNQrtpQUKCQbSte6J/oWPTmecSysu6dK2NzpWDqL5jqVkxIyUykMf kxF4wusIiYxo7tzWWD6QjaL0xsSo4DjaWfW8JCJn/vCREFC05nUUWlGBP8tOCPUUm4k+ iflWRI4lZJOgOwIXp1+SH+ptmK2ewy94hNUJcN58fSfmSYSivDWoTZCVKa+fXi/Hz4jB 1a4cB9TImweR0gnFmq2DwxeINHoeJh3FYsHHwUvxh3pyKhbglU0IVc3c/a98STrakZ6h 8x4n6cIIyTHH6lTqSLbSdyn1/eLNihdJ6BUU0taCUG5bmH3YbuD8dKXHtLeMbUgsC5cw Jzeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=wzxSHZZt; dkim=pass header.i=@linaro.org header.s=google header.b=qzJpZrbr; spf=pass (google.com: domain of libc-alpha-return-109392-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109392-patch=linaro.org@sourceware.org"; dmarc=pass (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 t1si623789otq.148.2020.02.10.11.22.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:22:03 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109392-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.s=default header.b=wzxSHZZt; dkim=pass header.i=@linaro.org header.s=google header.b=qzJpZrbr; spf=pass (google.com: domain of libc-alpha-return-109392-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109392-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=bP+B6uWjeEJqlxxY5VgU55zHRUp/cLu D9h5Ng9XwcmaIujW6Ok15ndKAqR/U1ZR4pBIjVNwVJ9h6/yJQtJN0u8QEY6baiSk 3XjCGehap6/UKKWAtEl0yONM3MrywTTJoOgiskAxSDR1Y2FjpO+73u1IJ6CfCX3c t8BCC7n+GQzc= 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:subject:date:message-id:in-reply-to :references; s=default; bh=HlVaR8TLfslcPKNR1vqU2J/MfWk=; b=wzxSH ZZto0nMpomTlemcAZryiBJP9u9uUmBNVC6xgvAny0w+9TiqKhZrGxX7Jp0Rpk0xf 6oJo3G3kRydYvCrv+SBJoTgDDE6kygqxjZsSrWPJaPYHFt8C+D01c10ZHneBc4wg 0JlEVsQx9dLFQA8Kx93n2DEIlIk1JELqhwm3Hw= Received: (qmail 100128 invoked by alias); 10 Feb 2020 19:20:56 -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 100000 invoked by uid 89); 10 Feb 2020 19:20:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=nios X-HELO: mail-qk1-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=gcRlSIUfDZNzDXLhQXEXcrQpCXiBWs/Mt0pzBbJG87Y=; b=qzJpZrbrfPCcI97bq1Yw+GTMUtCbxBq/zx7g3ogF7AzS+4/+R7o4XE7Mf3RLpzD6ui n5q3//nnKjCg/JNkMNdCYkfFEs9Bomo2jtH01KtbKkgQtPF8X6fwKJe00rHv6b9BzpzN JlNy6iuhVFt61OR/35LvnxRbKt8OVSek8FQg1qS23R13L0lgwtp3kCljEsSeyg2auOF2 lv0mgjwDiq4FlD27Bgd5gG/QxninP7aLfsRYcyHm0zlLJK328hezSLWltLwgh81T3y/m P0OhfFk5AIrhyVibOHUV+UPv7UmhbhgjnJ/jDnN5+AYuhp59bu4WRhUHKUHKyz5iIrIz cbUw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 08/15] nios2: Use Linux kABI for syscall return Date: Mon, 10 Feb 2020 16:20:31 -0300 Message-Id: <20200210192038.23588-8-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> It changes the nios INTERNAL_SYSCALL_RAW macro to return a negative value instead of 'r2' register value on 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P follows the other Linux kABIS. Checked with a build against nios2-linux-gnu. --- sysdeps/unix/sysv/linux/nios2/sysdep.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.h b/sysdeps/unix/sysv/linux/nios2/sysdep.h index b02730bd23..eab888df32 100644 --- a/sysdeps/unix/sysv/linux/nios2/sysdep.h +++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h @@ -157,13 +157,14 @@ (int) result_var; }) #undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) unsigned int err __attribute__((unused)) +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (unsigned int) (err)) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= (unsigned long) -4095) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #undef INTERNAL_SYSCALL_RAW #define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ @@ -180,8 +181,7 @@ : "+r" (_r2), "=r" (_err) \ : ASM_ARGS_##nr \ : __SYSCALL_CLOBBERS); \ - _sys_result = _r2; \ - err = _err; \ + _sys_result = _err != 0 ? -_r2 : -_r2; \ } \ (int) _sys_result; }) From patchwork Mon Feb 10 19:20:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183257 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4417861ile; Mon, 10 Feb 2020 11:22:24 -0800 (PST) X-Google-Smtp-Source: APXvYqyJUi1iD28O7cWl+2BN31ZouHyqxxopn1AhmpFYWTgwI4xOyi+xQ2i3V+hQ9CS6b3rpajxr X-Received: by 2002:a05:6830:1042:: with SMTP id b2mr2209963otp.306.1581362544587; Mon, 10 Feb 2020 11:22:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362544; cv=none; d=google.com; s=arc-20160816; b=hYisyHsAy55MQb/8Ui62rEYtqnVzSf15Q1zQ8QSJTQcdepvjTg1RqsNspHv/uwIrKp K0Qz54s85Y4Bb5/RQ0KuL1KQJhBykFaP0tI+wSV8iIzw/VgkvHJ026OKiwCAApudRFyS y2kHgIcqJeY50mV7MaEjxLohRWgCM/22QhrWRQbawe3+msaHR9gpncRWmlpYS6g1Q0fi oNFP1ZmxObA8sam6bazliLSrUQ+1A0KUp5QTHQvMVFftjk0faz1r3Qs4s5/ebvZk2q33 C9v0Iu7f0bWb98boImAA/rJSSj6369i3LnpW4CkicI8DEkvx3AC8CL1wxmqF9VE7g79b lxSA== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=OxPe/gvmXUwBAz0kyif56UJkvk1vjT9jldofje5Hor8=; b=b+nvzHuD9PgrAlD5FcTd/vRIibMI909j97n/zGUkCS72YqU9B2cvEEXAzZ7Zq+4lnV /8skOOmtLuhHDFhr5ytTBX+dMiG8c1qgS5zd8zXN6yF0FvTT9aFS49DYNQ0OtPfL54Cf AM9JTWFPSdPiwMS5rGemrW0RdLnRgy+caam2mx2ngrLdrSl4T8aQnPa6rkOe5H5V2mwL qt0jxV3vKfriCLe5UFVPwJnCIqRQsA3waRKzEAw2U3M35KuCAVGz/ubrffgN/RoJvjDo t3c5QkeQdn5M9AhlXyClWcMTZ0XY78hPFALlOkG4SyHvHIzM4/16tvwc9Y4KCwMMQnDY RTXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=kHs8Z3pY; dkim=pass header.i=@linaro.org header.s=google header.b=Zw9LQuF+; spf=pass (google.com: domain of libc-alpha-return-109394-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109394-patch=linaro.org@sourceware.org"; dmarc=pass (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 l10si631891oth.243.2020.02.10.11.22.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:22:24 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109394-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.s=default header.b=kHs8Z3pY; dkim=pass header.i=@linaro.org header.s=google header.b=Zw9LQuF+; spf=pass (google.com: domain of libc-alpha-return-109394-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109394-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=S5PTwLnPUXzr+eGXmyJDkhaSTDzdTCB AcN2eO69iM3tIZw5nSrmOO5mBkaL7LbIW7gus2Gzc3vqY6Rp3N6brzc8Qr8Oj9wo O+4yqloXwa7CQAmG9DW0VwSsbXDNOZ5QvPObyCFkKCAC06IdK49GrfMUlfla2tij /qYIGPUn/zQ4= 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:subject:date:message-id:in-reply-to :references; s=default; bh=tDJrY8owYzwtY1MOTc7RnnEbL8A=; b=kHs8Z 3pYHkQsl6KWLZ28XyTX4Q/9mTLvsk8pEaxK0qUTWA7Nl87IbX7P8oCIXuYGo9hm3 tSD6AcbPjR8JmUhz+A2ANtGH+GsdBGyABr6OoKicSpLYzdvF2YDXeFmVMhNorM+R sfmJMqEXfJv+vEgImI/zZMzlqZruhKQfqPPQ2M= Received: (qmail 100564 invoked by alias); 10 Feb 2020 19:20:59 -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 100489 invoked by uid 89); 10 Feb 2020 19:20:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=2199 X-HELO: mail-qk1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=OxPe/gvmXUwBAz0kyif56UJkvk1vjT9jldofje5Hor8=; b=Zw9LQuF+QNG/zECrOa0O5BWSjABjGdGZcsql2bs7bc5hFL+nXIGh8X++A2XaA7hgcI ynJuV5ebbswH2Ry0IrED5esnh+X2VBU0sVxorJRHUdQYKaq6I1LChROzEDgqnE9hmd5a lgWIjtODqF9bnqUshJ0t++6pUFok9v+MyMvPCMCQbdM5HHPQ2Dh8k/PQUE82DRAfrNU0 GQIkc4KIVUqnqa0rFErcR+1mVLLbP44PwJCgfeK+NMQTGR0xiCZU9bzIneL5vFklYWAL bK2c/FRPciYXbgtje1kV0ZaxvdaD9I68W6xq7mz0TjZ9lcZL7Wl6gouKchNLyE2Cx6wK OVwg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 09/15] microblaze: Avoid clobbering register parameters in syscall Date: Mon, 10 Feb 2020 16:20:32 -0300 Message-Id: <20200210192038.23588-9-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> The microblaze INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (BZ#25523). Checked with microblaze-linux-gnu and microblazeel-linux-gnu build. --- sysdeps/unix/sysv/linux/microblaze/sysdep.h | 63 ++++++++++++++------- 1 file changed, 42 insertions(+), 21 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h index ed873d9dd4..b4a6ee89f1 100644 --- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h +++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h @@ -219,9 +219,10 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall1(name,arg1) \ ({ \ + long __arg1 = (long) (arg1); \ register long __ret __asm__("r3"); \ register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ + register long __r5 __asm__("r5") = __arg1; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r12) \ @@ -230,10 +231,12 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall2(name,arg1,arg2) \ ({ \ + long __arg1 = (long) (arg1); \ + long __arg2 = (long) (arg2); \ register long __ret __asm__("r3"); \ register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ - register long __r6 __asm__("r6") = (long)(arg2); \ + register long __r5 __asm__("r5") = __arg1; \ + register long __r6 __asm__("r6") = __arg2; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r6), "r"(__r12) \ @@ -243,11 +246,14 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall3(name,arg1,arg2,arg3) \ ({ \ + long __arg1 = (long) (arg1); \ + long __arg2 = (long) (arg2); \ + long __arg3 = (long) (arg3); \ register long __ret __asm__("r3"); \ register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ - register long __r6 __asm__("r6") = (long)(arg2); \ - register long __r7 __asm__("r7") = (long)(arg3); \ + register long __r5 __asm__("r5") = __arg1; \ + register long __r6 __asm__("r6") = __arg2; \ + register long __r7 __asm__("r7") = __arg3; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r12) \ @@ -257,12 +263,16 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall4(name,arg1,arg2,arg3,arg4) \ ({ \ + long __arg1 = (long) (arg1); \ + long __arg2 = (long) (arg2); \ + long __arg3 = (long) (arg3); \ + long __arg4 = (long) (arg4); \ register long __ret __asm__("r3"); \ register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ - register long __r6 __asm__("r6") = (long)(arg2); \ - register long __r7 __asm__("r7") = (long)(arg3); \ - register long __r8 __asm__("r8") = (long)(arg4); \ + register long __r5 __asm__("r5") = __arg1; \ + register long __r6 __asm__("r6") = __arg2; \ + register long __r7 __asm__("r7") = __arg3; \ + register long __r8 __asm__("r8") = __arg4; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r12) \ @@ -272,13 +282,18 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ ({ \ + long __arg1 = (long) (arg1); \ + long __arg2 = (long) (arg2); \ + long __arg3 = (long) (arg3); \ + long __arg4 = (long) (arg4); \ + long __arg5 = (long) (arg5); \ register long __ret __asm__("r3"); \ register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ - register long __r6 __asm__("r6") = (long)(arg2); \ - register long __r7 __asm__("r7") = (long)(arg3); \ - register long __r8 __asm__("r8") = (long)(arg4); \ - register long __r9 __asm__("r9") = (long)(arg5); \ + register long __r5 __asm__("r5") = __arg1; \ + register long __r6 __asm__("r6") = __arg2; \ + register long __r7 __asm__("r7") = __arg3; \ + register long __r8 __asm__("r8") = __arg4; \ + register long __r9 __asm__("r9") = __arg5; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r12) \ @@ -288,14 +303,20 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ ({ \ + long __arg1 = (long) (arg1); \ + long __arg2 = (long) (arg2); \ + long __arg3 = (long) (arg3); \ + long __arg4 = (long) (arg4); \ + long __arg5 = (long) (arg5); \ + long __arg6 = (long) (arg6); \ register long __ret __asm__("r3"); \ register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ - register long __r6 __asm__("r6") = (long)(arg2); \ - register long __r7 __asm__("r7") = (long)(arg3); \ - register long __r8 __asm__("r8") = (long)(arg4); \ - register long __r9 __asm__("r9") = (long)(arg5); \ - register long __r10 __asm__("r10") = (long)(arg6); \ + register long __r5 __asm__("r5") = __arg1; \ + register long __r6 __asm__("r6") = __arg2; \ + register long __r7 __asm__("r7") = __arg3; \ + register long __r8 __asm__("r8") = __arg4; \ + register long __r9 __asm__("r9") = __arg5; \ + register long __r10 __asm__("r10") = __arg6; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r10), \ From patchwork Mon Feb 10 19:20:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183258 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4418020ile; Mon, 10 Feb 2020 11:22:34 -0800 (PST) X-Google-Smtp-Source: APXvYqyuQtEcRjMhOefum/G+84DYQD9cMfDWJARy/BfBTj71fqKCIq3lLrI1P6gB00EmjASOlDzh X-Received: by 2002:aca:4e02:: with SMTP id c2mr408276oib.142.1581362554256; Mon, 10 Feb 2020 11:22:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362554; cv=none; d=google.com; s=arc-20160816; b=dm4q+DoeleVpXqH8n+R/2B1tA2S2m441qmLtZ3VPtmBxpNn22fTfIG5JmV8kaFA8K0 VnJ/U+pDsHXDmZLQ66HVXxwNBbDn2+LUQrcBYeCQxrYaSuEWQcy341/WpvpaZKSh/fcW YlubhXQaAF+DPYDYUIqawEBXPWSUdanq+YLEOhqAru9DmK/4ZgS3uof1D+RMoGZ1Behn emsv3hbRvwlNGdMSxHKg8LslCuPc43VGLVXB9VhFzhgiLAZ0Y8CX5an3Lbei14XNK+5v neealxfb1wsyCaUeXm2quaLdo4DYDGPLS5/k2XaSTasAl32xWdKRfHubBdk8VZ5AFm6O hcrQ== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=XeP7B2e8mE4eHzQ3fGu7Yta/QYF+X0JL2lrZPqqc2PU=; b=KryMlcxDXscxgpbCTrdj57eWtJEsBV9iT5fpxfv6kLLeEAMhXlV9cGkXUkGW7Jpthe ErmVT7OI5WuftAGQ5mLiwM39F1AUxLxQMQpTcgxTySkyWAuhntvaX2A3UZGI+wHE+fPa BKa1NIV6V0TUuqXxXO+GohAYQVAJFciOvRBcZar1IOBwqyCNW7q81dgWsFM9D4MFRBnk o26mORTKCa/K540E4fgRlDqrzPERuW2xfB0oFRBkMh6sq8/NI3BLxGLLh54hU2AHmUfJ 5Q3WWsTLLN4Yno+nUNPA3QUWA3LVNUx46YmHZiLZOH6FO3Zw8dFrtYchmltSqajbxWY3 ygLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=GIZF1XEo; dkim=pass header.i=@linaro.org header.s=google header.b=DffbpFjD; spf=pass (google.com: domain of libc-alpha-return-109395-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109395-patch=linaro.org@sourceware.org"; dmarc=pass (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 s26si600817otp.172.2020.02.10.11.22.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:22:34 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109395-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.s=default header.b=GIZF1XEo; dkim=pass header.i=@linaro.org header.s=google header.b=DffbpFjD; spf=pass (google.com: domain of libc-alpha-return-109395-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109395-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=YvWIOyzUi//jPTzqYslaR25w04nobep vTXX+982Vv1VB0GPFRzsTjFpRapplclYicoHtEGV+RgwW/Dl61msGpuSLf+Mi4Xk /mgBb67drDYDBkIyIhdqIRhTFJheZMYvJvy4WjQZ5AjxFNH9NSvyjz8cS/3Y7Zl/ ze/KR8rlZfD0= 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:subject:date:message-id:in-reply-to :references; s=default; bh=nN1LUs8uWf8v56RmsnaQ1qouwmk=; b=GIZF1 XEokiAm/3IaT3biIICnzI3tZw5Yb0tJEynz2kBQXgK/aaiHVTuyGa2Qmzaz4qZpV fDhH0cQnExOpPbFGoxNz9tceCsLuS6+AbgUg67pN+jVrvKauCRahbl9y/GeQ30Yn Z9XCMbzhb5FUSvRVPcPHkz1/hQKHzyUlcNPhKs= Received: (qmail 100591 invoked by alias); 10 Feb 2020 19:20:59 -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 100525 invoked by uid 89); 10 Feb 2020 19:20:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qv1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=XeP7B2e8mE4eHzQ3fGu7Yta/QYF+X0JL2lrZPqqc2PU=; b=DffbpFjDNt2Xfwh+EcoPO9R3+fdDKwvhZS03Ev+144TUur+iHkA95edpAA36rT/pjY pMctxDP8oo28MqvDWbTKUloqVvkkN3Qru43XZjNDCix1ccQeV7IU+RKGd39tZl9erNho Qe5qpBT+vcDzBeyxOFje5xMiSj1xb73CXVsSZZ4tQ7SjpG//y64fsP98prlbbEx+CGE6 C24IqGcPdAaF9Ojjigfsu/1d6Ik/D82ZMR+w8rF5UXI6mBJxgqIobIfkEgMY5EpUDsWh rBTL7cLdTYEErqkQXwyQBzwhIXkRBtOz0RYiYpzarLDvn2UepCNZ9ar31xQCNP+3KyMl bIaw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 10/15] riscv: Avoid clobbering register parameters in syscall Date: Mon, 10 Feb 2020 16:20:33 -0300 Message-Id: <20200210192038.23588-10-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> The riscv INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (BZ#25523). Checked with riscv64-linux-gnu-rv64imafdc-lp64d build. --- sysdeps/unix/sysv/linux/riscv/sysdep.h | 84 +++++++++++++++++--------- 1 file changed, 56 insertions(+), 28 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index 201bf9a91b..2bd9b16f32 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -176,10 +176,11 @@ # define internal_syscall1(number, err, arg0) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ + register long int __a0 asm ("a0") = _arg0; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -193,11 +194,13 @@ # define internal_syscall2(number, err, arg0, arg1) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -211,12 +214,15 @@ # define internal_syscall3(number, err, arg0, arg1, arg2) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ - register long int __a2 asm ("a2") = (long int) (arg2); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ + register long int __a2 asm ("a2") = _arg2; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -230,13 +236,17 @@ # define internal_syscall4(number, err, arg0, arg1, arg2, arg3) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ - register long int __a2 asm ("a2") = (long int) (arg2); \ - register long int __a3 asm ("a3") = (long int) (arg3); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ + register long int __a2 asm ("a2") = _arg2; \ + register long int __a3 asm ("a3") = _arg3; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -250,14 +260,19 @@ # define internal_syscall5(number, err, arg0, arg1, arg2, arg3, arg4) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ - register long int __a2 asm ("a2") = (long int) (arg2); \ - register long int __a3 asm ("a3") = (long int) (arg3); \ - register long int __a4 asm ("a4") = (long int) (arg4); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ + register long int __a2 asm ("a2") = _arg2; \ + register long int __a3 asm ("a3") = _arg3; \ + register long int __a4 asm ("a4") = _arg4; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -271,15 +286,21 @@ # define internal_syscall6(number, err, arg0, arg1, arg2, arg3, arg4, arg5) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + long int _arg5 = (long int) (arg5); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ - register long int __a2 asm ("a2") = (long int) (arg2); \ - register long int __a3 asm ("a3") = (long int) (arg3); \ - register long int __a4 asm ("a4") = (long int) (arg4); \ - register long int __a5 asm ("a5") = (long int) (arg5); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ + register long int __a2 asm ("a2") = _arg2; \ + register long int __a3 asm ("a3") = _arg3; \ + register long int __a4 asm ("a4") = _arg4; \ + register long int __a5 asm ("a5") = _arg5; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -294,16 +315,23 @@ # define internal_syscall7(number, err, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + long int _arg5 = (long int) (arg5); \ + long int _arg6 = (long int) (arg6); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ - register long int __a2 asm ("a2") = (long int) (arg2); \ - register long int __a3 asm ("a3") = (long int) (arg3); \ - register long int __a4 asm ("a4") = (long int) (arg4); \ - register long int __a5 asm ("a5") = (long int) (arg5); \ - register long int __a6 asm ("a6") = (long int) (arg6); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ + register long int __a2 asm ("a2") = _arg2; \ + register long int __a3 asm ("a3") = _arg3; \ + register long int __a4 asm ("a4") = _arg4; \ + register long int __a5 asm ("a5") = _arg5; \ + register long int __a6 asm ("a6") = _arg6; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ From patchwork Mon Feb 10 19:20:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183259 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4418218ile; Mon, 10 Feb 2020 11:22:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxI+2OGan4x9Y+X3t+0cJ4qh2sOZ91l4u1LWSFOLhETYCTWQ1fw7BLI7BtxKFZLF8SnCESw X-Received: by 2002:aca:f1c2:: with SMTP id p185mr391617oih.87.1581362567262; Mon, 10 Feb 2020 11:22:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362567; cv=none; d=google.com; s=arc-20160816; b=igkdos1sCw3k0zFfg/iBGceauVCGhG5Sg73Le64j6HFDaIhSZ1g18q/YULiDdb8PNr kgqEGZEg/sx+PhfGoEDt91bndrikzfd8wlxJEOcGtUDxvX+XgHxsZwoAUeiMZc5BTaNr DZiGhcKfbkhIjFFaAZPcJZd/kpSbYq7qCuSJEnzao6CR56K9wpM5zWQhOGN+8vbHSC5v rS8B3OjU1ky7X52y2sGc/M0hF73Uh8ydCjY8jaXeQ+t0sfWZVmHvnYnJBcjREvwvCw4f PZ5bfnMTik+EedgVnm+hy7PckRyhyyJk32IMS/j1cXk5RIc00vHZO93IVsqwZUTi7ihZ e0ag== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=PuKa3nuGLOga3FHSXjV8IqXcLe94OG2sd/nQRrgYs/Y=; b=G37XBMM7swQYMtphoJkY0VKj/Zmr4Dy5fwozBvf5CKotiF13ndQAm8IKkisOHmLoTs ZpcvSdKW/XoxvdpLXB96sdNawqD5Hu20YLXyztDAZLXYkM7Si6yd2Zo8taWjBP8XBMOX FKOVBzFg+OhdMXu4cnyN2kH0pFWnu2dXMo5CkJPo0A3myPS/tw0pX/wP6fwoFpxypcic 0cb8R9M01mAkF2rv63PA3M/iWelZxab9MXyOU5fXAWMvVorIwcP9kA9VDE30umJviElR a8C7+63eLebF3eG7qbrxeLFPStLOVDy3dGoIkzAjDp6N451OMS1x0q7NoSx8pqH7/AbE 33ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=XL0B1Fej; dkim=pass header.i=@linaro.org header.s=google header.b=ntGkuNS9; spf=pass (google.com: domain of libc-alpha-return-109397-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109397-patch=linaro.org@sourceware.org"; dmarc=pass (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 j17si591496otl.278.2020.02.10.11.22.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:22:47 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109397-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.s=default header.b=XL0B1Fej; dkim=pass header.i=@linaro.org header.s=google header.b=ntGkuNS9; spf=pass (google.com: domain of libc-alpha-return-109397-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109397-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=b5QMcynkWXjW86gAJRZWZ0iKVrnyfNB TV4x2tWMRDtS3BBX2c1qPx1loVBZnSJoFbyYznstOQvSt/qtZ+du8u2toYU1SiQk BqHwCKWOThLY4tlHVB/u4On1xIXuXqUxoxcXwfcU5hzJ/VHHdCYnzAbxjNdWHl8W 4HwCQwEu8X1w= 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:subject:date:message-id:in-reply-to :references; s=default; bh=Vw7zMbbjTQIR401AU1cmiqdSC+M=; b=XL0B1 FejNhc3clmuR77Yp35O+c2f3mgLyuja10xW59iXMaYkpy94Nh+nN1JSIMvKAWAFc pl1eSxkbX79VPupaff5Ni5sLWqmeXqhkkFNqFczn0sKGR1Xsj0JzAlOFUaUSqbjp IZTlP8eWd5KsCgZlUDzdlY1VTHfUrCQFa4hUVQ= Received: (qmail 101019 invoked by alias); 10 Feb 2020 19:21:02 -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 100896 invoked by uid 89); 10 Feb 2020 19:21:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qt1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=PuKa3nuGLOga3FHSXjV8IqXcLe94OG2sd/nQRrgYs/Y=; b=ntGkuNS9A7l+IYmXbflWz/arlB4MLRoxQ4mS0uBhVlmHmx1HiPHBucD5tiRTaFRNmJ H6asle0Y62RdZHrWUpJPSSSUrk+s0dXwWdhCpoedaeX3J2jh3PfAhwHLWSxhS6b49Nst UeSr7ovzGzZkMIf3L4kk0AF6DDR/r58mS/6+ZUM4tesdUrMNgMQGpYWoBhw4NBQtojH2 t2HDdPZUmbqLFMOtRaL5tpMVAEszs/oks3cE0DPWpFz1xPX7mefpOvSV3UGtckdjGNj9 aK+83rgr61sO04x5HQr//GocIlZxOiAakSmxfEiVJb2Rm0J/GBcNyjT5cr1ung8okmnd H21w== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 11/15] s390: Consolidate Linux syscall definition Date: Mon, 10 Feb 2020 16:20:34 -0300 Message-Id: <20200210192038.23588-11-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> The {INTERNAL,INLINE}_SYSCALL are defined only on s390 sysdep.h. Checked on s390x-linux-gnu and s390-linux-gnu. --- sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 95 ---------------- sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 97 ----------------- sysdeps/unix/sysv/linux/s390/sysdep.h | 102 ++++++++++++++++++ 3 files changed, 102 insertions(+), 192 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index f52b8b8735..520c9356c6 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -38,9 +38,6 @@ /* in newer 2.1 kernels __NR_syscall is missing so we define it here */ #define __NR_syscall 0 -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - #ifdef __ASSEMBLER__ /* Linux uses a negative return value to indicate syscall errors, unlike @@ -180,98 +177,6 @@ #endif /* __ASSEMBLER__ */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ - _ret = 0xffffffff; \ - } \ - (int) _ret; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_DIRECT -#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register int _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc %b1\n\t" \ - : "=d" (_ret) \ - : "i" (__NR_##name) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL_SVC0 -#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name); \ - register int _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc 0\n\t" \ - : "=d" (_ret) \ - : "d" (_nr) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register unsigned long _nr __asm__("1") = (unsigned long)(no); \ - register int _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc 0\n\t" \ - : "=d" (_ret) \ - : "d" (_nr) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - (((__NR_##name) < 256) \ - ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args) \ - : INTERNAL_SYSCALL_SVC0(name, err,nr, args)) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - -#define DECLARGS_0() -#define DECLARGS_1(arg1) \ - register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1); -#define DECLARGS_2(arg1, arg2) \ - DECLARGS_1(arg1) \ - register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2); -#define DECLARGS_3(arg1, arg2, arg3) \ - DECLARGS_2(arg1, arg2) \ - register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3); -#define DECLARGS_4(arg1, arg2, arg3, arg4) \ - DECLARGS_3(arg1, arg2, arg3) \ - register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4); -#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - DECLARGS_4(arg1, arg2, arg3, arg4) \ - register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5); -#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ - DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6); - -#define ASMFMT_0 -#define ASMFMT_1 , "0" (gpr2) -#define ASMFMT_2 , "0" (gpr2), "d" (gpr3) -#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4) -#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5) -#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) -#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) - /* Pointer mangling support. */ #if IS_IN (rtld) /* We cannot use the thread descriptor because in ld.so we use setjmp diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 9ff4479dc3..623059135e 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -50,9 +50,6 @@ # define __NR_pwrite __NR_pwrite64 #endif -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - #ifdef __ASSEMBLER__ /* Linux uses a negative return value to indicate syscall errors, unlike @@ -186,100 +183,6 @@ #endif /* __ASSEMBLER__ */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - long _ret = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ - _ret = -1; \ - } \ - _ret; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_DIRECT -#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register long _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc %b1\n\t" \ - : "=d" (_ret) \ - : "i" (__NR_##name) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL_SVC0 -#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name); \ - register long _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc 0\n\t" \ - : "=d" (_ret) \ - : "d" (_nr) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register unsigned long _nr __asm__("1") = (unsigned long)(no); \ - register long _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc 0\n\t" \ - : "=d" (_ret) \ - : "d" (_nr) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - (((__NR_##name) < 256) \ - ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args) \ - : INTERNAL_SYSCALL_SVC0(name, err,nr, args)) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= -4095UL) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - -#define DECLARGS_0() -#define DECLARGS_1(arg1) \ - register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1); -#define DECLARGS_2(arg1, arg2) \ - DECLARGS_1(arg1) \ - register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2); -#define DECLARGS_3(arg1, arg2, arg3) \ - DECLARGS_2(arg1, arg2) \ - register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3); -#define DECLARGS_4(arg1, arg2, arg3, arg4) \ - DECLARGS_3(arg1, arg2, arg3) \ - register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4); -#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - DECLARGS_4(arg1, arg2, arg3, arg4) \ - register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5); -#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ - DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6); - -#define ASMFMT_0 -#define ASMFMT_1 , "0" (gpr2) -#define ASMFMT_2 , "0" (gpr2), "d" (gpr3) -#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4) -#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5) -#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) -#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) - -#define SINGLE_THREAD_BY_GLOBAL 1 - /* Pointer mangling support. */ #if IS_IN (rtld) /* We cannot use the thread descriptor because in ld.so we use setjmp diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h index 33ed86f252..1df0462cc4 100644 --- a/sysdeps/unix/sysv/linux/s390/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/sysdep.h @@ -16,6 +16,106 @@ License along with the GNU C Library; if not, see . */ +#ifndef __ASSEMBLY__ + +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + long _ret = INTERNAL_SYSCALL (name, , nr, args); \ + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ + _ret = -1; \ + } \ + _ret; }) + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + +#undef INTERNAL_SYSCALL_DIRECT +#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register long _ret __asm__("2"); \ + __asm__ __volatile__ ( \ + "svc %b1\n\t" \ + : "=d" (_ret) \ + : "i" (__NR_##name) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) + +#undef INTERNAL_SYSCALL_SVC0 +#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name); \ + register long _ret __asm__("2"); \ + __asm__ __volatile__ ( \ + "svc 0\n\t" \ + : "=d" (_ret) \ + : "d" (_nr) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) + +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register unsigned long _nr __asm__("1") = (unsigned long)(no); \ + register long _ret __asm__("2"); \ + __asm__ __volatile__ ( \ + "svc 0\n\t" \ + : "=d" (_ret) \ + : "d" (_nr) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, nr, args...) \ + (((__NR_##name) < 256) \ + ? INTERNAL_SYSCALL_DIRECT(name, nr, args) \ + : INTERNAL_SYSCALL_SVC0(name, nr, args)) + +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= -4095UL) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) + +#define DECLARGS_0() +#define DECLARGS_1(arg1) \ + register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1); +#define DECLARGS_2(arg1, arg2) \ + DECLARGS_1(arg1) \ + register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2); +#define DECLARGS_3(arg1, arg2, arg3) \ + DECLARGS_2(arg1, arg2) \ + register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3); +#define DECLARGS_4(arg1, arg2, arg3, arg4) \ + DECLARGS_3(arg1, arg2, arg3) \ + register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4); +#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ + DECLARGS_4(arg1, arg2, arg3, arg4) \ + register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5); +#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ + DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ + register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6); + +#define ASMFMT_0 +#define ASMFMT_1 , "0" (gpr2) +#define ASMFMT_2 , "0" (gpr2), "d" (gpr3) +#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4) +#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5) +#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) +#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) + +#define SINGLE_THREAD_BY_GLOBAL 1 + + #define VDSO_NAME "LINUX_2.6.29" #define VDSO_HASH 123718585 @@ -29,3 +129,5 @@ #endif #define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" #define HAVE_GETCPU_VSYSCALL "__kernel_getcpu" + +#endif From patchwork Mon Feb 10 19:20:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183260 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4418359ile; Mon, 10 Feb 2020 11:22:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxCvogTu2WDc+andJawpoeLu/NHkORL3FoyBtLm32VAuwa6GJNlOSnrKoWCw6yTNNhjkpVj X-Received: by 2002:a9d:3bc4:: with SMTP id k62mr2304154otc.186.1581362577743; Mon, 10 Feb 2020 11:22:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362577; cv=none; d=google.com; s=arc-20160816; b=j1AwrjP9of0xsuqBJGQqPb0Nhdkqg6YsawbiQqJgSNlmHx2SrmSThO9YEqOXjh1MMh fGufOqtsUFjI7cNbOtHCjEwIIA04dkAKdSRJMIoX8rTquNcfQpUdPuCmSVCU61TFSVCq VUZ0uTaifr7otba9StfqNXVeTHGPjyt7Hbs9mvdxImFRahBPgAFPKbEj8GK6xcI4PHJ3 rKjdhFdShpAG8uLS6Xq1RAgi/6rqlLNSPCaG3mWfrDhvtuTtgMfBCMQMn+WAFbhNbcWf t2bPu36IxshXkkWTiXib7d+/hY8q8SV61dEVONRyrNyAVyYCIcPmhUH7KYhFiqzW8OLI 1xBg== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=yHRlOLuz+g7J/taK0JyoH+VC7TAga3tawV/6ybHcTjQ=; b=E3YT0J4ccfWNofn023sf+6jfCSe9Fmu41/izQ/5+CX6FF28wF6Ubc92xQlvkuH/rr/ qwm4DZj1v25ya4EWdCON4kLN6Ug9fKEGXkaytIwzCRxk+lVkRZZP3SOTXmTio/yS29Kz WkdZl9UwgdjgIqlkqlWP/mTEuhJqzGsF1y+ZlFQQLvUJTF6leC2VpWp5mh8ydloVJ9BY WATU6Xp8eBjIJ3TlwM9F2JRE8sFYBgzyo22qYidPg57MOyaEZI7OSN9xkKm/3H6F1KUY ZGA8FtRMRLmPOs71IKqpAjguhg7AnJRpV/VpCFFbuz/XAGQ6BNBTwSTQ8VdFBiPtJtEw H77A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=ZFJQvzww; dkim=pass header.i=@linaro.org header.s=google header.b=OQnWjv2F; spf=pass (google.com: domain of libc-alpha-return-109396-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109396-patch=linaro.org@sourceware.org"; dmarc=pass (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 n11si612488otq.112.2020.02.10.11.22.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:22:57 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109396-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.s=default header.b=ZFJQvzww; dkim=pass header.i=@linaro.org header.s=google header.b=OQnWjv2F; spf=pass (google.com: domain of libc-alpha-return-109396-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109396-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=oLKiFfvkUsbRamJJwkPmsUoadwBwaDb D2M3uYG+tmgwmBhUINQZKiLErgdd0MofHA3OxUdzlexWYIAgrPyguM/S1nu1pZ5W ZQ7DCWsGX7Egn3H6QmZUY8L9UhM5JG0AWvUPAcNobiBn22esANTJf44SXL8TOSjx AdCqPdhPpMws= 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:subject:date:message-id:in-reply-to :references; s=default; bh=a4JErfIbudXU2j7f6bPQdjmGeZU=; b=ZFJQv zwwIzFKhfGRwu2eXVCEUEaUadztQXJ1h7Icw+JMxPNttQxXyDXT1GTFmArjccCYv mVSRMGah/N9dwiJJhPBlWLaE2REGiVD2rTNj4jHC1ylfORZ3GSvOW+TTfILy1BHS rb3gj3kL5oP4EFJ5tcBwczBtI3psp0TKMdOJY0= Received: (qmail 100955 invoked by alias); 10 Feb 2020 19:21:01 -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 100885 invoked by uid 89); 10 Feb 2020 19:21:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qk1-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=yHRlOLuz+g7J/taK0JyoH+VC7TAga3tawV/6ybHcTjQ=; b=OQnWjv2FtjDUdghv09L5Gynq5vJBYlr7APcE0RBRl2OKGNKxjg/Rp+KGkx9CkumnDe RSQ5Bixe8UtwsyZbcGmESTEZ/KAkSP9mCh+vcCKfyn8kvuwFfoKP+QOb2IyfSDv2TDgz BMT7Eep5Lnutgva6Ki9vhh/+RUedPMTrJWCbyIvvREETMENSZ353MoG700hHxke3dIXt qQHU2RRPPk3avFpdUha6fEYwOWXy1USRzKmLc+7mJBM+bIweEKYiUEBM+fwptVd5qtVS +MxaA8K+gbQQNegmaAVICxiSei9FFawm7/SPnte8pE6QWoafAQfagFfu+9iJVqQ4J+Ed Bxow== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 12/15] sparc: Avoid clobbering register parameters in syscall Date: Mon, 10 Feb 2020 16:20:35 -0300 Message-Id: <20200210192038.23588-12-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> The sparc INTERNAL_SYSCALL macro might clobber the register parameter if the argument itself might clobber any register (a function call for instance). This patch fixes it by using temporary variables for the expressions between the register assignments (as indicated by GCC documentation, 6.47.5.2 Specifying Registers for Local Variables). It is similar to the fix done for MIPS (BZ#25523). Checked on sparc64-linux-gnu and sparcv9-linux-gnu. --- sysdeps/unix/sysv/linux/sparc/sysdep.h | 78 +++++++++++++++++--------- 1 file changed, 52 insertions(+), 26 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index 67efa6f029..e2a12349a1 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -87,8 +87,9 @@ #define internal_syscall1(string,err,name,arg1) \ ({ \ + long _arg1 = (long) (arg1); \ register long __err __asm__("g1") = (name); \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ + register long __o0 __asm__ ("o0") = _arg1; \ __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ "0" (__err), "1" (__o0) : \ __SYSCALL_CLOBBERS); \ @@ -97,9 +98,11 @@ #define internal_syscall2(string,err,name,arg1,arg2) \ ({ \ + long _arg1 = (long) (arg1); \ + long _arg2 = (long) (arg2); \ register long __err __asm__("g1") = (name); \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ + register long __o0 __asm__ ("o0") = _arg1; \ + register long __o1 __asm__ ("o1") = _arg2; \ __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ "0" (__err), "1" (__o0), "r" (__o1) : \ __SYSCALL_CLOBBERS); \ @@ -108,10 +111,13 @@ #define internal_syscall3(string,err,name,arg1,arg2,arg3) \ ({ \ + long _arg1 = (long) (arg1); \ + long _arg2 = (long) (arg2); \ + long _arg3 = (long) (arg3); \ register long __err __asm__("g1") = (name); \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ + register long __o0 __asm__ ("o0") = _arg1; \ + register long __o1 __asm__ ("o1") = _arg2; \ + register long __o2 __asm__ ("o2") = _arg3; \ __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ "0" (__err), "1" (__o0), "r" (__o1), \ "r" (__o2) : \ @@ -121,11 +127,15 @@ #define internal_syscall4(string,err,name,arg1,arg2,arg3,arg4) \ ({ \ + long _arg1 = (long) (arg1); \ + long _arg2 = (long) (arg2); \ + long _arg3 = (long) (arg3); \ + long _arg4 = (long) (arg4); \ register long __err __asm__("g1") = (name); \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ + register long __o0 __asm__ ("o0") = _arg1; \ + register long __o1 __asm__ ("o1") = _arg2; \ + register long __o2 __asm__ ("o2") = _arg3; \ + register long __o3 __asm__ ("o3") = _arg4; \ __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ "0" (__err), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3) : \ @@ -135,12 +145,17 @@ #define internal_syscall5(string,err,name,arg1,arg2,arg3,arg4,arg5) \ ({ \ + long _arg1 = (long) (arg1); \ + long _arg2 = (long) (arg2); \ + long _arg3 = (long) (arg3); \ + long _arg4 = (long) (arg4); \ + long _arg5 = (long) (arg5); \ register long __err __asm__("g1") = (name); \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __o4 __asm__ ("o4") = (long)(arg5); \ + register long __o0 __asm__ ("o0") = _arg1; \ + register long __o1 __asm__ ("o1") = _arg2; \ + register long __o2 __asm__ ("o2") = _arg3; \ + register long __o3 __asm__ ("o3") = _arg4; \ + register long __o4 __asm__ ("o4") = _arg5; \ __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ "0" (__err), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4) : \ @@ -150,13 +165,19 @@ #define internal_syscall6(string,err,name,arg1,arg2,arg3,arg4,arg5,arg6)\ ({ \ + long _arg1 = (long) (arg1); \ + long _arg2 = (long) (arg2); \ + long _arg3 = (long) (arg3); \ + long _arg4 = (long) (arg4); \ + long _arg5 = (long) (arg5); \ + long _arg6 = (long) (arg6); \ register long __err __asm__("g1") = (name); \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __o4 __asm__ ("o4") = (long)(arg5); \ - register long __o5 __asm__ ("o5") = (long)(arg6); \ + register long __o0 __asm__ ("o0") = _arg1; \ + register long __o1 __asm__ ("o1") = _arg2; \ + register long __o2 __asm__ ("o2") = _arg3; \ + register long __o3 __asm__ ("o3") = _arg4; \ + register long __o4 __asm__ ("o4") = _arg5; \ + register long __o5 __asm__ ("o5") = _arg6; \ __asm __volatile (string : "=r" (__err), "=r" (__o0) : \ "0" (__err), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4), \ @@ -167,11 +188,16 @@ #define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \ ({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __o4 __asm__ ("o4") = (long)(arg5); \ + long _arg1 = (long) (arg1); \ + long _arg2 = (long) (arg2); \ + long _arg3 = (long) (arg3); \ + long _arg4 = (long) (arg4); \ + long _arg5 = (long) (arg5); \ + register long __o0 __asm__ ("o0") = _arg1; \ + register long __o1 __asm__ ("o1") = _arg2; \ + register long __o2 __asm__ ("o2") = _arg3; \ + register long __o3 __asm__ ("o3") = _arg4; \ + register long __o4 __asm__ ("o4") = _arg5; \ register long __g1 __asm__ ("g1") = __NR_clone; \ __asm __volatile (__SYSCALL_STRING : \ "=r" (__g1), "=r" (__o0), "=r" (__o1) : \ From patchwork Mon Feb 10 19:20:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183262 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4418706ile; Mon, 10 Feb 2020 11:23:18 -0800 (PST) X-Google-Smtp-Source: APXvYqwTAQHU8k07ICZ9AOz/FkIaDzud+d5dKNlLk1sKHm/FMu881o4qdV/zKcgCeH2JPX0VRS3D X-Received: by 2002:a9d:6289:: with SMTP id x9mr2268619otk.8.1581362598416; Mon, 10 Feb 2020 11:23:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362598; cv=none; d=google.com; s=arc-20160816; b=GUY8WbgpFSDA1SpLlY6rlgNOMBj4I6GzZ3jHQ8FRl/g68DPYfXKP69gvBLydWqc3YU KlxbREsvnM/WsvKScZjtYwlC65L28ulfRZzhg47HniQxQVcXagTZAmhkOBtlo/aqYkEs ew1NwzBQrod+JOUghPIebiqDbFXGd9b/PJUSbKXTaCt4TPNxve33R4hi3uMMXDTuPYMK zmJm226BKLW7LcVs+KvGZnH0fjegMv9k0RgCHk8mhc3OkwXJaQ248+BGS2aw7s89x/SP lwC8XFc0nNW0MTZvBNxmL+zRTJX32U1UzPST8m2G5q5MtvrjvzkJ65iwsKFsCqWch+tZ 04+A== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=YV99MR1OXuiP+poOM7j7QPjB2FAKTksjn7eeOdQLfOM=; b=CoyzIwppghkcymh9YFqXAvNtiw47Bl2vAz/4Sn7+xw1LOce/fIBRxLBjN/p682WbVA crhx+imjU59VzAJi+gMs8QxlW0SxiEsghnRyDc70EsRLOLPiPuwKnhx9itnm3Lr4u2Jq H3OMl3eMCV6ig0Zbc+AsPqH8JY4LA3ToXWvIRwIGI4tcvE0jNJyCIEn6QBbt58BTmPux NmfcMD9MAjlvacqg2Td/pHJdXNuKzPMQI+8PIVpOHDmk1L6a5irbnMMaMytfKeQv3E8s Qtx+kDarQ4rZJb82XcEkN/8qV1ObUN2JVbKn2jesz4a/uNxElYgLKemQ1e8oFhsgJZv3 q/nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=QtxRMoBx; dkim=pass header.i=@linaro.org header.s=google header.b=UuSHdMgy; spf=pass (google.com: domain of libc-alpha-return-109399-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109399-patch=linaro.org@sourceware.org"; dmarc=pass (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 u8si639150otq.262.2020.02.10.11.23.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:23:18 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109399-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.s=default header.b=QtxRMoBx; dkim=pass header.i=@linaro.org header.s=google header.b=UuSHdMgy; spf=pass (google.com: domain of libc-alpha-return-109399-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109399-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=FE4WS9MS3qXM7LS7a/gYtOhOUXBCYtT wXCtPm5rVesxSv1BPaOzE9/1AbIKgEAj8eARxTKVftGGFLQbeYHFyAGUft00z596 Crw6c86UG+uA+ug8WaSYUaWqYjW4Ul+sv7FSSaL79OpJAJOfo1xooZw7xrAi6P0w 51bxiLL8ad4I= 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:subject:date:message-id:in-reply-to :references; s=default; bh=/KjukjtV+2ctRZH1DHqagAlP0Ms=; b=QtxRM oBx3kTU926j5OIt18zuqOsHFEO74nmQKILplmA40XesMc4C6VX3WgP6m98OiTwT2 zDd7zzCwryKogHQWuCIZY+kUVq2G5p/ab4Z0cKG+Q+0iEAhfCLacuNTCuPfklXdD 2CWggiCVr9wq/QQIJYqF0GZY9vX8NyooJfX4r4= Received: (qmail 101891 invoked by alias); 10 Feb 2020 19:21:09 -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 101824 invoked by uid 89); 10 Feb 2020 19:21:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=4.5 X-HELO: mail-qk1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=YV99MR1OXuiP+poOM7j7QPjB2FAKTksjn7eeOdQLfOM=; b=UuSHdMgypFAIb6bzMAo9spgvYn9oVx3kY/FxbZTUDfFQyX8yPW7MgyEvwT3sZSqHID njR7fbmM/6S6bek4QVMJYXfEx7G8infK212odZ9bKMOXiVx1bRws3h6gBKCAYKKs8L0w IA5GHuR5Kocy4taV644Cb1aIftDmPsEaJNh62fWIDaPLhtEggGZWF0HsvuZOUyIxsgL9 AlEkETJfJEPXqyON0Z0ALnMdwVnRtciBEfVKPX1qV1hgHCmh9XB+D6wc1pfiYY7VyTg9 YNfncAUjUyvcwM9VHTwMfoYG7TrKjCgC+cDtzFGCW/twhsuJzwMCWjdKMaDNvmzBttTA c9Cw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 13/15] linux: Consolidate INLINE_SYSCALL Date: Mon, 10 Feb 2020 16:20:36 -0300 Message-Id: <20200210192038.23588-13-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, there is no need to replicate the INLINE_SYSCALL. The generic Linux sysdep.h includes errno.h even for !__ASSEMBLER__, which is ok now and it allows cleanup some archaic code that assume otherwise. Checked with a build against all affected ABIs. --- sysdeps/i386/pthread_spin_trylock.S | 2 +- sysdeps/mips/nptl/tls.h | 2 +- sysdeps/sh/nptl/pthread_spin_trylock.S | 2 +- sysdeps/sparc/sparc32/pthread_spin_trylock.S | 2 +- sysdeps/sparc/sparc64/pthread_spin_trylock.S | 2 +- sysdeps/unix/arm/sysdep.S | 3 +- sysdeps/unix/mips/sysdep.S | 3 +- sysdeps/unix/sh/sysdep.S | 3 +- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 22 ---------- sysdeps/unix/sysv/linux/alpha/brk.S | 3 +- sysdeps/unix/sysv/linux/alpha/sysdep.h | 24 ----------- sysdeps/unix/sysv/linux/arm/sysdep.h | 27 ------------- sysdeps/unix/sysv/linux/csky/sysdep.h | 22 ---------- sysdeps/unix/sysv/linux/hppa/sysdep.h | 30 -------------- sysdeps/unix/sysv/linux/i386/sysdep.h | 40 +------------------ sysdeps/unix/sysv/linux/ia64/sysdep.h | 20 ---------- sysdeps/unix/sysv/linux/m68k/sysdep.h | 22 ---------- sysdeps/unix/sysv/linux/microblaze/sysdep.h | 24 ----------- sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 28 ------------- sysdeps/unix/sysv/linux/mips/mips64/sysdep.h | 28 ------------- sysdeps/unix/sysv/linux/nios2/sysdep.h | 24 +---------- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 30 -------------- sysdeps/unix/sysv/linux/riscv/sysdep.h | 20 ---------- sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 5 --- sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 5 --- sysdeps/unix/sysv/linux/s390/sysdep.h | 21 ---------- sysdeps/unix/sysv/linux/sh/sysdep.h | 21 ---------- sysdeps/unix/sysv/linux/sparc/sparc64/brk.S | 3 +- sysdeps/unix/sysv/linux/sparc/sysdep.h | 22 ---------- sysdeps/unix/sysv/linux/sysdep.h | 40 +++++++++++++++++++ sysdeps/unix/sysv/linux/x86_64/sysdep.h | 35 ---------------- sysdeps/unix/x86_64/sysdep.S | 3 +- sysdeps/x86_64/nptl/pthread_spin_trylock.S | 2 +- 33 files changed, 54 insertions(+), 486 deletions(-) -- 2.17.1 diff --git a/sysdeps/i386/pthread_spin_trylock.S b/sysdeps/i386/pthread_spin_trylock.S index 949879c603..8edb676381 100644 --- a/sysdeps/i386/pthread_spin_trylock.S +++ b/sysdeps/i386/pthread_spin_trylock.S @@ -17,7 +17,7 @@ . */ #include -#include +#include #ifdef UP diff --git a/sysdeps/mips/nptl/tls.h b/sysdeps/mips/nptl/tls.h index ba0efe8af6..ae85984f95 100644 --- a/sysdeps/mips/nptl/tls.h +++ b/sysdeps/mips/nptl/tls.h @@ -35,7 +35,7 @@ # define READ_THREAD_POINTER() (__builtin_thread_pointer ()) #else /* Note: rd must be $v1 to be ABI-conformant. */ -# if __mips_isa_rev >= 2 +# if defined (__mips_isa_rev) && __mips_isa_rev >= 2 # define READ_THREAD_POINTER() \ ({ void *__result; \ asm volatile ("rdhwr\t%0, $29" : "=v" (__result)); \ diff --git a/sysdeps/sh/nptl/pthread_spin_trylock.S b/sysdeps/sh/nptl/pthread_spin_trylock.S index c8c453ca9f..142908cf32 100644 --- a/sysdeps/sh/nptl/pthread_spin_trylock.S +++ b/sysdeps/sh/nptl/pthread_spin_trylock.S @@ -15,7 +15,7 @@ License along with the GNU C Library; if not, see . */ -#include +#include .globl pthread_spin_trylock .type pthread_spin_trylock,@function diff --git a/sysdeps/sparc/sparc32/pthread_spin_trylock.S b/sysdeps/sparc/sparc32/pthread_spin_trylock.S index bd31fad711..4b992e78bf 100644 --- a/sysdeps/sparc/sparc32/pthread_spin_trylock.S +++ b/sysdeps/sparc/sparc32/pthread_spin_trylock.S @@ -16,7 +16,7 @@ . */ #include -#include +#include .text ENTRY(pthread_spin_trylock) diff --git a/sysdeps/sparc/sparc64/pthread_spin_trylock.S b/sysdeps/sparc/sparc64/pthread_spin_trylock.S index fd33946aec..b6cfa52b51 100644 --- a/sysdeps/sparc/sparc64/pthread_spin_trylock.S +++ b/sysdeps/sparc/sparc64/pthread_spin_trylock.S @@ -16,7 +16,7 @@ . */ #include -#include +#include .text ENTRY(pthread_spin_trylock) diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S index 514937bd4b..5c9022a869 100644 --- a/sysdeps/unix/arm/sysdep.S +++ b/sysdeps/unix/arm/sysdep.S @@ -16,8 +16,7 @@ . */ #include -#define _ERRNO_H -#include +#include #if IS_IN (rtld) # include /* Defines RTLD_PRIVATE_ERRNO. */ diff --git a/sysdeps/unix/mips/sysdep.S b/sysdeps/unix/mips/sysdep.S index fca1091cda..744d1620b3 100644 --- a/sysdeps/unix/mips/sysdep.S +++ b/sysdeps/unix/mips/sysdep.S @@ -17,8 +17,7 @@ . */ #include -#define _ERRNO_H -#include +#include #include .set nomips16 diff --git a/sysdeps/unix/sh/sysdep.S b/sysdeps/unix/sh/sysdep.S index 7facc028d6..dc9a230ee0 100644 --- a/sysdeps/unix/sh/sysdep.S +++ b/sysdeps/unix/sh/sysdep.S @@ -16,8 +16,7 @@ . */ #include -#define _ERRNO_H -#include +#include ENTRY(__syscall_error) #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index 00b8e241c8..79fa0bda27 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -170,21 +170,6 @@ # define SINGLE_THREAD_BY_GLOBAL 1 -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned long) -1; \ - } \ - (long) _sys_result; }) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - # undef INTERNAL_SYSCALL_RAW # define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ ({ long _sys_result; \ @@ -205,13 +190,6 @@ # define INTERNAL_SYSCALL_AARCH64(name, err, nr, args...) \ INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args) -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - # define LOAD_ARGS_0() \ register long _x0 asm ("x0"); # define LOAD_ARGS_1(x0) \ diff --git a/sysdeps/unix/sysv/linux/alpha/brk.S b/sysdeps/unix/sysv/linux/alpha/brk.S index 45ecbbea1b..5596b346d8 100644 --- a/sysdeps/unix/sysv/linux/alpha/brk.S +++ b/sysdeps/unix/sysv/linux/alpha/brk.S @@ -21,8 +21,7 @@ break value (instead of the new, requested one). */ #include -#define _ERRNO_H -#include +#include #ifdef PIC .section .bss diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h index ca0b4e475c..679d6169de 100644 --- a/sysdeps/unix/sysv/linux/alpha/sysdep.h +++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h @@ -169,42 +169,18 @@ __LABEL(name) \ #else /* !ASSEMBLER */ -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#include - -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ -({ \ - INTERNAL_SYSCALL_DECL (_sc_err); \ - long int _sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (_sc_ret, _sc_err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sc_ret, _sc_err)); \ - _sc_ret = -1L; \ - } \ - _sc_ret; \ -}) - #define INTERNAL_SYSCALL(name, err_out, nr, args...) \ internal_syscall##nr(__NR_##name, args) #define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \ internal_syscall##nr(name, args) -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - /* The normal Alpha calling convention sign-extends 32-bit quantties no matter what the "real" sign of the 32-bit type. We want to preserve that when filling in values for the kernel. */ #define syscall_promote(arg) \ (sizeof (arg) == 4 ? (long)(int)(long)(arg) : (long)(arg)) -/* Make sure and "use" the variable that we're not returning, - in order to suppress unused variable warnings. */ -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define internal_syscall_clobbers \ "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ "$22", "$23", "$24", "$25", "$27", "$28", "memory" diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index 0c5f498583..f6e6b63959 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -29,11 +29,6 @@ #include -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -317,21 +312,6 @@ __local_syscall_error: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned int) -1; \ - } \ - (int) _sys_result; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - #if defined(__thumb__) /* We can not expose the use of r7 to the compiler. GCC (as of 4.5) uses r7 as the hard frame pointer for Thumb - although @@ -377,13 +357,6 @@ __local_syscall_error: \ #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define VDSO_NAME "LINUX_2.6" #define VDSO_HASH 61765110 diff --git a/sysdeps/unix/sysv/linux/csky/sysdep.h b/sysdeps/unix/sysv/linux/csky/sysdep.h index fa1dbd6614..7ebb19dce8 100644 --- a/sysdeps/unix/sysv/linux/csky/sysdep.h +++ b/sysdeps/unix/sysv/linux/csky/sysdep.h @@ -293,28 +293,6 @@ __local_syscall_error: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result,), 0)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned int) -1; \ - } \ - (int) _sys_result; }) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xffffff01u) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - # undef INTERNAL_SYSCALL_RAW # define INTERNAL_SYSCALL_RAW0(name, err, dummy...) \ ({unsigned int __sys_result; \ diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h index 6c34189eca..88e368db4d 100644 --- a/sysdeps/unix/sysv/linux/hppa/sysdep.h +++ b/sysdeps/unix/sysv/linux/hppa/sysdep.h @@ -360,36 +360,6 @@ L(pre_end): ASM_LINE_SEP \ #define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \ "%r20", "%r29", "%r31" -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ -({ \ - long __sys_res = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_res, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_res, )); \ - __sys_res = -1; \ - } \ - __sys_res; \ -}) - -/* INTERNAL_SYSCALL_DECL - Allows us to setup some function static - value to use within the context of the syscall - INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise - You are allowed to use the syscall result (val) and the DECL error - variable to determine what went wrong. - INTERLAL_SYSCALL_ERRNO - Munges the val/err pair into the error number. - In our case we just flip the sign. */ - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((val < 0) && (val > -4095)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - /* Similar to INLINE_SYSCALL but we don't set errno */ #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 4aa7bb496a..d975683749 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -67,6 +67,7 @@ /* We don't want the label for the error handle to be global when we define it here. */ +#undef SYSCALL_ERROR_LABEL #define SYSCALL_ERROR_LABEL __syscall_error #undef PSEUDO @@ -280,35 +281,6 @@ struct libc_do_syscall_args }; #endif -/* Define a macro which expands inline into the wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#if IS_IN (libc) -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )) \ - ? __syscall_error (-INTERNAL_SYSCALL_ERRNO (resultvar, )) \ - : (int) resultvar; }) -#else -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = 0xffffffff; \ - } \ - (int) resultvar; }) -#endif - -/* Set error number and return -1. Return the internal function, - __syscall_error, which sets errno from the negative error number - and returns -1, to avoid PIC. */ -#undef INLINE_SYSCALL_ERROR_RETURN_VALUE -#define INLINE_SYSCALL_ERROR_RETURN_VALUE(resultvar) \ - __syscall_error (-(resultvar)) - # define VDSO_NAME "LINUX_2.6" # define VDSO_HASH 61765110 @@ -490,16 +462,6 @@ struct libc_do_syscall_args # endif /* GCC 5 */ #endif -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define LOADARGS_0 #ifdef __PIC__ # if I386_USE_SYSENTER && defined PIC diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h index 729bfadad0..fab8ca2359 100644 --- a/sysdeps/unix/sysv/linux/ia64/sysdep.h +++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h @@ -231,29 +231,9 @@ #endif /* !IA64_USE_NEW_STUB */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned long) -1; \ - } \ - (long) _sys_result; }) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define LOAD_ARGS_0() #define LOAD_REGS_0 #define LOAD_ARGS_1(a1) \ diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h index 5cd35fffcf..f6793d34fa 100644 --- a/sysdeps/unix/sysv/linux/m68k/sysdep.h +++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h @@ -221,21 +221,6 @@ SYSCALL_ERROR_LABEL: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned int) -1; \ - } \ - (int) _sys_result; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - /* Define a macro which expands inline into the wrapper code for a system call. This use is for internal calls that do not need to handle errors normally. It will never touch errno. This returns just what the kernel @@ -260,13 +245,6 @@ SYSCALL_ERROR_LABEL: \ #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= -4095U) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define LOAD_ARGS_0() #define LOAD_REGS_0 #define ASM_ARGS_0 diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h index b4a6ee89f1..6eeae33df5 100644 --- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h +++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h @@ -163,23 +163,6 @@ SYSCALL_ERROR_LABEL_DCL: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ -({ INTERNAL_SYSCALL_DECL(err); \ - unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \ - resultvar = (unsigned long) -1; \ - } \ - (long) resultvar; \ -}) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - /* Define a macro which expands inline into the wrapper code for a system call. This use is for internal calls that do not need to handle errors normally. It will never touch errno. This returns just what the kernel @@ -192,13 +175,6 @@ SYSCALL_ERROR_LABEL_DCL: \ # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ inline_syscall##nr(name, args) -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= -4095U) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - # define SYSCALL_CLOBBERS_6 "r11", "r4", "memory" # define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6 # define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5 diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index 6842ff5211..75d483c59b 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -25,11 +25,6 @@ #include -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -47,29 +42,6 @@ #else /* ! __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (_sc_err); \ - long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \ - result_var = -1L; \ - } \ - result_var; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the syscall number. Then if a restart triggered, $v0 would have been diff --git a/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h index 072016f07e..03873ce2c2 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h @@ -25,11 +25,6 @@ #include -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -55,29 +50,6 @@ typedef long long int __syscall_arg_t; typedef long int __syscall_arg_t; #endif -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (_sc_err); \ - long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \ - result_var = -1L; \ - } \ - result_var; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the syscall number. Then if a restart triggered, $v0 would have been diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.h b/sysdeps/unix/sysv/linux/nios2/sysdep.h index eab888df32..45ef817ab5 100644 --- a/sysdeps/unix/sysv/linux/nios2/sysdep.h +++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h @@ -37,6 +37,7 @@ #ifdef __ASSEMBLER__ +#undef SYSCALL_ERROR_LABEL #define SYSCALL_ERROR_LABEL __local_syscall_error #undef PSEUDO @@ -143,29 +144,6 @@ which lead in a non existent __send symbol in libc.so. */ # undef HAVE_INTERNAL_SEND_SYMBOL -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL(err); \ - unsigned int result_var = INTERNAL_SYSCALL (name, err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \ - result_var = -1L; \ - } \ - (int) result_var; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #undef INTERNAL_SYSCALL_RAW #define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ ({ unsigned int _sys_result; \ diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index abdcfd4a63..92503ee20f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -67,26 +67,6 @@ #define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) -/* This version is for kernels that implement system calls that - behave like function calls as far as register saving. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ - sc_ret = -1L; \ - } \ - sc_ret; \ - }) - -/* Define a macro which expands inline into the wrapper code for a system - call. This use is for internal calls that do not need to handle errors - normally. It will never touch errno. This returns just what the kernel - gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) - the negation of the return value in the kernel gets reverted. */ #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ @@ -114,16 +94,6 @@ #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #if defined(__PPC64__) || defined(__powerpc64__) # define SYSCALL_ARG_SIZE 8 #else diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index 2bd9b16f32..e46160f3f6 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -130,26 +130,6 @@ # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (err); \ - long int __sys_result = INTERNAL_SYSCALL (name, err, nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_result, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_result, )); \ - __sys_result = (unsigned long) -1; \ - } \ - __sys_result; }) - -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long int) (val) > -4096UL) - -# define INTERNAL_SYSCALL_ERRNO(val, err) (-val) - # define INTERNAL_SYSCALL(name, err, nr, args...) \ internal_syscall##nr (SYS_ify (name), err, args) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index 520c9356c6..7d31abbb6f 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -26,11 +26,6 @@ #include /* For RTLD_PRIVATE_ERRNO. */ #include -/* Define __set_errno() for INLINE_SYSCALL macro below. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 623059135e..aba3999315 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -27,11 +27,6 @@ #include /* For RTLD_PRIVATE_ERRNO. */ #include -/* Define __set_errno() for INLINE_SYSCALL macro below. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h index 1df0462cc4..3802e07277 100644 --- a/sysdeps/unix/sysv/linux/s390/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/sysdep.h @@ -21,20 +21,6 @@ #undef SYS_ify #define SYS_ify(syscall_name) __NR_##syscall_name -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - long _ret = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ - _ret = -1; \ - } \ - _ret; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - #undef INTERNAL_SYSCALL_DIRECT #define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \ ({ \ @@ -79,13 +65,6 @@ ? INTERNAL_SYSCALL_DIRECT(name, nr, args) \ : INTERNAL_SYSCALL_SVC0(name, nr, args)) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= -4095UL) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define DECLARGS_0() #define DECLARGS_1(arg1) \ register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1); diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h index 703b042f4f..c0e52af65a 100644 --- a/sysdeps/unix/sysv/linux/sh/sysdep.h +++ b/sysdeps/unix/sysv/linux/sh/sysdep.h @@ -287,17 +287,6 @@ register long int r1 asm ("%r1") = (long int) (_arg6); \ register long int r2 asm ("%r2") = (long int) (_arg7) -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = 0xffffffff; \ - } \ - (int) resultvar; }) - #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ @@ -326,16 +315,6 @@ \ (int) resultvar; }) -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #endif /* __ASSEMBLER__ */ /* Pointer mangling support. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S index 0bcd882532..471da3d268 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S @@ -21,8 +21,7 @@ break value (instead of the new, requested one). */ #include -#define _ERRNO_H -#include +#include #ifdef PIC .section .bss diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index e2a12349a1..46f4e06844 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -45,21 +45,6 @@ # endif # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ -({ INTERNAL_SYSCALL_DECL(err); \ - unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args);\ - if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \ - resultvar = (unsigned long) -1; \ - } \ - (long) resultvar; \ -}) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ internal_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args) @@ -68,13 +53,6 @@ #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ internal_syscall##nr(__SYSCALL_STRING, err, name, args) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define internal_syscall0(string,err,name,dummy...) \ ({ \ register long __err __asm__("g1") = (name); \ diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h index c7f3e54d37..389c94cfda 100644 --- a/sysdeps/unix/sysv/linux/sysdep.h +++ b/sysdeps/unix/sysv/linux/sysdep.h @@ -15,8 +15,44 @@ License along with the GNU C Library; if not, see . */ +#ifndef _SYSDEP_LINUX_H +#define _SYSDEP_LINUX_H + #include #include +#include + +#ifndef __ASSEMBLER__ + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) > -4096UL) + +#ifndef SYSCALL_ERROR_LABEL +# define SYSCALL_ERROR_LABEL(sc_err) \ + ({ \ + __set_errno (sc_err); \ + -1L; \ + }) +#endif + +/* This version is for kernels that implement system calls that + behave like function calls as far as register saving. */ +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + INTERNAL_SYSCALL_DECL (sc_err); \ + long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ + __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)) \ + : sc_ret; \ + }) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) /* Set error number and return -1. A target may choose to return the internal function, __syscall_error, which sets errno and returns -1. @@ -66,3 +102,7 @@ /* Exports the __send symbol on send.c linux implementation (some ABI have it missing due the usage of a old generic version without it). */ #define HAVE_INTERNAL_SEND_SYMBOL 1 + +#endif /* __ASSEMBLER__ */ + +#endif /* _SYSDEP_LINUX_H */ diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index c2eb37e575..d91e00572c 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -177,35 +177,6 @@ # define DOARGS_6 DOARGS_5 #else /* !__ASSEMBLER__ */ -/* Define a macro which expands inline into the wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = (unsigned long int) -1; \ - } \ - (long int) resultvar; }) - -/* Define a macro with explicit types for arguments, which expands inline - into the wrapper code for a system call. It should be used when size - of any argument > size of long int. */ -# undef INLINE_SYSCALL_TYPES -# define INLINE_SYSCALL_TYPES(name, nr, args...) \ - ({ \ - unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = (unsigned long int) -1; \ - } \ - (long int) resultvar; }) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) /* Registers clobbered by syscall. */ # define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx" @@ -353,12 +324,6 @@ (long int) resultvar; \ }) -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long int) (long int) (val) >= -4095L) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) # define VDSO_NAME "LINUX_2.6" # define VDSO_HASH 61765110 diff --git a/sysdeps/unix/x86_64/sysdep.S b/sysdeps/unix/x86_64/sysdep.S index f617627eb8..2278fce9e4 100644 --- a/sysdeps/unix/x86_64/sysdep.S +++ b/sysdeps/unix/x86_64/sysdep.S @@ -16,8 +16,7 @@ . */ #include -#define _ERRNO_H -#include +#include #include #if IS_IN (rtld) diff --git a/sysdeps/x86_64/nptl/pthread_spin_trylock.S b/sysdeps/x86_64/nptl/pthread_spin_trylock.S index 24981fe717..c084577755 100644 --- a/sysdeps/x86_64/nptl/pthread_spin_trylock.S +++ b/sysdeps/x86_64/nptl/pthread_spin_trylock.S @@ -16,8 +16,8 @@ License along with the GNU C Library; if not, see . */ -#include #include +#include #ifdef UP From patchwork Mon Feb 10 19:20:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183261 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4418484ile; Mon, 10 Feb 2020 11:23:06 -0800 (PST) X-Google-Smtp-Source: APXvYqxIzx2L5eNrjUKzNrTGmbZfG5mD1Ixs6Ij7QNdgGuvbY5gjPAIL2w9G9A4W624WwlzV/HYq X-Received: by 2002:a05:6830:22cc:: with SMTP id q12mr2301686otc.110.1581362586578; Mon, 10 Feb 2020 11:23:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362586; cv=none; d=google.com; s=arc-20160816; b=aCGj0PPSgNabgKMuvUEBzk40JkqEMnOkpJ+gK575HhaIhodkulVO6e8+EaPrI4UN3j MoaF5rmmnFo32mUBX2dxKW2FAmECNVOom6PiiK5Iq683Gfn5y0qKGP6fXbyXPREtZWG9 h11gY+Sap2VEitrymSSjej8vTeznvqYbhwP6EGM552JosFxhAQcBmt4eWwnbJqX0AyFh Spa7jBK2WR1/sCezWdlLht/vEEHsl05S8E54t0WRHKJ/PEOC/YqODXeVgAACVX2TfKyS 84E+arEATrcBgpIuKBYJ2P7RGRRMW4lNMVEvBCMDWislsVQrw99oDk5fUhN6EVgZ8ibR zhgA== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=ra4ePMBgN/iPhOeQ7eRhFx9ThQwcKZOU8wHhXC3tle0=; b=ho4fPMxIiABz112MTEKLfvFTD4QpxdDwVSkrcPHASHVQ0FsAYmjICEq8F9ntQMlWCD ZUh4jhcegyBbHmdlTdXVjuSdqkhBaK79kJajHWSOv5MK67yuMny9Y71FLFCDGjSXnN62 sZEK4VgvYrtitJwECu3LFYX3jKzk0W9K6cD+WEWksXa8vuJlkdMEpNvFwZhiVO30fmdf 4P51YL5hTxcLsS745Pzb4K+x1LQ+oNgv9HDDiBVIOm1fR5xGLGR9Zxp2CnufeFH3rFOG MoNJVRydPyhDYe37BYZb6fe49Nz3I/QZ6jJ/ziE0ym2SHpGQ0CdCju0QYTdONR3JMNWN hOQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="X/sgq6w9"; dkim=pass header.i=@linaro.org header.s=google header.b=ZpV9YZvB; spf=pass (google.com: domain of libc-alpha-return-109398-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109398-patch=linaro.org@sourceware.org"; dmarc=pass (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 e9si599671otk.318.2020.02.10.11.23.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:23:06 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109398-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.s=default header.b="X/sgq6w9"; dkim=pass header.i=@linaro.org header.s=google header.b=ZpV9YZvB; spf=pass (google.com: domain of libc-alpha-return-109398-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109398-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=We3hy55xMS/z67cqRAc2sULgfnOL+uP VUsgp1E2d5ooVMidPc398IpBRhY+c+j/ksoHQDoLrKaS9Br2hNaY8Xu0uvfvriLA dk+2VO5zlOMRMEP27tXCpLqqWWE8lnF75ZzjedXuZ3UClky0lkACF0Q3sWiL50An vfWaT8mnMqqg= 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:subject:date:message-id:in-reply-to :references; s=default; bh=NSvW51DC8ontEAyyIcgC2pbYBYU=; b=X/sgq 6w9oPOrGGrVhBTjsZ3WJamZlWDy4t/Fk7js8MgQiqKjs3ZGQB36n5JIm79jbhko4 KB+vML77WWHfwdqsWJYmNPdau2Bt7bvo0eKxfD1vbtL+yK07PH8FxsdEkMDKFMG2 0sW/A54YzSsd1Y+efdzeU7Qtr2R8wIFUYfc7IY= Received: (qmail 101462 invoked by alias); 10 Feb 2020 19:21:05 -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 101114 invoked by uid 89); 10 Feb 2020 19:21:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qk1-f178.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=ra4ePMBgN/iPhOeQ7eRhFx9ThQwcKZOU8wHhXC3tle0=; b=ZpV9YZvBZ7jqklPJBSiZv2H7VdDx+Sxm7v35tg4xOJ6u52zaqOI6xMoxIVssv52sPd 8LrOCDSTbSESI47csiI93n3w90y0CLDUF29o1Ig0lDrw1fp+57eN6tTJIa5u6fRMQmSZ uWNMKTFPN7Y/MeL0a2/3oHPp/EBdKtovBloDg9OUe7Ts6mmY1oyMSXFdAR79UnkK+rVC MirVXbp3Hufj6RfrjA7mNwTRj2bi81sPT4ncnfJxz4UJ6qlpC15zFZuQ7vgJHKq8YVeO 2EPwf3m1IJPXQjxKDpIwm+3OKsZDwfB3ztCVP2wHceq3cWoQ6efMpRp63eoRtOatYcAG C5Cg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 14/15] nptl: Remove ununsed pthread-errnos.h rule Date: Mon, 10 Feb 2020 16:20:37 -0300 Message-Id: <20200210192038.23588-14-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> --- nptl/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.1 diff --git a/nptl/Makefile b/nptl/Makefile index 6f210d60e3..fcdc72adfe 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -327,8 +327,7 @@ test-xfail-tst-once5 = yes # Files which must not be linked with libpthread. tests-nolibpthread = tst-unload -gen-as-const-headers = pthread-errnos.sym \ - unwindbuf.sym \ +gen-as-const-headers = unwindbuf.sym \ pthread-pi-defines.sym gen-py-const-headers := nptl_lock_constants.pysym From patchwork Mon Feb 10 19:20:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183263 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4419046ile; Mon, 10 Feb 2020 11:23:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzIAVbUHf6+36ARkV5JkqFVmvCqj8u0Ul8RkpajbAPptZWMwN762fD6MUXgRBr4xTb0uT38 X-Received: by 2002:a9d:2c2:: with SMTP id 60mr2239690otl.208.1581362620137; Mon, 10 Feb 2020 11:23:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362620; cv=none; d=google.com; s=arc-20160816; b=fNUlQQbTc9LjdFwMU6xk4v7K+/i9cxwVsQWQPlsdAlosJSTq9W9JKxIY0CAvh4T6wG EVvewhJvAsqeMKlaNYywpsd+uSzGMvwZIY4SavXWNVlEOro2U2PJJAodbApswJpyhdT3 UVXePnTgqhbaWXpMKk3BJ6UkwMBhhqkISvruO7v2cKr0M41wbOi7PIWTEezF23uSPWvi G85LEaenJfCQTcUm/LrzRSHSawr3xZJXv4XppxnWGLuLXYVwaizMHT+kyzwSUNH+OmRk k/7YEetNH1U6BEf1duokMPtNpyJVDE+sMyOCfTkuJera4ysXCkTl+rKLaz6UfBnL6LCQ ssSw== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=ONB4GvsAUoYDO88zRI+zN7TpABsBm9Mq59CtIylMepI=; b=cUxgT5sk4u5KQamuV+k4WywsD9mjciJVpK4BL7Rf/p3IpbrUVdpRdGd2Pdlms1sFNT a1iHE4UUC3kVXeAPM7to1ZTktCepj7N3P/kUCT6qpOjRj83aTNHGX2pGDv90OBm79NLv 49Yx5myYf/nKyeSR/Iirexe/+hOqCsZfswBGwL49HGZhxlvVqwTcHUcqzVdREa+fw9H+ UcNwkwbVxOUO96v0RWJEl2n+ouleCG2VBWFdqWi1Mm+argG8cmfvee2PJydQOqB3c8BB f+LAcfmBPjBC8TtEJ4o75IsJSf2rsTbYu+80+Pr5INbH1OUZ10rTVnwaWbmLo14EsxHA JueA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=V6zL8tV9; dkim=pass header.i=@linaro.org header.s=google header.b=bzmENxdx; spf=pass (google.com: domain of libc-alpha-return-109400-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109400-patch=linaro.org@sourceware.org"; dmarc=pass (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 z3si526484oib.164.2020.02.10.11.23.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:23:40 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109400-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.s=default header.b=V6zL8tV9; dkim=pass header.i=@linaro.org header.s=google header.b=bzmENxdx; spf=pass (google.com: domain of libc-alpha-return-109400-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109400-patch=linaro.org@sourceware.org"; dmarc=pass (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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=kKnQO1/5yZaqGZ0o0Ben/ALANBCHB8A 3j1buD3Gsp8E9e0lYM/1RRRw/+EUEUU1w7gkgMzpEMFAEI6cUlCJn6+NJuo+COa6 k3oolpBZPRCNtW81sX3F5LNecBQFf0AIBY41DPYePSC9nFmnqG0eO5Qc6n2wZY5y tsOciB7UXDk8= 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:subject:date:message-id:in-reply-to :references; s=default; bh=2HMNege2K0ZmgEUHXFZFTYCcsbI=; b=V6zL8 tV9sTO8dYMAUFqEB/IKjROUjZNQDvNRR/If7hu3eCs3XM980C/nLHPgKQ4SsGf/7 lNHX7JwfbG+16VHwn9Zq6DEznD8LKTOHWRLipoyD8UwxjO8iHXkxn3ZkPOOwHmaL 7p6BXLrnKW8DwiO/jWqpIVoO/K2/3u4HZRKsMs= Received: (qmail 103572 invoked by alias); 10 Feb 2020 19:21:25 -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 103421 invoked by uid 89); 10 Feb 2020 19:21:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qt1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=ONB4GvsAUoYDO88zRI+zN7TpABsBm9Mq59CtIylMepI=; b=bzmENxdxjOKSdk4Lu5+mG7h0zbz99hOWlTwoel+Aeh4T7xRhI+QphPZ/lvof6UxMTK SjcSKORcsAoN6haXDhafZVBia5uSHReN9M5m7uK8Mo+nOjoTnOuu0y3ZwoOTuQNrDMyo blV3Xp2Q6gNcU8vcHGeEVA6GiqNJJ3ukS7kPh7osIHJYHu3ye/8s5qrCvkEUEXPWftiC ek6jlmH+HTRVWGcHIYOLRAfRgZwVwmWLjfa4t2LnpSvsAT6Ns3aHHHOe5LPlWX6EMxPb Vrl3rvsfWPKKOUlXaEAbxZR1XgO6bJ5OqgZgBA0LGhW9f8UCVow2DNRsVPqVMwvvtaoV +vMw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 15/15] linux: Remove INTERNAL_SYSCALL_DECL Date: Mon, 10 Feb 2020 16:20:38 -0300 Message-Id: <20200210192038.23588-15-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, the INTERNAL_SYSCALL_DECL is an empty declaration on all ports. This patch removes the 'err' argument on INTERNAL_SYSCALL* macro and remove the INTERNAL_SYSCALL_DECL usage. Checked with a build against all affected ABIs. --- nptl/allocatestack.c | 12 ++-- nptl/nptl-init.c | 26 ++++----- nptl/pthread_cancel.c | 7 +-- nptl/pthread_create.c | 8 +-- nptl/pthread_mutex_trylock.c | 11 ++-- nptl/pthread_sigmask.c | 13 ++--- nptl/thrd_yield.c | 3 +- sysdeps/csky/nptl/tls.h | 7 +-- sysdeps/i386/nptl/tls.h | 3 +- sysdeps/m68k/nptl/tls.h | 5 +- sysdeps/mips/nptl/tls.h | 7 +-- sysdeps/nptl/lowlevellock-futex.h | 9 ++- sysdeps/powerpc/nofpu/sfp-machine.h | 5 +- sysdeps/unix/sysdep.h | 36 ++++++------ sysdeps/unix/sysv/linux/aarch64/sysdep.h | 14 ++--- sysdeps/unix/sysv/linux/aio_misc.h | 8 +-- sysdeps/unix/sysv/linux/alpha/fxstat.c | 13 ++--- sysdeps/unix/sysv/linux/alpha/fxstatat.c | 7 +-- sysdeps/unix/sysv/linux/alpha/lxstat.c | 13 ++--- sysdeps/unix/sysv/linux/alpha/sysdep.h | 4 +- sysdeps/unix/sysv/linux/alpha/xstat.c | 13 ++--- sysdeps/unix/sysv/linux/arm/dl-machine.h | 2 +- sysdeps/unix/sysv/linux/arm/sysdep.h | 12 ++-- sysdeps/unix/sysv/linux/arm/tls.h | 7 +-- sysdeps/unix/sysv/linux/clock_getcpuclockid.c | 9 ++- sysdeps/unix/sysv/linux/clock_nanosleep.c | 22 ++++--- sysdeps/unix/sysv/linux/createthread.c | 19 +++--- sysdeps/unix/sysv/linux/csky/sysdep.h | 24 ++++---- sysdeps/unix/sysv/linux/default-sched.h | 6 +- sysdeps/unix/sysv/linux/dl-origin.c | 7 +-- sysdeps/unix/sysv/linux/dl-writev.h | 3 +- sysdeps/unix/sysv/linux/exit-thread.h | 3 +- sysdeps/unix/sysv/linux/fcntl_nocancel.c | 7 +-- sysdeps/unix/sysv/linux/fxstatat.c | 9 +-- sysdeps/unix/sysv/linux/fxstatat64.c | 13 ++--- .../unix/sysv/linux/generic/____longjmp_chk.c | 3 +- sysdeps/unix/sysv/linux/generic/brk.c | 4 +- sysdeps/unix/sysv/linux/generic/dl-origin.c | 7 +-- .../unix/sysv/linux/hppa/____longjmp_chk.c | 5 +- sysdeps/unix/sysv/linux/hppa/sysdep.h | 4 +- sysdeps/unix/sysv/linux/i386/brk.c | 3 +- sysdeps/unix/sysv/linux/i386/fxstat.c | 8 +-- sysdeps/unix/sysv/linux/i386/fxstatat.c | 8 +-- sysdeps/unix/sysv/linux/i386/lxstat.c | 8 +-- sysdeps/unix/sysv/linux/i386/sysdep.h | 58 +++++++++---------- sysdeps/unix/sysv/linux/i386/xstat.c | 8 +-- .../unix/sysv/linux/ia64/__sigstack_longjmp.c | 3 +- sysdeps/unix/sysv/linux/ia64/sysdep.h | 8 +-- sysdeps/unix/sysv/linux/ifaddrs.c | 3 +- sysdeps/unix/sysv/linux/internal-signals.h | 9 +-- sysdeps/unix/sysv/linux/libc_fatal.c | 7 +-- .../unix/sysv/linux/m68k/____longjmp_chk.c | 5 +- sysdeps/unix/sysv/linux/m68k/brk.c | 3 +- .../sysv/linux/m68k/coldfire/atomic-machine.h | 2 +- sysdeps/unix/sysv/linux/m68k/getpagesize.c | 5 +- sysdeps/unix/sysv/linux/m68k/m68k-helpers.c | 3 +- sysdeps/unix/sysv/linux/m68k/sysdep.h | 6 +- sysdeps/unix/sysv/linux/microblaze/brk.c | 4 +- sysdeps/unix/sysv/linux/microblaze/sysdep.h | 4 +- sysdeps/unix/sysv/linux/mips/brk.c | 3 +- sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 11 ++-- .../unix/sysv/linux/mips/mips64/fxstatat64.c | 7 +-- sysdeps/unix/sysv/linux/mips/mips64/sysdep.h | 30 +++++----- sysdeps/unix/sysv/linux/mq_unlink.c | 7 +-- sysdeps/unix/sysv/linux/nios2/sysdep.h | 10 ++-- sysdeps/unix/sysv/linux/not-cancel.h | 3 +- sysdeps/unix/sysv/linux/not-errno.h | 16 +++-- sysdeps/unix/sysv/linux/nscd_setup_thread.c | 7 +-- sysdeps/unix/sysv/linux/personality.c | 7 +-- sysdeps/unix/sysv/linux/posix_fadvise.c | 11 ++-- sysdeps/unix/sysv/linux/posix_fadvise64.c | 9 ++- sysdeps/unix/sysv/linux/posix_fallocate.c | 9 ++- sysdeps/unix/sysv/linux/posix_fallocate64.c | 15 ++--- sysdeps/unix/sysv/linux/posix_madvise.c | 5 +- .../sysv/linux/powerpc/get_timebase_freq.c | 3 +- .../linux/powerpc/powerpc32/fpu/fe_mask.c | 3 +- .../linux/powerpc/powerpc32/fpu/fe_nomask.c | 3 +- .../linux/powerpc/powerpc64/fpu/fe_mask.c | 3 +- .../linux/powerpc/powerpc64/fpu/fe_nomask.c | 3 +- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 12 ++-- sysdeps/unix/sysv/linux/pthread-pids.h | 3 +- sysdeps/unix/sysv/linux/pthread_getaffinity.c | 9 ++- sysdeps/unix/sysv/linux/pthread_kill.c | 8 +-- sysdeps/unix/sysv/linux/pthread_setaffinity.c | 11 ++-- sysdeps/unix/sysv/linux/pthread_sigqueue.c | 8 +-- sysdeps/unix/sysv/linux/raise.c | 7 +-- sysdeps/unix/sysv/linux/riscv/syscall.c | 5 +- sysdeps/unix/sysv/linux/riscv/sysdep.h | 24 ++++---- .../sysv/linux/s390/s390-32/____longjmp_chk.c | 5 +- .../sysv/linux/s390/s390-32/posix_fadvise64.c | 7 +-- sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 4 ++ .../sysv/linux/s390/s390-64/____longjmp_chk.c | 5 +- sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 4 ++ sysdeps/unix/sysv/linux/s390/sysdep.h | 6 +- sysdeps/unix/sysv/linux/safe-fatal.h | 5 +- sysdeps/unix/sysv/linux/sh/sysdep.h | 4 +- sysdeps/unix/sysv/linux/shmat.c | 8 +-- sysdeps/unix/sysv/linux/sparc/sysdep.h | 22 +++---- sysdeps/unix/sysv/linux/sysdep-vdso.h | 15 +++-- sysdeps/unix/sysv/linux/sysdep.h | 14 ++--- sysdeps/unix/sysv/linux/timer_create.c | 9 ++- sysdeps/unix/sysv/linux/timer_routines.c | 9 +-- sysdeps/unix/sysv/linux/times.c | 7 +-- sysdeps/unix/sysv/linux/x86/cpu-features.c | 4 +- sysdeps/unix/sysv/linux/x86/dl-cet.h | 17 +++--- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 24 ++++---- sysdeps/unix/sysv/linux/x86_64/x32/times.c | 4 +- 107 files changed, 426 insertions(+), 544 deletions(-) -- 2.17.1 diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 110ba18f5d..c94980c21c 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -1028,11 +1028,10 @@ setxid_signal_thread (struct xid_command *cmdp, struct pthread *t) int val; pid_t pid = __getpid (); - INTERNAL_SYSCALL_DECL (err); - val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, t->tid, SIGSETXID); + val = INTERNAL_SYSCALL_CALL (tgkill, pid, t->tid, SIGSETXID); /* If this failed, it must have had not started yet or else exited. */ - if (!INTERNAL_SYSCALL_ERROR_P (val, err)) + if (!INTERNAL_SYSCALL_ERROR_P (val)) { atomic_increment (&cmdp->cntr); return 1; @@ -1158,13 +1157,12 @@ __nptl_setxid (struct xid_command *cmdp) /* This must be last, otherwise the current thread might not have permissions to send SIGSETXID syscall to the other threads. */ - INTERNAL_SYSCALL_DECL (err); - result = INTERNAL_SYSCALL_NCS (cmdp->syscall_no, err, 3, + result = INTERNAL_SYSCALL_NCS (cmdp->syscall_no, 3, cmdp->id[0], cmdp->id[1], cmdp->id[2]); int error = 0; - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) { - error = INTERNAL_SYSCALL_ERRNO (result, err); + error = INTERNAL_SYSCALL_ERRNO (result); __set_errno (error); result = -1; } diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c index 1877248014..6bc1e75f55 100644 --- a/nptl/nptl-init.c +++ b/nptl/nptl-init.c @@ -130,9 +130,8 @@ void __nptl_set_robust (struct pthread *self) { #ifdef __NR_set_robust_list - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (set_robust_list, err, 2, &self->robust_head, - sizeof (struct robust_list_head)); + INTERNAL_SYSCALL_CALL (set_robust_list, &self->robust_head, + sizeof (struct robust_list_head)); #endif } @@ -203,12 +202,11 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx) || si->si_code != SI_TKILL) return; - INTERNAL_SYSCALL_DECL (err); - result = INTERNAL_SYSCALL_NCS (__xidcmd->syscall_no, err, 3, __xidcmd->id[0], + result = INTERNAL_SYSCALL_NCS (__xidcmd->syscall_no, 3, __xidcmd->id[0], __xidcmd->id[1], __xidcmd->id[2]); int error = 0; - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - error = INTERNAL_SYSCALL_ERRNO (result, err); + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) + error = INTERNAL_SYSCALL_ERRNO (result); __nptl_setxid_error (__xidcmd, error); /* Reset the SETXID flag. */ @@ -258,10 +256,9 @@ __pthread_initialize_minimal_internal (void) pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock) - offsetof (pthread_mutex_t, __data.__list.__next)); - INTERNAL_SYSCALL_DECL (err); - int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head, - sizeof (struct robust_list_head)); - if (INTERNAL_SYSCALL_ERROR_P (res, err)) + int res = INTERNAL_SYSCALL_CALL (set_robust_list, &pd->robust_head, + sizeof (struct robust_list_head)); + if (INTERNAL_SYSCALL_ERROR_P (res)) #endif set_robust_list_not_avail (); } @@ -299,11 +296,8 @@ __pthread_initialize_minimal_internal (void) structure. It is already cleared. */ __sigaddset (&sa.sa_mask, SIGCANCEL); __sigaddset (&sa.sa_mask, SIGSETXID); - { - INTERNAL_SYSCALL_DECL (err); - (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask, - NULL, _NSIG / 8); - } + INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sa.sa_mask, + NULL, _NSIG / 8); /* Get the size of the static and alignment requirements for the TLS block. */ diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c index 8e7be996e9..88c1ab8f6a 100644 --- a/nptl/pthread_cancel.c +++ b/nptl/pthread_cancel.c @@ -67,11 +67,10 @@ __pthread_cancel (pthread_t th) thread as canceled. */ pid_t pid = __getpid (); - INTERNAL_SYSCALL_DECL (err); - int val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, pd->tid, + int val = INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid, SIGCANCEL); - if (INTERNAL_SYSCALL_ERROR_P (val, err)) - result = INTERNAL_SYSCALL_ERRNO (val, err); + if (INTERNAL_SYSCALL_ERROR_P (val)) + result = INTERNAL_SYSCALL_ERRNO (val); break; } diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index d3fd58730c..f8c7e73881 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -394,10 +394,9 @@ START_THREAD_DEFN if (__set_robust_list_avail >= 0) # endif { - INTERNAL_SYSCALL_DECL (err); /* This call should never fail because the initial call in init.c succeeded. */ - INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head, + INTERNAL_SYSCALL (set_robust_list, 2, &pd->robust_head, sizeof (struct robust_list_head)); } #endif @@ -407,12 +406,11 @@ START_THREAD_DEFN cancellation signal mask. */ if (__glibc_unlikely (pd->parent_cancelhandling & CANCELING_BITMASK)) { - INTERNAL_SYSCALL_DECL (err); sigset_t mask; __sigemptyset (&mask); __sigaddset (&mask, SIGCANCEL); - (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &mask, - NULL, _NSIG / 8); + INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &mask, + NULL, _NSIG / 8); } /* This is where the try/finally block should be created. For diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c index b9896f420e..2130f52529 100644 --- a/nptl/pthread_mutex_trylock.c +++ b/nptl/pthread_mutex_trylock.c @@ -297,13 +297,12 @@ __pthread_mutex_trylock (pthread_mutex_t *mutex) int private = (robust ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex) : PTHREAD_MUTEX_PSHARED (mutex)); - INTERNAL_SYSCALL_DECL (__err); - int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock, - __lll_private_flag (FUTEX_TRYLOCK_PI, - private), 0, 0); + int e = INTERNAL_SYSCALL_CALL (futex, &mutex->__data.__lock, + __lll_private_flag (FUTEX_TRYLOCK_PI, + private), 0, 0); - if (INTERNAL_SYSCALL_ERROR_P (e, __err) - && INTERNAL_SYSCALL_ERRNO (e, __err) == EWOULDBLOCK) + if (INTERNAL_SYSCALL_ERROR_P (e) + && INTERNAL_SYSCALL_ERRNO (e) == EWOULDBLOCK) { /* The kernel has not yet finished the mutex owner death. We do not need to ensure ordering wrt another memory diff --git a/nptl/pthread_sigmask.c b/nptl/pthread_sigmask.c index 84eb189c81..c7860e02a5 100644 --- a/nptl/pthread_sigmask.c +++ b/nptl/pthread_sigmask.c @@ -39,16 +39,11 @@ pthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask) newmask = &local_newmask; } -#ifdef INTERNAL_SYSCALL /* We know that realtime signals are available if NPTL is used. */ - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (rt_sigprocmask, err, 4, how, newmask, - oldmask, _NSIG / 8); + int result = INTERNAL_SYSCALL_CALL (rt_sigprocmask, how, newmask, + oldmask, _NSIG / 8); - return (INTERNAL_SYSCALL_ERROR_P (result, err) - ? INTERNAL_SYSCALL_ERRNO (result, err) + return (INTERNAL_SYSCALL_ERROR_P (result) + ? INTERNAL_SYSCALL_ERRNO (result) : 0); -#else - return sigprocmask (how, newmask, oldmask) == -1 ? errno : 0; -#endif } diff --git a/nptl/thrd_yield.c b/nptl/thrd_yield.c index 865f123d73..3e0fd46a27 100644 --- a/nptl/thrd_yield.c +++ b/nptl/thrd_yield.c @@ -21,6 +21,5 @@ void thrd_yield (void) { - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL_CALL (sched_yield, err); + INTERNAL_SYSCALL_CALL (sched_yield); } diff --git a/sysdeps/csky/nptl/tls.h b/sysdeps/csky/nptl/tls.h index af8e2c4882..552bc4d429 100644 --- a/sysdeps/csky/nptl/tls.h +++ b/sysdeps/csky/nptl/tls.h @@ -96,11 +96,10 @@ typedef struct special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ # define TLS_INIT_TP(tcbp) \ - ({ INTERNAL_SYSCALL_DECL (err); \ - long result_var; \ - result_var = INTERNAL_SYSCALL (set_thread_area, err, 1, \ + ({ long result_var; \ + result_var = INTERNAL_SYSCALL_CALL (set_thread_area, \ (char *) (tcbp) + TLS_TCB_OFFSET); \ - INTERNAL_SYSCALL_ERROR_P (result_var, err) \ + INTERNAL_SYSCALL_ERROR_P (result_var) \ ? "unknown error" : NULL; }) /* Return the address of the dtv for the current thread. */ diff --git a/sysdeps/i386/nptl/tls.h b/sysdeps/i386/nptl/tls.h index d1bf90a503..ffead90857 100644 --- a/sysdeps/i386/nptl/tls.h +++ b/sysdeps/i386/nptl/tls.h @@ -202,8 +202,7 @@ tls_fill_user_desc (union user_desc_init *desc, tls_fill_user_desc (&_segdescr, -1, _thrdescr); \ \ /* Install the TLS. */ \ - INTERNAL_SYSCALL_DECL (err); \ - _result = INTERNAL_SYSCALL (set_thread_area, err, 1, &_segdescr.desc); \ + _result = INTERNAL_SYSCALL_CALL (set_thread_area, &_segdescr.desc); \ \ if (_result == 0) \ /* We know the index in the GDT, now load the segment register. \ diff --git a/sysdeps/m68k/nptl/tls.h b/sysdeps/m68k/nptl/tls.h index 27e01f6e80..68ea952e79 100644 --- a/sysdeps/m68k/nptl/tls.h +++ b/sysdeps/m68k/nptl/tls.h @@ -95,12 +95,11 @@ typedef struct operation can cause a failure 'errno' must not be touched. */ # define TLS_INIT_TP(tcbp) \ ({ \ - INTERNAL_SYSCALL_DECL (err); \ int _sys_result; \ \ - _sys_result = INTERNAL_SYSCALL (set_thread_area, err, 1, \ + _sys_result = INTERNAL_SYSCALL_CALL (set_thread_area, \ ((void *) (tcbp)) + TLS_TCB_OFFSET); \ - INTERNAL_SYSCALL_ERROR_P (_sys_result, err) ? "unknown error" : NULL; }) + INTERNAL_SYSCALL_ERROR_P (_sys_result) ? "unknown error" : NULL; }) # define TLS_DEFINE_INIT_TP(tp, pd) \ void *tp = (void *) (pd) + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE diff --git a/sysdeps/mips/nptl/tls.h b/sysdeps/mips/nptl/tls.h index ae85984f95..c93c3496e1 100644 --- a/sysdeps/mips/nptl/tls.h +++ b/sysdeps/mips/nptl/tls.h @@ -120,11 +120,10 @@ typedef struct special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ # define TLS_INIT_TP(tcbp) \ - ({ INTERNAL_SYSCALL_DECL (err); \ - long result_var; \ - result_var = INTERNAL_SYSCALL (set_thread_area, err, 1, \ + ({ long result_var; \ + result_var = INTERNAL_SYSCALL_CALL (set_thread_area, \ (char *) (tcbp) + TLS_TCB_OFFSET); \ - INTERNAL_SYSCALL_ERROR_P (result_var, err) \ + INTERNAL_SYSCALL_ERROR_P (result_var) \ ? "unknown error" : NULL; }) /* Value passed to 'clone' for initialization of the thread register. */ diff --git a/sysdeps/nptl/lowlevellock-futex.h b/sysdeps/nptl/lowlevellock-futex.h index 746f56f80c..2209ca76a1 100644 --- a/sysdeps/nptl/lowlevellock-futex.h +++ b/sysdeps/nptl/lowlevellock-futex.h @@ -65,13 +65,12 @@ (((fl) | FUTEX_PRIVATE_FLAG) ^ (private)) # endif -# define lll_futex_syscall(nargs, futexp, op, ...) \ +# define lll_futex_syscall(nargs, futexp, op, ...) \ ({ \ - INTERNAL_SYSCALL_DECL (__err); \ - long int __ret = INTERNAL_SYSCALL (futex, __err, nargs, futexp, op, \ + long int __ret = INTERNAL_SYSCALL (futex, nargs, futexp, op, \ __VA_ARGS__); \ - (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret, __err)) \ - ? -INTERNAL_SYSCALL_ERRNO (__ret, __err) : 0); \ + (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret)) \ + ? -INTERNAL_SYSCALL_ERRNO (__ret) : 0); \ }) /* For most of these macros, the return value is never really used. diff --git a/sysdeps/powerpc/nofpu/sfp-machine.h b/sysdeps/powerpc/nofpu/sfp-machine.h index d92a90e3e2..8489c0f1c0 100644 --- a/sysdeps/powerpc/nofpu/sfp-machine.h +++ b/sysdeps/powerpc/nofpu/sfp-machine.h @@ -67,11 +67,10 @@ libc_hidden_proto (__feraiseexcept_soft) do \ { \ int _r; \ - INTERNAL_SYSCALL_DECL (_err); \ \ _spefscr = fegetenv_register (); \ - _r = INTERNAL_SYSCALL (prctl, _err, 2, PR_GET_FPEXC, &_ftrapex); \ - if (INTERNAL_SYSCALL_ERROR_P (_r, _err)) \ + _r = INTERNAL_SYSCALL_CALL (prctl, PR_GET_FPEXC, &_ftrapex); \ + if (INTERNAL_SYSCALL_ERROR_P (_r)) \ _ftrapex = 0; \ } \ while (0) diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h index c2f1bd3c63..3c687a717a 100644 --- a/sysdeps/unix/sysdep.h +++ b/sysdeps/unix/sysdep.h @@ -28,24 +28,24 @@ #define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b) -#define __INTERNAL_SYSCALL0(name, err) \ - INTERNAL_SYSCALL (name, err, 0) -#define __INTERNAL_SYSCALL1(name, err, a1) \ - INTERNAL_SYSCALL (name, err, 1, a1) -#define __INTERNAL_SYSCALL2(name, err, a1, a2) \ - INTERNAL_SYSCALL (name, err, 2, a1, a2) -#define __INTERNAL_SYSCALL3(name, err, a1, a2, a3) \ - INTERNAL_SYSCALL (name, err, 3, a1, a2, a3) -#define __INTERNAL_SYSCALL4(name, err, a1, a2, a3, a4) \ - INTERNAL_SYSCALL (name, err, 4, a1, a2, a3, a4) -#define __INTERNAL_SYSCALL5(name, err, a1, a2, a3, a4, a5) \ - INTERNAL_SYSCALL (name, err, 5, a1, a2, a3, a4, a5) -#define __INTERNAL_SYSCALL6(name, err, a1, a2, a3, a4, a5, a6) \ - INTERNAL_SYSCALL (name, err, 6, a1, a2, a3, a4, a5, a6) -#define __INTERNAL_SYSCALL7(name, err, a1, a2, a3, a4, a5, a6, a7) \ - INTERNAL_SYSCALL (name, err, 7, a1, a2, a3, a4, a5, a6, a7) - -#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,o,...) o +#define __INTERNAL_SYSCALL0(name) \ + INTERNAL_SYSCALL (name, 0) +#define __INTERNAL_SYSCALL1(name, a1) \ + INTERNAL_SYSCALL (name, 1, a1) +#define __INTERNAL_SYSCALL2(name, a1, a2) \ + INTERNAL_SYSCALL (name, 2, a1, a2) +#define __INTERNAL_SYSCALL3(name, a1, a2, a3) \ + INTERNAL_SYSCALL (name, 3, a1, a2, a3) +#define __INTERNAL_SYSCALL4(name, a1, a2, a3, a4) \ + INTERNAL_SYSCALL (name, 4, a1, a2, a3, a4) +#define __INTERNAL_SYSCALL5(name, a1, a2, a3, a4, a5) \ + INTERNAL_SYSCALL (name, 5, a1, a2, a3, a4, a5) +#define __INTERNAL_SYSCALL6(name, a1, a2, a3, a4, a5, a6) \ + INTERNAL_SYSCALL (name, 6, a1, a2, a3, a4, a5, a6) +#define __INTERNAL_SYSCALL7(name, a1, a2, a3, a4, a5, a6, a7) \ + INTERNAL_SYSCALL (name, 7, a1, a2, a3, a4, a5, a6, a7) + +#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n #define __INTERNAL_SYSCALL_NARGS(...) \ __INTERNAL_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,) #define __INTERNAL_SYSCALL_DISP(b,...) \ diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index 79fa0bda27..319a7c7ac5 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -171,7 +171,7 @@ # define SINGLE_THREAD_BY_GLOBAL 1 # undef INTERNAL_SYSCALL_RAW -# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_RAW(name, nr, args...) \ ({ long _sys_result; \ { \ LOAD_ARGS_##nr (args) \ @@ -183,12 +183,12 @@ _sys_result; }) # undef INTERNAL_SYSCALL -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) +# define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args) # undef INTERNAL_SYSCALL_AARCH64 -# define INTERNAL_SYSCALL_AARCH64(name, err, nr, args...) \ - INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args) +# define INTERNAL_SYSCALL_AARCH64(name, nr, args...) \ + INTERNAL_SYSCALL_RAW(__ARM_NR_##name, nr, args) # define LOAD_ARGS_0() \ register long _x0 asm ("x0"); @@ -231,8 +231,8 @@ # define ASM_ARGS_7 ASM_ARGS_6, "r" (_x6) # undef INTERNAL_SYSCALL_NCS -# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - INTERNAL_SYSCALL_RAW (number, err, nr, args) +# define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + INTERNAL_SYSCALL_RAW (number, nr, args) #endif /* __ASSEMBLER__ */ diff --git a/sysdeps/unix/sysv/linux/aio_misc.h b/sysdeps/unix/sysv/linux/aio_misc.h index 42849ab74c..7c8f6144a6 100644 --- a/sysdeps/unix/sysv/linux/aio_misc.h +++ b/sysdeps/unix/sysv/linux/aio_misc.h @@ -31,8 +31,7 @@ __aio_start_notify_thread (void) { sigset_t ss; sigemptyset (&ss); - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8); + INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, NULL, _NSIG / 8); } extern inline int @@ -53,13 +52,12 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), sigset_t ss; sigset_t oss; sigfillset (&ss); - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, &oss, _NSIG / 8); + INTERNAL_SYSCALL (rt_sigprocmask, 4, SIG_SETMASK, &ss, &oss, _NSIG / 8); int ret = pthread_create (threadp, &attr, tf, arg); /* Restore the signal mask. */ - INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &oss, NULL, + INTERNAL_SYSCALL (rt_sigprocmask, 4, SIG_SETMASK, &oss, NULL, _NSIG / 8); (void) pthread_attr_destroy (&attr); diff --git a/sysdeps/unix/sysv/linux/alpha/fxstat.c b/sysdeps/unix/sysv/linux/alpha/fxstat.c index d10e0ac2de..0978610bf0 100644 --- a/sysdeps/unix/sysv/linux/alpha/fxstat.c +++ b/sysdeps/unix/sysv/linux/alpha/fxstat.c @@ -33,23 +33,22 @@ int __fxstat (int vers, int fd, struct stat *buf) { - INTERNAL_SYSCALL_DECL (err); int result; struct kernel_stat kbuf; if (vers == _STAT_VER_KERNEL64) { - result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf); - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + result = INTERNAL_SYSCALL_CALL (fstat64, fd, buf); + if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) return result; - __set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); + __set_errno (INTERNAL_SYSCALL_ERRNO (result)); return -1; } - result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf); - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + result = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf); + if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) return __xstat_conv (vers, &kbuf, buf); - __set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); + __set_errno (INTERNAL_SYSCALL_ERRNO (result)); return -1; } hidden_def (__fxstat) diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat.c b/sysdeps/unix/sysv/linux/alpha/fxstatat.c index 4d2815ade0..c5953d250a 100644 --- a/sysdeps/unix/sysv/linux/alpha/fxstatat.c +++ b/sysdeps/unix/sysv/linux/alpha/fxstatat.c @@ -33,7 +33,6 @@ int __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) { - INTERNAL_SYSCALL_DECL (err); int result, errno_out; /* ??? The __fxstatat entry point is new enough that it must be using @@ -41,10 +40,10 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) cannot actually check this, lest the compiler not optimize the rest of the function away. */ - result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, st, flag); - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, st, flag); + if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) return result; - errno_out = INTERNAL_SYSCALL_ERRNO (result, err); + errno_out = INTERNAL_SYSCALL_ERRNO (result); __set_errno (errno_out); return -1; } diff --git a/sysdeps/unix/sysv/linux/alpha/lxstat.c b/sysdeps/unix/sysv/linux/alpha/lxstat.c index bb2baf0ad9..eb03a5fbfe 100644 --- a/sysdeps/unix/sysv/linux/alpha/lxstat.c +++ b/sysdeps/unix/sysv/linux/alpha/lxstat.c @@ -33,23 +33,22 @@ int __lxstat (int vers, const char *name, struct stat *buf) { - INTERNAL_SYSCALL_DECL (err); int result; struct kernel_stat kbuf; if (vers == _STAT_VER_KERNEL64) { - result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf); - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + result = INTERNAL_SYSCALL_CALL (lstat64, name, buf); + if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) return result; - __set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); + __set_errno (INTERNAL_SYSCALL_ERRNO (result)); return -1; } - result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf); - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + result = INTERNAL_SYSCALL_CALL (lstat, name, &kbuf); + if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) return __xstat_conv (vers, &kbuf, buf); - __set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); + __set_errno (INTERNAL_SYSCALL_ERRNO (result)); return -1; } hidden_def (__lxstat) diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h index 679d6169de..5ec73084c1 100644 --- a/sysdeps/unix/sysv/linux/alpha/sysdep.h +++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h @@ -169,10 +169,10 @@ __LABEL(name) \ #else /* !ASSEMBLER */ -#define INTERNAL_SYSCALL(name, err_out, nr, args...) \ +#define INTERNAL_SYSCALL(name, nr, args...) \ internal_syscall##nr(__NR_##name, args) -#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ internal_syscall##nr(name, args) /* The normal Alpha calling convention sign-extends 32-bit quantties diff --git a/sysdeps/unix/sysv/linux/alpha/xstat.c b/sysdeps/unix/sysv/linux/alpha/xstat.c index aa45c7df69..3ba1ae1811 100644 --- a/sysdeps/unix/sysv/linux/alpha/xstat.c +++ b/sysdeps/unix/sysv/linux/alpha/xstat.c @@ -33,23 +33,22 @@ int __xstat (int vers, const char *name, struct stat *buf) { - INTERNAL_SYSCALL_DECL (err); int result; struct kernel_stat kbuf; if (vers == _STAT_VER_KERNEL64) { - result = INTERNAL_SYSCALL (stat64, err, 2, name, buf); - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + result = INTERNAL_SYSCALL_CALL (stat64, name, buf); + if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) return result; - __set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); + __set_errno (INTERNAL_SYSCALL_ERRNO (result)); return -1; } - result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf); - if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + result = INTERNAL_SYSCALL_CALL (stat, name, &kbuf); + if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result))) return __xstat_conv (vers, &kbuf, buf); - __set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); + __set_errno (INTERNAL_SYSCALL_ERRNO (result)); return -1; } hidden_def (__xstat) diff --git a/sysdeps/unix/sysv/linux/arm/dl-machine.h b/sysdeps/unix/sysv/linux/arm/dl-machine.h index 5fc685fdaf..a307326e9c 100644 --- a/sysdeps/unix/sysv/linux/arm/dl-machine.h +++ b/sysdeps/unix/sysv/linux/arm/dl-machine.h @@ -20,7 +20,7 @@ /* This definition is Linux-specific. */ #define CLEAR_CACHE(BEG,END) \ - INTERNAL_SYSCALL (cacheflush, , 3, (BEG), (END), 0) + INTERNAL_SYSCALL_CALL (cacheflush, (BEG), (END), 0) #endif diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index f6e6b63959..e2985cffd7 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -328,7 +328,7 @@ __local_syscall_error: \ then unwinding will fail higher up the stack. So we move the syscall out of line and provide its own unwind information. */ # undef INTERNAL_SYSCALL_RAW -# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_RAW(name, nr, args...) \ ({ \ register int _a1 asm ("a1"); \ int _nametmp = name; \ @@ -341,7 +341,7 @@ __local_syscall_error: \ _a1; }) #else /* ARM */ # undef INTERNAL_SYSCALL_RAW -# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_RAW(name, nr, args...) \ ({ \ register int _a1 asm ("r0"), _nr asm ("r7"); \ LOAD_ARGS_##nr (args) \ @@ -354,8 +354,8 @@ __local_syscall_error: \ #endif #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args) #define VDSO_NAME "LINUX_2.6" #define VDSO_HASH 61765110 @@ -407,8 +407,8 @@ __local_syscall_error: \ /* For EABI, non-constant syscalls are actually pretty easy... */ #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - INTERNAL_SYSCALL_RAW (number, err, nr, args) +#define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + INTERNAL_SYSCALL_RAW (number, nr, args) #define SINGLE_THREAD_BY_GLOBAL 1 diff --git a/sysdeps/unix/sysv/linux/arm/tls.h b/sysdeps/unix/sysv/linux/arm/tls.h index 18afe244d7..1b520c6802 100644 --- a/sysdeps/unix/sysv/linux/arm/tls.h +++ b/sysdeps/unix/sysv/linux/arm/tls.h @@ -31,10 +31,9 @@ special attention since 'errno' is not yet available and if the operation can cause a failure 'errno' must not be touched. */ # define TLS_INIT_TP(tcbp) \ - ({ INTERNAL_SYSCALL_DECL (err); \ - long int result_var; \ - result_var = INTERNAL_SYSCALL (set_tls, err, 1, (tcbp)); \ - INTERNAL_SYSCALL_ERROR_P (result_var, err) \ + ({ long int result_var; \ + result_var = INTERNAL_SYSCALL_CALL (set_tls, 1, (tcbp)); \ + INTERNAL_SYSCALL_ERROR_P (result_var) \ ? "unknown error" : NULL; }) #endif /* __ASSEMBLER__ */ diff --git a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c index 97fa9cc496..be1f477187 100644 --- a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c +++ b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c @@ -30,21 +30,20 @@ __clock_getcpuclockid (pid_t pid, clockid_t *clock_id) const clockid_t pidclock = MAKE_PROCESS_CPUCLOCK (pid, CPUCLOCK_SCHED); - INTERNAL_SYSCALL_DECL (err); - int r = INTERNAL_SYSCALL (clock_getres, err, 2, pidclock, NULL); - if (!INTERNAL_SYSCALL_ERROR_P (r, err)) + int r = INTERNAL_SYSCALL_CALL (clock_getres, pidclock, NULL); + if (!INTERNAL_SYSCALL_ERROR_P (r)) { *clock_id = pidclock; return 0; } - if (INTERNAL_SYSCALL_ERRNO (r, err) == EINVAL) + if (INTERNAL_SYSCALL_ERRNO (r) == EINVAL) { /* The clock_getres system call checked the PID for us. */ return ESRCH; } else - return INTERNAL_SYSCALL_ERRNO (r, err); + return INTERNAL_SYSCALL_ERRNO (r); } versioned_symbol (libc, __clock_getcpuclockid, clock_getcpuclockid, GLIBC_2_17); diff --git a/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c index 728137aa56..48175ef1da 100644 --- a/sysdeps/unix/sysv/linux/clock_nanosleep.c +++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c @@ -39,23 +39,21 @@ __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec /* If the call is interrupted by a signal handler or encounters an error, it returns a positive value similar to errno. */ - INTERNAL_SYSCALL_DECL (err); - #ifdef __ASSUME_TIME64_SYSCALLS # ifndef __NR_clock_nanosleep_time64 # define __NR_clock_nanosleep_time64 __NR_clock_nanosleep # endif - r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, err, clock_id, + r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, clock_id, flags, req, rem); #else # ifdef __NR_clock_nanosleep_time64 - r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, err, clock_id, + r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, clock_id, flags, req, rem); - if (! INTERNAL_SYSCALL_ERROR_P (r, err)) + if (! INTERNAL_SYSCALL_ERROR_P (r)) return 0; - if (INTERNAL_SYSCALL_ERRNO (r, err) != ENOSYS) - return INTERNAL_SYSCALL_ERRNO (r, err); + if (INTERNAL_SYSCALL_ERRNO (r) != ENOSYS) + return INTERNAL_SYSCALL_ERRNO (r); # endif /* __NR_clock_nanosleep_time64 */ if (! in_time_t_range (req->tv_sec)) @@ -66,18 +64,18 @@ __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec struct timespec tr32; struct timespec ts32 = valid_timespec64_to_timespec (*req); - r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep, err, clock_id, flags, + r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep, clock_id, flags, &ts32, &tr32); - if (INTERNAL_SYSCALL_ERROR_P (r, err)) + if (INTERNAL_SYSCALL_ERROR_P (r)) { - if (INTERNAL_SYSCALL_ERRNO (r, err) == EINTR && rem != NULL + if (INTERNAL_SYSCALL_ERRNO (r) == EINTR && rem != NULL && (flags & TIMER_ABSTIME) == 0) *rem = valid_timespec_to_timespec64 (tr32); } #endif /* __ASSUME_TIME64_SYSCALLS */ - return (INTERNAL_SYSCALL_ERROR_P (r, err) - ? INTERNAL_SYSCALL_ERRNO (r, err) : 0); + return (INTERNAL_SYSCALL_ERROR_P (r) + ? INTERNAL_SYSCALL_ERRNO (r) : 0); } #if __TIMESIZE != 64 diff --git a/sysdeps/unix/sysv/linux/createthread.c b/sysdeps/unix/sysv/linux/createthread.c index 33e5f5dbbb..21f9d24f2d 100644 --- a/sysdeps/unix/sysv/linux/createthread.c +++ b/sysdeps/unix/sysv/linux/createthread.c @@ -110,7 +110,6 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, /* Now we have the possibility to set scheduling parameters etc. */ if (attr != NULL) { - INTERNAL_SYSCALL_DECL (err); int res; /* Set the affinity mask if necessary. */ @@ -118,21 +117,19 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, { assert (*stopped_start); - res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid, - attr->cpusetsize, attr->cpuset); + res = INTERNAL_SYSCALL_CALL (sched_setaffinity, pd->tid, + attr->cpusetsize, attr->cpuset); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err))) + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res))) err_out: { /* The operation failed. We have to kill the thread. We let the normal cancellation mechanism do the work. */ pid_t pid = __getpid (); - INTERNAL_SYSCALL_DECL (err2); - (void) INTERNAL_SYSCALL_CALL (tgkill, err2, pid, pd->tid, - SIGCANCEL); + INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid, SIGCANCEL); - return INTERNAL_SYSCALL_ERRNO (res, err); + return INTERNAL_SYSCALL_ERRNO (res); } } @@ -141,10 +138,10 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, { assert (*stopped_start); - res = INTERNAL_SYSCALL (sched_setscheduler, err, 3, pd->tid, - pd->schedpolicy, &pd->schedparam); + res = INTERNAL_SYSCALL_CALL (sched_setscheduler, pd->tid, + pd->schedpolicy, &pd->schedparam); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err))) + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res))) goto err_out; } } diff --git a/sysdeps/unix/sysv/linux/csky/sysdep.h b/sysdeps/unix/sysv/linux/csky/sysdep.h index 7ebb19dce8..7e8e89dd42 100644 --- a/sysdeps/unix/sysv/linux/csky/sysdep.h +++ b/sysdeps/unix/sysv/linux/csky/sysdep.h @@ -294,7 +294,7 @@ __local_syscall_error: \ #else /* not __ASSEMBLER__ */ # undef INTERNAL_SYSCALL_RAW -# define INTERNAL_SYSCALL_RAW0(name, err, dummy...) \ +# define INTERNAL_SYSCALL_RAW0(name, dummy...) \ ({unsigned int __sys_result; \ { \ register int _a1 __asm__ ("a0"), _nr __asm__ ("r7"); \ @@ -307,7 +307,7 @@ __local_syscall_error: \ } \ (int) __sys_result; }) -# define INTERNAL_SYSCALL_RAW1(name, err, arg1) \ +# define INTERNAL_SYSCALL_RAW1(name, arg1) \ ({unsigned int __sys_result; \ register int _tmp_arg1 = (int)(arg1); \ { \ @@ -322,7 +322,7 @@ __local_syscall_error: \ } \ (int) __sys_result; }) -# define INTERNAL_SYSCALL_RAW2(name, err, arg1, arg2) \ +# define INTERNAL_SYSCALL_RAW2(name, arg1, arg2) \ ({unsigned int __sys_result; \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ { \ @@ -338,7 +338,7 @@ __local_syscall_error: \ } \ (int) __sys_result; }) -# define INTERNAL_SYSCALL_RAW3(name, err, arg1, arg2, arg3) \ +# define INTERNAL_SYSCALL_RAW3(name, arg1, arg2, arg3) \ ({unsigned int __sys_result; \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ register int _tmp_arg3 = (int)(arg3); \ @@ -359,7 +359,7 @@ __local_syscall_error: \ } \ (int) __sys_result; }) -# define INTERNAL_SYSCALL_RAW4(name, err, arg1, arg2, arg3, arg4) \ +# define INTERNAL_SYSCALL_RAW4(name, arg1, arg2, arg3, arg4) \ ({unsigned int __sys_result; \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4); \ @@ -379,7 +379,7 @@ __local_syscall_error: \ } \ (int) __sys_result; }) -# define INTERNAL_SYSCALL_RAW5(name, err, arg1, arg2, arg3, arg4, \ +# define INTERNAL_SYSCALL_RAW5(name, arg1, arg2, arg3, arg4, \ arg5) \ ({unsigned int __sys_result; \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ @@ -402,7 +402,7 @@ __local_syscall_error: \ } \ (int) __sys_result; }) -# define INTERNAL_SYSCALL_RAW6(name, err, arg1, arg2, arg3, arg4, \ +# define INTERNAL_SYSCALL_RAW6(name, arg1, arg2, arg3, arg4, \ arg5, arg6) \ ({unsigned int __sys_result; \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ @@ -426,7 +426,7 @@ __local_syscall_error: \ } \ (int) __sys_result; }) -# define INTERNAL_SYSCALL_RAW7(name, err, arg1, arg2, arg3, arg4, \ +# define INTERNAL_SYSCALL_RAW7(name, arg1, arg2, arg3, arg4, \ arg5, arg6, arg7) \ ({unsigned int __sys_result; \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ @@ -454,12 +454,12 @@ __local_syscall_error: \ (int) __sys_result; }) # undef INTERNAL_SYSCALL -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_RAW##nr(SYS_ify(name), err, args) +# define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_RAW##nr(SYS_ify(name), args) # undef INTERNAL_SYSCALL_NCS -# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - INTERNAL_SYSCALL_RAW##nr (number, err, args) +# define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + INTERNAL_SYSCALL_RAW##nr (number, args) #endif /* __ASSEMBLER__ */ diff --git a/sysdeps/unix/sysv/linux/default-sched.h b/sysdeps/unix/sysv/linux/default-sched.h index 26fe9ec6e6..6db3e3ba46 100644 --- a/sysdeps/unix/sysv/linux/default-sched.h +++ b/sysdeps/unix/sysv/linux/default-sched.h @@ -26,17 +26,15 @@ static void collect_default_sched (struct pthread *pd) { - INTERNAL_SYSCALL_DECL (scerr); - if ((pd->flags & ATTR_FLAG_POLICY_SET) == 0) { - pd->schedpolicy = INTERNAL_SYSCALL (sched_getscheduler, scerr, 1, 0); + pd->schedpolicy = INTERNAL_SYSCALL_CALL (sched_getscheduler, 0); pd->flags |= ATTR_FLAG_POLICY_SET; } if ((pd->flags & ATTR_FLAG_SCHED_SET) == 0) { - INTERNAL_SYSCALL (sched_getparam, scerr, 2, 0, &pd->schedparam); + INTERNAL_SYSCALL_CALL (sched_getparam, 0, &pd->schedparam); pd->flags |= ATTR_FLAG_SCHED_SET; } } diff --git a/sysdeps/unix/sysv/linux/dl-origin.c b/sysdeps/unix/sysv/linux/dl-origin.c index 74c8ff142b..515ed6fc8c 100644 --- a/sysdeps/unix/sysv/linux/dl-origin.c +++ b/sysdeps/unix/sysv/linux/dl-origin.c @@ -37,11 +37,10 @@ _dl_get_origin (void) char linkval[PATH_MAX]; char *result; int len; - INTERNAL_SYSCALL_DECL (err); - len = INTERNAL_SYSCALL (readlink, err, 3, "/proc/self/exe", linkval, - sizeof (linkval)); - if (! INTERNAL_SYSCALL_ERROR_P (len, err) && len > 0 && linkval[0] != '[') + len = INTERNAL_SYSCALL_CALL (readlink, "/proc/self/exe", linkval, + sizeof (linkval)); + if (! INTERNAL_SYSCALL_ERROR_P (len) && len > 0 && linkval[0] != '[') { /* We can use this value. */ assert (linkval[0] == '/'); diff --git a/sysdeps/unix/sysv/linux/dl-writev.h b/sysdeps/unix/sysv/linux/dl-writev.h index c04d1a74a8..3dd8376385 100644 --- a/sysdeps/unix/sysv/linux/dl-writev.h +++ b/sysdeps/unix/sysv/linux/dl-writev.h @@ -33,6 +33,5 @@ static inline void _dl_writev (int fd, const struct iovec *iov, size_t niov) { - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (writev, err, 3, fd, iov, niov); + INTERNAL_SYSCALL_CALL (writev, fd, iov, niov); } diff --git a/sysdeps/unix/sysv/linux/exit-thread.h b/sysdeps/unix/sysv/linux/exit-thread.h index 083e4620d9..d617594bfd 100644 --- a/sysdeps/unix/sysv/linux/exit-thread.h +++ b/sysdeps/unix/sysv/linux/exit-thread.h @@ -32,7 +32,6 @@ __exit_thread (void) of the caller and doing unexpectedly strange things. */ while (1) { - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (exit, err, 1, 0); + INTERNAL_SYSCALL_CALL (exit, 0); } } diff --git a/sysdeps/unix/sysv/linux/fcntl_nocancel.c b/sysdeps/unix/sysv/linux/fcntl_nocancel.c index bafc1cff5f..ed9211001f 100644 --- a/sysdeps/unix/sysv/linux/fcntl_nocancel.c +++ b/sysdeps/unix/sysv/linux/fcntl_nocancel.c @@ -51,14 +51,13 @@ __fcntl64_nocancel_adjusted (int fd, int cmd, void *arg) { if (cmd == F_GETOWN) { - INTERNAL_SYSCALL_DECL (err); struct f_owner_ex fex; - int res = INTERNAL_SYSCALL_CALL (fcntl64, err, fd, F_GETOWN_EX, &fex); - if (!INTERNAL_SYSCALL_ERROR_P (res, err)) + int res = INTERNAL_SYSCALL_CALL (fcntl64, fd, F_GETOWN_EX, &fex); + if (!INTERNAL_SYSCALL_ERROR_P (res)) return fex.type == F_OWNER_GID ? -fex.pid : fex.pid; return INLINE_SYSCALL_ERROR_RETURN_VALUE - (INTERNAL_SYSCALL_ERRNO (res, err)); + (INTERNAL_SYSCALL_ERRNO (res)); } return INLINE_SYSCALL_CALL (fcntl64, fd, cmd, (void *) arg); diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c index 524d5a6df6..3eb898e322 100644 --- a/sysdeps/unix/sysv/linux/fxstatat.c +++ b/sysdeps/unix/sysv/linux/fxstatat.c @@ -37,15 +37,14 @@ int __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) { int result; - INTERNAL_SYSCALL_DECL (err); #ifdef STAT_IS_KERNEL_STAT # define kst (*st) #else struct kernel_stat kst; #endif - result = INTERNAL_SYSCALL (newfstatat, err, 4, fd, file, &kst, flag); - if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + result = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); + if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result))) { #ifdef STAT_IS_KERNEL_STAT return 0; @@ -53,9 +52,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) return __xstat_conv (vers, &kst, st); #endif } - else - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result, - err)); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); } libc_hidden_def (__fxstatat) #if XSTAT_IS_XSTAT64 diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c index c0f1035652..e24b456604 100644 --- a/sysdeps/unix/sysv/linux/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/fxstatat64.c @@ -37,22 +37,19 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); int result; - INTERNAL_SYSCALL_DECL (err); #ifdef __NR_fstatat64 - result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, st, flag); + result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, st, flag); #else struct statx tmp; - result = INTERNAL_SYSCALL (statx, err, 5, fd, file, AT_NO_AUTOMOUNT | flag, - STATX_BASIC_STATS, &tmp); + result = INTERNAL_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag, + STATX_BASIC_STATS, &tmp); if (result == 0) __cp_stat64_statx (st, &tmp); #endif - if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result))) return 0; - else - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result, - err)); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); } libc_hidden_def (__fxstatat64) diff --git a/sysdeps/unix/sysv/linux/generic/____longjmp_chk.c b/sysdeps/unix/sysv/linux/generic/____longjmp_chk.c index 634101a1cd..9be49ad91c 100644 --- a/sysdeps/unix/sysv/linux/generic/____longjmp_chk.c +++ b/sysdeps/unix/sysv/linux/generic/____longjmp_chk.c @@ -36,7 +36,6 @@ void ____longjmp_chk (__jmp_buf env, int val) { void *this_frame = __builtin_frame_address (0); void *saved_frame = JB_FRAME_ADDRESS (env); - INTERNAL_SYSCALL_DECL (err); stack_t ss; /* If "env" is from a frame that called us, we're all set. */ @@ -44,7 +43,7 @@ void ____longjmp_chk (__jmp_buf env, int val) __longjmp (env, val); /* If we can't get the current stack state, give up and do the longjmp. */ - if (INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &ss) != 0) + if (INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &ss) != 0) __longjmp (env, val); /* If we we are executing on the alternate stack and within the diff --git a/sysdeps/unix/sysv/linux/generic/brk.c b/sysdeps/unix/sysv/linux/generic/brk.c index 2bfe5f2e39..40a80ab970 100644 --- a/sysdeps/unix/sysv/linux/generic/brk.c +++ b/sysdeps/unix/sysv/linux/generic/brk.c @@ -31,9 +31,7 @@ weak_alias (__curbrk, ___brk_addr) int __brk (void *addr) { - INTERNAL_SYSCALL_DECL (err); - - __curbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr); + __curbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr); if (__curbrk < addr) { __set_errno (ENOMEM); diff --git a/sysdeps/unix/sysv/linux/generic/dl-origin.c b/sysdeps/unix/sysv/linux/generic/dl-origin.c index 9d3c639a7c..1ab02bbf10 100644 --- a/sysdeps/unix/sysv/linux/generic/dl-origin.c +++ b/sysdeps/unix/sysv/linux/generic/dl-origin.c @@ -38,11 +38,10 @@ _dl_get_origin (void) char linkval[PATH_MAX]; char *result; int len; - INTERNAL_SYSCALL_DECL (err); - len = INTERNAL_SYSCALL (readlinkat, err, 4, AT_FDCWD, "/proc/self/exe", - linkval, sizeof (linkval)); - if (! INTERNAL_SYSCALL_ERROR_P (len, err) && len > 0 && linkval[0] != '[') + len = INTERNAL_SYSCALL_CALL (readlinkat, AT_FDCWD, "/proc/self/exe", + linkval, sizeof (linkval)); + if (! INTERNAL_SYSCALL_ERROR_P (len) && len > 0 && linkval[0] != '[') { /* We can use this value. */ assert (linkval[0] == '/'); diff --git a/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c b/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c index d77db64a54..eae0a7fe31 100644 --- a/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c +++ b/sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c @@ -28,15 +28,14 @@ if ((unsigned long) (sp) > this_sp) \ { \ stack_t oss; \ - INTERNAL_SYSCALL_DECL (err); \ - int result = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss);\ + int result = INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &oss);\ /* If we aren't using an alternate stack then we have already \ shown that we are jumping to a frame that doesn't exist so \ error out. If we are using an alternate stack we must prove \ that we are jumping *out* of the alternate stack. Note that \ the check for that is the same as that for _STACK_GROWS_UP \ as for _STACK_GROWS_DOWN. */ \ - if (!INTERNAL_SYSCALL_ERROR_P (result, err) \ + if (!INTERNAL_SYSCALL_ERROR_P (result) \ && ((oss.ss_flags & SS_ONSTACK) == 0 \ || ((unsigned long) oss.ss_sp + oss.ss_size \ - (unsigned long) (sp)) < oss.ss_size)) \ diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h index 88e368db4d..7f8da30d23 100644 --- a/sysdeps/unix/sysv/linux/hppa/sysdep.h +++ b/sysdeps/unix/sysv/linux/hppa/sysdep.h @@ -362,7 +362,7 @@ L(pre_end): ASM_LINE_SEP \ /* Similar to INLINE_SYSCALL but we don't set errno */ #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL(name, nr, args...) \ ({ \ long __sys_res; \ { \ @@ -388,7 +388,7 @@ L(pre_end): ASM_LINE_SEP \ /* The _NCS variant allows non-constant syscall numbers. */ #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ long __sys_res; \ { \ diff --git a/sysdeps/unix/sysv/linux/i386/brk.c b/sysdeps/unix/sysv/linux/i386/brk.c index b0e5b0f85c..021b6d37a0 100644 --- a/sysdeps/unix/sysv/linux/i386/brk.c +++ b/sysdeps/unix/sysv/linux/i386/brk.c @@ -36,8 +36,7 @@ weak_alias (__curbrk, ___brk_addr) int __brk (void *addr) { - INTERNAL_SYSCALL_DECL (err); - void *newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr); + void *newbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr); __curbrk = newbrk; if (newbrk < addr) return INLINE_SYSCALL_ERROR_RETURN_VALUE (ENOMEM); diff --git a/sysdeps/unix/sysv/linux/i386/fxstat.c b/sysdeps/unix/sysv/linux/i386/fxstat.c index 8eda42f2e6..db59baa71b 100644 --- a/sysdeps/unix/sysv/linux/i386/fxstat.c +++ b/sysdeps/unix/sysv/linux/i386/fxstat.c @@ -42,11 +42,9 @@ __fxstat (int vers, int fd, struct stat *buf) { struct stat64 buf64; - INTERNAL_SYSCALL_DECL (err); - result = INTERNAL_SYSCALL (fstat64, err, 2, fd, &buf64); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result, - err)); + result = INTERNAL_SYSCALL_CALL (fstat64, fd, &buf64); + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); else return __xstat32_conv (vers, &buf64, buf); } diff --git a/sysdeps/unix/sysv/linux/i386/fxstatat.c b/sysdeps/unix/sysv/linux/i386/fxstatat.c index d510d7463d..f720f6e429 100644 --- a/sysdeps/unix/sysv/linux/i386/fxstatat.c +++ b/sysdeps/unix/sysv/linux/i386/fxstatat.c @@ -38,13 +38,11 @@ int __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) { int result; - INTERNAL_SYSCALL_DECL (err); struct stat64 st64; - result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, &st64, flag); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result, - err)); + result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, &st64, flag); + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); else return __xstat32_conv (vers, &st64, st); } diff --git a/sysdeps/unix/sysv/linux/i386/lxstat.c b/sysdeps/unix/sysv/linux/i386/lxstat.c index e6f8e0fbca..e960077893 100644 --- a/sysdeps/unix/sysv/linux/i386/lxstat.c +++ b/sysdeps/unix/sysv/linux/i386/lxstat.c @@ -43,11 +43,9 @@ __lxstat (int vers, const char *name, struct stat *buf) { struct stat64 buf64; - INTERNAL_SYSCALL_DECL (err); - result = INTERNAL_SYSCALL (lstat64, err, 2, name, &buf64); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result, - err)); + result = INTERNAL_SYSCALL_CALL (lstat64, name, &buf64); + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); else return __xstat32_conv (vers, &buf64, buf); } diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index d975683749..62d9119e64 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -299,25 +299,25 @@ struct libc_do_syscall_args The _NCS variant allows non-constant syscall numbers but it is not possible to use more than four parameters. */ #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL_MAIN_0(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 0, args) -#define INTERNAL_SYSCALL_MAIN_1(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 1, args) -#define INTERNAL_SYSCALL_MAIN_2(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 2, args) -#define INTERNAL_SYSCALL_MAIN_3(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 3, args) -#define INTERNAL_SYSCALL_MAIN_4(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 4, args) -#define INTERNAL_SYSCALL_MAIN_5(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 5, args) +#define INTERNAL_SYSCALL_MAIN_0(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 0, args) +#define INTERNAL_SYSCALL_MAIN_1(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 1, args) +#define INTERNAL_SYSCALL_MAIN_2(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 2, args) +#define INTERNAL_SYSCALL_MAIN_3(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 3, args) +#define INTERNAL_SYSCALL_MAIN_4(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 4, args) +#define INTERNAL_SYSCALL_MAIN_5(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 5, args) /* Each object using 6-argument inline syscalls must include a definition of __libc_do_syscall. */ #ifdef OPTIMIZE_FOR_GCC_5 -# define INTERNAL_SYSCALL_MAIN_6(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 6, args) +# define INTERNAL_SYSCALL_MAIN_6(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 6, args) #else /* GCC 5 */ -# define INTERNAL_SYSCALL_MAIN_6(name, err, arg1, arg2, arg3, \ +# define INTERNAL_SYSCALL_MAIN_6(name, arg1, arg2, arg3, \ arg4, arg5, arg6) \ struct libc_do_syscall_args _xv = \ { \ @@ -332,22 +332,22 @@ struct libc_do_syscall_args : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \ : "memory", "cc") #endif /* GCC 5 */ -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL(name, nr, args...) \ ({ \ register unsigned int resultvar; \ - INTERNAL_SYSCALL_MAIN_##nr (name, err, args); \ + INTERNAL_SYSCALL_MAIN_##nr (name, args); \ (int) resultvar; }) #if I386_USE_SYSENTER # ifdef OPTIMIZE_FOR_GCC_5 # ifdef PIC -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "call *%%gs:%P2" \ : "=a" (resultvar) \ : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \ ASMARGS_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ register unsigned int resultvar; \ LOADREGS_##nr(args) \ @@ -358,13 +358,13 @@ struct libc_do_syscall_args ASMARGS_##nr(args) : "memory", "cc"); \ (int) resultvar; }) # else -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "call *_dl_sysinfo" \ : "=a" (resultvar) \ : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ register unsigned int resultvar; \ LOADREGS_##nr(args) \ @@ -376,7 +376,7 @@ struct libc_do_syscall_args # endif # else /* GCC 5 */ # ifdef PIC -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ EXTRAVAR_##nr \ asm volatile ( \ LOADARGS_##nr \ @@ -386,7 +386,7 @@ struct libc_do_syscall_args : "=a" (resultvar) \ : "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \ ASMFMT_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ register unsigned int resultvar; \ EXTRAVAR_##nr \ @@ -399,7 +399,7 @@ struct libc_do_syscall_args ASMFMT_##nr(args) : "memory", "cc"); \ (int) resultvar; }) # else -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ EXTRAVAR_##nr \ asm volatile ( \ LOADARGS_##nr \ @@ -408,7 +408,7 @@ struct libc_do_syscall_args RESTOREARGS_##nr \ : "=a" (resultvar) \ : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ register unsigned int resultvar; \ EXTRAVAR_##nr \ @@ -423,13 +423,13 @@ struct libc_do_syscall_args # endif /* GCC 5 */ #else # ifdef OPTIMIZE_FOR_GCC_5 -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "int $0x80" \ : "=a" (resultvar) \ : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ register unsigned int resultvar; \ LOADREGS_##nr(args) \ @@ -439,7 +439,7 @@ struct libc_do_syscall_args : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \ (int) resultvar; }) # else /* GCC 5 */ -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ EXTRAVAR_##nr \ asm volatile ( \ LOADARGS_##nr \ @@ -448,7 +448,7 @@ struct libc_do_syscall_args RESTOREARGS_##nr \ : "=a" (resultvar) \ : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ register unsigned int resultvar; \ EXTRAVAR_##nr \ diff --git a/sysdeps/unix/sysv/linux/i386/xstat.c b/sysdeps/unix/sysv/linux/i386/xstat.c index 3557a91394..96f67168ac 100644 --- a/sysdeps/unix/sysv/linux/i386/xstat.c +++ b/sysdeps/unix/sysv/linux/i386/xstat.c @@ -43,11 +43,9 @@ __xstat (int vers, const char *name, struct stat *buf) { struct stat64 buf64; - INTERNAL_SYSCALL_DECL (err); - result = INTERNAL_SYSCALL (stat64, err, 2, name, &buf64); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result, - err)); + result = INTERNAL_SYSCALL_CALL (stat64, name, &buf64); + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result)); else return __xstat32_conv (vers, &buf64, buf); } diff --git a/sysdeps/unix/sysv/linux/ia64/__sigstack_longjmp.c b/sysdeps/unix/sysv/linux/ia64/__sigstack_longjmp.c index 85a8714c4d..6e16651fd0 100644 --- a/sysdeps/unix/sysv/linux/ia64/__sigstack_longjmp.c +++ b/sysdeps/unix/sysv/linux/ia64/__sigstack_longjmp.c @@ -112,8 +112,7 @@ __sigstack_longjmp (__jmp_buf buf, int val) jb_sp = ((unsigned long *) buf)[JB_SP]; jb_bsp = ((unsigned long **) buf)[JB_BSP]; - INTERNAL_SYSCALL_DECL (err); - (void) INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &stk); + INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &stk); ss_sp = (unsigned long) stk.ss_sp; jb_rnat_addr = ia64_rse_rnat_addr (jb_bsp); diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h index fab8ca2359..3d79b8ce82 100644 --- a/sysdeps/unix/sysv/linux/ia64/sysdep.h +++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h @@ -191,7 +191,7 @@ #ifdef IA64_USE_NEW_STUB -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ LOAD_ARGS_##nr (args) \ register long _r8 __asm ("r8"); \ @@ -214,7 +214,7 @@ #else /* !IA64_USE_NEW_STUB */ -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ LOAD_ARGS_##nr (args) \ register long _r8 asm ("r8"); \ @@ -231,8 +231,8 @@ #endif /* !IA64_USE_NEW_STUB */ -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args) #define LOAD_ARGS_0() #define LOAD_REGS_0 diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c index ccacbfdb16..8ab73a7422 100644 --- a/sysdeps/unix/sysv/linux/ifaddrs.c +++ b/sysdeps/unix/sysv/linux/ifaddrs.c @@ -244,8 +244,7 @@ void __netlink_close (struct netlink_handle *h) { /* Don't modify errno. */ - INTERNAL_SYSCALL_DECL (err); - (void) INTERNAL_SYSCALL (close, err, 1, h->fd); + INTERNAL_SYSCALL_CALL (close, h->fd); } diff --git a/sysdeps/unix/sysv/linux/internal-signals.h b/sysdeps/unix/sysv/linux/internal-signals.h index bc2f23aea4..e958522a07 100644 --- a/sysdeps/unix/sysv/linux/internal-signals.h +++ b/sysdeps/unix/sysv/linux/internal-signals.h @@ -62,8 +62,7 @@ static const sigset_t sigall_set = { static inline void __libc_signal_block_all (sigset_t *set) { - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_BLOCK, &sigall_set, set, + INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigall_set, set, _NSIG / 8); } @@ -73,8 +72,7 @@ __libc_signal_block_app (sigset_t *set) { sigset_t allset = sigall_set; __clear_internal_signals (&allset); - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_BLOCK, &allset, set, + INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &allset, set, _NSIG / 8); } @@ -82,8 +80,7 @@ __libc_signal_block_app (sigset_t *set) static inline void __libc_signal_restore_set (const sigset_t *set) { - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_SETMASK, set, NULL, + INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, set, NULL, _NSIG / 8); } diff --git a/sysdeps/unix/sysv/linux/libc_fatal.c b/sysdeps/unix/sysv/linux/libc_fatal.c index 5097f41dc8..7e22c0fc32 100644 --- a/sysdeps/unix/sysv/linux/libc_fatal.c +++ b/sysdeps/unix/sysv/linux/libc_fatal.c @@ -22,12 +22,11 @@ static bool writev_for_fatal (int fd, const struct iovec *iov, size_t niov, size_t total) { - INTERNAL_SYSCALL_DECL (err); ssize_t cnt; do - cnt = INTERNAL_SYSCALL (writev, err, 3, fd, iov, niov); - while (INTERNAL_SYSCALL_ERROR_P (cnt, err) - && INTERNAL_SYSCALL_ERRNO (cnt, err) == EINTR); + cnt = INTERNAL_SYSCALL_CALL (writev, fd, iov, niov); + while (INTERNAL_SYSCALL_ERROR_P (cnt) + && INTERNAL_SYSCALL_ERRNO (cnt) == EINTR); return cnt == total; } #define WRITEV_FOR_FATAL writev_for_fatal diff --git a/sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c b/sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c index 28b0ee08c1..1e9c5259ab 100644 --- a/sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c +++ b/sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c @@ -25,9 +25,8 @@ if ((unsigned long) (sp) < this_sp) \ { \ stack_t oss; \ - INTERNAL_SYSCALL_DECL (err); \ - int result = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss); \ - if (!INTERNAL_SYSCALL_ERROR_P (result, err) \ + int result = INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &oss); \ + if (!INTERNAL_SYSCALL_ERROR_P (result) \ && ((oss.ss_flags & SS_ONSTACK) == 0 \ || ((unsigned long) oss.ss_sp + oss.ss_size \ - (unsigned long) (sp)) < oss.ss_size)) \ diff --git a/sysdeps/unix/sysv/linux/m68k/brk.c b/sysdeps/unix/sysv/linux/m68k/brk.c index 6ce2f2553c..ee88acbdc4 100644 --- a/sysdeps/unix/sysv/linux/m68k/brk.c +++ b/sysdeps/unix/sysv/linux/m68k/brk.c @@ -32,8 +32,7 @@ __brk (void *addr) { void *newbrk; - INTERNAL_SYSCALL_DECL (err); - newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr); + newbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr); __curbrk = newbrk; if (newbrk < addr) diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h b/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h index 53c30be802..ea05b00357 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h @@ -61,6 +61,6 @@ typedef uintmax_t uatomic_max_t; }) # define atomic_full_barrier() \ - (INTERNAL_SYSCALL (atomic_barrier, , 0), (void) 0) + (INTERNAL_SYSCALL_CALL (atomic_barrier), (void) 0) #endif diff --git a/sysdeps/unix/sysv/linux/m68k/getpagesize.c b/sysdeps/unix/sysv/linux/m68k/getpagesize.c index ad6559320e..b57a03f7d3 100644 --- a/sysdeps/unix/sysv/linux/m68k/getpagesize.c +++ b/sysdeps/unix/sysv/linux/m68k/getpagesize.c @@ -36,10 +36,9 @@ __getpagesize (void) return GLRO(dl_pagesize); #ifdef __NR_getpagesize - INTERNAL_SYSCALL_DECL (err); - result = INTERNAL_SYSCALL (getpagesize, err, 0); + result = INTERNAL_SYSCALL_CALL (getpagesize); /* The only possible error is ENOSYS. */ - if (!INTERNAL_SYSCALL_ERROR_P (result, err)) + if (!INTERNAL_SYSCALL_ERROR_P (result)) return result; #endif diff --git a/sysdeps/unix/sysv/linux/m68k/m68k-helpers.c b/sysdeps/unix/sysv/linux/m68k/m68k-helpers.c index f3bb727d02..62809e3f5a 100644 --- a/sysdeps/unix/sysv/linux/m68k/m68k-helpers.c +++ b/sysdeps/unix/sysv/linux/m68k/m68k-helpers.c @@ -21,6 +21,5 @@ void * __m68k_read_tp (void) { - INTERNAL_SYSCALL_DECL (err); - return (void*) INTERNAL_SYSCALL_CALL (get_thread_area, err); + return (void*) INTERNAL_SYSCALL_CALL (get_thread_area); } diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h index f6793d34fa..a1316d6da7 100644 --- a/sysdeps/unix/sysv/linux/m68k/sysdep.h +++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h @@ -226,7 +226,7 @@ SYSCALL_ERROR_LABEL: \ normally. It will never touch errno. This returns just what the kernel gave back. */ #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ unsigned int _sys_result; \ { \ /* Load argument values in temporary variables @@ -242,8 +242,8 @@ SYSCALL_ERROR_LABEL: \ _sys_result = _d0; \ } \ (int) _sys_result; }) -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args) #define LOAD_ARGS_0() #define LOAD_REGS_0 diff --git a/sysdeps/unix/sysv/linux/microblaze/brk.c b/sysdeps/unix/sysv/linux/microblaze/brk.c index 4dd5b76079..20c3e625e4 100644 --- a/sysdeps/unix/sysv/linux/microblaze/brk.c +++ b/sysdeps/unix/sysv/linux/microblaze/brk.c @@ -30,9 +30,7 @@ weak_alias (__curbrk, ___brk_addr) int __brk (void *addr) { - INTERNAL_SYSCALL_DECL (err); - - __curbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr); + __curbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr); if (__curbrk < addr) { __set_errno (ENOMEM); diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h index 6eeae33df5..6b0132398d 100644 --- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h +++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h @@ -168,11 +168,11 @@ SYSCALL_ERROR_LABEL_DCL: \ normally. It will never touch errno. This returns just what the kernel gave back. */ # undef INTERNAL_SYSCALL -# define INTERNAL_SYSCALL(name, err, nr, args...) \ +# define INTERNAL_SYSCALL(name, nr, args...) \ inline_syscall##nr(SYS_ify(name), args) # undef INTERNAL_SYSCALL_NCS -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ inline_syscall##nr(name, args) # define SYSCALL_CLOBBERS_6 "r11", "r4", "memory" diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c index 4ec2a43bc8..0335837948 100644 --- a/sysdeps/unix/sysv/linux/mips/brk.c +++ b/sysdeps/unix/sysv/linux/mips/brk.c @@ -30,10 +30,9 @@ weak_alias (__curbrk, ___brk_addr) int __brk (void *addr) { - INTERNAL_SYSCALL_DECL (err); void *newbrk; - newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr); + newbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr); __curbrk = newbrk; if (newbrk < addr) diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index 75d483c59b..8e9cb187d2 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -37,6 +37,7 @@ /* We don't want the label for the error handler to be visible in the symbol table when we define it here. */ #ifdef __PIC__ +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 99b #endif @@ -94,10 +95,10 @@ union __mips_syscall_return # include -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (SYS_ify (name), err, nr, args) +# define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS (SYS_ify (name), nr, args) -# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(number, nr, args...) \ ({ \ union __mips_syscall_return _sc_ret; \ _sc_ret.val = __mips16_syscall##nr (args, number); \ @@ -110,12 +111,12 @@ union __mips_syscall_return number, err, args) #else /* !__mips16 */ -# define INTERNAL_SYSCALL(name, err, nr, args...) \ +# define INTERNAL_SYSCALL(name, nr, args...) \ internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \ "IK" (SYS_ify (name)), \ SYS_ify (name), err, args) -# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(number, nr, args...) \ internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \ "r" (__s0), \ number, err, args) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c index 6d36adab05..cd495a3337 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c @@ -40,15 +40,14 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) } int result; - INTERNAL_SYSCALL_DECL (err); struct kernel_stat kst; - result = INTERNAL_SYSCALL (newfstatat, err, 4, fd, file, &kst, flag); - if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + result = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result))) return __xstat64_conv (vers, &kst, st); else { - __set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); + __set_errno (INTERNAL_SYSCALL_ERRNO (result)); return -1; } } diff --git a/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h index 03873ce2c2..fad4c14fa0 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h @@ -36,6 +36,7 @@ /* We don't want the label for the error handler to be visible in the symbol table when we define it here. */ +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 99b #else /* ! __ASSEMBLER__ */ @@ -78,18 +79,18 @@ typedef long int __syscall_arg_t; #endif #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL(name, nr, args...) \ internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \ "IK" (SYS_ify (name)), \ - 0, err, args) + 0, args) #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(number, nr, args...) \ internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \ "r" (__s0), \ - number, err, args) + number, args) -#define internal_syscall0(v0_init, input, number, err, dummy...) \ +#define internal_syscall0(v0_init, input, number, dummy...) \ ({ \ long _sys_result; \ \ @@ -111,7 +112,7 @@ typedef long int __syscall_arg_t; _sys_result; \ }) -#define internal_syscall1(v0_init, input, number, err, arg1) \ +#define internal_syscall1(v0_init, input, number, arg1) \ ({ \ long _sys_result; \ \ @@ -134,7 +135,7 @@ typedef long int __syscall_arg_t; _sys_result; \ }) -#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \ +#define internal_syscall2(v0_init, input, number, arg1, arg2) \ ({ \ long _sys_result; \ \ @@ -158,8 +159,7 @@ typedef long int __syscall_arg_t; _sys_result; \ }) -#define internal_syscall3(v0_init, input, number, err, \ - arg1, arg2, arg3) \ +#define internal_syscall3(v0_init, input, number, arg1, arg2, arg3) \ ({ \ long _sys_result; \ \ @@ -184,8 +184,8 @@ typedef long int __syscall_arg_t; _sys_result; \ }) -#define internal_syscall4(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4) \ +#define internal_syscall4(v0_init, input, number, arg1, arg2, arg3, \ + arg4) \ ({ \ long _sys_result; \ \ @@ -210,8 +210,8 @@ typedef long int __syscall_arg_t; _sys_result; \ }) -#define internal_syscall5(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4, arg5) \ +#define internal_syscall5(v0_init, input, number, arg1, arg2, arg3, \ + arg4, arg5) \ ({ \ long _sys_result; \ \ @@ -237,8 +237,8 @@ typedef long int __syscall_arg_t; _sys_result; \ }) -#define internal_syscall6(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4, arg5, arg6) \ +#define internal_syscall6(v0_init, input, number, arg1, arg2, arg3, \ + arg4, arg5, arg6) \ ({ \ long _sys_result; \ \ diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c index a0c3348744..4ea882da86 100644 --- a/sysdeps/unix/sysv/linux/mq_unlink.c +++ b/sysdeps/unix/sysv/linux/mq_unlink.c @@ -28,14 +28,13 @@ mq_unlink (const char *name) if (name[0] != '/') return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); - INTERNAL_SYSCALL_DECL (err); - int ret = INTERNAL_SYSCALL (mq_unlink, err, 1, name + 1); + int ret = INTERNAL_SYSCALL_CALL (mq_unlink, name + 1); /* While unlink can return either EPERM or EACCES, mq_unlink should return just EACCES. */ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret, err))) + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret))) { - ret = INTERNAL_SYSCALL_ERRNO (ret, err); + ret = INTERNAL_SYSCALL_ERRNO (ret); if (ret == EPERM) ret = EACCES; return INLINE_SYSCALL_ERROR_RETURN_VALUE (ret); diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.h b/sysdeps/unix/sysv/linux/nios2/sysdep.h index 45ef817ab5..dbd23b814a 100644 --- a/sysdeps/unix/sysv/linux/nios2/sysdep.h +++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h @@ -145,7 +145,7 @@ # undef HAVE_INTERNAL_SEND_SYMBOL #undef INTERNAL_SYSCALL_RAW -#define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_RAW(name, nr, args...) \ ({ unsigned int _sys_result; \ { \ /* Load argument values in temporary variables @@ -164,12 +164,12 @@ (int) _sys_result; }) #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args) #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - INTERNAL_SYSCALL_RAW(number, err, nr, args) +#define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + INTERNAL_SYSCALL_RAW(number, nr, args) #define LOAD_ARGS_0() #define LOAD_REGS_0 diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index df6023a1de..bf09a3d6b8 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -65,8 +65,7 @@ __close_nocancel_nostatus (int fd) static inline void __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) { - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL_CALL (writev, err, fd, iov, iovcnt); + INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt); } /* Uncancelable fcntl. */ diff --git a/sysdeps/unix/sysv/linux/not-errno.h b/sysdeps/unix/sysv/linux/not-errno.h index cdc9d9b492..394dabeb93 100644 --- a/sysdeps/unix/sysv/linux/not-errno.h +++ b/sysdeps/unix/sysv/linux/not-errno.h @@ -26,14 +26,13 @@ static inline int __access_noerrno (const char *pathname, int mode) { int res; - INTERNAL_SYSCALL_DECL (err); #ifdef __NR_access - res = INTERNAL_SYSCALL_CALL (access, err, pathname, mode); + res = INTERNAL_SYSCALL_CALL (access, pathname, mode); #else - res = INTERNAL_SYSCALL_CALL (faccessat, err, AT_FDCWD, pathname, mode); + res = INTERNAL_SYSCALL_CALL (faccessat, AT_FDCWD, pathname, mode); #endif - if (INTERNAL_SYSCALL_ERROR_P (res, err)) - return INTERNAL_SYSCALL_ERRNO (res, err); + if (INTERNAL_SYSCALL_ERROR_P (res)) + return INTERNAL_SYSCALL_ERRNO (res); return 0; } @@ -41,9 +40,8 @@ static inline int __kill_noerrno (pid_t pid, int sig) { int res; - INTERNAL_SYSCALL_DECL (err); - res = INTERNAL_SYSCALL_CALL (kill, err, pid, sig); - if (INTERNAL_SYSCALL_ERROR_P (res, err)) - return INTERNAL_SYSCALL_ERRNO (res, err); + res = INTERNAL_SYSCALL_CALL (kill, pid, sig); + if (INTERNAL_SYSCALL_ERROR_P (res)) + return INTERNAL_SYSCALL_ERRNO (res); return 0; } diff --git a/sysdeps/unix/sysv/linux/nscd_setup_thread.c b/sysdeps/unix/sysv/linux/nscd_setup_thread.c index 6e14918be0..fe77704d1f 100644 --- a/sysdeps/unix/sysv/linux/nscd_setup_thread.c +++ b/sysdeps/unix/sysv/linux/nscd_setup_thread.c @@ -35,10 +35,9 @@ setup_thread (struct database_dyn *db) /* Do not try this at home, kids. We play with the SETTID address even thought the process is multi-threaded. This can only work since none of the threads ever terminates. */ - INTERNAL_SYSCALL_DECL (err); - int r = INTERNAL_SYSCALL (set_tid_address, err, 1, - &db->head->nscd_certainly_running); - if (!INTERNAL_SYSCALL_ERROR_P (r, err)) + int r = INTERNAL_SYSCALL_CALL (set_tid_address, + &db->head->nscd_certainly_running); + if (!INTERNAL_SYSCALL_ERROR_P (r)) /* We know the kernel can reset this field when nscd terminates. So, set the field to a nonzero value which indicates that nscd is certainly running and clients can skip the test. */ diff --git a/sysdeps/unix/sysv/linux/personality.c b/sysdeps/unix/sysv/linux/personality.c index 970bd7becd..d0c597b6a0 100644 --- a/sysdeps/unix/sysv/linux/personality.c +++ b/sysdeps/unix/sysv/linux/personality.c @@ -35,15 +35,14 @@ __personality (unsigned long persona) persona = (unsigned int) persona; #endif - INTERNAL_SYSCALL_DECL (err); - long ret = INTERNAL_SYSCALL (personality, err, 1, persona); + long ret = INTERNAL_SYSCALL_CALL (personality, persona); /* Starting with kernel commit v2.6.29-6609-g11d06b2, the personality syscall never fails. However, 32-bit kernels might flag valid values as errors, so we need to reverse the error setting. We can't use the raw result as some arches split the return/error values. */ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret, err))) - ret = -INTERNAL_SYSCALL_ERRNO (ret, err); + if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret))) + ret = -INTERNAL_SYSCALL_ERRNO (ret); return ret; } weak_alias (__personality, personality) diff --git a/sysdeps/unix/sysv/linux/posix_fadvise.c b/sysdeps/unix/sysv/linux/posix_fadvise.c index 63965dddbd..bada96b697 100644 --- a/sysdeps/unix/sysv/linux/posix_fadvise.c +++ b/sysdeps/unix/sysv/linux/posix_fadvise.c @@ -41,14 +41,13 @@ int posix_fadvise (int fd, off_t offset, off_t len, int advise) { - INTERNAL_SYSCALL_DECL (err); # if defined (__NR_fadvise64) && !defined (__ASSUME_FADVISE64_AS_64_64) - int ret = INTERNAL_SYSCALL_CALL (fadvise64, err, fd, + int ret = INTERNAL_SYSCALL_CALL (fadvise64, fd, __ALIGNMENT_ARG SYSCALL_LL (offset), len, advise); # else # ifdef __ASSUME_FADVISE64_64_6ARG - int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, err, fd, advise, + int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, fd, advise, SYSCALL_LL (offset), SYSCALL_LL (len)); # else @@ -56,13 +55,13 @@ posix_fadvise (int fd, off_t offset, off_t len, int advise) # define __NR_fadvise64_64 __NR_fadvise64 # endif - int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, err, fd, + int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, fd, __ALIGNMENT_ARG SYSCALL_LL (offset), SYSCALL_LL (len), advise); # endif # endif - if (INTERNAL_SYSCALL_ERROR_P (ret, err)) - return INTERNAL_SYSCALL_ERRNO (ret, err); + if (INTERNAL_SYSCALL_ERROR_P (ret)) + return INTERNAL_SYSCALL_ERRNO (ret); return 0; } #endif /* __OFF_T_MATCHES_OFF64_T */ diff --git a/sysdeps/unix/sysv/linux/posix_fadvise64.c b/sysdeps/unix/sysv/linux/posix_fadvise64.c index c0fa6e3391..9787ab4c7c 100644 --- a/sysdeps/unix/sysv/linux/posix_fadvise64.c +++ b/sysdeps/unix/sysv/linux/posix_fadvise64.c @@ -40,18 +40,17 @@ libc_hidden_proto (__posix_fadvise64_l64) int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) { - INTERNAL_SYSCALL_DECL (err); #ifdef __ASSUME_FADVISE64_64_6ARG - int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, err, fd, advise, + int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, fd, advise, SYSCALL_LL64 (offset), SYSCALL_LL64 (len)); #else - int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, err, fd, + int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, fd, __ALIGNMENT_ARG SYSCALL_LL64 (offset), SYSCALL_LL64 (len), advise); #endif - if (!INTERNAL_SYSCALL_ERROR_P (ret, err)) + if (!INTERNAL_SYSCALL_ERROR_P (ret)) return 0; - return INTERNAL_SYSCALL_ERRNO (ret, err); + return INTERNAL_SYSCALL_ERRNO (ret); } /* The type of the len argument was changed from size_t to off_t in diff --git a/sysdeps/unix/sysv/linux/posix_fallocate.c b/sysdeps/unix/sysv/linux/posix_fallocate.c index 7af973be9e..7238b00038 100644 --- a/sysdeps/unix/sysv/linux/posix_fallocate.c +++ b/sysdeps/unix/sysv/linux/posix_fallocate.c @@ -26,12 +26,11 @@ int posix_fallocate (int fd, __off_t offset, __off_t len) { - INTERNAL_SYSCALL_DECL (err); - int res = INTERNAL_SYSCALL_CALL (fallocate, err, fd, 0, + int res = INTERNAL_SYSCALL_CALL (fallocate, fd, 0, SYSCALL_LL (offset), SYSCALL_LL (len)); - if (! INTERNAL_SYSCALL_ERROR_P (res, err)) + if (! INTERNAL_SYSCALL_ERROR_P (res)) return 0; - if (INTERNAL_SYSCALL_ERRNO (res, err) != EOPNOTSUPP) - return INTERNAL_SYSCALL_ERRNO (res, err); + if (INTERNAL_SYSCALL_ERRNO (res) != EOPNOTSUPP) + return INTERNAL_SYSCALL_ERRNO (res); return internal_fallocate (fd, offset, len); } diff --git a/sysdeps/unix/sysv/linux/posix_fallocate64.c b/sysdeps/unix/sysv/linux/posix_fallocate64.c index ce8de713d5..2de63ac277 100644 --- a/sysdeps/unix/sysv/linux/posix_fallocate64.c +++ b/sysdeps/unix/sysv/linux/posix_fallocate64.c @@ -28,19 +28,12 @@ libc_hidden_proto (__posix_fallocate64_l64) int __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len) { - INTERNAL_SYSCALL_DECL (err); -#ifdef INTERNAL_SYSCALL_TYPES - int res = INTERNAL_SYSCALL_TYPES (fallocate, err, 4, int, fd, - int, 0, off_t, offset, - off_t, len); -#else - int res = INTERNAL_SYSCALL_CALL (fallocate, err, fd, 0, + int res = INTERNAL_SYSCALL_CALL (fallocate, fd, 0, SYSCALL_LL64 (offset), SYSCALL_LL64 (len)); -#endif - if (! INTERNAL_SYSCALL_ERROR_P (res, err)) + if (! INTERNAL_SYSCALL_ERROR_P (res)) return 0; - if (INTERNAL_SYSCALL_ERRNO (res, err) != EOPNOTSUPP) - return INTERNAL_SYSCALL_ERRNO (res, err); + if (INTERNAL_SYSCALL_ERRNO (res) != EOPNOTSUPP) + return INTERNAL_SYSCALL_ERRNO (res); return internal_fallocate64 (fd, offset, len); } libc_hidden_def (__posix_fallocate64_l64) diff --git a/sysdeps/unix/sysv/linux/posix_madvise.c b/sysdeps/unix/sysv/linux/posix_madvise.c index daff027aac..0e49f3b7ac 100644 --- a/sysdeps/unix/sysv/linux/posix_madvise.c +++ b/sysdeps/unix/sysv/linux/posix_madvise.c @@ -31,7 +31,6 @@ posix_madvise (void *addr, size_t len, int advice) if (advice == POSIX_MADV_DONTNEED) return 0; - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice); - return INTERNAL_SYSCALL_ERRNO (result, err); + int result = INTERNAL_SYSCALL_CALL (madvise, addr, len, advice); + return INTERNAL_SYSCALL_ERRNO (result); } diff --git a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c index 81f7c73f38..279b86e0da 100644 --- a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c +++ b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c @@ -105,7 +105,6 @@ __get_timebase_freq (void) if (vdsop == NULL) return get_timebase_freq_fallback (); - INTERNAL_SYSCALL_DECL (err); - return INTERNAL_VSYSCALL_CALL_TYPE (vdsop, err, uint64_t, 0); + return INTERNAL_VSYSCALL_CALL_TYPE (vdsop, uint64_t, 0); } weak_alias (__get_timebase_freq, __ppc_get_timebase_freq) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_mask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_mask.c index 61164f21df..1a047fb7ff 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_mask.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_mask.c @@ -26,8 +26,7 @@ const fenv_t * __fe_mask_env (void) { - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, PR_FP_EXC_DISABLED); + INTERNAL_SYSCALL_CALL (prctl, PR_SET_FPEXC, PR_FP_EXC_DISABLED); return FE_DFL_ENV; } diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c index 6ee75f6324..1c40cd36d6 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c @@ -27,8 +27,7 @@ const fenv_t * __fe_nomask_env_priv (void) { - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, PR_FP_EXC_PRECISE); + INTERNAL_SYSCALL_CALL (prctl, PR_SET_FPEXC, PR_FP_EXC_PRECISE); return FE_ENABLED_ENV; } diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_mask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_mask.c index 61fd3b0181..02ed0a66ae 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_mask.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_mask.c @@ -26,8 +26,7 @@ const fenv_t * __fe_mask_env (void) { #if defined PR_SET_FPEXC && defined PR_FP_EXC_DISABLED - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, PR_FP_EXC_DISABLED); + INTERNAL_SYSCALL_CALL (prctl, PR_SET_FPEXC, PR_FP_EXC_DISABLED); #else __set_errno (ENOSYS); #endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c index f4febe7603..33a36e2673 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c @@ -27,8 +27,7 @@ const fenv_t * __fe_nomask_env_priv (void) { #if defined PR_SET_FPEXC && defined PR_FP_EXC_PRECISE - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, PR_FP_EXC_PRECISE); + INTERNAL_SYSCALL_CALL (prctl, PR_SET_FPEXC, PR_FP_EXC_PRECISE); #else __set_errno (ENOSYS); #endif diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index 92503ee20f..b5ef255156 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -41,7 +41,7 @@ gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) the negation of the return value in the kernel gets reverted. */ -#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ +#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, type, nr, args...) \ ({ \ register void *r0 __asm__ ("r0"); \ register long int r3 __asm__ ("r3"); \ @@ -64,12 +64,12 @@ (long int) r0 & (1 << 28) ? -rval : rval; \ }) -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) +#define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \ + INTERNAL_VSYSCALL_CALL_TYPE(funcptr, long int, nr, args) #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ register long int r0 __asm__ ("r0"); \ register long int r3 __asm__ ("r3"); \ @@ -91,8 +91,8 @@ "cr0", "ctr", "memory"); \ r0 & (1 << 28) ? -r3 : r3; \ }) -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS (__NR_##name, nr, args) #if defined(__PPC64__) || defined(__powerpc64__) # define SYSCALL_ARG_SIZE 8 diff --git a/sysdeps/unix/sysv/linux/pthread-pids.h b/sysdeps/unix/sysv/linux/pthread-pids.h index 50c022ead2..0b8ca4ec06 100644 --- a/sysdeps/unix/sysv/linux/pthread-pids.h +++ b/sysdeps/unix/sysv/linux/pthread-pids.h @@ -25,6 +25,5 @@ static inline void __pthread_initialize_pids (struct pthread *pd) { - INTERNAL_SYSCALL_DECL (err); - pd->tid = INTERNAL_SYSCALL_CALL (set_tid_address, err, &pd->tid); + pd->tid = INTERNAL_SYSCALL_CALL (set_tid_address, &pd->tid); } diff --git a/sysdeps/unix/sysv/linux/pthread_getaffinity.c b/sysdeps/unix/sysv/linux/pthread_getaffinity.c index a3d5856763..cf6ecfe01f 100644 --- a/sysdeps/unix/sysv/linux/pthread_getaffinity.c +++ b/sysdeps/unix/sysv/linux/pthread_getaffinity.c @@ -31,11 +31,10 @@ __pthread_getaffinity_new (pthread_t th, size_t cpusetsize, cpu_set_t *cpuset) { const struct pthread *pd = (const struct pthread *) th; - INTERNAL_SYSCALL_DECL (err); - int res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, pd->tid, - MIN (INT_MAX, cpusetsize), cpuset); - if (INTERNAL_SYSCALL_ERROR_P (res, err)) - return INTERNAL_SYSCALL_ERRNO (res, err); + int res = INTERNAL_SYSCALL_CALL (sched_getaffinity, pd->tid, + MIN (INT_MAX, cpusetsize), cpuset); + if (INTERNAL_SYSCALL_ERROR_P (res)) + return INTERNAL_SYSCALL_ERRNO (res); /* Clean the rest of the memory the kernel didn't do. */ memset ((char *) cpuset + res, '\0', cpusetsize - res); diff --git a/sysdeps/unix/sysv/linux/pthread_kill.c b/sysdeps/unix/sysv/linux/pthread_kill.c index 1d63100b33..4dfe08ffcd 100644 --- a/sysdeps/unix/sysv/linux/pthread_kill.c +++ b/sysdeps/unix/sysv/linux/pthread_kill.c @@ -48,12 +48,10 @@ __pthread_kill (pthread_t threadid, int signo) return EINVAL; /* We have a special syscall to do the work. */ - INTERNAL_SYSCALL_DECL (err); - pid_t pid = __getpid (); - int val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, tid, signo); - return (INTERNAL_SYSCALL_ERROR_P (val, err) - ? INTERNAL_SYSCALL_ERRNO (val, err) : 0); + int val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo); + return (INTERNAL_SYSCALL_ERROR_P (val) + ? INTERNAL_SYSCALL_ERRNO (val) : 0); } strong_alias (__pthread_kill, pthread_kill) diff --git a/sysdeps/unix/sysv/linux/pthread_setaffinity.c b/sysdeps/unix/sysv/linux/pthread_setaffinity.c index 746824c79f..264d677c29 100644 --- a/sysdeps/unix/sysv/linux/pthread_setaffinity.c +++ b/sysdeps/unix/sysv/linux/pthread_setaffinity.c @@ -28,19 +28,18 @@ __pthread_setaffinity_new (pthread_t th, size_t cpusetsize, const cpu_set_t *cpuset) { const struct pthread *pd = (const struct pthread *) th; - INTERNAL_SYSCALL_DECL (err); int res; - res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid, cpusetsize, - cpuset); + res = INTERNAL_SYSCALL_CALL (sched_setaffinity, pd->tid, cpusetsize, + cpuset); #ifdef RESET_VGETCPU_CACHE - if (!INTERNAL_SYSCALL_ERROR_P (res, err)) + if (!INTERNAL_SYSCALL_ERROR_P (res)) RESET_VGETCPU_CACHE (); #endif - return (INTERNAL_SYSCALL_ERROR_P (res, err) - ? INTERNAL_SYSCALL_ERRNO (res, err) + return (INTERNAL_SYSCALL_ERROR_P (res) + ? INTERNAL_SYSCALL_ERRNO (res) : 0); } versioned_symbol (libpthread, __pthread_setaffinity_new, diff --git a/sysdeps/unix/sysv/linux/pthread_sigqueue.c b/sysdeps/unix/sysv/linux/pthread_sigqueue.c index 52d815a399..4b32be2d64 100644 --- a/sysdeps/unix/sysv/linux/pthread_sigqueue.c +++ b/sysdeps/unix/sysv/linux/pthread_sigqueue.c @@ -61,12 +61,10 @@ pthread_sigqueue (pthread_t threadid, int signo, const union sigval value) info.si_value = value; /* We have a special syscall to do the work. */ - INTERNAL_SYSCALL_DECL (err); - - int val = INTERNAL_SYSCALL_CALL (rt_tgsigqueueinfo, err, pid, tid, signo, + int val = INTERNAL_SYSCALL_CALL (rt_tgsigqueueinfo, pid, tid, signo, &info); - return (INTERNAL_SYSCALL_ERROR_P (val, err) - ? INTERNAL_SYSCALL_ERRNO (val, err) : 0); + return (INTERNAL_SYSCALL_ERROR_P (val) + ? INTERNAL_SYSCALL_ERRNO (val) : 0); #else return ENOSYS; #endif diff --git a/sysdeps/unix/sysv/linux/raise.c b/sysdeps/unix/sysv/linux/raise.c index 4c9f3fad8b..3b90ae1d55 100644 --- a/sysdeps/unix/sysv/linux/raise.c +++ b/sysdeps/unix/sysv/linux/raise.c @@ -39,11 +39,10 @@ raise (int sig) sigset_t set; __libc_signal_block_app (&set); - INTERNAL_SYSCALL_DECL (err); - pid_t pid = INTERNAL_SYSCALL (getpid, err, 0); - pid_t tid = INTERNAL_SYSCALL (gettid, err, 0); + pid_t pid = INTERNAL_SYSCALL_CALL (getpid); + pid_t tid = INTERNAL_SYSCALL_CALL (gettid); - int ret = INLINE_SYSCALL (tgkill, 3, pid, tid, sig); + int ret = INLINE_SYSCALL_CALL (tgkill, pid, tid, sig); __libc_signal_restore_set (&set); diff --git a/sysdeps/unix/sysv/linux/riscv/syscall.c b/sysdeps/unix/sysv/linux/riscv/syscall.c index 9d0e4175dd..a99375c054 100644 --- a/sysdeps/unix/sysv/linux/riscv/syscall.c +++ b/sysdeps/unix/sysv/linux/riscv/syscall.c @@ -23,12 +23,11 @@ syscall (long int syscall_number, long int arg1, long int arg2, long int arg3, long int arg4, long int arg5, long int arg6, long int arg7) { long int ret; - INTERNAL_SYSCALL_DECL (err); - ret = INTERNAL_SYSCALL_NCS (syscall_number, err, 7, arg1, arg2, arg3, arg4, + ret = INTERNAL_SYSCALL_NCS (syscall_number, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - if (INTERNAL_SYSCALL_ERROR_P (ret, err)) + if (INTERNAL_SYSCALL_ERROR_P (ret)) return __syscall_error (ret); return ret; diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index e46160f3f6..83e4adf6a2 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -130,13 +130,13 @@ # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - internal_syscall##nr (SYS_ify (name), err, args) +# define INTERNAL_SYSCALL(name, nr, args...) \ + internal_syscall##nr (SYS_ify (name), args) -# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - internal_syscall##nr (number, err, args) +# define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + internal_syscall##nr (number, args) -# define internal_syscall0(number, err, dummy...) \ +# define internal_syscall0(number, dummy...) \ ({ \ long int _sys_result; \ \ @@ -153,7 +153,7 @@ _sys_result; \ }) -# define internal_syscall1(number, err, arg0) \ +# define internal_syscall1(number, arg0) \ ({ \ long int _sys_result; \ long int _arg0 = (long int) (arg0); \ @@ -171,7 +171,7 @@ _sys_result; \ }) -# define internal_syscall2(number, err, arg0, arg1) \ +# define internal_syscall2(number, arg0, arg1) \ ({ \ long int _sys_result; \ long int _arg0 = (long int) (arg0); \ @@ -191,7 +191,7 @@ _sys_result; \ }) -# define internal_syscall3(number, err, arg0, arg1, arg2) \ +# define internal_syscall3(number, arg0, arg1, arg2) \ ({ \ long int _sys_result; \ long int _arg0 = (long int) (arg0); \ @@ -213,7 +213,7 @@ _sys_result; \ }) -# define internal_syscall4(number, err, arg0, arg1, arg2, arg3) \ +# define internal_syscall4(number, arg0, arg1, arg2, arg3) \ ({ \ long int _sys_result; \ long int _arg0 = (long int) (arg0); \ @@ -237,7 +237,7 @@ _sys_result; \ }) -# define internal_syscall5(number, err, arg0, arg1, arg2, arg3, arg4) \ +# define internal_syscall5(number, arg0, arg1, arg2, arg3, arg4) \ ({ \ long int _sys_result; \ long int _arg0 = (long int) (arg0); \ @@ -263,7 +263,7 @@ _sys_result; \ }) -# define internal_syscall6(number, err, arg0, arg1, arg2, arg3, arg4, arg5) \ +# define internal_syscall6(number, arg0, arg1, arg2, arg3, arg4, arg5) \ ({ \ long int _sys_result; \ long int _arg0 = (long int) (arg0); \ @@ -292,7 +292,7 @@ _sys_result; \ }) -# define internal_syscall7(number, err, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ +# define internal_syscall7(number, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ ({ \ long int _sys_result; \ long int _arg0 = (long int) (arg0); \ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c b/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c index 28fa16fe4e..1f214173fe 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c +++ b/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c @@ -39,9 +39,8 @@ if (new_sp < cur_sp) \ { \ stack_t oss; \ - INTERNAL_SYSCALL_DECL (err); \ - int res = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss); \ - if (!INTERNAL_SYSCALL_ERROR_P (res, err)) \ + int res = INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &oss); \ + if (!INTERNAL_SYSCALL_ERROR_P (res)) \ { \ if ((oss.ss_flags & SS_ONSTACK) == 0 \ || ((uintptr_t) (oss.ss_sp + oss.ss_size) - new_sp \ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c b/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c index c9847796f4..b556a6caae 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c +++ b/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c @@ -37,16 +37,15 @@ int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) { struct fadvise64_64_layout parameters; - INTERNAL_SYSCALL_DECL (err); parameters.fd = fd; parameters.offset = offset; parameters.len = len; parameters.advise = advise; - int ret = INTERNAL_SYSCALL (fadvise64_64, err, 1, ¶meters); - if (!INTERNAL_SYSCALL_ERROR_P (ret, err)) + int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, ¶meters); + if (!INTERNAL_SYSCALL_ERROR_P (ret)) return 0; - return INTERNAL_SYSCALL_ERRNO (ret, err); + return INTERNAL_SYSCALL_ERRNO (ret); } #include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index 7d31abbb6f..73c42c6b5b 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -81,6 +81,7 @@ END (name) #ifndef PIC +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: basr %r1,0; \ @@ -89,6 +90,7 @@ 2: .long syscall_error #else # if RTLD_PRIVATE_ERRNO +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: basr %r1,0; \ @@ -104,6 +106,7 @@ # else # define SYSCALL_ERROR_ERRNO errno # endif +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: lcr %r0,%r2; \ @@ -116,6 +119,7 @@ br %r14; \ 2: .long _GLOBAL_OFFSET_TABLE_-1b # else +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: basr %r1,0; \ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c b/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c index 1305c81421..bc74408135 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c +++ b/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c @@ -39,9 +39,8 @@ if (new_sp < cur_sp) \ { \ stack_t oss; \ - INTERNAL_SYSCALL_DECL (err); \ - int res = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss); \ - if (!INTERNAL_SYSCALL_ERROR_P (res, err)) \ + int res = INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &oss); \ + if (!INTERNAL_SYSCALL_ERROR_P (res)) \ { \ if ((oss.ss_flags & SS_ONSTACK) == 0 \ || ((uintptr_t) (oss.ss_sp + oss.ss_size) - new_sp \ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index aba3999315..8049fb4e1b 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -95,10 +95,12 @@ END (name) #ifndef PIC +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL syscall_error # define SYSCALL_ERROR_HANDLER #else # if RTLD_PRIVATE_ERRNO +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: larl %r1,rtld_errno; \ @@ -112,6 +114,7 @@ # else # define SYSCALL_ERROR_ERRNO errno # endif +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: lcr %r0,%r2; \ @@ -124,6 +127,7 @@ lghi %r2,-1; \ br %r14 # else +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: larl %r1,_GLOBAL_OFFSET_TABLE_; \ diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h index 3802e07277..b846c3c27e 100644 --- a/sysdeps/unix/sysv/linux/s390/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/sysdep.h @@ -22,7 +22,7 @@ #define SYS_ify(syscall_name) __NR_##syscall_name #undef INTERNAL_SYSCALL_DIRECT -#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_DIRECT(name, nr, args...) \ ({ \ DECLARGS_##nr(args) \ register long _ret __asm__("2"); \ @@ -34,7 +34,7 @@ _ret; }) #undef INTERNAL_SYSCALL_SVC0 -#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_SVC0(name, nr, args...) \ ({ \ DECLARGS_##nr(args) \ register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name); \ @@ -47,7 +47,7 @@ _ret; }) #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(no, nr, args...) \ ({ \ DECLARGS_##nr(args) \ register unsigned long _nr __asm__("1") = (unsigned long)(no); \ diff --git a/sysdeps/unix/sysv/linux/safe-fatal.h b/sysdeps/unix/sysv/linux/safe-fatal.h index 31432b5bf7..62126d1195 100644 --- a/sysdeps/unix/sysv/linux/safe-fatal.h +++ b/sysdeps/unix/sysv/linux/safe-fatal.h @@ -25,9 +25,8 @@ static inline void __safe_fatal (void) { - INTERNAL_SYSCALL_DECL (err); - pid_t self = INTERNAL_SYSCALL (getpid, err, 0); - INTERNAL_SYSCALL (kill, err, 2, self, SIGKILL); + pid_t self = INTERNAL_SYSCALL_CALL (getpid); + INTERNAL_SYSCALL_CALL (kill, self, SIGKILL); } #endif /* safe-fatal.h */ diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h index c0e52af65a..60a5032ce4 100644 --- a/sysdeps/unix/sysv/linux/sh/sysdep.h +++ b/sysdeps/unix/sysv/linux/sh/sysdep.h @@ -288,7 +288,7 @@ register long int r2 asm ("%r2") = (long int) (_arg7) #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL(name, nr, args...) \ ({ \ unsigned long int resultvar; \ register long int r3 asm ("%r3") = SYS_ify (name); \ @@ -302,7 +302,7 @@ (int) resultvar; }) /* The _NCS variant allows non-constant syscall numbers. */ -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ unsigned long int resultvar; \ register long int r3 asm ("%r3") = (name); \ diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c index c11811ae17..3bc791c05f 100644 --- a/sysdeps/unix/sysv/linux/shmat.c +++ b/sysdeps/unix/sysv/linux/shmat.c @@ -31,15 +31,13 @@ shmat (int shmid, const void *shmaddr, int shmflg) #ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS return (void*) INLINE_SYSCALL_CALL (shmat, shmid, shmaddr, shmflg); #else - INTERNAL_SYSCALL_DECL(err); unsigned long resultvar; void *raddr; - resultvar = INTERNAL_SYSCALL_CALL (ipc, err, IPCOP_shmat, shmid, shmflg, + resultvar = INTERNAL_SYSCALL_CALL (ipc, IPCOP_shmat, shmid, shmflg, &raddr, shmaddr); - if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) - return (void *) INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (resultvar, - err)); + if (INTERNAL_SYSCALL_ERROR_P (resultvar)) + return (void *) INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (resultvar)); return raddr; #endif diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index 46f4e06844..babb82f4e2 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -46,14 +46,14 @@ # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - internal_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args) +#define INTERNAL_SYSCALL(name, nr, args...) \ + internal_syscall##nr(__SYSCALL_STRING, __NR_##name, args) #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - internal_syscall##nr(__SYSCALL_STRING, err, name, args) +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ + internal_syscall##nr(__SYSCALL_STRING, name, args) -#define internal_syscall0(string,err,name,dummy...) \ +#define internal_syscall0(string,name,dummy...) \ ({ \ register long __err __asm__("g1") = (name); \ register long __o0 __asm__ ("o0"); \ @@ -63,7 +63,7 @@ __err == -1 ? -__o0 : __o0; \ }) -#define internal_syscall1(string,err,name,arg1) \ +#define internal_syscall1(string,name,arg1) \ ({ \ long _arg1 = (long) (arg1); \ register long __err __asm__("g1") = (name); \ @@ -74,7 +74,7 @@ __err == -1 ? -__o0 : __o0; \ }) -#define internal_syscall2(string,err,name,arg1,arg2) \ +#define internal_syscall2(string,name,arg1,arg2) \ ({ \ long _arg1 = (long) (arg1); \ long _arg2 = (long) (arg2); \ @@ -87,7 +87,7 @@ __err == -1 ? -__o0 : __o0; \ }) -#define internal_syscall3(string,err,name,arg1,arg2,arg3) \ +#define internal_syscall3(string,name,arg1,arg2,arg3) \ ({ \ long _arg1 = (long) (arg1); \ long _arg2 = (long) (arg2); \ @@ -103,7 +103,7 @@ __err == -1 ? -__o0 : __o0; \ }) -#define internal_syscall4(string,err,name,arg1,arg2,arg3,arg4) \ +#define internal_syscall4(string,name,arg1,arg2,arg3,arg4) \ ({ \ long _arg1 = (long) (arg1); \ long _arg2 = (long) (arg2); \ @@ -121,7 +121,7 @@ __err == -1 ? -__o0 : __o0; \ }) -#define internal_syscall5(string,err,name,arg1,arg2,arg3,arg4,arg5) \ +#define internal_syscall5(string,name,arg1,arg2,arg3,arg4,arg5) \ ({ \ long _arg1 = (long) (arg1); \ long _arg2 = (long) (arg2); \ @@ -141,7 +141,7 @@ __err == -1 ? -__o0 : __o0; \ }) -#define internal_syscall6(string,err,name,arg1,arg2,arg3,arg4,arg5,arg6)\ +#define internal_syscall6(string,name,arg1,arg2,arg3,arg4,arg5,arg6) \ ({ \ long _arg1 = (long) (arg1); \ long _arg2 = (long) (arg2); \ diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h index dc6eaddbbf..a9215494dc 100644 --- a/sysdeps/unix/sysv/linux/sysdep-vdso.h +++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h @@ -22,7 +22,7 @@ #include #ifndef INTERNAL_VSYSCALL_CALL -# define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ +# define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \ funcptr (args) #endif @@ -30,24 +30,23 @@ ({ \ __label__ out; \ __label__ iserr; \ - INTERNAL_SYSCALL_DECL (sc_err); \ long int sc_ret; \ \ __typeof (GLRO(dl_vdso_##name)) vdsop = GLRO(dl_vdso_##name); \ if (vdsop != NULL) \ { \ - sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, sc_err, nr, ##args); \ - if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, nr, ##args); \ + if (!INTERNAL_SYSCALL_ERROR_P (sc_ret)) \ goto out; \ - if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \ + if (INTERNAL_SYSCALL_ERRNO (sc_ret) != ENOSYS) \ goto iserr; \ } \ \ - sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + sc_ret = INTERNAL_SYSCALL_CALL (name, ##args); \ + if (INTERNAL_SYSCALL_ERROR_P (sc_ret)) \ { \ iserr: \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ + __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret)); \ sc_ret = -1L; \ } \ out: \ diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h index 389c94cfda..5c94357394 100644 --- a/sysdeps/unix/sysv/linux/sysdep.h +++ b/sysdeps/unix/sysv/linux/sysdep.h @@ -24,11 +24,8 @@ #ifndef __ASSEMBLER__ -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ +#define INTERNAL_SYSCALL_ERROR_P(val) \ ((unsigned long) (val) > -4096UL) #ifndef SYSCALL_ERROR_LABEL @@ -44,15 +41,14 @@ #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)) \ + long int sc_ret = INTERNAL_SYSCALL (name, nr, args); \ + __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret)) \ + ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret)) \ : sc_ret; \ }) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) +#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) /* Set error number and return -1. A target may choose to return the internal function, __syscall_error, which sets errno and returns -1. diff --git a/sysdeps/unix/sysv/linux/timer_create.c b/sysdeps/unix/sysv/linux/timer_create.c index b850a7631e..64d68a6ade 100644 --- a/sysdeps/unix/sysv/linux/timer_create.c +++ b/sysdeps/unix/sysv/linux/timer_create.c @@ -148,11 +148,10 @@ timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid) ._sigev_un = { ._pad = { [0] = __helper_tid } } }; /* Create the timer. */ - INTERNAL_SYSCALL_DECL (err); int res; - res = INTERNAL_SYSCALL (timer_create, err, 3, - syscall_clockid, &sev, &newp->ktimerid); - if (! INTERNAL_SYSCALL_ERROR_P (res, err)) + res = INTERNAL_SYSCALL_CALL (timer_create, + syscall_clockid, &sev, &newp->ktimerid); + if (! INTERNAL_SYSCALL_ERROR_P (res)) { /* Add to the queue of active timers with thread delivery. */ @@ -168,7 +167,7 @@ timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid) /* Free the resources. */ free (newp); - __set_errno (INTERNAL_SYSCALL_ERRNO (res, err)); + __set_errno (INTERNAL_SYSCALL_ERRNO (res)); return -1; } diff --git a/sysdeps/unix/sysv/linux/timer_routines.c b/sysdeps/unix/sysv/linux/timer_routines.c index abafffdfd5..00b7e018ba 100644 --- a/sysdeps/unix/sysv/linux/timer_routines.c +++ b/sysdeps/unix/sysv/linux/timer_routines.c @@ -47,8 +47,7 @@ timer_sigev_thread (void *arg) signals. */ sigset_t ss; sigemptyset (&ss); - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8); + INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, NULL, _NSIG / 8); struct thread_start_data *td = (struct thread_start_data *) arg; @@ -168,8 +167,7 @@ __start_helper_thread (void) sigset_t oss; sigfillset (&ss); __sigaddset (&ss, SIGCANCEL); - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, &oss, _NSIG / 8); + INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, &oss, _NSIG / 8); /* Create the helper thread for this timer. */ pthread_t th; @@ -179,8 +177,7 @@ __start_helper_thread (void) __helper_tid = ((struct pthread *) th)->tid; /* Restore the signal mask. */ - INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &oss, NULL, - _NSIG / 8); + INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &oss, NULL, _NSIG / 8); /* No need for the attribute anymore. */ (void) pthread_attr_destroy (&attr); diff --git a/sysdeps/unix/sysv/linux/times.c b/sysdeps/unix/sysv/linux/times.c index fee7f7eee3..e3db9cb400 100644 --- a/sysdeps/unix/sysv/linux/times.c +++ b/sysdeps/unix/sysv/linux/times.c @@ -23,10 +23,9 @@ clock_t __times (struct tms *buf) { - INTERNAL_SYSCALL_DECL (err); - clock_t ret = INTERNAL_SYSCALL (times, err, 1, buf); - if (INTERNAL_SYSCALL_ERROR_P (ret, err) - && __builtin_expect (INTERNAL_SYSCALL_ERRNO (ret, err) == EFAULT, 0) + clock_t ret = INTERNAL_SYSCALL_CALL (times, buf); + if (INTERNAL_SYSCALL_ERROR_P (ret) + && __glibc_unlikely (INTERNAL_SYSCALL_ERRNO (ret) == EFAULT) && buf) { /* This might be an error or not. For architectures which have no diff --git a/sysdeps/unix/sysv/linux/x86/cpu-features.c b/sysdeps/unix/sysv/linux/x86/cpu-features.c index fcba2c000d..d67b300595 100644 --- a/sysdeps/unix/sysv/linux/x86/cpu-features.c +++ b/sysdeps/unix/sysv/linux/x86/cpu-features.c @@ -24,9 +24,7 @@ static inline int __attribute__ ((always_inline)) get_cet_status (void) { unsigned long long cet_status[3]; - INTERNAL_SYSCALL_DECL (err); - if (INTERNAL_SYSCALL (arch_prctl, err, 2, ARCH_CET_STATUS, - cet_status) == 0) + if (INTERNAL_SYSCALL_CALL (arch_prctl, ARCH_CET_STATUS, cet_status) == 0) return cet_status[0]; return 0; } diff --git a/sysdeps/unix/sysv/linux/x86/dl-cet.h b/sysdeps/unix/sysv/linux/x86/dl-cet.h index a5cd95f4c3..1410f0fb59 100644 --- a/sysdeps/unix/sysv/linux/x86/dl-cet.h +++ b/sysdeps/unix/sysv/linux/x86/dl-cet.h @@ -22,14 +22,13 @@ static inline int __attribute__ ((always_inline)) dl_cet_allocate_legacy_bitmap (unsigned long *legacy_bitmap) { /* Allocate legacy bitmap. */ - INTERNAL_SYSCALL_DECL (err); #ifdef __LP64__ - return (int) INTERNAL_SYSCALL (arch_prctl, err, 2, - ARCH_CET_LEGACY_BITMAP, legacy_bitmap); + return (int) INTERNAL_SYSCALL_CALL (arch_prctl, + ARCH_CET_LEGACY_BITMAP, legacy_bitmap); #else unsigned long long legacy_bitmap_u64[2]; - int res = INTERNAL_SYSCALL (arch_prctl, err, 2, - ARCH_CET_LEGACY_BITMAP, legacy_bitmap_u64); + int res = INTERNAL_SYSCALL_CALL (arch_prctl, + ARCH_CET_LEGACY_BITMAP, legacy_bitmap_u64); if (res == 0) { legacy_bitmap[0] = legacy_bitmap_u64[0]; @@ -42,14 +41,12 @@ dl_cet_allocate_legacy_bitmap (unsigned long *legacy_bitmap) static inline int __attribute__ ((always_inline)) dl_cet_disable_cet (unsigned int cet_feature) { - INTERNAL_SYSCALL_DECL (err); - return (int) INTERNAL_SYSCALL (arch_prctl, err, 2, ARCH_CET_DISABLE, - cet_feature); + return (int) INTERNAL_SYSCALL_CALL (arch_prctl, ARCH_CET_DISABLE, + cet_feature); } static inline int __attribute__ ((always_inline)) dl_cet_lock_cet (void) { - INTERNAL_SYSCALL_DECL (err); - return (int) INTERNAL_SYSCALL (arch_prctl, err, 2, ARCH_CET_LOCK, 0); + return (int) INTERNAL_SYSCALL_CALL (arch_prctl, ARCH_CET_LOCK, 0); } diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index d91e00572c..9897fbec78 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -56,8 +56,10 @@ /* We don't want the label for the error handle to be global when we define it here. */ # ifdef PIC +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # else +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL syscall_error # endif @@ -189,15 +191,15 @@ #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) +#define INTERNAL_SYSCALL(name, nr, args...) \ + internal_syscall##nr (SYS_ify (name), args) #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - internal_syscall##nr (number, err, args) +#define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + internal_syscall##nr (number, args) #undef internal_syscall0 -#define internal_syscall0(number, err, dummy...) \ +#define internal_syscall0(number, dummy...) \ ({ \ unsigned long int resultvar; \ asm volatile ( \ @@ -209,7 +211,7 @@ }) #undef internal_syscall1 -#define internal_syscall1(number, err, arg1) \ +#define internal_syscall1(number, arg1) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg1, __arg1) = ARGIFY (arg1); \ @@ -223,7 +225,7 @@ }) #undef internal_syscall2 -#define internal_syscall2(number, err, arg1, arg2) \ +#define internal_syscall2(number, arg1, arg2) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg2, __arg2) = ARGIFY (arg2); \ @@ -239,7 +241,7 @@ }) #undef internal_syscall3 -#define internal_syscall3(number, err, arg1, arg2, arg3) \ +#define internal_syscall3(number, arg1, arg2, arg3) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg3, __arg3) = ARGIFY (arg3); \ @@ -257,7 +259,7 @@ }) #undef internal_syscall4 -#define internal_syscall4(number, err, arg1, arg2, arg3, arg4) \ +#define internal_syscall4(number, arg1, arg2, arg3, arg4) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg4, __arg4) = ARGIFY (arg4); \ @@ -277,7 +279,7 @@ }) #undef internal_syscall5 -#define internal_syscall5(number, err, arg1, arg2, arg3, arg4, arg5) \ +#define internal_syscall5(number, arg1, arg2, arg3, arg4, arg5) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg5, __arg5) = ARGIFY (arg5); \ @@ -300,7 +302,7 @@ }) #undef internal_syscall6 -#define internal_syscall6(number, err, arg1, arg2, arg3, arg4, arg5, arg6) \ +#define internal_syscall6(number, arg1, arg2, arg3, arg4, arg5, arg6) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg6, __arg6) = ARGIFY (arg6); \ diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/times.c b/sysdeps/unix/sysv/linux/x86_64/x32/times.c index fb93cb609c..864c123117 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/times.c +++ b/sysdeps/unix/sysv/linux/x86_64/x32/times.c @@ -20,7 +20,7 @@ /* Linux times system call returns 64-bit integer. */ #undef internal_syscall1 -#define internal_syscall1(number, err, arg1) \ +#define internal_syscall1(number, arg1) \ ({ \ unsigned long long int resultvar; \ TYPEFY (arg1, __arg1) = ARGIFY (arg1); \ @@ -34,7 +34,7 @@ }) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ +#define INTERNAL_SYSCALL_ERROR_P(val) \ ((unsigned long long int) (val) >= -4095LL) #include