This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] ppc64 changes to common powerpc headers
- From: Steve Munroe <sjmunroe at vnet dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com
- Cc: aj at suse dot de, geoffk at geoffk dot org, roland at frob dot com
- Date: Fri, 20 Sep 2002 11:42:38 -0500
- Subject: [PATCH] ppc64 changes to common powerpc headers
Some small changes in headers common to powerpc32/powerpc64.
2002-07-29 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/bits/setjmp.h [__WORDSIZE]: Add 64-bit jmpbuf.
* sysdeps/powerpc/bits/wordsize.h: New file.
* sysdeps/powerpc/fpu/bits/mathinline.h <__ll[2]>: Change long to int
array in union for 32-/64-bit compatibility.
* sysdeps/powerpc/fpu_control.h (_FPU_GETCW): Make union volitile
to convince gcc to load int value for storage.
>>>>>>> ppc64-powerpc-bits.patch
diff -rupPN libc23-cvstip-20020918/sysdeps/powerpc/bits/setjmp.h libc23/sysdeps/powerpc/bits/setjmp.h
--- libc23-cvstip-20020918/sysdeps/powerpc/bits/setjmp.h Thu Jul 5 23:56:01 2001
+++ libc23/sysdeps/powerpc/bits/setjmp.h Fri Sep 20 11:30:18 2002
@@ -31,14 +31,25 @@
# define JB_GPR1 0 /* Also known as the stack pointer */
# define JB_GPR2 1
# define JB_LR 2 /* The address we will return to */
-# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */
-# define JB_CR 21 /* Condition code registers. */
-# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */
-# define JB_SIZE (58*4)
+# if __WORDSIZE == 64
+# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18*2 words total. */
+# define JB_CR 21 /* Condition code registers. */
+# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */
+# define JB_SIZE (40*8)
+# else
+# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total. */
+# define JB_CR 21 /* Condition code registers. */
+# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */
+# define JB_SIZE (58*4)
+# endif
#endif
#ifndef _ASM
+# if __WORDSIZE == 64
+typedef long int __jmp_buf[40];
+# else
typedef long int __jmp_buf[58];
+# endif
#endif
/* Test if longjmp to JMPBUF would unwind the frame
diff -rupPN libc23-cvstip-20020918/sysdeps/powerpc/bits/wordsize.h libc23/sysdeps/powerpc/bits/wordsize.h
--- libc23-cvstip-20020918/sysdeps/powerpc/bits/wordsize.h Wed Dec 31 18:00:00 1969
+++ libc23/sysdeps/powerpc/bits/wordsize.h Wed Sep 18 19:43:52 2002
@@ -0,0 +1,7 @@
+/* Determine the wordsize from the preprocessor defines. */
+
+#if defined __powerpc64__
+# define __WORDSIZE 64
+#else
+# define __WORDSIZE 32
+#endif
diff -rupPN libc23-cvstip-20020918/sysdeps/powerpc/fpu/bits/mathinline.h libc23/sysdeps/powerpc/fpu/bits/mathinline.h
--- libc23-cvstip-20020918/sysdeps/powerpc/fpu/bits/mathinline.h Thu Jul 5 23:56:02 2001
+++ libc23/sysdeps/powerpc/fpu/bits/mathinline.h Wed Sep 18 19:43:52 2002
@@ -63,8 +63,8 @@ __MATH_INLINE long int
lrint (double __x) __THROW
{
union {
- double __d;
- long int __ll[2];
+ double __d;
+ int __ll[2];
} __u;
__asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
return __u.__ll[1];
@@ -76,7 +76,7 @@ lrintf (float __x) __THROW
{
union {
double __d;
- long int __ll[2];
+ int __ll[2];
} __u;
__asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
return __u.__ll[1];
diff -rupPN libc23-cvstip-20020918/sysdeps/powerpc/fpu/fpu_control.h libc23/sysdeps/powerpc/fpu/fpu_control.h
--- libc23-cvstip-20020918/sysdeps/powerpc/fpu/fpu_control.h Wed Dec 5 18:12:11 2001
+++ libc23/sysdeps/powerpc/fpu/fpu_control.h Fri Sep 20 11:36:49 2002
@@ -50,7 +50,8 @@ typedef unsigned int fpu_control_t __att
/* Macros for accessing the hardware control word. */
#define _FPU_GETCW(cw) ( { \
- union { double d; fpu_control_t cw[2]; } tmp __attribute__ ((__aligned__(8))); \
+ volatile union { double d; fpu_control_t cw[2]; } \
+ tmp __attribute__ ((__aligned__(8))); \
__asm__ ("mffs 0; stfd%U0 0,%0" : "=m" (tmp.d) : : "fr0"); \
(cw)=tmp.cw[1]; \
tmp.cw[1]; } )
<<<<<<< ppc64-powerpc-bits.patch