patches/glibc/linuxthreads-2.2.5/linuxthreads-2.2.5-ppc405erratum77.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jul 28 21:34:41 2007 +0000 (2007-07-28)
changeset 301 2be7232a73ac
permissions -rw-r--r--
Bump version to 0.2.2.
     1 # see http://bugs.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4155
     2 # and http://www.kegel.com/xgcc3/ppc405erratum77.html
     3 # See also matching patch for glibc
     4 
     5 diff -aur glibc-2.2.5.orig/linuxthreads/sysdeps/powerpc/pt-machine.h glibc-2.2.5/linuxthreads/sysdeps/powerpc/pt-machine.h
     6 --- glibc-2.2.5.orig/linuxthreads/sysdeps/powerpc/pt-machine.h	Thu May 17 12:47:46 2001
     7 +++ glibc-2.2.5/linuxthreads/sysdeps/powerpc/pt-machine.h	Tue Jul 23 05:38:24 2002
     8 @@ -41,6 +41,17 @@
     9  #define HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
    10  #define IMPLEMENT_TAS_WITH_CAS
    11  
    12 +#ifdef __PPC405__
    13 +/* workaround for PPC405 erratum #77 - Mark Hatle, dank.  References:
    14 +   http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/89DED00DEBFF54BF87256A8000491BA2/$file/405CR_C_errata_1_2.pdf
    15 +   http://ppc.bkbits.net:8080/linuxppc_2_4_devel/cset@1.489
    16 +   http://www.kegel.com/xgcc3/ppc405erratum77.html
    17 +   FIXME: using dbct instead of sync would be faster  */
    18 +#define __LINUXTHREADS_PPC405_ERR77_SYNC   "sync \n\t"
    19 +#else
    20 +#define __LINUXTHREADS_PPC405_ERR77_SYNC
    21 +#endif
    22 +
    23  PT_EI int
    24  __compare_and_swap (long int *p, long int oldval, long int newval)
    25  {
    26 @@ -50,6 +61,7 @@
    27  	   "0:    lwarx %0,0,%1 ;"
    28  	   "      xor. %0,%3,%0;"
    29  	   "      bne 1f;"
    30 +	   __LINUXTHREADS_PPC405_ERR77_SYNC
    31  	   "      stwcx. %2,0,%1;"
    32  	   "      bne- 0b;"
    33  	   "1:    "
    34