arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone

Blame SOURCES/glibc-rh731833-misc.patch

147e83
From 51a8476450158fb522c791c73b7b56dc30a741fc Mon Sep 17 00:00:00 2001
147e83
From: Anton Blanchard <anton@samba.org>
147e83
Date: Tue, 15 Jan 2013 12:50:46 -0600
147e83
Subject: [PATCH 14/42] PowerPC: Rename __kernel_vdso_get_tbfreq to
147e83
 __kernel_get_tbfreq.
147e83
147e83
In order for the __kernel_get_tbfreq vDSO call to work the
147e83
INTERNAL_VSYSCALL_NCS macro needed to be updated to prevent it from
147e83
assuming an integer return type (since the timebase frequency is a 64-bit
147e83
value) by specifying the type of the return type as a macro parameter.  The
147e83
macro then specifically declares the return value as a 'register' (or
147e83
implied pair) of the denoted type.  The compiler is then informed that this
147e83
register (or implied pair) is to be used for the return value.
147e83
(cherry picked from commit 471a1672d4d55124de4db8273829f96cc14d424a)
147e83
---
147e83
 sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c    |  3 ++-
147e83
 sysdeps/unix/sysv/linux/powerpc/init-first.c       |  2 +-
147e83
 sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h | 28 +++++++++++----------
147e83
 sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h | 29 +++++++++++-----------
147e83
 5 files changed, 55 insertions(+), 29 deletions(-)
147e83
147e83
diff --git glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
147e83
index a863a27..021594c 100644
147e83
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
147e83
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
147e83
@@ -41,7 +41,8 @@ __get_clockfreq (void)
147e83
   /* If we can use the vDSO to obtain the timebase even better.  */
147e83
 #ifdef SHARED
147e83
   INTERNAL_SYSCALL_DECL (err);
147e83
-  timebase_freq = INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, 0);
147e83
+  timebase_freq =
147e83
+    INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, hp_timing_t, 0);
147e83
   if (INTERNAL_SYSCALL_ERROR_P (timebase_freq, err)
147e83
       && INTERNAL_SYSCALL_ERRNO (timebase_freq, err) == ENOSYS)
147e83
 #endif
147e83
diff --git glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/init-first.c glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/init-first.c
147e83
index 6bcb7d5..5587e2a 100644
147e83
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/init-first.c
147e83
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/init-first.c
147e83
@@ -41,7 +41,7 @@ _libc_vdso_platform_setup (void)
147e83
 
147e83
   __vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2615);
147e83
 
147e83
-  __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_vdso_get_tbfreq", &linux2615);
147e83
+  __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_get_tbfreq", &linux2615);
147e83
 
147e83
   __vdso_getcpu = _dl_vdso_vsym ("__kernel_getcpu", &linux2615);
147e83
 }
147e83
diff --git glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
147e83
index da25c01..fa4116e 100644
147e83
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
147e83
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
147e83
@@ -60,7 +60,8 @@
147e83
 									      \
147e83
     if (__vdso_##name != NULL)						      \
147e83
       {									      \
147e83
-	sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args);   \
147e83
+	sc_ret =							      \
147e83
+	  INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\
147e83
 	if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
147e83
 	  goto out;							      \
147e83
 	if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS)		      \
147e83
@@ -90,7 +91,8 @@
147e83
 									      \
147e83
     if (__vdso_##name != NULL)						      \
147e83
       {									      \
147e83
-	v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
147e83
+	v_ret =								      \
147e83
+	  INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args);   \
147e83
 	if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err)			      \
147e83
 	    || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS)		      \
147e83
 	  goto out;							      \
147e83
@@ -104,12 +106,12 @@
147e83
   INTERNAL_SYSCALL (name, err, nr, ##args)
147e83
 # endif
147e83
 
147e83
-# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...)	      \
147e83
+# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...)  \
147e83
   ({									      \
147e83
-    long int sc_ret = ENOSYS;						      \
147e83
+    type sc_ret = ENOSYS;						      \
147e83
 									      \
147e83
     if (__vdso_##name != NULL)						      \
147e83
-      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
147e83
+      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args);  \
147e83
     else								      \
147e83
       err = 1 << 28;							      \
147e83
     sc_ret;								      \
147e83
@@ -126,7 +128,7 @@
147e83
    function call, with the exception of LR (which is needed for the
147e83
    "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
147e83
    an error return status).  */
147e83
-# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
147e83
+# define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \
147e83
   ({									      \
147e83
     register void *r0  __asm__ ("r0");					      \
147e83
     register long int r3  __asm__ ("r3");				      \
147e83
@@ -139,18 +141,18 @@
147e83
     register long int r10 __asm__ ("r10");				      \
147e83
     register long int r11 __asm__ ("r11");				      \
147e83
     register long int r12 __asm__ ("r12");				      \
147e83
+    register type rval  __asm__ ("r3");					      \
147e83
     LOADARGS_##nr (funcptr, args);					      \
147e83
     __asm__ __volatile__						      \
147e83
       ("mtctr %0\n\t"							      \
147e83
        "bctrl\n\t"							      \
147e83
        "mfcr %0"							      \
147e83
-       : "=&r" (r0),							      \
147e83
-	 "=&r" (r3), "=&r" (r4), "=&r" (r5),  "=&r" (r6),  "=&r" (r7),	      \
147e83
-	 "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12)	      \
147e83
-       : ASM_INPUT_##nr							      \
147e83
-       : "cr0", "ctr", "lr", "memory");					      \
147e83
+       : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5),  "+r" (r6),  "+r" (r7),  \
147e83
+	 "+r" (r8), "+r" (r9), "+r" (r10), "+r" (r11), "+r" (r12)	      \
147e83
+       : : "cr0", "ctr", "lr", "memory");				      \
147e83
     err = (long int) r0;						      \
147e83
-    (int) r3;								      \
147e83
+    __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3), "r" (r4));	      \
147e83
+    rval;								      \
147e83
   })
