public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] powerpc: Use Linux kABI for syscall return
@ 2020-02-15  0:13 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2020-02-15  0:13 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e26b8a008ae6f45f6aa2dd56f6d6ce13f181df9f

commit e26b8a008ae6f45f6aa2dd56f6d6ce13f181df9f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sun Feb 2 20:45:58 2020 -0300

    powerpc: Use Linux kABI for syscall return
    
    It changes the powerpc INTERNAL_VSYSCALL_CALL and INTERNAL_SYSCALL_NCS
    to return a negative value instead of the returning the CR value in
    the 'err' macro argument.
    
    The macro INTERNAL_SYSCALL_DECL is no longer required, and the
    INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs.
    
    Checked on powerpc64-linux-gnu, powerpc64le-linux-gnu, and
    powerpc-linux-gnu-power4.

Diff:
---
 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 0f067db..aab4901 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h
@@ -57,9 +57,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...)		\
@@ -107,21 +106,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 int) (val) > -4096UL)
 
 #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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-15  0:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-15  0:13 [glibc] powerpc: Use Linux kABI for syscall return Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).