patches/glibc/2.1.3/rh62-07-glibc-2.1.3-alpha.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.1.3/rh62-07-glibc-2.1.3-alpha.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,124 @@
     1.4 +2000-03-15  Cristian Gafton  <gafton@redhat.com>
     1.5 +
     1.6 +	* db2/mutex/alpha.gcc (TSL_SET): Backport from db3.
     1.7 +	* sysdeps/alpha/Makefile (CPPFLAGS): Define for db2 directory.
     1.8 +	* db2/mutex/mutex.c: Include alpha.gcc ifdef HAVE_ASSEM_ALPHA_GCC.
     1.9 +
    1.10 +2000-03-14  Ulrich Drepper  <drepper@redhat.com>
    1.11 +
    1.12 +	* sysdeps/unix/sysv/linux/alpha/ioperm.c (platform): Add entry for
    1.13 +	Nautilus.  Patch by Soohoon Lee <soohoon.lee@alpha-processor.com>.
    1.14 +
    1.15 +--- glibc-2.1.3-15/db2/mutex/alpha.gcc	Wed Aug 27 15:32:54 1997
    1.16 ++++ glibc-2.1.3-16/db2/mutex/alpha.gcc	Wed Mar 15 16:50:45 2000
    1.17 +@@ -1,52 +1,24 @@
    1.18 + /*
    1.19 +- * @(#)alpha.gcc	10.1 (Sleepycat) 4/12/97
    1.20 +- *
    1.21 +- * The code appearing below is taken from Richard L. Sites, ed.  "Alpha
    1.22 +- * Architecture Reference Manual", Digital Press, 1992, page 5-7 and 5-8.
    1.23 +- * There are 2 modifications:
    1.24 +- *
    1.25 +- * 1. The jump from blbs __r1,30f to !__r1, which is dictated by the way the
    1.26 +- * TSL_SET macro is used.  The code suggested in Sites includes the main loop
    1.27 +- * of the spin lock, whereas in this code the rest the loop is specified in C.
    1.28 +- * The generated code might be suboptimal if the compiler generates a forward
    1.29 +- * branch for the usual case in which the mutex is uncontested.
    1.30 +- *
    1.31 +- * 2. At label 20, Sites suggests including code for testing for an excessive
    1.32 +- * number of _processor_ lock conflicts.  (The seq_c instruction stores its
    1.33 +- * first argument provided that no other processor has written to a byte range
    1.34 +- * including its memory-location argument.)  Absent such checking the code
    1.35 +- * below could conceivably stall silently on a multiprocessor alpha, depending
    1.36 +- * on how often processor/processor conflicts occur in a particular byte range.
    1.37 +- *
    1.38 +- * Note that the mb ("memory-barrier") instruction in TSL_UNSET is critical to
    1.39 +- * correct operation in a multiprocessor alpha (as is, of course, the mb in
    1.40 +- * the TSL_SET macro).  Without the mb, changes to shared memory that occurred
    1.41 +- * inside the critical section (before the TSL_UNSET) might reach shared memory
    1.42 +- * _after_ the change of tsl to 0, thereby permitting another processor to see
    1.43 +- * an inconsistent view of the data protected by the mutex.
    1.44 ++ * @(#)alpha.gcc	11.1 (Sleepycat) 8/30/99
    1.45 +  *
    1.46 +  * For gcc/alpha, 0 is clear, 1 is set.
    1.47 +  */
    1.48 +-#define TSL_SET(tsl) ({							\
    1.49 ++#ifdef __GNUC__
    1.50 ++#define	TSL_SET(tsl) ({							\
    1.51 + 	register tsl_t *__l = (tsl);					\
    1.52 +-	register tsl_t __r1, __r2;					\
    1.53 +-	__asm__ volatile("						\n\
    1.54 +-	   10: ldq_l %0,(%2)						\n\
    1.55 +-	       blbs  %0,30f						\n\
    1.56 +-	       or    %0,1,%1						\n\
    1.57 +-	       stq_c %1,(%2)						\n\
    1.58 +-	       beq   %1,20f						\n\
    1.59 +-	       mb							\n\
    1.60 +-	       br    30f						\n\
    1.61 +-	   20: br    10b						\n\
    1.62 +-	   30: "							\
    1.63 +-	  : "=&r" (__r1), "=&r" (__r2)					\
    1.64 +-	  : "r" (__l));							\
    1.65 +-	!__r1;								\
    1.66 ++	int __r;							\
    1.67 ++	asm volatile(							\
    1.68 ++		"1:	ldl_l	%0,%1\n"				\
    1.69 ++		"	blbs	%0,2f\n"				\
    1.70 ++		"	mov	1,%0\n"					\
    1.71 ++		"	stl_c	%0,%1\n"				\
    1.72 ++		"	bne	%0,1b\n"				\
    1.73 ++		"	mb\n"						\
    1.74 ++		"2:"							\
    1.75 ++		: "=&r"(__r), "=m"(*__l) : "m"(*__l) : "memory");	\
    1.76 ++	__r;								\
    1.77 + })
    1.78 ++#endif
    1.79 + 
    1.80 +-#define TSL_UNSET(tsl) ({						\
    1.81 +-	register tsl_t *__l = (tsl);					\
    1.82 +-	__asm__ volatile("mb; stq $31,(%0);" : : "r" (__l));		\
    1.83 +-})
    1.84 ++#define	TSL_UNSET(tsl)	(*(tsl) = 0)
    1.85 + #define	TSL_INIT(tsl)	TSL_UNSET(tsl)
    1.86 +--- glibc-2.1.3-15/db2/mutex/mutex.c	Wed Jun 30 11:51:07 1999
    1.87 ++++ glibc-2.1.3-16/db2/mutex/mutex.c	Wed Mar 15 16:50:45 2000
    1.88 +@@ -86,6 +86,10 @@ static const char sccsid[] = "@(#)mutex.
    1.89 + #include "sparc.gcc"
    1.90 + #endif
    1.91 + 
    1.92 ++#ifdef HAVE_ASSEM_ALPHA_GCC
    1.93 ++#include "alpha.gcc"
    1.94 ++#endif
    1.95 ++
    1.96 + #ifdef HAVE_ASSEM_UTS4_CC
    1.97 + #define TSL_INIT(x)
    1.98 + #define TSL_SET(x)	(!uts_lock(x, 1))
    1.99 +--- glibc-2.1.3-15/sysdeps/alpha/Makefile	Thu Jul  9 14:52:03 1998
   1.100 ++++ glibc-2.1.3-16/sysdeps/alpha/Makefile	Wed Mar 15 16:50:45 2000
   1.101 +@@ -17,6 +17,10 @@
   1.102 + # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   1.103 + # Boston, MA 02111-1307, USA.
   1.104 + 
   1.105 ++ifeq ($(subdir),db2)
   1.106 ++CPPFLAGS += -DHAVE_SPINLOCKS=1 -DHAVE_ASSEM_ALPHA_GCC=1
   1.107 ++endif
   1.108 ++
   1.109 + ifeq ($(subdir),gmon)
   1.110 + sysdep_routines += _mcount
   1.111 + endif
   1.112 +--- glibc-2.1.3-15/sysdeps/unix/sysv/linux/alpha/ioperm.c	Mon Oct 11 10:25:24 1999
   1.113 ++++ glibc-2.1.3-16/sysdeps/unix/sysv/linux/alpha/ioperm.c	Wed Mar 15 11:57:14 2000
   1.114 +@@ -1,4 +1,4 @@
   1.115 +-/* Copyright (C) 1992, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
   1.116 ++/* Copyright (C) 1992, 1996-1999, 2000 Free Software Foundation, Inc.
   1.117 +    This file is part of the GNU C Library.
   1.118 +    Contributed by David Mosberger.
   1.119 + 
   1.120 +@@ -139,6 +139,7 @@ static struct platform {
   1.121 +   {"Sable",	IOSYS_CPUDEP},
   1.122 +   {"Miata",	IOSYS_CIA},
   1.123 +   {"Tsunami",	IOSYS_TSUNAMI},
   1.124 ++  {"Nautilus",	IOSYS_TSUNAMI},
   1.125 +   {"Rawhide",	IOSYS_MCPCIA},
   1.126 +   {"Ruffian",	IOSYS_CIA},
   1.127 +   {"Takara",	IOSYS_CIA},