diff options
Diffstat (limited to 'libc/sysdeps/linux/powerpc')
-rw-r--r-- | libc/sysdeps/linux/powerpc/README.bits | 14 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/atomic.h | 252 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/mathinline.h | 76 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/setjmp.h | 7 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/stat.h | 108 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/wordsize.h | 7 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/jmpbuf-offsets.h | 25 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/powerpc32/sysdep.h | 151 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/powerpc64/sysdep.h | 243 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/sys/ucontext.h | 78 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/sysdep.h | 104 |
11 files changed, 102 insertions, 963 deletions
diff --git a/libc/sysdeps/linux/powerpc/README.bits b/libc/sysdeps/linux/powerpc/README.bits deleted file mode 100644 index c0542e5b2..000000000 --- a/libc/sysdeps/linux/powerpc/README.bits +++ /dev/null @@ -1,14 +0,0 @@ - -include/bits is mostly the same as glibc-2.2.4. The glibc-2.2.4 -versions can be accessed with the tag glibc224. - -Major differences: - - - termios.h is from the Linux kernel, not glibc, because glibc has - a very strange legacy conversion layer, which we ignore. - - - syscall.h is deleted; instead, sysnum.h is autogenerated in uClibc - - - syscalls.h is added. - - diff --git a/libc/sysdeps/linux/powerpc/bits/atomic.h b/libc/sysdeps/linux/powerpc/bits/atomic.h index a401206d5..4294fb206 100644 --- a/libc/sysdeps/linux/powerpc/bits/atomic.h +++ b/libc/sysdeps/linux/powerpc/bits/atomic.h @@ -1,247 +1,3 @@ -/* Atomic operations. PowerPC Common version. - Copyright (C) 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <bits/wordsize.h> - -#if __WORDSIZE == 64 -/* Atomic operations. PowerPC64 version. - Copyright (C) 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* The 32-bit exchange_bool is different on powerpc64 because the subf - does signed 64-bit arthmatic while the lwarx is 32-bit unsigned - (a load word and zero (high 32) form) load. - In powerpc64 register values are 64-bit by default, including oldval. - The value in old val unknown sign extension, lwarx loads the 32-bit - value as unsigned. So we explicitly clear the high 32 bits in oldval. */ -# define __arch_compare_and_exchange_bool_32_acq(mem, newval, oldval) \ -({ \ - unsigned int __tmp, __tmp2; \ - __asm__ __volatile__ (" clrldi %1,%1,32\n" \ - "1: lwarx %0,0,%2\n" \ - " subf. %0,%1,%0\n" \ - " bne 2f\n" \ - " stwcx. %4,0,%2\n" \ - " bne- 1b\n" \ - "2: " __ARCH_ACQ_INSTR \ - : "=&r" (__tmp), "=r" (__tmp2) \ - : "b" (mem), "1" (oldval), "r" (newval) \ - : "cr0", "memory"); \ - __tmp != 0; \ -}) - -# define __arch_compare_and_exchange_bool_32_rel(mem, newval, oldval) \ -({ \ - unsigned int __tmp, __tmp2; \ - __asm__ __volatile__ (__ARCH_REL_INSTR "\n" \ - " clrldi %1,%1,32\n" \ - "1: lwarx %0,0,%2\n" \ - " subf. %0,%1,%0\n" \ - " bne 2f\n" \ - " stwcx. %4,0,%2\n" \ - " bne- 1b\n" \ - "2: " \ - : "=&r" (__tmp), "=r" (__tmp2) \ - : "b" (mem), "1" (oldval), "r" (newval) \ - : "cr0", "memory"); \ - __tmp != 0; \ -}) - -/* - * Only powerpc64 processors support Load doubleword and reserve index (ldarx) - * and Store doubleword conditional indexed (stdcx) instructions. So here - * we define the 64-bit forms. - */ -# define __arch_compare_and_exchange_bool_64_acq(mem, newval, oldval) \ -({ \ - unsigned long __tmp; \ - __asm__ __volatile__ ( \ - "1: ldarx %0,0,%1\n" \ - " subf. %0,%2,%0\n" \ - " bne 2f\n" \ - " stdcx. %3,0,%1\n" \ - " bne- 1b\n" \ - "2: " __ARCH_ACQ_INSTR \ - : "=&r" (__tmp) \ - : "b" (mem), "r" (oldval), "r" (newval) \ - : "cr0", "memory"); \ - __tmp != 0; \ -}) - -# define __arch_compare_and_exchange_bool_64_rel(mem, newval, oldval) \ -({ \ - unsigned long __tmp; \ - __asm__ __volatile__ (__ARCH_REL_INSTR "\n" \ - "1: ldarx %0,0,%1\n" \ - " subf. %0,%2,%0\n" \ - " bne 2f\n" \ - " stdcx. %3,0,%1\n" \ - " bne- 1b\n" \ - "2: " \ - : "=&r" (__tmp) \ - : "b" (mem), "r" (oldval), "r" (newval) \ - : "cr0", "memory"); \ - __tmp != 0; \ -}) - -#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ \ - __typeof (*(mem)) __tmp; \ - __typeof (mem) __memp = (mem); \ - __asm__ __volatile__ ( \ - "1: ldarx %0,0,%1\n" \ - " cmpd %0,%2\n" \ - " bne 2f\n" \ - " stdcx. %3,0,%1\n" \ - " bne- 1b\n" \ - "2: " __ARCH_ACQ_INSTR \ - : "=&r" (__tmp) \ - : "b" (__memp), "r" (oldval), "r" (newval) \ - : "cr0", "memory"); \ - __tmp; \ - }) - -#define __arch_compare_and_exchange_val_64_rel(mem, newval, oldval) \ - ({ \ - __typeof (*(mem)) __tmp; \ - __typeof (mem) __memp = (mem); \ - __asm__ __volatile__ (__ARCH_REL_INSTR "\n" \ - "1: ldarx %0,0,%1\n" \ - " cmpd %0,%2\n" \ - " bne 2f\n" \ - " stdcx. %3,0,%1\n" \ - " bne- 1b\n" \ - "2: " \ - : "=&r" (__tmp) \ - : "b" (__memp), "r" (oldval), "r" (newval) \ - : "cr0", "memory"); \ - __tmp; \ - }) - -# define __arch_atomic_exchange_64_acq(mem, value) \ - ({ \ - __typeof (*mem) __val; \ - __asm__ __volatile__ (__ARCH_REL_INSTR "\n" \ - "1: ldarx %0,0,%2\n" \ - " stdcx. %3,0,%2\n" \ - " bne- 1b\n" \ - " " __ARCH_ACQ_INSTR \ - : "=&r" (__val), "=m" (*mem) \ - : "b" (mem), "r" (value), "m" (*mem) \ - : "cr0", "memory"); \ - __val; \ - }) - -# define __arch_atomic_exchange_64_rel(mem, value) \ - ({ \ - __typeof (*mem) __val; \ - __asm__ __volatile__ (__ARCH_REL_INSTR "\n" \ - "1: ldarx %0,0,%2\n" \ - " stdcx. %3,0,%2\n" \ - " bne- 1b" \ - : "=&r" (__val), "=m" (*mem) \ - : "b" (mem), "r" (value), "m" (*mem) \ - : "cr0", "memory"); \ - __val; \ - }) - -# define __arch_atomic_exchange_and_add_64(mem, value) \ - ({ \ - __typeof (*mem) __val, __tmp; \ - __asm__ __volatile__ ("1: ldarx %0,0,%3\n" \ - " add %1,%0,%4\n" \ - " stdcx. %1,0,%3\n" \ - " bne- 1b" \ - : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \ - : "b" (mem), "r" (value), "m" (*mem) \ - : "cr0", "memory"); \ - __val; \ - }) - -# define __arch_atomic_increment_val_64(mem) \ - ({ \ - __typeof (*(mem)) __val; \ - __asm__ __volatile__ ("1: ldarx %0,0,%2\n" \ - " addi %0,%0,1\n" \ - " stdcx. %0,0,%2\n" \ - " bne- 1b" \ - : "=&b" (__val), "=m" (*mem) \ - : "b" (mem), "m" (*mem) \ - : "cr0", "memory"); \ - __val; \ - }) - -# define __arch_atomic_decrement_val_64(mem) \ - ({ \ - __typeof (*(mem)) __val; \ - __asm__ __volatile__ ("1: ldarx %0,0,%2\n" \ - " subi %0,%0,1\n" \ - " stdcx. %0,0,%2\n" \ - " bne- 1b" \ - : "=&b" (__val), "=m" (*mem) \ - : "b" (mem), "m" (*mem) \ - : "cr0", "memory"); \ - __val; \ - }) - -# define __arch_atomic_decrement_if_positive_64(mem) \ - ({ int __val, __tmp; \ - __asm__ __volatile__ ("1: ldarx %0,0,%3\n" \ - " cmpdi 0,%0,0\n" \ - " addi %1,%0,-1\n" \ - " ble 2f\n" \ - " stdcx. %1,0,%3\n" \ - " bne- 1b\n" \ - "2: " __ARCH_ACQ_INSTR \ - : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \ - : "b" (mem), "m" (*mem) \ - : "cr0", "memory"); \ - __val; \ - }) - -/* - * All powerpc64 processors support the new "light weight" sync (lwsync). - */ -# define atomic_read_barrier() __asm__ ("lwsync" ::: "memory") -/* - * "light weight" sync can also be used for the release barrier. - */ -# ifndef UP -# define __ARCH_REL_INSTR "lwsync" -# endif - -#else /* Atomic operations. PowerPC32 version. Copyright (C) 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -261,12 +17,6 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -/* - * The 32-bit exchange_bool is different on powerpc64 because the subf - * does signed 64-bit arthmatic while the lwarx is 32-bit unsigned - * (a load word and zero (high 32) form). So powerpc64 has a slightly - * different version in sysdeps/powerpc/powerpc64/bits/atomic.h. - */ # define __arch_compare_and_exchange_bool_32_acq(mem, newval, oldval) \ ({ \ unsigned int __tmp; \ @@ -355,8 +105,6 @@ # define atomic_read_barrier() __asm__ ("sync" ::: "memory") #endif -#endif - #include <stdint.h> typedef int32_t atomic32_t; diff --git a/libc/sysdeps/linux/powerpc/bits/mathinline.h b/libc/sysdeps/linux/powerpc/bits/mathinline.h index 206ca977e..f98d4d60b 100644 --- a/libc/sysdeps/linux/powerpc/bits/mathinline.h +++ b/libc/sysdeps/linux/powerpc/bits/mathinline.h @@ -57,30 +57,12 @@ # endif /* __GNUC_PREREQ (2,97) */ -/* The gcc, version 2.7 or below, has problems with all this inlining - code. So disable it for this version of the compiler. */ -# if __GNUC_PREREQ (2, 8) -/* Test for negative number. Used in the signbit() macro. */ -__MATH_INLINE int -__NTH (__signbitf (float __x)) -{ - __extension__ union { float __f; int __i; } __u = { __f: __x }; - return __u.__i < 0; -} -__MATH_INLINE int -__NTH (__signbit (double __x)) -{ - __extension__ union { double __d; int __i[2]; } __u = { __d: __x }; - return __u.__i[0] < 0; -} -# endif #endif /* __USE_ISOC99 */ #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ #ifdef __USE_ISOC99 -# ifndef __powerpc64__ __MATH_INLINE long int lrint (double __x) __THROW; __MATH_INLINE long int __NTH (lrint (double __x)) @@ -104,7 +86,6 @@ __NTH (lrintf (float __x)) __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x)); return __u.__ll[1]; } -# endif __MATH_INLINE double fdim (double __x, double __y) __THROW; __MATH_INLINE double @@ -123,62 +104,5 @@ __NTH (fdimf (float __x, float __y)) #endif /* __USE_ISOC99 */ #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ -/* This code is used internally in the GNU libc. */ -#if 0 /*def __LIBC_INTERNAL_MATH_INLINES*/ - -#include <sysdep.h> -#include <ldsodefs.h> -#include <dl-procinfo.h> - -# if __WORDSIZE == 64 || defined _ARCH_PWR4 -# define __CPU_HAS_FSQRT 1 -# else -# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0) -# endif - -extern double __slow_ieee754_sqrt (double); -__MATH_INLINE double -__NTH (__ieee754_sqrt (double __x)) -{ - double __z; - - /* If the CPU is 64-bit we can use the optional FP instructions. */ - if (__CPU_HAS_FSQRT) - { - /* Volatile is required to prevent the compiler from moving the - fsqrt instruction above the branch. */ - __asm__ __volatile__ ( - " fsqrt %0,%1\n" - : "=f" (__z) - : "f" (__x)); - } - else - __z = __slow_ieee754_sqrt(__x); - - return __z; -} - -extern float __slow_ieee754_sqrtf (float); -__MATH_INLINE float -__NTH (__ieee754_sqrtf (float __x)) -{ - float __z; - - /* If the CPU is 64-bit we can use the optional FP instructions. */ - if (__CPU_HAS_FSQRT) - { - /* Volatile is required to prevent the compiler from moving the - fsqrts instruction above the branch. */ - __asm__ __volatile__ ( - " fsqrts %0,%1\n" - : "=f" (__z) - : "f" (__x)); - } - else - __z = __slow_ieee754_sqrtf(__x); - - return __z; -} -#endif /* __LIBC_INTERNAL_MATH_INLINES */ #endif /* __GNUC__ && !_SOFT_FLOAT */ diff --git a/libc/sysdeps/linux/powerpc/bits/setjmp.h b/libc/sysdeps/linux/powerpc/bits/setjmp.h index 46e8bf7d1..1cc1d836e 100644 --- a/libc/sysdeps/linux/powerpc/bits/setjmp.h +++ b/libc/sysdeps/linux/powerpc/bits/setjmp.h @@ -29,8 +29,6 @@ assembler easier. Naturally, user code should not depend on either representation. */ -#include <bits/wordsize.h> - /* The current powerpc 32-bit Altivec ABI specifies for SVR4 ABI and EABI the vrsave must be at byte 248 & v20 at byte 256. So we must pad this correctly on 32 bit. It also insists that vecregs are only gauranteed @@ -38,12 +36,9 @@ We have to version the code because members like int __mask_was_saved in the jmp_buf will move as jmp_buf is now larger than 248 bytes. We cannot keep the altivec jmp_buf backward compatible with the jmp_buf. */ -#if __WORDSIZE == 64 -typedef long int __jmp_buf[64] __attribute__ ((__aligned__ (16))); -#else + /* The alignment is not essential, i.e.the buffer can be copied to a 4 byte aligned buffer as per the ABI it is just added for performance reasons. */ typedef long int __jmp_buf[64 + (12 * 4)] __attribute__ ((__aligned__ (16))); -#endif #endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/powerpc/bits/stat.h b/libc/sysdeps/linux/powerpc/bits/stat.h index 10fa2cbf7..a90043f8a 100644 --- a/libc/sysdeps/linux/powerpc/bits/stat.h +++ b/libc/sysdeps/linux/powerpc/bits/stat.h @@ -20,27 +20,18 @@ # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." #endif -#include <bits/wordsize.h> - /* Versions of the `struct stat' data structure. */ #define _STAT_VER_LINUX_OLD 1 #define _STAT_VER_KERNEL 1 #define _STAT_VER_SVR4 2 #define _STAT_VER_LINUX 3 -#if __WORDSIZE == 32 -# define _STAT_VER _STAT_VER_LINUX -#else -# define _STAT_VER _STAT_VER_KERNEL -#endif +#define _STAT_VER _STAT_VER_LINUX /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 1 #define _MKNOD_VER_SVR4 2 #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - -#if __WORDSIZE == 32 - struct stat { __dev_t st_dev; /* Device. */ @@ -134,103 +125,6 @@ struct stat64 }; # endif /* __USE_LARGEFILE64 */ -#else /* __WORDSIZE == 32 */ - -struct stat - { - __dev_t st_dev; /* Device. */ -# ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -# else - __ino64_t st_ino; /* File serial number. */ -# endif - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - int __pad2; - __dev_t st_rdev; /* Device number, if device. */ -# ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -# else - __off64_t st_size; /* Size of file, in bytes. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -# ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -# else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# endif -#ifdef __USE_MISC - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the <sys/stat.h> header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - unsigned long int __unused4; - unsigned long int __unused5; - unsigned long int __unused6; - }; - -# ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - int __pad2; - __dev_t st_rdev; /* Device number, if device. */ - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#ifdef __USE_MISC - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the <sys/stat.h> header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - unsigned long int __unused4; - unsigned long int __unused5; - unsigned long int __unused6; - }; -# endif /* __USE_LARGEFILE64 */ -#endif - - /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV diff --git a/libc/sysdeps/linux/powerpc/bits/wordsize.h b/libc/sysdeps/linux/powerpc/bits/wordsize.h index 3e8a1e0a1..0c0d31b98 100644 --- a/libc/sysdeps/linux/powerpc/bits/wordsize.h +++ b/libc/sysdeps/linux/powerpc/bits/wordsize.h @@ -1,11 +1,6 @@ /* Determine the wordsize from the preprocessor defines. */ -#if defined __powerpc64__ -# define __WORDSIZE 64 -# define __WORDSIZE_TIME64_COMPAT32 1 -#else -# define __WORDSIZE 32 -#endif +#define __WORDSIZE 32 #if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL diff --git a/libc/sysdeps/linux/powerpc/jmpbuf-offsets.h b/libc/sysdeps/linux/powerpc/jmpbuf-offsets.h index eb7d7fd17..5639ac5ed 100644 --- a/libc/sysdeps/linux/powerpc/jmpbuf-offsets.h +++ b/libc/sysdeps/linux/powerpc/jmpbuf-offsets.h @@ -16,25 +16,12 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <bits/wordsize.h> - #define JB_GPR1 0 /* Also known as the stack pointer */ #define JB_GPR2 1 #define JB_LR 2 /* The address we will return to */ -#if __WORDSIZE == 64 -# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18*2 words total. */ -# define JB_CR 21 /* Condition code registers with the VRSAVE at */ - /* offset 172 (low half of the double word. */ -# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */ -# define JB_SIZE (64 * 8) /* As per PPC64-VMX ABI. */ -# define JB_VRSAVE 21 /* VRSAVE shares a double word with the CR at offset */ - /* 168 (high half of the double word). */ -# define JB_VRS 40 /* VRs 20 through 31 are saved, 12*4 words total. */ -#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 ((64 + (12 * 4)) * 4) -# define JB_VRSAVE 62 -# define JB_VRS 64 -#endif +#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 ((64 + (12 * 4)) * 4) +#define JB_VRSAVE 62 +#define JB_VRS 64 diff --git a/libc/sysdeps/linux/powerpc/powerpc32/sysdep.h b/libc/sysdeps/linux/powerpc/powerpc32/sysdep.h deleted file mode 100644 index 9459e7919..000000000 --- a/libc/sysdeps/linux/powerpc/powerpc32/sysdep.h +++ /dev/null @@ -1,151 +0,0 @@ -/* Assembly macros for 32-bit PowerPC. - Copyright (C) 1999, 2001, 2002, 2003, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifdef __ASSEMBLER__ - -#ifdef __ELF__ - -/* If compiled for profiling, call `_mcount' at the start of each - function. */ -#ifdef PROF -/* The mcount code relies on a the return address being on the stack - to locate our caller and so it can restore it; so store one just - for its benefit. */ -# define CALL_MCOUNT \ - mflr r0; \ - stw r0,4(r1); \ - cfi_offset (lr, 4); \ - bl JUMPTARGET(_mcount); -#else /* PROF */ -# define CALL_MCOUNT /* Do nothing. */ -#endif /* PROF */ - -#define ENTRY(name) \ - .globl C_SYMBOL_NAME(name); \ - ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ - .align ALIGNARG(2); \ - C_LABEL(name) \ - cfi_startproc; \ - CALL_MCOUNT - -#define EALIGN_W_0 /* No words to insert. */ -#define EALIGN_W_1 nop -#define EALIGN_W_2 nop;nop -#define EALIGN_W_3 nop;nop;nop -#define EALIGN_W_4 EALIGN_W_3;nop -#define EALIGN_W_5 EALIGN_W_4;nop -#define EALIGN_W_6 EALIGN_W_5;nop -#define EALIGN_W_7 EALIGN_W_6;nop - -/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes - past a 2^align boundary. */ -#ifdef PROF -# define EALIGN(name, alignt, words) \ - .globl C_SYMBOL_NAME(name); \ - ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ - .align ALIGNARG(2); \ - C_LABEL(name) \ - cfi_startproc; \ - CALL_MCOUNT \ - b 0f; \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ - 0: -#else /* PROF */ -# define EALIGN(name, alignt, words) \ - .globl C_SYMBOL_NAME(name); \ - ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ - C_LABEL(name) \ - cfi_startproc; -#endif - -#undef END -#define END(name) \ - cfi_endproc; \ - ASM_SIZE_DIRECTIVE(name) - -#define DO_CALL(syscall) \ - li 0,syscall; \ - sc - -#undef JUMPTARGET -#ifdef PIC -# define JUMPTARGET(name) name##@plt -#else -# define JUMPTARGET(name) name -#endif - -#if defined SHARED && defined DO_VERSIONING && defined PIC \ - && !defined NO_HIDDEN -# undef HIDDEN_JUMPTARGET -# define HIDDEN_JUMPTARGET(name) __GI_##name##@local -#endif - -#define PSEUDO(name, syscall_name, args) \ - .section ".text"; \ - ENTRY (name) \ - DO_CALL (SYS_ify (syscall_name)); - -#define PSEUDO_RET \ - bnslr+; \ - b __syscall_error@local -#define ret PSEUDO_RET - -#undef PSEUDO_END -#define PSEUDO_END(name) \ - END (name) - -#define PSEUDO_NOERRNO(name, syscall_name, args) \ - .section ".text"; \ - ENTRY (name) \ - DO_CALL (SYS_ify (syscall_name)); - -#define PSEUDO_RET_NOERRNO \ - blr -#define ret_NOERRNO PSEUDO_RET_NOERRNO - -#undef PSEUDO_END_NOERRNO -#define PSEUDO_END_NOERRNO(name) \ - END (name) - -#define PSEUDO_ERRVAL(name, syscall_name, args) \ - .section ".text"; \ - ENTRY (name) \ - DO_CALL (SYS_ify (syscall_name)); - -#define PSEUDO_RET_ERRVAL \ - blr -#undef ret_ERRVAL -#define ret_ERRVAL PSEUDO_RET_ERRVAL - -#undef PSEUDO_END_ERRVAL -#define PSEUDO_END_ERRVAL(name) \ - END (name) - -/* Local labels stripped out by the linker. */ -#undef L -#define L(x) .L##x - -/* Label in text section. */ -#define C_TEXT(name) name - -#endif /* __ELF__ */ - -#endif /* __ASSEMBLER__ */ diff --git a/libc/sysdeps/linux/powerpc/powerpc64/sysdep.h b/libc/sysdeps/linux/powerpc/powerpc64/sysdep.h deleted file mode 100644 index 5a194af58..000000000 --- a/libc/sysdeps/linux/powerpc/powerpc64/sysdep.h +++ /dev/null @@ -1,243 +0,0 @@ -/* Assembly macros for 64-bit PowerPC. - Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifdef __ELF__ - -#ifdef __ASSEMBLER__ - -/* Support macros for CALL_MCOUNT. */ - .macro SAVE_ARG NARG - .if \NARG - SAVE_ARG \NARG-1 - std 2+\NARG,-72+8*(\NARG)(1) - .endif - .endm - - .macro REST_ARG NARG - .if \NARG - REST_ARG \NARG-1 - ld 2+\NARG,40+8*(\NARG)(1) - .endif - .endm - -/* If compiled for profiling, call `_mcount' at the start of each function. - see ppc-mcount.S for more details. */ - .macro CALL_MCOUNT NARG -#ifdef PROF - mflr r0 - SAVE_ARG \NARG - std r0,16(r1) - stdu r1,-112(r1) - bl JUMPTARGET (_mcount) - ld r0,128(r1) - REST_ARG \NARG - addi r1,r1,112 - mtlr r0 -#endif - .endm - -#ifdef USE_PPC64_OVERLAPPING_OPD -# define OPD_ENT(name) .quad BODY_LABEL (name), .TOC.@tocbase -#else -# define OPD_ENT(name) .quad BODY_LABEL (name), .TOC.@tocbase, 0 -#endif - -#define ENTRY_1(name) \ - .section ".text"; \ - .type BODY_LABEL(name),@function; \ - .globl name; \ - .section ".opd","aw"; \ - .align 3; \ -name##: OPD_ENT (name); \ - .previous; - -# define DOT_LABEL(X) X -# define BODY_LABEL(X) .LY##X -# define ENTRY_2(name) \ - .type name,@function; \ - ENTRY_1(name) -# define END_2(name) \ - .size name,.-BODY_LABEL(name); \ - .size BODY_LABEL(name),.-BODY_LABEL(name); - -#define ENTRY(name) \ - ENTRY_2(name) \ - .align ALIGNARG(2); \ -BODY_LABEL(name): \ - cfi_startproc; - -#define EALIGN_W_0 /* No words to insert. */ -#define EALIGN_W_1 nop -#define EALIGN_W_2 nop;nop -#define EALIGN_W_3 nop;nop;nop -#define EALIGN_W_4 EALIGN_W_3;nop -#define EALIGN_W_5 EALIGN_W_4;nop -#define EALIGN_W_6 EALIGN_W_5;nop -#define EALIGN_W_7 EALIGN_W_6;nop - -/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes - past a 2^alignt boundary. */ -#define EALIGN(name, alignt, words) \ - ENTRY_2(name) \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ -BODY_LABEL(name): \ - cfi_startproc; - -/* Local labels stripped out by the linker. */ -#undef L -#define L(x) .L##x - -#define tostring(s) #s -#define stringify(s) tostring(s) -#define XGLUE(a,b) a##b -#define GLUE(a,b) XGLUE(a,b) -#define LT_LABEL(name) GLUE(.LT,name) -#define LT_LABELSUFFIX(name,suffix) GLUE(GLUE(.LT,name),suffix) - -/* Support Traceback tables */ -#define TB_ASM 0x000c000000000000 -#define TB_GLOBALLINK 0x0000800000000000 -#define TB_IS_EPROL 0x0000400000000000 -#define TB_HAS_TBOFF 0x0000200000000000 -#define TB_INT_PROC 0x0000100000000000 -#define TB_HAS_CTL 0x0000080000000000 -#define TB_TOCLESS 0x0000040000000000 -#define TB_FP_PRESENT 0x0000020000000000 -#define TB_LOG_ABORT 0x0000010000000000 -#define TB_INT_HANDL 0x0000008000000000 -#define TB_NAME_PRESENT 0x0000004000000000 -#define TB_USES_ALLOCA 0x0000002000000000 -#define TB_SAVES_CR 0x0000000200000000 -#define TB_SAVES_LR 0x0000000100000000 -#define TB_STORES_BC 0x0000000080000000 -#define TB_FIXUP 0x0000000040000000 -#define TB_FP_SAVED(fprs) (((fprs) & 0x3f) << 24) -#define TB_GPR_SAVED(gprs) (((fprs) & 0x3f) << 16) -#define TB_FIXEDPARMS(parms) (((parms) & 0xff) << 8) -#define TB_FLOATPARMS(parms) (((parms) & 0x7f) << 1) -#define TB_PARMSONSTK 0x0000000000000001 - -#define PPC_HIGHER(v) (((v) >> 32) & 0xffff) -#define TB_DEFAULT TB_ASM | TB_HAS_TBOFF | TB_NAME_PRESENT - -#define TRACEBACK(name) \ -LT_LABEL(name): ; \ - .long 0 ; \ - .quad TB_DEFAULT ; \ - .long LT_LABEL(name)-BODY_LABEL(name) ; \ - .short LT_LABELSUFFIX(name,_name_end)-LT_LABELSUFFIX(name,_name_start) ; \ -LT_LABELSUFFIX(name,_name_start): ;\ - .ascii stringify(name) ; \ -LT_LABELSUFFIX(name,_name_end): ; \ - .align 2 ; - -#define TRACEBACK_MASK(name,mask) \ -LT_LABEL(name): ; \ - .long 0 ; \ - .quad TB_DEFAULT | mask ; \ - .long LT_LABEL(name)-BODY_LABEL(name) ; \ - .short LT_LABELSUFFIX(name,_name_end)-LT_LABELSUFFIX(name,_name_start) ; \ -LT_LABELSUFFIX(name,_name_start): ;\ - .ascii stringify(name) ; \ -LT_LABELSUFFIX(name,_name_end): ; \ - .align 2 ; - -/* END generates Traceback tables */ -#undef END -#define END(name) \ - cfi_endproc; \ - TRACEBACK(name) \ - END_2(name) - -/* This form supports more informative traceback tables */ -#define END_GEN_TB(name,mask) \ - cfi_endproc; \ - TRACEBACK_MASK(name,mask) \ - END_2(name) - -#define DO_CALL(syscall) \ - li 0,syscall; \ - sc - -/* ppc64 is always PIC */ -#undef JUMPTARGET -#define JUMPTARGET(name) DOT_LABEL(name) - -#define PSEUDO(name, syscall_name, args) \ - .section ".text"; \ - ENTRY (name) \ - DO_CALL (SYS_ify (syscall_name)); - -#define PSEUDO_RET \ - bnslr+; \ - b JUMPTARGET(__syscall_error) - -#define ret PSEUDO_RET - -#undef PSEUDO_END -#define PSEUDO_END(name) \ - END (name) - -#define PSEUDO_NOERRNO(name, syscall_name, args) \ - .section ".text"; \ - ENTRY (name) \ - DO_CALL (SYS_ify (syscall_name)); - -#define PSEUDO_RET_NOERRNO \ - blr - -#define ret_NOERRNO PSEUDO_RET_NOERRNO - -#undef PSEUDO_END_NOERRNO -#define PSEUDO_END_NOERRNO(name) \ - END (name) - -#define PSEUDO_ERRVAL(name, syscall_name, args) \ - .section ".text"; \ - ENTRY (name) \ - DO_CALL (SYS_ify (syscall_name)); - -#define PSEUDO_RET_ERRVAL \ - blr - -#undef ret_ERRVAL -#define ret_ERRVAL PSEUDO_RET_ERRVAL - -#undef PSEUDO_END_ERRVAL -#define PSEUDO_END_ERRVAL(name) \ - END (name) - -#else /* !__ASSEMBLER__ */ - -#ifdef USE_PPC64_OVERLAPPING_OPD -# define OPD_ENT(name) ".quad " BODY_PREFIX #name ", .TOC.@tocbase;" -#else -# define OPD_ENT(name) ".quad " BODY_PREFIX #name ", .TOC.@tocbase, 0;" -#endif - -# define DOT_PREFIX "" -# define BODY_PREFIX ".LY" -# define ENTRY_2(name) ".type " #name ",@function;" -# define END_2(name) \ - ".size " #name ",.-" BODY_PREFIX #name ";\n" \ - ".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";" - -#endif /* __ASSEMBLER__ */ - -#endif /* __ELF__ */ diff --git a/libc/sysdeps/linux/powerpc/sys/ucontext.h b/libc/sysdeps/linux/powerpc/sys/ucontext.h index 72fbae4f2..fa3cbb68d 100644 --- a/libc/sysdeps/linux/powerpc/sys/ucontext.h +++ b/libc/sysdeps/linux/powerpc/sys/ucontext.h @@ -25,8 +25,6 @@ included in <signal.h>. */ #include <bits/sigcontext.h> -#if __WORDSIZE == 32 - /* Number of general registers. */ # define NGREG 48 @@ -59,84 +57,12 @@ typedef struct vrregset_t vrregs __attribute__((__aligned__(16))); } mcontext_t; -#else - -/* For 64-bit kernels with Altivec support, a machine context is exactly - * a sigcontext. For older kernel (without Altivec) the sigcontext matches - * the mcontext upto but not including the v_regs field. For kernels that - * don't AT_HWCAP or return AT_HWCAP without PPC_FEATURE_HAS_ALTIVEC the - * v_regs field may not exit and should not be referenced. The v_regd field - * can be refernced safely only after verifying that PPC_FEATURE_HAS_ALTIVEC - * is set in AT_HWCAP. */ - -/* Number of general registers. */ -# define NGREG 48 /* includes r0-r31, nip, msr, lr, etc. */ -# define NFPREG 33 /* includes fp0-fp31 &fpscr. */ -# define NVRREG 34 /* includes v0-v31, vscr, & vrsave in split vectors */ - -typedef unsigned long gregset_t[NGREG]; -typedef double fpregset_t[NFPREG]; - -/* Container for Altivec/VMX Vector Status and Control Register. Only 32-bits - but can only be copied to/from a 128-bit vector register. So we allocated - a whole quadword speedup save/restore. */ -typedef struct _libc_vscr -{ - unsigned int __pad[3]; - unsigned int vscr_word; -} vscr_t; - -/* Container for Altivec/VMX registers and status. - Must to be aligned on a 16-byte boundary. */ -typedef struct _libc_vrstate -{ - unsigned int vrregs[32][4]; - vscr_t vscr; - unsigned int vrsave; - unsigned int __pad[3]; -} vrregset_t __attribute__((__aligned__(16))); - -typedef struct { - unsigned long __unused[4]; - int signal; - int __pad0; - unsigned long handler; - unsigned long oldmask; - struct pt_regs *regs; - gregset_t gp_regs; - fpregset_t fp_regs; -/* - * To maintain compatibility with current implementations the sigcontext is - * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t) - * followed by an unstructured (vmx_reserve) field of 69 doublewords. This - * allows the array of vector registers to be quadword aligned independent of - * the alignment of the containing sigcontext or ucontext. It is the - * responsibility of the code setting the sigcontext to set this pointer to - * either NULL (if this processor does not support the VMX feature) or the - * address of the first quadword within the allocated (vmx_reserve) area. - * - * The pointer (v_regs) of vector type (elf_vrreg_t) is essentually - * an array of 34 quadword entries. The entries with - * indexes 0-31 contain the corresponding vector registers. The entry with - * index 32 contains the vscr as the last word (offset 12) within the - * quadword. This allows the vscr to be stored as either a quadword (since - * it must be copied via a vector register to/from storage) or as a word. - * The entry with index 33 contains the vrsave as the first word (offset 0) - * within the quadword. - */ - vrregset_t *v_regs; - long vmx_reserve[NVRREG+NVRREG+1]; -} mcontext_t; - -#endif - /* Userlevel context. */ typedef struct ucontext { unsigned long int uc_flags; struct ucontext *uc_link; stack_t uc_stack; -#if __WORDSIZE == 32 /* * These fields are set up this way to maximize source and * binary compatibility with code written for the old @@ -167,10 +93,6 @@ typedef struct ucontext } uc_mcontext; sigset_t uc_sigmask; char uc_reg_space[sizeof(mcontext_t) + 12]; /* last for extensibility */ -#else /* 64-bit */ - sigset_t uc_sigmask; - mcontext_t uc_mcontext; /* last for extensibility */ -#endif } ucontext_t; #endif /* sys/ucontext.h */ diff --git a/libc/sysdeps/linux/powerpc/sysdep.h b/libc/sysdeps/linux/powerpc/sysdep.h index 9a57062dc..c512c5ab5 100644 --- a/libc/sysdeps/linux/powerpc/sysdep.h +++ b/libc/sysdeps/linux/powerpc/sysdep.h @@ -16,6 +16,7 @@ <http://www.gnu.org/licenses/>. */ #include <common/sysdep.h> +#include <sys/syscall.h> /* * Powerpc Feature masks for the Aux Vector Hardware Capabilities (AT_HWCAP). @@ -169,9 +170,6 @@ #define VRSAVE 256 - -#ifdef __ELF__ - /* This seems to always be the case on PPC. */ #define ALIGNARG(log2) log2 /* For ELF we need the `.type' directive to make shared libs work right. */ @@ -182,14 +180,98 @@ #undef NO_UNDERSCORES #define NO_UNDERSCORES -#endif /* __ELF__ */ +#define ENTRY(name) \ + .globl C_SYMBOL_NAME(name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ + .align ALIGNARG(2); \ + C_LABEL(name) \ + cfi_startproc; \ -# include <sys/syscall.h> -# if defined(__powerpc64__) -# include "powerpc64/sysdep.h" -# else -# include "powerpc32/sysdep.h" -# endif +#define EALIGN_W_0 /* No words to insert. */ +#define EALIGN_W_1 nop +#define EALIGN_W_2 nop;nop +#define EALIGN_W_3 nop;nop;nop +#define EALIGN_W_4 EALIGN_W_3;nop +#define EALIGN_W_5 EALIGN_W_4;nop +#define EALIGN_W_6 EALIGN_W_5;nop +#define EALIGN_W_7 EALIGN_W_6;nop -#endif /* __ASSEMBLER__ */ +#define EALIGN(name, alignt, words) \ + .globl C_SYMBOL_NAME(name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + C_LABEL(name) \ + cfi_startproc; + +#undef END +#define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(name) + +#define DO_CALL(syscall) \ + li 0,syscall; \ + sc + +#undef JUMPTARGET +#ifdef PIC +# define JUMPTARGET(name) name##@plt +#else +# define JUMPTARGET(name) name +#endif + +#if defined SHARED && defined DO_VERSIONING && defined PIC \ + && !defined NO_HIDDEN +# undef HIDDEN_JUMPTARGET +# define HIDDEN_JUMPTARGET(name) __GI_##name##@local +#endif + +#define PSEUDO(name, syscall_name, args) \ + .section ".text"; \ + ENTRY (name) \ + DO_CALL (SYS_ify (syscall_name)); + +#define PSEUDO_RET \ + bnslr+; \ + b __syscall_error@local +#define ret PSEUDO_RET + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + END (name) +#define PSEUDO_NOERRNO(name, syscall_name, args) \ + .section ".text"; \ + ENTRY (name) \ + DO_CALL (SYS_ify (syscall_name)); + +#define PSEUDO_RET_NOERRNO \ + blr +#define ret_NOERRNO PSEUDO_RET_NOERRNO + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO(name) \ + END (name) + +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + .section ".text"; \ + ENTRY (name) \ + DO_CALL (SYS_ify (syscall_name)); + +#define PSEUDO_RET_ERRVAL \ + blr +#undef ret_ERRVAL +#define ret_ERRVAL PSEUDO_RET_ERRVAL + +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(name) \ + END (name) + +/* Local labels stripped out by the linker. */ +#undef L +#define L(x) .L##x + +/* Label in text section. */ +#define C_TEXT(name) name + +#endif /* __ASSEMBLER__ */ |