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] PPC enable Altivec for setjmp/longjmp part 1 of 5


Tom Gall found a versioned symbol bug in my previous patch. This was caused by bad ordering of macro defs. Also found that I did not really need powerpc32/novmx-setjmp.c and powerpc64/novmx-setjmp.c.

So I am reissuing parts 1, 2, and 3. Parts 4 and 5 are unchanged.

2004-02-04  Steven Munroe  <sjmunroe@us.ibm.com>

	* sysdeps/powerpc/Dist: New File.
	* sysdeps/powerpc/Makefile(sysdep_routines): Add novmx-longjmp.c
	and novmx-sigjmp.c
	* sysdeps/powerpc/Versions(libc): Add _longjmp, __sigsetjmp _setjmp,
	longjmp, and setjmp for GLIBC_2.3_4.  Add __novmx__libc_longjmp, 
	__novmx__libc_siglongjmp, __vmx__libc_longjmp, and 
	__vmx__libc_siglongjmp to GLIBC_PRIVATE.
	(ld): Add _longjmp, __sigsetjmp _setjmp, longjmp, and setjmp for 
	GLIBC_2.3_4.
	* sysdeps/powerpc/bits/setjmp.h: Define JB_VRSAVE, JB_VRS, and adjust 
	JB_SIZE to add VMX regs to __jmp_buf.
	* sysdeps/powerpc/longjmp.c(__vmx__libc_siglongjmp): Default version
	of __libc_siglongjmp.
	* sysdeps/powerpc/novmxsetjmp.h: New file.
	* sysdeps/powerpc/sigjmp.c(__vmx__sigjmp_save): Default version of 
	__sigjmp_save.
	* sysdeps/powerpc/powerpc32/novmx-longjmp.c
	[SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)]
	(__novmx__libc_siglongjmp): Original version of __libc_siglongjmp.
	* sysdeps/powerpc/powerpc32/novmx-sigjmp.c
	[SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)]
	(__novmx__sigjmp_save): Original version of __sigjmp_save.
	* sysdeps/powerpc/powerpc64/novmx-longjmp.c
	[SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)]
	(__novmx__libc_siglongjmp): Original version of __libc_siglongjmp.
	* sysdeps/powerpc/powerpc64/novmx-sigjmp.c
	[SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)]
	(__novmx__sigjmp_save): Original version of __sigjmp_save.

diff -urN libc23-cvstip-20040129/sysdeps/powerpc/Dist libc23/sysdeps/powerpc/Dist
--- libc23-cvstip-20040129/sysdeps/powerpc/Dist	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/Dist	Wed Feb 04 18:07:49 2004
@@ -0,0 +1,2 @@
+novmx-longjmp.c
+novmx-sigjmp.c 
diff -urN libc23-cvstip-20040129/sysdeps/powerpc/Makefile libc23/sysdeps/powerpc/Makefile
--- libc23-cvstip-20040129/sysdeps/powerpc/Makefile	2004-01-15 22:42:35.000000000 -0600
+++ libc23/sysdeps/powerpc/Makefile	2004-02-04 18:08:21.000000000 -0600
@@ -15,7 +15,13 @@
 sysdep-dl-routines += dl-machine
 sysdep_routines += dl-machine
 # extra shared linker files to link only into dl-allobjs.so
-sysdep-rtld-routines += dl-machine
+sysdep-rtld-routines += dl-machine 
+endif
+
+ifeq ($(subdir),setjmp)
+ifeq (yes,$(build-shared))
+sysdep_routines += novmx-longjmp novmx-sigjmp
+endif
 endif
 
 ifeq ($(subdir),csu)
diff -urN libc23-cvstip-20040129/sysdeps/powerpc/Versions libc23/sysdeps/powerpc/Versions
--- libc23-cvstip-20040129/sysdeps/powerpc/Versions	2002-09-05 04:54:59.000000000 -0500
+++ libc23/sysdeps/powerpc/Versions	2004-01-29 13:12:15.000000000 -0600
@@ -4,3 +4,21 @@
     __fe_dfl_env; __fe_enabled_env; __fe_nonieee_env; __fe_nomask_env;
   }
 }
