aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/configure.in2
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h13
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c5
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S14
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S16
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S18
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S18
7 files changed, 81 insertions, 5 deletions
diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index 7947743f1a..462965f4f6 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -80,7 +80,7 @@ case "$machine" in
arch_minimum_kernel=2.0.10
;;
powerpc/powerpc64)
- arch_minimum_kernel=2.4.21
+ arch_minimum_kernel=2.4.19
;;
s390/s390-32)
libc_cv_gcc_unwind_find_fde=yes
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 3159dd1ada..45cd3e59c8 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -210,6 +210,19 @@
# define __ASSUME_MMAP2_SYSCALL 1
#endif
+/* Starting with 2.4.21 PowerPC64 implements the new prctl syscall.
+ This allows applications to get/set the Floating Point Exception Mode. */
+#if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc64__
+# define __ASSUME_NEW_PRCTL_SYSCALL 1
+#endif
+
+/* Starting with 2.4.21 PowerPC64 implements the new rt_sigreturn syscall.
+ The new rt_sigreturn takes an ucontext pointer allowing rt_sigreturn
+ to be used in the set/swapcontext implementation. */
+#if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc64__
+# define __ASSUME_NEW_RT_SIGRETURN_SYSCALL 1
+#endif
+
/* On x86, the set_thread_area syscall was introduced in 2.5.29, but its
semantics was changed in 2.5.30, and again after 2.5.31. */
#if __LINUX_KERNEL_VERSION >= 132384 && defined __i386__
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c
index 16619cddd2..6a0a82c703 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c
@@ -26,8 +26,11 @@
const fenv_t *
__fe_nomask_env (void)
{
+#ifdef __ASSUME_NEW_PRCTL_SYSCALL
INTERNAL_SYSCALL_DECL (err);
INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, PR_FP_EXC_PRECISE);
-
+#else
+ __set_errno (ENOSYS);
+#endif
return FE_ENABLED_ENV;
}
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
index 59dfb82ef5..ddbf40b8d9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
@@ -21,9 +21,11 @@
#define __ASSEMBLY__
#include <asm/ptrace.h>
+#include <asm/errno.h>
#include "ucontext_i.h"
ENTRY(__getcontext)
+#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
std r0,(SIGCONTEXT_GP_REGS+(PT_R0*8))(r3)
std r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3)
mflr r0
@@ -126,8 +128,18 @@ ENTRY(__getcontext)
addi r5,r3,UCONTEXT_SIGMASK
li r4,0
li r3,SIG_BLOCK
- bl .sigprocmask
+ bl JUMPTARGET(sigprocmask)
nop
+#else
+ /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */
+ mflr r0
+ std r0,FRAME_LR_SAVE(r1)
+ stdu r1,-128(r1)
+ li r3,ENOSYS
+ bl JUMPTARGET(__syscall_error)
+ nop
+ li r3,-1
+#endif
ld r0,128+FRAME_LR_SAVE(r1)
addi r1,r1,128
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
index 29dd17ffe4..08ce90177b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
@@ -22,8 +22,10 @@
#define __ASSEMBLY__
#include <asm/ptrace.h>
#include "ucontext_i.h"
+#include <asm/errno.h>
ENTRY(__makecontext)
+#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
/* Save parameters into the parameter save area of callers frame. */
std r3,FRAME_PARM1_SAVE(r1) /* ucontext_t *ucp */
std r4,FRAME_PARM2_SAVE(r1) /* void (*func)(void) */
@@ -156,6 +158,20 @@ L(gotexitcodeaddr):
addi r1,r1,128
mtlr r0
blr
+#else
+ /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */
+ mflr r0
+ std r0,FRAME_LR_SAVE(r1)
+ stdu r1,-128(r1)
+ li r3,ENOSYS
+ bl JUMPTARGET(__syscall_error)
+ nop
+ li r3,-1
+ ld r0,128+FRAME_LR_SAVE(r1)
+ addi r1,r1,128
+ mtlr r0
+ blr
+#endif
END(__makecontext)
weak_alias(__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
index d503cbbf3e..fa37abd6da 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
@@ -22,8 +22,10 @@
#define __ASSEMBLY__
#include <asm/ptrace.h>
#include "ucontext_i.h"
+#include <asm/errno.h>
ENTRY(__setcontext)
+#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
mflr r0
std r31,-8(1)
std r0,FRAME_LR_SAVE(r1)
@@ -47,7 +49,7 @@ ENTRY(__setcontext)
li r5,0
addi r4,r3,UCONTEXT_SIGMASK
li r3,SIG_SETMASK
- bl .sigprocmask
+ bl JUMPTARGET(sigprocmask)
nop
cmpdi r3,0
bne L(error_exit)
@@ -156,6 +158,20 @@ L(do_sigret):
li r0,SYS_ify(rt_sigreturn)
sc
/* No return. */
+#else
+ /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */
+ mflr r0
+ std r0,FRAME_LR_SAVE(r1)
+ stdu r1,-128(r1)
+ li r3,ENOSYS
+ bl JUMPTARGET(__syscall_error)
+ nop
+ li r3,-1
+ ld r0,128+FRAME_LR_SAVE(r1)
+ addi r1,r1,128
+ mtlr r0
+ blr
+#endif
PSEUDO_END(__setcontext)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
index 23422fb948..b1bcd44af1 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
@@ -22,8 +22,10 @@
#define __ASSEMBLY__
#include <asm/ptrace.h>
#include "ucontext_i.h"
+#include <asm/errno.h>
ENTRY(__swapcontext)
+#ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
std r0,(SIGCONTEXT_GP_REGS+(PT_R0*8))(r3)
std r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3)
mflr r0
@@ -128,7 +130,7 @@ ENTRY(__swapcontext)
addi r5,r3,UCONTEXT_SIGMASK
addi r4,r4,UCONTEXT_SIGMASK
li r3,SIG_SETMASK
- bl .sigprocmask
+ bl JUMPTARGET(sigprocmask)
nop
cmpdi r3,0
bne L(error_exit)
@@ -251,6 +253,20 @@ L(do_sigret):
li r0,SYS_ify(rt_sigreturn)
sc
/* No return. */
+#else
+ /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */
+ mflr r0
+ std r0,FRAME_LR_SAVE(r1)
+ stdu r1,-128(r1)
+ li r3,ENOSYS
+ bl JUMPTARGET(__syscall_error)
+ nop
+ li r3,-1
+ ld r0,128+FRAME_LR_SAVE(r1)
+ addi r1,r1,128
+ mtlr r0
+ blr
+#endif
PSEUDO_END(__swapcontext)