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