patches/glibc/linuxthreads-2.2.5/linuxthreads-2.2.5-ppc405erratum77.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
yann@1
     1
# see http://bugs.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4155
yann@1
     2
# and http://www.kegel.com/xgcc3/ppc405erratum77.html
yann@1
     3
# See also matching patch for glibc
yann@1
     4
yann@1
     5
diff -aur glibc-2.2.5.orig/linuxthreads/sysdeps/powerpc/pt-machine.h glibc-2.2.5/linuxthreads/sysdeps/powerpc/pt-machine.h
yann@1
     6
--- glibc-2.2.5.orig/linuxthreads/sysdeps/powerpc/pt-machine.h	Thu May 17 12:47:46 2001
yann@1
     7
+++ glibc-2.2.5/linuxthreads/sysdeps/powerpc/pt-machine.h	Tue Jul 23 05:38:24 2002
yann@1
     8
@@ -41,6 +41,17 @@
yann@1
     9
 #define HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
yann@1
    10
 #define IMPLEMENT_TAS_WITH_CAS
yann@1
    11
 
yann@1
    12
+#ifdef __PPC405__
yann@1
    13
+/* workaround for PPC405 erratum #77 - Mark Hatle, dank.  References:
yann@1
    14
+   http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/89DED00DEBFF54BF87256A8000491BA2/$file/405CR_C_errata_1_2.pdf
yann@1
    15
+   http://ppc.bkbits.net:8080/linuxppc_2_4_devel/cset@1.489
yann@1
    16
+   http://www.kegel.com/xgcc3/ppc405erratum77.html
yann@1
    17
+   FIXME: using dbct instead of sync would be faster  */
yann@1
    18
+#define __LINUXTHREADS_PPC405_ERR77_SYNC   "sync \n\t"
yann@1
    19
+#else
yann@1
    20
+#define __LINUXTHREADS_PPC405_ERR77_SYNC
yann@1
    21
+#endif
yann@1
    22
+
yann@1
    23
 PT_EI int
yann@1
    24
 __compare_and_swap (long int *p, long int oldval, long int newval)
yann@1
    25
 {
yann@1
    26
@@ -50,6 +61,7 @@
yann@1
    27
 	   "0:    lwarx %0,0,%1 ;"
yann@1
    28
 	   "      xor. %0,%3,%0;"
yann@1
    29
 	   "      bne 1f;"
yann@1
    30
+	   __LINUXTHREADS_PPC405_ERR77_SYNC
yann@1
    31
 	   "      stwcx. %2,0,%1;"
yann@1
    32
 	   "      bne- 0b;"
yann@1
    33
 	   "1:    "
yann@1
    34