+
+libc {
+  GLIBC_2.3.4 {
+     _longjmp; __sigsetjmp; _setjmp;
+     longjmp; setjmp;
+  }	
+  GLIBC_PRIVATE {
+     __novmx__libc_longjmp; __novmx__libc_siglongjmp;
+	__vmx__libc_longjmp; __vmx__libc_siglongjmp; 
+  }
+}
+
+ld {
+  GLIBC_2.3.4 {
+     _longjmp; __sigsetjmp; _setjmp;
+     longjmp; setjmp;
+  }
+}
diff -urN libc23-cvstip-20040129/sysdeps/powerpc/bits/setjmp.h libc23/sysdeps/powerpc/bits/setjmp.h
--- libc23-cvstip-20040129/sysdeps/powerpc/bits/setjmp.h	2003-04-11 19:53:57.000000000 -0500
+++ libc23/sysdeps/powerpc/bits/setjmp.h	2004-01-29 13:12:15.000000000 -0600
@@ -37,22 +37,44 @@
 # 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. */
+#  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   (40*8)
+#  define JB_SIZE   (64*8) /* As per PPC64-VMXabi.txt */
+#  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   (58*4)
+#  define JB_SIZE   ((64+(12*4))*4)
+#  define JB_VRSAVE 62
+#  define JB_VRS    64
 # endif
 #endif
 
+
+/* 
+ * ALTIVECPIM.pdf specifies for SVR4 ABI and EABI on 32 bit 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 4 byte alignment 
+ * so we need to use vperm in the setjmp/longjmp routines.  Yes because 
+ * members like  int __mask_was_saved in the jmp_buf have to move as 
+ * jmp_buf is currently larger than 248 bytes we cannot keep the altivec 
+ * jmp_buf backward compatible with the jmp_buf without altivec things 
+ * compiled with jmpbufs -mabi altivec will work on machines without 
+ * altivec but you will not be able to setjmp & longjmp between code 
+ * compiled with & without -mabi altivec you have been warned. 
+ */
 #ifndef	_ASM
 # if __WORDSIZE == 64
-typedef long int __jmp_buf[40];
+typedef long int __jmp_buf[64] __attribute__((aligned(16)));
 # else
