patches/gcc/3.2.3/gcc-20020722-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://gcc.gnu.org/PR7383, http://www.kegel.com/xgcc3/ppc405erratum77.html
yann@1
     2
# Fixed in gcc-3.3
yann@1
     3
yann@1
     4
diff -aur gcc-20020722.orig/gcc/config/rs6000/rs6000.h gcc-20020722/gcc/config/rs6000/rs6000.h
yann@1
     5
--- gcc-20020722.orig/gcc/config/rs6000/rs6000.h	Thu Jul 25 09:32:21 2002
yann@1
     6
+++ gcc-20020722/gcc/config/rs6000/rs6000.h	Thu Jul 25 09:34:45 2002
yann@1
     7
@@ -66,7 +66,7 @@
yann@1
     8
 %{mcpu=rsc1: -D_ARCH_PWR} \
yann@1
     9
 %{mcpu=401: -D_ARCH_PPC} \
yann@1
    10
 %{mcpu=403: -D_ARCH_PPC} \
yann@1
    11
-%{mcpu=405: -D_ARCH_PPC} \
yann@1
    12
+%{mcpu=405: -D_ARCH_PPC -D__PPC405__} \
yann@1
    13
 %{mcpu=505: -D_ARCH_PPC} \
yann@1
    14
 %{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} \
yann@1
    15
 %{mcpu=602: -D_ARCH_PPC} \
yann@1
    16
diff -aur gcc-20020722.orig/libjava/sysdep/powerpc/locks.h gcc-20020722/libjava/sysdep/powerpc/locks.h
yann@1
    17
--- gcc-20020722.orig/libjava/sysdep/powerpc/locks.h	Thu Jul 25 09:32:30 2002
yann@1
    18
+++ gcc-20020722/libjava/sysdep/powerpc/locks.h	Thu Jul 25 11:39:13 2002
yann@1
    19
@@ -11,6 +11,17 @@
yann@1
    20
 #ifndef __SYSDEP_LOCKS_H__
yann@1
    21
 #define __SYSDEP_LOCKS_H__
yann@1
    22
 
yann@1
    23
+#ifdef __PPC405__
yann@1
    24
+// workaround for PPC405 erratum #77 - 07/18/02 JRO, dank, NN.  References:
yann@1
    25
+// http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/89DED00DEBFF54BF87256A8000491BA2/$file/405CR_C_errata_1_2.pdf
yann@1
    26
+// http://ppc.bkbits.net:8080/linuxppc_2_4_devel/cset@1.489
yann@1
    27
+// http://www.kegel.com/xgcc3/ppc405erratum77.html
yann@1
    28
+// FIXME: using dbct instead of sync would be faster
yann@1
    29
+#define __LIBGCJ_PPC405_ERR77_SYNC   "sync \n\t"
yann@1
    30
+#else
yann@1
    31
+#define __LIBGCJ_PPC405_ERR77_SYNC
yann@1
    32
+#endif
yann@1
    33
+
yann@1
    34
 typedef size_t obj_addr_t;	/* Integer type big enough for object	*/
yann@1
    35
 				/* address.				*/
yann@1
    36
 
yann@1
    37
@@ -25,6 +36,7 @@
yann@1
    38
 	   "0:    lwarx %0,0,%1 ;"
yann@1
    39
 	   "      xor. %0,%3,%0;"
yann@1
    40
 	   "      bne 1f;"
yann@1
    41
+  	  __LIBGCJ_PPC405_ERR77_SYNC
yann@1
    42
 	   "      stwcx. %2,0,%1;"
yann@1
    43
 	   "      bne- 0b;"
yann@1
    44
 	   "1:    "
yann@1
    45
@@ -58,6 +70,7 @@
yann@1
    46
 	   "0:    lwarx %0,0,%1 ;"
yann@1
    47
 	   "      xor. %0,%3,%0;"
yann@1
    48
 	   "      bne 1f;"
yann@1
    49
