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: 37868 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(-) 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