-typedef long int __jmp_buf[58];
+/* 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
 
diff -urN libc23-cvstip-20040129/sysdeps/powerpc/longjmp.c libc23/sysdeps/powerpc/longjmp.c
--- libc23-cvstip-20040129/sysdeps/powerpc/longjmp.c	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/longjmp.c	Thu Jan 29 13:12:15 2004
@@ -0,0 +1,60 @@
+/* Copyright (C) 1991,92,94,95,97,98,2000,2002 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.  */
+/*
+  Versioned copy of sysdeps/generic/longjmp.c modified for AltiVec support.
+ */
+#include  <shlib-compat.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <signal.h>
+
+extern void __vmx__longjmp (__jmp_buf __env, int __val);
+extern void __vmx__libc_longjmp (sigjmp_buf env, int val)
+     __attribute__ ((noreturn));
+libc_hidden_proto (__vmx__libc_longjmp)
+
+/* Set the signal mask to the one specified in ENV, and jump
+   to the position specified in ENV, causing the setjmp
+   call there to return VAL, or 1 if VAL is 0.  */
+void
+__vmx__libc_siglongjmp (sigjmp_buf env, int val)
+{
+  /* Perform any cleanups needed by the frames being unwound.  */
+  _longjmp_unwind (env, val);
+
+  if (env[0].__mask_was_saved)
+    /* Restore the saved signal mask.  */
+    (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
+			  (sigset_t *) NULL);
+
+  /* Call the machine-dependent function to restore machine state.  */
+  __vmx__longjmp (env[0].__jmpbuf, val ?: 1);
+}
+
+strong_alias (__vmx__libc_siglongjmp, __vmx__libc_longjmp)
+libc_hidden_def (__vmx__libc_longjmp)
+weak_alias (__vmx__libc_siglongjmp, __vmx_longjmp)
+weak_alias (__vmx__libc_siglongjmp, __vmxlongjmp)
+weak_alias (__vmx__libc_siglongjmp, __vmxsiglongjmp)
+
+
+default_symbol_version (__vmx__libc_longjmp, __libc_longjmp, GLIBC_2.3.4);
+default_symbol_version (__vmx__libc_siglongjmp, __libc_siglongjmp, GLIBC_2.3.4);
+default_symbol_version (__vmx_longjmp, _longjmp, GLIBC_2.3.4);
+default_symbol_version (__vmxlongjmp, longjmp, GLIBC_2.3.4);
+default_symbol_version (__vmxsiglongjmp, siglongjmp, GLIBC_2.3.4);
diff -urN libc23-cvstip-20040129/sysdeps/powerpc/novmxsetjmp.h libc23/sysdeps/powerpc/novmxsetjmp.h
--- libc23-cvstip-20040129/sysdeps/powerpc/novmxsetjmp.h	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/novmxsetjmp.h	Fri Jan 30 16:12:40 2004
@@ -0,0 +1,138 @@
+/* Copyright (C) 1991-1999, 2001, 2002, 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.  */
+
+/* copied from setjmp/setjmp.h, powerpc/bits/setjmp.h and modified 
+   appropriately to keep backward compatible with setjmp without 
+   AltiVec/VMX support.  This file is not exported and the interfaces
+   are private to libc.  */
+
+#ifndef	_SETJMP_H
+#define	_SETJMP_H	1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+#define _BITS_SETJMP_H  1
+#include <bits/wordsize.h>
+
+#if defined __USE_MISC || defined _ASM
+/* The following definitions are needed by ASM implementations of the old 
+   (novmx) __longjmp/__setjmp functions.  */
+   
+# 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. */
+#  define JB_FPRS   22 /* FPRs 14 through 31 are saved, 18*2 words total.  */
+#  define JB_SIZE   (40*8)
+# 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   (58*4)
+# endif
+#endif
+
+#ifndef	_ASM
+/* The following definitions are needed by the novmx* implementations of 
+   setjmp/longjmp/sigsetjmp/etc that wrapper __setjmp/__longjmp.  */
+   
+# if __WORDSIZE == 64
+typedef long int __jmp_buf[40];
+# else
+typedef long int __jmp_buf[58];
+# endif
+
+# include <bits/sigset.h>		/* Get `__sigset_t'.  */
+
+/* Calling environment, plus possibly a saved signal mask.  */
+typedef struct __jmp_buf_tag	/* C++ doesn't like tagless structs.  */
+  {
+    /* NOTE: The machine-dependent definitions of `__sigsetjmp'
+       assume that a `jmp_buf' begins with a `__jmp_buf' and that
+       `__mask_was_saved' follows it.  Do not move these members
+       or add others before it.  */
+    __jmp_buf __jmpbuf;		/* Calling environment.  */
+    int __mask_was_saved;	/* Saved the signal mask?  */
+    __sigset_t __saved_mask;	/* Saved signal mask.  */
+  } jmp_buf[1];
+
+
+/* Store the calling environment in ENV, also saving the signal mask.
+   Return 0.  */
+extern int __novmxsetjmp (jmp_buf __env) __THROW;
+
+/* Store the calling environment in ENV, also saving the
+   signal mask if SAVEMASK is nonzero.  Return 0.
+   This is the internal name for `sigsetjmp'.  */
+extern int __novmx__sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROW;
+
+/* Store the calling environment in ENV, not saving the signal mask.
+   Return 0.  */
+extern int __novmx_setjmp (struct __jmp_buf_tag __env[1]) __THROW;
+
+/* Jump to the environment saved in ENV, making the
+   `setjmp' call there return VAL, or 1 if VAL is 0.  */
+extern void __novmxlongjmp (struct __jmp_buf_tag __env[1], int __val)
+     __THROW __attribute__ ((__noreturn__));
+
+/* Same.  Usually `_longjmp' is used with `_setjmp', which does not save
+   the signal mask.  But it is how ENV was saved that determines whether
+   `longjmp' restores the mask; `_longjmp' is just an alias.  */
+extern void __novmx_longjmp (struct __jmp_buf_tag __env[1], int __val)
+     __THROW __attribute__ ((__noreturn__));
+
+/* Use the same type for `jmp_buf' and `sigjmp_buf'.
+   The `__mask_was_saved' flag determines whether
+   or not `longjmp' will restore the signal mask.  */
+typedef struct __jmp_buf_tag sigjmp_buf[1];
+
+/* Jump to the environment saved in ENV, making the
+   sigsetjmp call there return VAL, or 1 if VAL is 0.
+   Restore the signal mask if that sigsetjmp call saved it.
+   This is just an alias `longjmp'.  */
+extern void __novmxsiglongjmp (sigjmp_buf __env, int __val)
+     __THROW __attribute__ ((__noreturn__));
+
+/* Internal machine-dependent function to restore context sans signal mask.  */
+extern void __novmx__longjmp (__jmp_buf __env, int __val)
+     __attribute__ ((__noreturn__));
+
+/* Internal function to possibly save the current mask of blocked signals
+   in ENV, and always set the flag saying whether or not it was saved.
+   This is used by the machine-dependent definition of `__sigsetjmp'.
+   Always returns zero, for convenience.  */
+extern int __novmx__sigjmp_save (jmp_buf __env, int __savemask);
+
+extern void _longjmp_unwind (jmp_buf env, int val);
+
+extern void __novmx__libc_siglongjmp (sigjmp_buf env, int val)
+          __attribute__ ((noreturn));
+	  
+extern void __novmx__libc_longjmp (sigjmp_buf env, int val)
+     __attribute__ ((noreturn));
+     
+libc_hidden_proto (__novmx__libc_longjmp)
+libc_hidden_proto (__novmx_setjmp)
+libc_hidden_proto (__novmx__sigsetjmp)
+#endif /* !_ASM */
+
+#endif
diff -urN libc23-cvstip-20040129/sysdeps/powerpc/powerpc32/novmx-longjmp.c libc23/sysdeps/powerpc/powerpc32/novmx-longjmp.c
--- libc23-cvstip-20040129/sysdeps/powerpc/powerpc32/novmx-longjmp.c	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc32/novmx-longjmp.c	Thu Jan 29 13:12:15 2004
@@ -0,0 +1,58 @@
+/* Copyright (C) 1991,92,94,95,97,98,2000,2002,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.  */
+/*
+  Copy of sysdeps/generic/longjmp.c modified for backward compatibility
+  with old non AltiVec/VMX longjmp.
+ */
+#include  <shlib-compat.h>
+#if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+#include <stddef.h>
+#include <novmxsetjmp.h>
+#include <signal.h>
+
+
+/* Set the signal mask to the one specified in ENV, and jump
+   to the position specified in ENV, causing the setjmp
+   call there to return VAL, or 1 if VAL is 0.  */
+void
+__novmx__libc_siglongjmp (sigjmp_buf env, int val)
+{
+  /* Perform any cleanups needed by the frames being unwound.  */
+  _longjmp_unwind (env, val);
+
+  if (env[0].__mask_was_saved)
+    /* Restore the saved signal mask.  */
+    (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
+			  (sigset_t *) NULL);
+
+  /* Call the machine-dependent function to restore machine state.  */
+  __novmx__longjmp (env[0].__jmpbuf, val ?: 1);
+}
+
+strong_alias (__novmx__libc_siglongjmp, __novmx__libc_longjmp)
+libc_hidden_def (__novmx__libc_longjmp)
+weak_alias (__novmx__libc_siglongjmp, __novmx_longjmp)
+weak_alias (__novmx__libc_siglongjmp, __novmxlongjmp)
+weak_alias (__novmx__libc_siglongjmp, __novmxsiglongjmp)
+
+symbol_version (__novmx__libc_longjmp,__libc_longjmp,GLIBC_2.0);
+symbol_version (__novmx__libc_siglongjmp,__libc_siglongjmp,GLIBC_2.0);
+symbol_version (__novmx_longjmp,_longjmp,GLIBC_2.0);
+symbol_version (__novmxlongjmp,longjmp,GLIBC_2.0);
+symbol_version (__novmxsiglongjmp,siglongjmp,GLIBC_2.0);
+#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4))  */ 
diff -urN libc23-cvstip-20040129/sysdeps/powerpc/powerpc32/novmx-sigjmp.c libc23/sysdeps/powerpc/powerpc32/novmx-sigjmp.c
--- libc23-cvstip-20040129/sysdeps/powerpc/powerpc32/novmx-sigjmp.c	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc32/novmx-sigjmp.c	Wed Feb 04 18:05:22 2004
@@ -0,0 +1,43 @@
+/* Copyright (C) 1992, 1994, 1997, 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.  */
+
+
+/* Copy of sysdeps/generic/sigjmp.c modified for backward compatibility
+   with old non AltiVec/VMX setjmp.  */
+#include  <shlib-compat.h>
+#if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+#include <stddef.h>
+#include <novmxsetjmp.h>
+#include <signal.h>
+
+/* This function is called by the `sigsetjmp' macro
+   before doing a `__setjmp' on ENV[0].__jmpbuf.
+   Always return zero.  */
+
+int
+__novmx__sigjmp_save (sigjmp_buf env, int savemask)
+{
+  env[0].__mask_was_saved = (savemask &&
+			     __sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
+					    &env[0].__saved_mask) == 0);
+
+  return 0;
+}
+
+symbol_version (__novmx__sigjmp_save,__sigjmp_save,GLIBC_2.0);
+#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) */
diff -urN libc23-cvstip-20040129/sysdeps/powerpc/powerpc64/novmx-longjmp.c libc23/sysdeps/powerpc/powerpc64/novmx-longjmp.c
--- libc23-cvstip-20040129/sysdeps/powerpc/powerpc64/novmx-longjmp.c	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/novmx-longjmp.c	Thu Jan 29 13:12:15 2004
@@ -0,0 +1,59 @@
+/* Copyright (C) 1991,92,94,95,97,98,2000,2002,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.  */
+/*
+  Copy of sysdeps/generic/longjmp.c modified for backward compatibility
+  with old non AltiVec/VMX longjmp.
+ */
+#include  <shlib-compat.h>
+#if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)
+#include <stddef.h>
+#include <novmxsetjmp.h>
+#include <signal.h>
+
+
+/* Set the signal mask to the one specified in ENV, and jump
+   to the position specified in ENV, causing the setjmp
+   call there to return VAL, or 1 if VAL is 0.  */
+void
+__novmx__libc_siglongjmp (sigjmp_buf env, int val)
+{
+  /* Perform any cleanups needed by the frames being unwound.  */
+  _longjmp_unwind (env, val);
+
+  if (env[0].__mask_was_saved)
+    /* Restore the saved signal mask.  */
+    (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
+			  (sigset_t *) NULL);
+
+  /* Call the machine-dependent function to restore machine state.  */
+  __novmx__longjmp (env[0].__jmpbuf, val ?: 1);
+}
+
+strong_alias (__novmx__libc_siglongjmp, __novmx__libc_longjmp)
+libc_hidden_def (__novmx__libc_longjmp)
+weak_alias (__novmx__libc_siglongjmp, __novmx_longjmp)
+weak_alias (__novmx__libc_siglongjmp, __novmxlongjmp)
+weak_alias (__novmx__libc_siglongjmp, __novmxsiglongjmp)
+
+symbol_version (__novmx__libc_longjmp,__libc_longjmp,GLIBC_2.3);
+symbol_version (__novmx__libc_siglongjmp,__libc_siglongjmp,GLIBC_2.3);
+symbol_version (__novmx_longjmp,_longjmp,GLIBC_2.3);
+symbol_version (__novmxlongjmp,longjmp,GLIBC_2.3);
+symbol_version (__novmxsiglongjmp,siglongjmp,GLIBC_2.3);
+#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4) */
+
diff -urN libc23-cvstip-20040129/sysdeps/powerpc/powerpc64/novmx-sigjmp.c libc23/sysdeps/powerpc/powerpc64/novmx-sigjmp.c
--- libc23-cvstip-20040129/sysdeps/powerpc/powerpc64/novmx-sigjmp.c	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/powerpc64/novmx-sigjmp.c	Wed Feb 04 18:05:22 2004
@@ -0,0 +1,42 @@
+/* Copyright (C) 1992, 1994, 1997, 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.  */
+
+/* Copy of sysdeps/generic/sigjmp.c modified for backward compatibility
+   with old non AltiVec/VMX setjmp.  */
+#include  <shlib-compat.h>
+#if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)
+#include <stddef.h>
+#include <novmxsetjmp.h>
+#include <signal.h>
+
+/* This function is called by the `sigsetjmp' macro
+   before doing a `__setjmp' on ENV[0].__jmpbuf.
+   Always return zero.  */
+
+int
+__novmx__sigjmp_save (sigjmp_buf env, int savemask)
+{
+  env[0].__mask_was_saved = (savemask &&
+			     __sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
+					    &env[0].__saved_mask) == 0);
+
+  return 0;
+}
+
+symbol_version (__novmx__sigjmp_save,__sigjmp_save,GLIBC_2.3);
+#endif /* SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4) */
diff -urN libc23-cvstip-20040129/sysdeps/powerpc/sigjmp.c libc23/sysdeps/powerpc/sigjmp.c
--- libc23-cvstip-20040129/sysdeps/powerpc/sigjmp.c	Wed Dec 31 17:00:00 1969
+++ libc23/sysdeps/powerpc/sigjmp.c	Thu Jan 29 13:12:15 2004
@@ -0,0 +1,41 @@
+/* Copyright (C) 1992, 1994, 1997 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.  */
+/*
+  Versioned copy of sysdeps/generic/sigjmp.c modified for AltiVec support.
+ */
+#include  <shlib-compat.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <signal.h>
+
+/* This function is called by the `sigsetjmp' macro
+   before doing a `__setjmp' on ENV[0].__jmpbuf.
+   Always return zero.  */
+
+int
+__vmx__sigjmp_save (sigjmp_buf env, int savemask)
+{
+  env[0].__mask_was_saved = (savemask &&
+			     __sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
+					    &env[0].__saved_mask) == 0);
+
+  return 0;
+}
+
+default_symbol_version (__vmx__sigjmp_save,__sigjmp_save,GLIBC_2.3.4);
+

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