+	   __LIBGCJ_PPC405_ERR77_SYNC	 
yann@1
    50
 	   "      stwcx. %2,0,%1;"
yann@1
    51
 	   "      bne- 0b;"
yann@1
    52
 	   "1:    "
yann@1
    53
diff -aur gcc-20020722.orig/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h gcc-20020722/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h
yann@1
    54
--- gcc-20020722.orig/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h	Thu Jul 25 09:32:31 2002
yann@1
    55
+++ gcc-20020722/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h	Thu Jul 25 09:34:45 2002
yann@1
    56
@@ -32,6 +32,17 @@
yann@1
    57
 
yann@1
    58
 typedef int _Atomic_word;
yann@1
    59
 
yann@1
    60
+#ifdef __PPC405__
yann@1
    61
+// workaround for PPC405 erratum #77 - 07/18/02 JRO & dank.  References:
yann@1
    62
+// http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/89DED00DEBFF54BF87256A8000491BA2/$file/405CR_C_errata_1_2.pdf
yann@1
    63
+// http://ppc.bkbits.net:8080/linuxppc_2_4_devel/cset@1.489
yann@1
    64
+// http://www.kegel.com/xgcc3/ppc405erratum77.html
yann@1
    65
+// FIXME: using dbct instead of sync would be faster
yann@1
    66
+#define	__LIBSTDCPP_PPC405_ERR77_SYNC	"sync \n\t"
yann@1
    67
+#else
yann@1
    68
+#define __LIBSTDCPP_PPC405_ERR77_SYNC
yann@1
    69
+#endif
yann@1
    70
+
yann@1
    71
 static inline _Atomic_word
yann@1
    72
 __attribute__ ((__unused__))
yann@1
    73
 __exchange_and_add (volatile _Atomic_word* __mem, int __val)
yann@1
    74
@@ -42,6 +53,7 @@
yann@1
    75
 	"0:\t"
yann@1
    76
 	"lwarx    %0,0,%2 \n\t"
yann@1
    77
 	"add%I3   %1,%0,%3 \n\t"
yann@1
    78
+	__LIBSTDCPP_PPC405_ERR77_SYNC
yann@1
    79
 	"stwcx.   %1,0,%2 \n\t"
yann@1
    80
 	"bne-     0b \n\t"
yann@1
    81
 	"/* End exchange & add */"
yann@1
    82
@@ -61,6 +73,7 @@
yann@1
    83
 	"0:\t"
yann@1
    84
 	"lwarx    %0,0,%1 \n\t"
yann@1
    85
 	"add%I2   %0,%0,%2 \n\t"
yann@1
    86
+	__LIBSTDCPP_PPC405_ERR77_SYNC
yann@1
    87
 	"stwcx.   %0,0,%1 \n\t"
yann@1
    88
 	"bne-     0b \n\t"
yann@1
    89
 	"/* End atomic add */"
yann@1
    90
@@ -78,6 +91,7 @@
yann@1
    91
 	"/* Inline always swap */\n"
yann@1
    92
 	"0:\t"
yann@1
    93
 	"lwarx    %0,0,%1 \n\t"
yann@1
    94
+	__LIBSTDCPP_PPC405_ERR77_SYNC
yann@1
    95
 	"stwcx.   %2,0,%1 \n\t"
yann@1
    96
 	"bne-     0b \n\t"
yann@1
    97
 	"/* End always swap */"
yann@1
    98
@@ -98,6 +112,7 @@
yann@1
    99
 	"lwarx    %0,0,%1 \n\t"
yann@1
   100
 	"cmpwi    %0,0 \n\t"
yann@1
   101
 	"bne-     1f \n\t"
yann@1
   102
+	__LIBSTDCPP_PPC405_ERR77_SYNC
yann@1
   103
 	"stwcx.   %2,0,%1 \n\t"
yann@1
   104
 	"bne-     0b \n"
yann@1
   105
 	"1:\n\t"