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