147e83
 
147e83
 # undef INLINE_SYSCALL
147e83
@@ -191,7 +193,7 @@
147e83
     register long int r10 __asm__ ("r10");				\
147e83
     register long int r11 __asm__ ("r11");				\
147e83
     register long int r12 __asm__ ("r12");				\
147e83
-    LOADARGS_##nr(name, args);					\
147e83
+    LOADARGS_##nr(name, args);						\
147e83
     __asm__ __volatile__						\
147e83
       ("sc   \n\t"							\
147e83
        "mfcr %0"							\
147e83
diff --git glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
147e83
index 059cf70..b4cdbbb 100644
147e83
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
147e83
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
147e83
@@ -75,7 +75,8 @@
147e83
 									      \
147e83
     if (__vdso_##name != NULL)						      \
147e83
       {									      \
147e83
-	sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args);   \
147e83
+	sc_ret =							      \
147e83
+	  INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\
147e83
 	if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
147e83
 	  goto out;							      \
147e83
 	if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS)		      \
147e83
@@ -105,7 +106,8 @@
147e83
 									      \
147e83
     if (__vdso_##name != NULL)						      \
147e83
       {									      \
147e83
-	v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
147e83
+	v_ret =								      \
147e83
+	  INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args);   \
147e83
 	if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err)			      \
147e83
 	    || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS)		      \
147e83
 	  goto out;							      \
147e83
@@ -121,12 +123,12 @@
147e83
 
147e83
 /* This version is for internal uses when there is no desire
147e83
    to set errno */
147e83
-#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...)	      \
147e83
+#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...)   \
147e83
   ({									      \
147e83
-    long int sc_ret = ENOSYS;						      \
147e83
+    type sc_ret = ENOSYS;						      \
147e83
 									      \
147e83
     if (__vdso_##name != NULL)						      \
147e83
-      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
147e83
+      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args);  \
147e83
     else								      \
147e83
       err = 1 << 28;							      \
147e83
     sc_ret;								      \
147e83
@@ -142,7 +144,7 @@
147e83
    gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set)
147e83
    the negation of the return value in the kernel gets reverted.  */
147e83
 
147e83
-#define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
147e83
+#define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \
147e83
   ({									\
147e83
     register void *r0  __asm__ ("r0");					\
147e83
     register long int r3  __asm__ ("r3");				\
147e83
@@ -151,20 +153,19 @@
147e83
     register long int r6  __asm__ ("r6");				\
147e83
     register long int r7  __asm__ ("r7");				\
147e83
     register long int r8  __asm__ ("r8");				\
147e83
+    register type rval  __asm__ ("r3");				        \
147e83
     LOADARGS_##nr (funcptr, args);					\
147e83
     __asm__ __volatile__						\
147e83
       ("mtctr %0\n\t"							\
147e83
        "bctrl\n\t"							\
147e83
        "mfcr  %0\n\t"							\
147e83
        "0:"								\
147e83
-       : "=&r" (r0),							\
147e83
-         "=&r" (r3), "=&r" (r4), "=&r" (r5),				\
147e83
-         "=&r" (r6), "=&r" (r7), "=&r" (r8)				\
147e83
-       : ASM_INPUT_##nr							\
147e83
-       : "r9", "r10", "r11", "r12",					\
147e83
-         "cr0", "ctr", "lr", "memory");					\
147e83
-	  err = (long int) r0;						\
147e83
-    r3;								\
147e83
+       : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5),  "+r" (r6),        \
147e83
+         "+r" (r7), "+r" (r8)						\
147e83
+       : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory");	\
147e83
+    err = (long int) r0;						\
147e83
+    __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3));		        \
147e83
+    rval;								\
147e83
   })
147e83
 
147e83
 #undef INLINE_SYSCALL
147e83
-- 
147e83
1.7.11.7
147e83