summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2007-02-12 21:57:57 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2007-02-12 21:57:57 +0000
commitdcf241189ab7eb060aeb06caad8b14aa964f6736 (patch)
tree735c06c0036aed160a35e9c0e2870e87fe5730e5 /libc/sysdeps
parent216bfd092c46dc0479e571a37fd2fd96e47605b5 (diff)
Rehash the PowerPC e500 port to avoid creating symlinks
in the powerpc arch code and make more code common with classic PowerPC. From Steve Papacharalambous Lets hope I didn't break something.
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/Makefile.commonarch5
-rw-r--r--libc/sysdeps/linux/powerpc/Makefile.arch31
-rw-r--r--libc/sysdeps/linux/powerpc/__longjmp.S94
-rw-r--r--libc/sysdeps/linux/powerpc/bits/classic/fenv.h145
-rw-r--r--libc/sysdeps/linux/powerpc/bits/e500/fenv.h79
-rw-r--r--libc/sysdeps/linux/powerpc/bits/e500/fenvinline.h2
-rw-r--r--libc/sysdeps/linux/powerpc/bits/e500/mathdef.h84
-rw-r--r--libc/sysdeps/linux/powerpc/bits/e500/mathinline.h2
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fenvinline.h (renamed from libc/sysdeps/linux/powerpc/bits/classic/fenvinline.h)10
-rw-r--r--libc/sysdeps/linux/powerpc/bits/mathdef.h (renamed from libc/sysdeps/linux/powerpc/bits/classic/mathdef.h)10
-rw-r--r--libc/sysdeps/linux/powerpc/bits/mathinline.h (renamed from libc/sysdeps/linux/powerpc/bits/classic/mathinline.h)10
-rw-r--r--libc/sysdeps/linux/powerpc/bits/sysdep.h301
-rw-r--r--libc/sysdeps/linux/powerpc/classic/__longjmp.S84
-rw-r--r--libc/sysdeps/linux/powerpc/classic/setjmp.S82
-rw-r--r--libc/sysdeps/linux/powerpc/e500/__longjmp.S86
-rw-r--r--libc/sysdeps/linux/powerpc/e500/fpu_control.h66
-rw-r--r--libc/sysdeps/linux/powerpc/e500/setjmp.S84
-rw-r--r--libc/sysdeps/linux/powerpc/fenv.h (renamed from libc/sysdeps/linux/powerpc/e500/fenv_top.h)0
-rw-r--r--libc/sysdeps/linux/powerpc/fpu_control.h (renamed from libc/sysdeps/linux/powerpc/classic/fpu_control.h)35
-rw-r--r--libc/sysdeps/linux/powerpc/setjmp.S92
20 files changed, 545 insertions, 757 deletions
diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch
index 4ce8452f0..ea4ba53b3 100644
--- a/libc/sysdeps/linux/Makefile.commonarch
+++ b/libc/sysdeps/linux/Makefile.commonarch
@@ -23,11 +23,6 @@ objclean-y += arch_objclean
arch_objclean:
$(RM) $(ARCH_OUT)/*.{o,os} $(CTOR_TARGETS) $(CRTS)
-ifneq ($(ARCH_FPU_HEADERS),)
-headers-y += arch_fpu_headers
-headers_clean-y += arch_fpu_headers_clean
-endif
-
ifneq ($(ARCH_HEADERS),)
ARCH_HEADERS_IN := $(patsubst %,../libc/sysdeps/linux/$(TARGET_ARCH)/%,$(ARCH_HEADERS))
diff --git a/libc/sysdeps/linux/powerpc/Makefile.arch b/libc/sysdeps/linux/powerpc/Makefile.arch
index 0e3799f81..1e0f5b4ea 100644
--- a/libc/sysdeps/linux/powerpc/Makefile.arch
+++ b/libc/sysdeps/linux/powerpc/Makefile.arch
@@ -11,37 +11,8 @@ SSRC := \
__longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \
clone.S __uClibc_syscall.S syscall.S vfork.S
-ARCH_FPU_HEADERS := fpu_control.h
-ARCH_DIR := libc/sysdeps/linux/powerpc
-
-arch_fpu_headers:
ifeq ($(CONFIG_E500),y)
- $(LN) -fs e500/fpu_control.h $(ARCH_DIR)
- $(LN) -fs e500/setjmp.S $(ARCH_DIR)
- $(LN) -fs e500/__longjmp.S $(ARCH_DIR)
- $(LN) -fs e500/fenv.h $(ARCH_DIR)/bits
- $(LN) -fs e500/fenvinline.h $(ARCH_DIR)/bits
- $(LN) -fs e500/mathinline.h $(ARCH_DIR)/bits
- $(LN) -fs e500/mathdef.h $(ARCH_DIR)/bits
- $(LN) -fs ../$(ARCH_DIR)/e500/fenv_top.h $(top_builddir)include/fenv.h
-else
- $(LN) -fs classic/fpu_control.h $(ARCH_DIR)
- $(LN) -fs classic/setjmp.S $(ARCH_DIR)
- $(LN) -fs classic/__longjmp.S $(ARCH_DIR)
- $(LN) -fs classic/fenv.h $(ARCH_DIR)/bits
- $(LN) -fs classic/fenvinline.h $(ARCH_DIR)/bits
- $(LN) -fs classic/mathinline.h $(ARCH_DIR)/bits
- $(LN) -fs classic/mathdef.h $(ARCH_DIR)/bits
+ARCH_HEADERS := fenv.h
endif
-arch_fpu_headers_clean:
- $(RM) $(ARCH_DIR)/fpu_control.h
- $(RM) $(ARCH_DIR)/setjmp.S
- $(RM) $(ARCH_DIR)/__longjmp.S
- $(RM) $(ARCH_DIR)/bits/fenv.h
- $(RM) $(ARCH_DIR)/bits/fenvinline.h
- $(RM) $(ARCH_DIR)/bits/mathinline.h
- $(RM) $(ARCH_DIR)/bits/mathdef.h
- $(RM) include/fenv.h
-
include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/sysdeps/linux/powerpc/__longjmp.S b/libc/sysdeps/linux/powerpc/__longjmp.S
new file mode 100644
index 000000000..765a87315
--- /dev/null
+++ b/libc/sysdeps/linux/powerpc/__longjmp.S
@@ -0,0 +1,94 @@
+/* longjmp for PowerPC and PowerPC e500.
+ Copyright (C) 1995, 1996, 1997, 1999, 2000, 2004
+ Free Software Foundation, Inc.
+ e500 contributed by Aldy Hernandez <aldyh@redhat.com>.
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <features.h>
+#include "ppc_asm.h"
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+
+
+#if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
+#define FP(x...) x
+#else
+#define FP(x...)
+#endif
+
+#if defined __CONFIG_E500__
+#define LFD(reg) evldd r##reg
+#define STFD(reg) evstdd r##reg
+#else
+#define LFD(reg) lfd fp##reg
+#define STFD(reg) stfd fp##reg
+#endif /* __CONFIG_E500__ */
+
+.globl __longjmp;
+.type __longjmp, @function;
+.align 2;
+
+__longjmp:
+ lwz r1,(JB_GPR1*4)(r3)
+ lwz r2,(JB_GPR2*4)(r3)
+ lwz r0,(JB_LR*4)(r3)
+ lwz r14,((JB_GPRS+0)*4)(r3)
+FP( LFD (14),((JB_FPRS+0*2)*4)(r3))
+ lwz r15,((JB_GPRS+1)*4)(r3)
+FP( LFD (15),((JB_FPRS+1*2)*4)(r3))
+ lwz r16,((JB_GPRS+2)*4)(r3)
+FP( LFD (16),((JB_FPRS+2*2)*4)(r3))
+ lwz r17,((JB_GPRS+3)*4)(r3)
+FP( LFD (17),((JB_FPRS+3*2)*4)(r3))
+ lwz r18,((JB_GPRS+4)*4)(r3)
+FP( LFD (18),((JB_FPRS+4*2)*4)(r3))
+ lwz r19,((JB_GPRS+5)*4)(r3)
+FP( LFD (19),((JB_FPRS+5*2)*4)(r3))
+ lwz r20,((JB_GPRS+6)*4)(r3)
+FP( LFD (20),((JB_FPRS+6*2)*4)(r3))
+ mtlr r0
+ lwz r21,((JB_GPRS+7)*4)(r3)
+FP( LFD (21),((JB_FPRS+7*2)*4)(r3))
+ lwz r22,((JB_GPRS+8)*4)(r3)
+FP( LFD (22),((JB_FPRS+8*2)*4)(r3))
+ lwz r0,(JB_CR*4)(r3)
+ lwz r23,((JB_GPRS+9)*4)(r3)
+FP( LFD (23),((JB_FPRS+9*2)*4)(r3))
+ lwz r24,((JB_GPRS+10)*4)(r3)
+FP( LFD (24),((JB_FPRS+10*2)*4)(r3))
+ lwz r25,((JB_GPRS+11)*4)(r3)
+FP( LFD (25),((JB_FPRS+11*2)*4)(r3))
+ mtcrf 0xFF,r0
+ lwz r26,((JB_GPRS+12)*4)(r3)
+FP( LFD (26),((JB_FPRS+12*2)*4)(r3))
+ lwz r27,((JB_GPRS+13)*4)(r3)
+FP( LFD (27),((JB_FPRS+13*2)*4)(r3))
+ lwz r28,((JB_GPRS+14)*4)(r3)
+FP( LFD (28),((JB_FPRS+14*2)*4)(r3))
+ lwz r29,((JB_GPRS+15)*4)(r3)
+FP( LFD (29),((JB_FPRS+15*2)*4)(r3))
+ lwz r30,((JB_GPRS+16)*4)(r3)
+FP( LFD (30),((JB_FPRS+16*2)*4)(r3))
+ lwz r31,((JB_GPRS+17)*4)(r3)
+FP( LFD (31),((JB_FPRS+17*2)*4)(r3))
+ mr r3,r4
+ blr
+.size __longjmp,.-__longjmp
+
+libc_hidden_def(__longjmp)
diff --git a/libc/sysdeps/linux/powerpc/bits/classic/fenv.h b/libc/sysdeps/linux/powerpc/bits/classic/fenv.h
deleted file mode 100644
index 8509b4b0c..000000000
--- a/libc/sysdeps/linux/powerpc/bits/classic/fenv.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999 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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _FENV_H
-# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
-#endif
-
-
-/* Define bits representing the exception. We use the bit positions of
- the appropriate bits in the FPSCR... */
-enum
- {
- FE_INEXACT = 1 << (31 - 6),
-#define FE_INEXACT FE_INEXACT
- FE_DIVBYZERO = 1 << (31 - 5),
-#define FE_DIVBYZERO FE_DIVBYZERO
- FE_UNDERFLOW = 1 << (31 - 4),
-#define FE_UNDERFLOW FE_UNDERFLOW
- FE_OVERFLOW = 1 << (31 - 3),
-#define FE_OVERFLOW FE_OVERFLOW
-
- /* ... except for FE_INVALID, for which we use bit 31. FE_INVALID
- actually corresponds to bits 7 through 12 and 21 through 23
- in the FPSCR, but we can't use that because the current draft
- says that it must be a power of 2. Instead we use bit 2 which
- is the summary bit for all the FE_INVALID exceptions, which
- kind of makes sense. */
- FE_INVALID = 1 << (31 - 2),
-#define FE_INVALID FE_INVALID
-
-#ifdef __USE_GNU
- /* Breakdown of the FE_INVALID bits. Setting FE_INVALID on an
- input to a routine is equivalent to setting all of these bits;
- FE_INVALID will be set on output from a routine iff one of
- these bits is set. Note, though, that you can't disable or
- enable these exceptions individually. */
-
- /* Operation with SNaN. */
- FE_INVALID_SNAN = 1 << (31 - 7),
-# define FE_INVALID_SNAN FE_INVALID_SNAN
-
- /* Inf - Inf */
- FE_INVALID_ISI = 1 << (31 - 8),
-# define FE_INVALID_ISI FE_INVALID_ISI
-
- /* Inf / Inf */
- FE_INVALID_IDI = 1 << (31 - 9),
-# define FE_INVALID_IDI FE_INVALID_IDI
-
- /* 0 / 0 */
- FE_INVALID_ZDZ = 1 << (31 - 10),
-# define FE_INVALID_ZDZ FE_INVALID_ZDZ
-
- /* Inf * 0 */
- FE_INVALID_IMZ = 1 << (31 - 11),
-# define FE_INVALID_IMZ FE_INVALID_IMZ
-
- /* Comparison with NaN or SNaN. */
- FE_INVALID_COMPARE = 1 << (31 - 12),
-# define FE_INVALID_COMPARE FE_INVALID_COMPARE
-
- /* Invalid operation flag for software (not set by hardware). */
- /* Note that some chips don't have this implemented, presumably
- because no-one expected anyone to write software for them %-). */
- FE_INVALID_SOFTWARE = 1 << (31 - 21),
-# define FE_INVALID_SOFTWARE FE_INVALID_SOFTWARE
-
- /* Square root of negative number (including -Inf). */
- /* Note that some chips don't have this implemented. */
- FE_INVALID_SQRT = 1 << (31 - 22),
-# define FE_INVALID_SQRT FE_INVALID_SQRT
-
- /* Conversion-to-integer of a NaN or a number too large or too small. */
- FE_INVALID_INTEGER_CONVERSION = 1 << (31 - 23)
-# define FE_INVALID_INTEGER_CONVERSION FE_INVALID_INTEGER_CONVERSION
-
-# define FE_ALL_INVALID \
- (FE_INVALID_SNAN | FE_INVALID_ISI | FE_INVALID_IDI | FE_INVALID_ZDZ \
- | FE_INVALID_IMZ | FE_INVALID_COMPARE | FE_INVALID_SOFTWARE \
- | FE_INVALID_SQRT | FE_INVALID_INTEGER_CONVERSION)
-#endif
- };
-
-#define FE_ALL_EXCEPT \
- (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
-
-/* PowerPC chips support all of the four defined rounding modes. We
- use the bit pattern in the FPSCR as the values for the
- appropriate macros. */
-enum
- {
- FE_TONEAREST = 0,
-#define FE_TONEAREST FE_TONEAREST
- FE_TOWARDZERO = 1,
-#define FE_TOWARDZERO FE_TOWARDZERO
- FE_UPWARD = 2,
-#define FE_UPWARD FE_UPWARD
- FE_DOWNWARD = 3
-#define FE_DOWNWARD FE_DOWNWARD
- };
-
-/* Type representing exception flags. */
-typedef unsigned int fexcept_t;
-
-/* Type representing floating-point environment. We leave it as 'double'
- for efficiency reasons (rather than writing it to a 32-bit integer). */
-typedef double fenv_t;
-
-/* If the default argument is used we use this value. */
-extern const fenv_t __fe_dfl_env;
-#define FE_DFL_ENV (&__fe_dfl_env)
-
-#ifdef __USE_GNU
-/* Floating-point environment where all exceptions are enabled. Note that
- this is not sufficient to give you SIGFPE. */
-extern const fenv_t __fe_enabled_env;
-# define FE_ENABLED_ENV (&__fe_enabled_env)
-
-/* Floating-point environment with (processor-dependent) non-IEEE floating
- point. */
-extern const fenv_t __fe_nonieee_env;
-# define FE_NONIEEE_ENV (&__fe_nonieee_env)
-
-/* Floating-point environment with all exceptions enabled. Note that
- just evaluating this value will set the processor into 'FPU
- exceptions imprecise recoverable' mode, which may cause a significant
- performance penalty (but have no other visible effect). */
-extern const fenv_t *__fe_nomask_env (void);
-# define FE_NOMASK_ENV (__fe_nomask_env ())
-#endif
diff --git a/libc/sysdeps/linux/powerpc/bits/e500/fenv.h b/libc/sysdeps/linux/powerpc/bits/e500/fenv.h
deleted file mode 100644
index 41963da38..000000000
--- a/libc/sysdeps/linux/powerpc/bits/e500/fenv.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _FENV_H
-# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
-#endif
-
-
-/* Define bits representing the exception. We use the bit positions of
- the appropriate bits in the SPEFSCR... */
-enum
- {
- FE_INEXACT = 1 << (63 - 42),
-#define FE_INEXACT FE_INEXACT
- FE_INVALID = 1 << (63 - 43),
-#define FE_INVALID FE_INVALID
- FE_DIVBYZERO = 1 << (63 - 44),
-#define FE_DIVBYZERO FE_DIVBYZERO
- FE_UNDERFLOW = 1 << (63 - 45),
-#define FE_UNDERFLOW FE_UNDERFLOW
- FE_OVERFLOW = 1 << (63 - 46)
-#define FE_OVERFLOW FE_OVERFLOW
- };
-
-#define FE_ALL_EXCEPT \
- (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
-
-/* The E500 support all of the four defined rounding modes. We use
- the bit pattern in the SPEFSCR as the values for the appropriate
- macros. */
-enum
- {
- FE_TONEAREST = 0,
-#define FE_TONEAREST FE_TONEAREST
- FE_TOWARDZERO = 1,
-#define FE_TOWARDZERO FE_TOWARDZERO
- FE_UPWARD = 2,
-#define FE_UPWARD FE_UPWARD
- FE_DOWNWARD = 3
-#define FE_DOWNWARD FE_DOWNWARD
- };
-
-/* Type representing exception flags. */
-typedef unsigned int fexcept_t;
-
-typedef double fenv_t;
-
-/* If the default argument is used we use this value. */
-extern const fenv_t __fe_dfl_env;
-#define FE_DFL_ENV (&__fe_dfl_env)
-
-#ifdef __USE_GNU
-/* Floating-point environment where all exceptions are enabled. Note that
- this is not sufficient to give you SIGFPE. */
-extern const fenv_t __fe_enabled_env;
-# define FE_ENABLED_ENV (&__fe_enabled_env)
-
-/* Floating-point environment with all exceptions enabled. Note that
- just evaluating this value will set the processor into 'FPU
- exceptions imprecise recoverable' mode, which may cause a significant
- performance penalty (but have no other visible effect). */
-extern const fenv_t *__fe_nomask_env (void);
-# define FE_NOMASK_ENV (__fe_nomask_env ())
-#endif
diff --git a/libc/sysdeps/linux/powerpc/bits/e500/fenvinline.h b/libc/sysdeps/linux/powerpc/bits/e500/fenvinline.h
deleted file mode 100644
index 8dee09d18..000000000
--- a/libc/sysdeps/linux/powerpc/bits/e500/fenvinline.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We don't need no stinking inline versions. Life is hard enough as it
- is with this hybrid soft/hard float business. */
diff --git a/libc/sysdeps/linux/powerpc/bits/e500/mathdef.h b/libc/sysdeps/linux/powerpc/bits/e500/mathdef.h
deleted file mode 100644
index 4a698e96c..000000000
--- a/libc/sysdeps/linux/powerpc/bits/e500/mathdef.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright (C) 1997,1998,1999,2000,2003 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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-
-/* FIXME! This file describes properties of the compiler, not the machine;
- it should not be part of libc!
-
- FIXME! This file does not deal with the -fshort-double option of
- gcc! */
-
-#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
-# define _MATH_H_MATHDEF 1
-
-# ifdef __GNUC__
-# if __STDC__ == 1
-
-/* In GNU or ANSI mode, gcc leaves `float' expressions as-is. */
-typedef float float_t; /* `float' expressions are evaluated as
- `float'. */
-typedef double double_t; /* `double' expressions are evaluated as
- `double'. */
-
-/* Define `INFINITY' as value of type `float'. */
-# ifndef __UCLIBC__
-# define INFINITY HUGE_VALF
-# endif
-
-# else
-
-/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
-typedef double float_t; /* `float' expressions are evaluated as
- `double'. */
-typedef double double_t; /* `double' expressions are evaluated as
- `double'. */
-
-/* Define `INFINITY' as value of type `float'. */
-# ifndef __UCLIBC__
-# define INFINITY HUGE_VALF
-# endif
-
-# endif
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
-typedef double double_t;
-
-/* Define `INFINITY' as value of type `float'. */
-# ifndef __UCLIBC__
-# define INFINITY HUGE_VALF
-# endif
-
-# endif
-
-/* The values returned by `ilogb' for 0 and NaN respectively. */
-# define FP_ILOGB0 (-2147483647)
-# define FP_ILOGBNAN (2147483647)
-
-#endif /* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'. The disables the
- declaration of all the `long double' function variants. */
-# define __NO_LONG_DOUBLE_MATH 1
-#endif
diff --git a/libc/sysdeps/linux/powerpc/bits/e500/mathinline.h b/libc/sysdeps/linux/powerpc/bits/e500/mathinline.h
deleted file mode 100644
index ebd8ec4a3..000000000
--- a/libc/sysdeps/linux/powerpc/bits/e500/mathinline.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Inline? You've got to be kidding me. We'll take the library functions
- any day. */
diff --git a/libc/sysdeps/linux/powerpc/bits/classic/fenvinline.h b/libc/sysdeps/linux/powerpc/bits/fenvinline.h
index f7700a49e..f7a1a3ac1 100644
--- a/libc/sysdeps/linux/powerpc/bits/classic/fenvinline.h
+++ b/libc/sysdeps/linux/powerpc/bits/fenvinline.h
@@ -18,6 +18,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <features.h>
+
+/*
+ * Disable for e500, uses library functions instead of in lines.
+ */
+#ifndef __CONFIG_E500__
+
#if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_MATH_INLINES
/* Inline definition for fegetround. */
@@ -59,3 +66,6 @@
: (feclearexcept) (__excepts))
#endif /* __GNUC__ && !_SOFT_FLOAT */
+
+#endif /* __CONFIG_E500__ */
+
diff --git a/libc/sysdeps/linux/powerpc/bits/classic/mathdef.h b/libc/sysdeps/linux/powerpc/bits/mathdef.h
index a076fb6d7..7c7d9f7d7 100644
--- a/libc/sysdeps/linux/powerpc/bits/classic/mathdef.h
+++ b/libc/sysdeps/linux/powerpc/bits/mathdef.h
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <features.h>
+
#if !defined _MATH_H && !defined _COMPLEX_H
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
#endif
@@ -64,6 +66,9 @@ typedef double double_t;
#endif /* ISO C99 */
#ifndef __NO_LONG_DOUBLE_MATH
+#ifdef __CONFIG_E500__
+# define __NO_LONG_DOUBLE_MATH 1
+#else
#include <bits/wordsize.h>
/* Signal that we do not really have a `long double'. The disables the
declaration of all the `long double' function variants. */
@@ -71,5 +76,6 @@ typedef double double_t;
# define __NO_LONG_DOUBLE_MATH 1
# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
# define __NO_LONG_DOUBLE_MATH 1
-# endif
-#endif
+# endif /* __WORDSIZE == 32 */
+# endif /* __CONGIG_E500__ */
+# endif /* __NO_LONG_DOUBLE_MATH */
diff --git a/libc/sysdeps/linux/powerpc/bits/classic/mathinline.h b/libc/sysdeps/linux/powerpc/bits/mathinline.h
index 87985a744..695cc3fab 100644
--- a/libc/sysdeps/linux/powerpc/bits/classic/mathinline.h
+++ b/libc/sysdeps/linux/powerpc/bits/mathinline.h
@@ -18,6 +18,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <features.h>
+
+/*
+ * Disable for e500, uses library functions instead of in lines.
+ */
+#ifndef __CONFIG_E500__
+
#ifndef _MATH_H
# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
#endif
@@ -180,3 +187,6 @@ __NTH (__ieee754_sqrtf (float __x))
}
#endif /* __LIBC_INTERNAL_MATH_INLINES */
#endif /* __GNUC__ && !_SOFT_FLOAT */
+
+#endif /* __CONFIG_E500__ */
+
diff --git a/libc/sysdeps/linux/powerpc/bits/sysdep.h b/libc/sysdeps/linux/powerpc/bits/sysdep.h
new file mode 100644
index 000000000..c42efbabd
--- /dev/null
+++ b/libc/sysdeps/linux/powerpc/bits/sysdep.h
@@ -0,0 +1,301 @@
+/* Copyright (C) 1992,1997-2003,2004,2005,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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _LINUX_POWERPC_SYSDEP_H
+#define _LINUX_POWERPC_SYSDEP_H 1
+
+#include <sysdeps/unix/powerpc/sysdep.h>
+#include <tls.h>
+
+/* Some systen calls got renamed over time, but retained the same semantics.
+ Handle them here so they can be catched by both C and assembler stubs in
+ glibc. */
+
+#ifdef __NR_pread64
+# ifdef __NR_pread
+# error "__NR_pread and __NR_pread64 both defined???"
+# endif
+# define __NR_pread __NR_pread64
+#endif
+
+#ifdef __NR_pwrite64
+# ifdef __NR_pwrite
+# error "__NR_pwrite and __NR_pwrite64 both defined???"
+# endif
+# define __NR_pwrite __NR_pwrite64
+#endif
+
+/* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
+ of the kernel. But these symbols do not follow the SYS_* syntax
+ so we have to redefine the `SYS_ify' macro here. */
+#undef SYS_ify
+#ifdef __STDC__
+# define SYS_ify(syscall_name) __NR_##syscall_name
+#else
+# define SYS_ify(syscall_name) __NR_/**/syscall_name
+#endif
+
+#ifndef __ASSEMBLER__
+
+# include <errno.h>
+
+# ifdef SHARED
+# define INLINE_VSYSCALL(name, nr, args...) \
+ ({ \
+ __label__ out; \
+ __label__ iserr; \
+ INTERNAL_SYSCALL_DECL (sc_err); \
+ long int sc_ret; \
+ \
+ if (__vdso_##name != NULL) \
+ { \
+ sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \
+ if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
+ goto out; \
+ if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
+ goto iserr; \
+ } \
+ \
+ sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
+ if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
+ { \
+ iserr: \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
+ sc_ret = -1L; \
+ } \
+ out: \
+ sc_ret; \
+ })
+# else
+# define INLINE_VSYSCALL(name, nr, args...) \
+ INLINE_SYSCALL (name, nr, ##args)
+# endif
+
+# ifdef SHARED
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+ ({ \
+ __label__ out; \
+ long int v_ret; \
+ \
+ if (__vdso_##name != NULL) \
+ { \
+ v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
+ || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
+ goto out; \
+ } \
+ v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
+ out: \
+ v_ret; \
+ })
+# else
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+ INTERNAL_SYSCALL (name, err, nr, ##args)
+# endif
+
+# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \
+ ({ \
+ long int sc_ret = ENOSYS; \
+ \
+ if (__vdso_##name != NULL) \
+ sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ else \
+ err = 1 << 28; \
+ sc_ret; \
+ })
+
+/* List of system calls which are supported as vsyscalls. */
+# define HAVE_CLOCK_GETRES_VSYSCALL 1
+# define HAVE_CLOCK_GETTIME_VSYSCALL 1
+
+/* Define a macro which expands inline into the wrapper code for a VDSO
+ call. This use is for internal calls that do not need to handle errors
+ normally. It will never touch errno.
+ On powerpc a system call basically clobbers the same registers like a
+ function call, with the exception of LR (which is needed for the
+ "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
+ an error return status). */
+# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+ ({ \
+ register void *r0 __asm__ ("r0"); \
+ register long int r3 __asm__ ("r3"); \
+ register long int r4 __asm__ ("r4"); \
+ register long int r5 __asm__ ("r5"); \
+ register long int r6 __asm__ ("r6"); \
+ register long int r7 __asm__ ("r7"); \
+ register long int r8 __asm__ ("r8"); \
+ register long int r9 __asm__ ("r9"); \
+ register long int r10 __asm__ ("r10"); \
+ register long int r11 __asm__ ("r11"); \
+ register long int r12 __asm__ ("r12"); \
+ LOADARGS_##nr (funcptr, args); \
+ __asm__ __volatile__ \
+ ("mtctr %0\n\t" \
+ "bctrl\n\t" \
+ "mfcr %0" \
+ : "=&r" (r0), \
+ "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \
+ "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \
+ : ASM_INPUT_##nr \
+ : "cr0", "ctr", "lr", "memory"); \
+ err = (long int) r0; \
+ (int) r3; \
+ })
+
+# undef INLINE_SYSCALL
+# define INLINE_SYSCALL(name, nr, args...) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (sc_err); \
+ long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \
+ if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
+ { \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
+ sc_ret = -1L; \
+ } \
+ sc_ret; \
+ })
+
+/* Define a macro which expands inline into the wrapper code for a system
+ call. This use is for internal calls that do not need to handle errors
+ normally. It will never touch errno.
+ On powerpc a system call basically clobbers the same registers like a
+ function call, with the exception of LR (which is needed for the
+ "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
+ an error return status). */
+
+# undef INTERNAL_SYSCALL_DECL
+# define INTERNAL_SYSCALL_DECL(err) long int err
+
+# undef INTERNAL_SYSCALL
+# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+ ({ \
+ register long int r0 __asm__ ("r0"); \
+ register long int r3 __asm__ ("r3"); \
+ register long int r4 __asm__ ("r4"); \
+ register long int r5 __asm__ ("r5"); \
+ register long int r6 __asm__ ("r6"); \
+ register long int r7 __asm__ ("r7"); \
+ register long int r8 __asm__ ("r8"); \
+ register long int r9 __asm__ ("r9"); \
+ register long int r10 __asm__ ("r10"); \
+ register long int r11 __asm__ ("r11"); \
+ register long int r12 __asm__ ("r12"); \
+ LOADARGS_##nr(name, args); \
+ __asm__ __volatile__ \
+ ("sc \n\t" \
+ "mfcr %0" \
+ : "=&r" (r0), \
+ "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \
+ "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \
+ : ASM_INPUT_##nr \
+ : "cr0", "ctr", "memory"); \
+ err = r0; \
+ (int) r3; \
+ })
+# define INTERNAL_SYSCALL(name, err, nr, args...) \
+ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
+
+# undef INTERNAL_SYSCALL_ERROR_P
+# define INTERNAL_SYSCALL_ERROR_P(val, err) \
+ ((void) (val), __builtin_expect ((err) & (1 << 28), 0))
+
+# undef INTERNAL_SYSCALL_ERRNO
+# define INTERNAL_SYSCALL_ERRNO(val, err) (val)
+
+# define LOADARGS_0(name, dummy) \
+ r0 = name
+# define LOADARGS_1(name, __arg1) \
+ long int arg1 = (long int) (__arg1); \
+ LOADARGS_0(name, 0); \
+ extern void __illegally_sized_syscall_arg1 (void); \
+ if