1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/glibc/linuxthreads-2.2.5/linuxthreads-2.2.5-ppc405erratum77.patch Mon Jul 16 16:34:36 2007 +0000
1.3 @@ -0,0 +1,34 @@
1.4 +# see http://bugs.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4155
1.5 +# and http://www.kegel.com/xgcc3/ppc405erratum77.html
1.6 +# See also matching patch for glibc
1.7 +
1.8 +diff -aur glibc-2.2.5.orig/linuxthreads/sysdeps/powerpc/pt-machine.h glibc-2.2.5/linuxthreads/sysdeps/powerpc/pt-machine.h
1.9 +--- glibc-2.2.5.orig/linuxthreads/sysdeps/powerpc/pt-machine.h Thu May 17 12:47:46 2001
1.10 ++++ glibc-2.2.5/linuxthreads/sysdeps/powerpc/pt-machine.h Tue Jul 23 05:38:24 2002
1.11 +@@ -41,6 +41,17 @@
1.12 + #define HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
1.13 + #define IMPLEMENT_TAS_WITH_CAS
1.14 +
1.15 ++#ifdef __PPC405__
1.16 ++/* workaround for PPC405 erratum #77 - Mark Hatle, dank. References:
1.17 ++ http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/89DED00DEBFF54BF87256A8000491BA2/$file/405CR_C_errata_1_2.pdf
1.18 ++ http://ppc.bkbits.net:8080/linuxppc_2_4_devel/cset@1.489
1.19 ++ http://www.kegel.com/xgcc3/ppc405erratum77.html
1.20 ++ FIXME: using dbct instead of sync would be faster */
1.21 ++#define __LINUXTHREADS_PPC405_ERR77_SYNC "sync \n\t"
1.22 ++#else
1.23 ++#define __LINUXTHREADS_PPC405_ERR77_SYNC
1.24 ++#endif
1.25 ++
1.26 + PT_EI int
1.27 + __compare_and_swap (long int *p, long int oldval, long int newval)
1.28 + {
1.29 +@@ -50,6 +61,7 @@
1.30 + "0: lwarx %0,0,%1 ;"
1.31 + " xor. %0,%3,%0;"
1.32 + " bne 1f;"
1.33 ++ __LINUXTHREADS_PPC405_ERR77_SYNC
1.34 + " stwcx. %2,0,%1;"
1.35 + " bne- 0b;"
1.36 + "1: "
1.37 +