summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/ieee754/dbl-64/s_llrint.c23
-rw-r--r--sysdeps/ieee754/dbl-64/s_lrint.c21
-rw-r--r--sysdeps/ieee754/flt-32/s_llrintf.c10
-rw-r--r--sysdeps/ieee754/flt-32/s_lrintf.c10
-rw-r--r--sysdeps/ieee754/ldbl-128/s_llrintl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128/s_lrintl.c21
-rw-r--r--sysdeps/ieee754/ldbl-96/s_llrintl.c10
-rw-r--r--sysdeps/ieee754/ldbl-96/s_lrintl.c17
-rw-r--r--sysdeps/powerpc/powerpc32/__longjmp-common.S8
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S8
-rw-r--r--sysdeps/powerpc/powerpc64/__longjmp-common.S6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c20
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c19
15 files changed, 96 insertions, 93 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_llrint.c b/sysdeps/ieee754/dbl-64/s_llrint.c
index 893bd716b5..64c870eaaa 100644
--- a/sysdeps/ieee754/dbl-64/s_llrint.c
+++ b/sysdeps/ieee754/dbl-64/s_llrint.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,7 +23,7 @@
#include "math_private.h"
-static const long double two52[2] =
+static const double two52[2] =
{
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
@@ -48,19 +48,14 @@ __llrint (double x)
if (j0 < 20)
{
- if (j0 < -1)
- return 0;
- else
- {
- w = two52[sx] + x;
- t = w - two52[sx];
- EXTRACT_WORDS (i0, i1, t);
- j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
- i0 &= 0xfffff;
- i0 |= 0x100000;
+ w = two52[sx] + x;
+ t = w - two52[sx];
+ EXTRACT_WORDS (i0, i1, t);
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ i0 &= 0xfffff;
+ i0 |= 0x100000;
- result = i0 >> (20 - j0);
- }
+ result = (j0 < 0 ? 0 : i0 >> (20 - j0));
}
else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
{
diff --git a/sysdeps/ieee754/dbl-64/s_lrint.c b/sysdeps/ieee754/dbl-64/s_lrint.c
index 2da68d4dcd..1084ed6e2d 100644
--- a/sysdeps/ieee754/dbl-64/s_lrint.c
+++ b/sysdeps/ieee754/dbl-64/s_lrint.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -48,19 +48,14 @@ __lrint (double x)
if (j0 < 20)
{
- if (j0 < -1)
- return 0;
- else
- {
- w = two52[sx] + x;
- t = w - two52[sx];
- EXTRACT_WORDS (i0, i1, t);
- j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
- i0 &= 0xfffff;
- i0 |= 0x100000;
+ w = two52[sx] + x;
+ t = w - two52[sx];
+ EXTRACT_WORDS (i0, i1, t);
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ i0 &= 0xfffff;
+ i0 |= 0x100000;
- result = i0 >> (20 - j0);
- }
+ result = (j0 < 0 ? 0 : i0 >> (20 - j0));
}
else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
{
diff --git a/sysdeps/ieee754/flt-32/s_llrintf.c b/sysdeps/ieee754/flt-32/s_llrintf.c
index 3b9a484a8d..7c6e4bcda4 100644
--- a/sysdeps/ieee754/flt-32/s_llrintf.c
+++ b/sysdeps/ieee754/flt-32/s_llrintf.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,7 +23,7 @@
#include "math_private.h"
-static const double two23[2] =
+static const float two23[2] =
{
8.3886080000e+06, /* 0x4B000000 */
-8.3886080000e+06, /* 0xCB000000 */
@@ -49,9 +49,7 @@ __llrintf (float x)
if (j0 < (int32_t) (sizeof (long long int) * 8) - 1)
{
- if (j0 < -1)
- return 0;
- else if (j0 >= 23)
+ if (j0 >= 23)
result = (long long int) i0 << (j0 - 23);
else
{
@@ -62,7 +60,7 @@ __llrintf (float x)
i0 &= 0x7fffff;
i0 |= 0x800000;
- result = i0 >> (23 - j0);
+ result = (j0 < 0 ? 0 : i0 >> (23 - j0));
}
}
else
diff --git a/sysdeps/ieee754/flt-32/s_lrintf.c b/sysdeps/ieee754/flt-32/s_lrintf.c
index 2a156f7ce2..64486a4c3e 100644
--- a/sysdeps/ieee754/flt-32/s_lrintf.c
+++ b/sysdeps/ieee754/flt-32/s_lrintf.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,7 +23,7 @@
#include "math_private.h"
-static const double two23[2] =
+static const float two23[2] =
{
8.3886080000e+06, /* 0x4B000000 */
-8.3886080000e+06, /* 0xCB000000 */
@@ -49,9 +49,7 @@ __lrintf (float x)
if (j0 < (int32_t) (sizeof (long int) * 8) - 1)
{
- if (j0 < -1)
- return 0;
- else if (j0 >= 23)
+ if (j0 >= 23)
result = (long int) i0 << (j0 - 23);
else
{
@@ -62,7 +60,7 @@ __lrintf (float x)
i0 &= 0x7fffff;
i0 |= 0x800000;
- result = i0 >> (23 - j0);
+ result = (j0 < 0 ? 0 : i0 >> (23 - j0));
}
}
else
diff --git a/sysdeps/ieee754/ldbl-128/s_llrintl.c b/sysdeps/ieee754/ldbl-128/s_llrintl.c
index ee66454e2f..5804f57d11 100644
--- a/sysdeps/ieee754/ldbl-128/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_llrintl.c
@@ -48,8 +48,6 @@ __llrintl (long double x)
if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
{
- if (j0 < -1)
- return 0;
w = two112[sx] + x;
t = w - two112[sx];
GET_LDOUBLE_WORDS64 (i0, i1, t);
@@ -57,7 +55,9 @@ __llrintl (long double x)
i0 &= 0x0000ffffffffffffLL;
i0 |= 0x0001000000000000LL;
- if (j0 <= 48)
+ if (j0 < 0)
+ result = 0;
+ else if (j0 <= 48)
result = i0 >> (48 - j0);
else
result = ((long long int) i0 << (j0 - 48)) | (i1 >> (112 - j0));
diff --git a/sysdeps/ieee754/ldbl-128/s_lrintl.c b/sysdeps/ieee754/ldbl-128/s_lrintl.c
index 66f9a429fc..53835a4bbc 100644
--- a/sysdeps/ieee754/ldbl-128/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_lrintl.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
Jakub Jelinek <jj@ultra.linux.cz>, 1999.
@@ -48,19 +48,14 @@ __lrintl (long double x)
if (j0 < 48)
{
- if (j0 < -1)
- return 0;
- else
- {
- w = two112[sx] + x;
- t = w - two112[sx];
- GET_LDOUBLE_WORDS64 (i0, i1, x);
- j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
- i0 &= 0x0000ffffffffffffLL;
- i0 |= 0x0001000000000000LL;
+ w = two112[sx] + x;
+ t = w - two112[sx];
+ GET_LDOUBLE_WORDS64 (i0, i1, x);
+ j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
+ i0 &= 0x0000ffffffffffffLL;
+ i0 |= 0x0001000000000000LL;
- result = i0 >> (48 - j0);
- }
+ result = (j0 < 0 ? 0 : i0 >> (48 - j0));
}
else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
{
diff --git a/sysdeps/ieee754/ldbl-96/s_llrintl.c b/sysdeps/ieee754/ldbl-96/s_llrintl.c
index e927a8af40..d6eedf1f33 100644
--- a/sysdeps/ieee754/ldbl-96/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-96/s_llrintl.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -47,9 +47,7 @@ __llrintl (long double x)
if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
{
- if (j0 < -1)
- return 0;
- else if (j0 >= 63)
+ if (j0 >= 63)
result = (((long long int) i0 << 32) | i1) << (j0 - 63);
else
{
@@ -58,7 +56,9 @@ __llrintl (long double x)
GET_LDOUBLE_WORDS (se, i0, i1, t);
j0 = (se & 0x7fff) - 0x3fff;
- if (j0 <= 31)
+ if (j0 < 0)
+ result = 0;
+ else if (j0 <= 31)
result = i0 >> (31 - j0);
else
result = ((long long int) i0 << (j0 - 31)) | (i1 >> (63 - j0));
diff --git a/sysdeps/ieee754/ldbl-96/s_lrintl.c b/sysdeps/ieee754/ldbl-96/s_lrintl.c
index 4212093989..621951d87b 100644
--- a/sysdeps/ieee754/ldbl-96/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-96/s_lrintl.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -47,17 +47,12 @@ __lrintl (long double x)
if (j0 < 31)
{
- if (j0 < -1)
- return 0;
- else
- {
- w = two63[sx] + x;
- t = w - two63[sx];
- GET_LDOUBLE_WORDS (se, i0, i1, t);
- j0 = (se & 0x7fff) - 0x3fff;
+ w = two63[sx] + x;
+ t = w - two63[sx];
+ GET_LDOUBLE_WORDS (se, i0, i1, t);
+ j0 = (se & 0x7fff) - 0x3fff;
- result = i0 >> (31 - j0);
- }
+ result = (j0 < 0 ? 0 : i0 >> (31 - j0));
}
else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
{
diff --git a/sysdeps/powerpc/powerpc32/__longjmp-common.S b/sysdeps/powerpc/powerpc32/__longjmp-common.S
index 411b6a20cb..2093b7e337 100644
--- a/sysdeps/powerpc/powerpc32/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/__longjmp-common.S
@@ -31,7 +31,11 @@
ENTRY (BP_SYM (__longjmp))
CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+#ifdef PTR_DEMANGLE
+ lwz r24,(JB_GPR1*4)(r3)
+#else
lwz r1,(JB_GPR1*4)(r3)
+#endif
lwz r0,(JB_LR*4)(r3)
lwz r14,((JB_GPRS+0)*4)(r3)
lwz r15,((JB_GPRS+1)*4)(r3)
@@ -41,8 +45,8 @@ ENTRY (BP_SYM (__longjmp))
lwz r19,((JB_GPRS+5)*4)(r3)
lwz r20,((JB_GPRS+6)*4)(r3)
#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (r0, r25)
- PTR_DEMANGLE2 (r1, r25)
+ PTR_DEMANGLE3 (r1, r24, r25)
+ PTR_DEMANGLE2 (r0, r25)
#endif
mtlr r0
lwz r21,((JB_GPRS+7)*4)(r3)
diff --git a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
index aa24b059d1..404f403855 100644
--- a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
@@ -114,7 +114,11 @@ aligned_restore_vmx:
lvx v31,0,r6
L(no_vmx):
#endif
+#ifdef PTR_DEMANGLE
+ lwz r24,(JB_GPR1*4)(r3)
+#else
lwz r1,(JB_GPR1*4)(r3)
+#endif
lwz r0,(JB_LR*4)(r3)
lwz r14,((JB_GPRS+0)*4)(r3)
lfd fp14,((JB_FPRS+0*2)*4)(r3)
@@ -131,8 +135,8 @@ L(no_vmx):
lwz r20,((JB_GPRS+6)*4)(r3)
lfd fp20,((JB_FPRS+6*2)*4)(r3)
#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (r0, r25)
- PTR_DEMANGLE2 (r1, r25)
+ PTR_DEMANGLE3 (r1, r24, r25)
+ PTR_DEMANGLE2 (r0, r25)
#endif
mtlr r0
lwz r21,((JB_GPRS+7)*4)(r3)
diff --git a/sysdeps/powerpc/powerpc64/__longjmp-common.S b/sysdeps/powerpc/powerpc64/__longjmp-common.S
index 31b1af34f9..700a2a543c 100644
--- a/sysdeps/powerpc/powerpc64/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc64/__longjmp-common.S
@@ -108,9 +108,11 @@ aligned_restore_vmx:
lvx v31,0,r6
L(no_vmx):
#endif
- ld r1,(JB_GPR1*8)(r3)
#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (r1, r25)
+ ld r22,(JB_GPR1*8)(r3)
+ PTR_DEMANGLE3 (r1, r22, r25)
+#else
+ ld r1,(JB_GPR1*8)(r3)
#endif
ld r2,(JB_GPR2*8)(r3)
ld r0,(JB_LR*8)(r3)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index 470da5aa6e..c42efbabdd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1997-2003,2004,2005 Free Software Foundation, Inc.
+/* 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
@@ -285,8 +285,12 @@
xor reg,tmpreg,reg
# define PTR_MANGLE2(reg, tmpreg) \
xor reg,tmpreg,reg
+# define PTR_MANGLE3(destreg, reg, tmpreg) \
+ lwz tmpreg,POINTER_GUARD(r2); \
+ xor destreg,tmpreg,reg
# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
+# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
# else
# define PTR_MANGLE(var) \
(var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index fd67f56983..aab4b721c0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -299,8 +299,12 @@
xor reg,tmpreg,reg
# define PTR_MANGLE2(reg, tmpreg) \
xor reg,tmpreg,reg
+# define PTR_MANGLE3(destreg, reg, tmpreg) \
+ ld tmpreg,POINTER_GUARD(r13); \
+ xor destreg,tmpreg,reg
# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
+# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
# else
# define PTR_MANGLE(var) \
(var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c b/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
index 29c8640e92..94760e0c2b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
@@ -37,8 +37,6 @@
+-----------------------+
n | overflow parameters | 96
+-----------------------+
- 8 | trampoline | 96+n
- +-----------------------+
The registers are set up like this:
%r2-%r6: parameters 1 to 5
%r7 : (*func) pointer
@@ -55,18 +53,16 @@
void
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
{
+ extern void __makecontext_ret (void);
unsigned long *sp;
va_list ap;
int i;
- sp = (long *) (((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & -8L);
-
- /* Setup the trampoline. */
- *--sp = 0x07f90000;
- *--sp = 0x0de71828;
+ sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
+ + ucp->uc_stack.ss_size) & -8L);
/* Set the return address to trampoline. */
- ucp->uc_mcontext.gregs[14] = (long) sp;
+ ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
/* Set register parameters. */
va_start (ap, argc);
@@ -98,4 +94,12 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
ucp->uc_mcontext.gregs[15] = (long) sp;
}
+asm(".text\n"
+ ".type __makecontext_ret,@function\n"
+ "__makecontext_ret:\n"
+ " basr %r14,%r7\n"
+ " lr %r2,%r8\n"
+ " br %r9\n"
+ ".size __makecontext_ret, .-__makecontext_ret");
+
weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c b/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
index cdff9a4f21..b08f1b4047 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
@@ -37,8 +37,6 @@
+-----------------------+
n | overflow parameters | 160
+-----------------------+
- 8 | trampoline | 160+n
- +-----------------------+
The registers are set up like this:
%r2-%r6: parameters 1 to 5
%r7 : (*func) pointer
@@ -55,17 +53,16 @@
void
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
{
+ extern void __makecontext_ret (void);
unsigned long *sp;
va_list ap;
int i;
- sp = (long *) (((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & -8L);
-
- /* Setup the trampoline. */
- *--sp = 0x0de7b904002807f9;
+ sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
+ + ucp->uc_stack.ss_size) & -8L);
/* Set the return address to trampoline. */
- ucp->uc_mcontext.gregs[14] = (long) sp;
+ ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
/* Set register parameters. */
va_start (ap, argc);
@@ -97,4 +94,12 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
ucp->uc_mcontext.gregs[15] = (long) sp;
}
+asm(".text\n"
+ ".type __makecontext_ret,@function\n"
+ "__makecontext_ret:\n"
+ " basr %r14,%r7\n"
+ " lgr %r2,%r8\n"
+ " br %r9\n"
+ ".size __makecontext_ret, .-__makecontext_ret");
+
weak_alias (__makecontext, makecontext)