This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] ppc64 get/make/set/swapcontext again


This patch (with related kernel-feature and fe_nomask patches) makes
glibc 2.3 compatible with exiting Suse SLES 8 systems (which run the
2.4.19 kernel) use !__ASSUME_NEW_RT_SIGRETURN_SYSCALL to replace
get/make/set/swapcontext with ENOSYS stubs.

2003-01-31  Steven Munroe  <sjmunroe@us.ibm.com>

	* sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
	[!__ASSUME_NEW_RT_SIGRETURN_SYSCALL]: Generate ENOSYS stub.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
	[!__ASSUME_NEW_RT_SIGRETURN_SYSCALL]: Generate ENOSYS stub.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
	[!__ASSUME_NEW_RT_SIGRETURN_SYSCALL]: Generate ENOSYS stub.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
	[!__ASSUME_NEW_RT_SIGRETURN_SYSCALL]: Generate ENOSYS stub.

-- 
Steven Munroe
sjmunroe@us.ibm.com
Linux on PowerPC-64 Development
GLIBC for PowerPC-64 Development
diff -rupPN  libc23-cvstip-20030131/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
--- libc23-cvstip-20030131/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S	2003-01-16 19:01:03.000000000 -0600
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S	2003-01-31 14:47:05.000000000 -0600
@@ -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 -rupPN  libc23-cvstip-20030131/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
--- libc23-cvstip-20030131/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S	2003-01-16 19:01:11.000000000 -0600
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S	2003-01-31 14:47:36.000000000 -0600
@@ -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 -rupPN  libc23-cvstip-20030131/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
--- libc23-cvstip-20030131/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S	2003-01-16 19:01:16.000000000 -0600
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S	2003-01-31 14:48:35.000000000 -0600
@@ -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 -rupPN  libc23-cvstip-20030131/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
--- libc23-cvstip-20030131/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S	2003-01-16 19:01:28.000000000 -0600
+++ libc23/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S	2003-01-31 14:46:41.000000000 -0600
@@ -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)
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]