gc_priv.h (GC_test_and_set): Implementation for Linux PPC from Franz Sirl <Franz...
authorTom Tromey <tromey@cygnus.com>
Wed, 4 Aug 1999 03:26:15 +0000 (03:26 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 4 Aug 1999 03:26:15 +0000 (03:26 +0000)
* gc_priv.h (GC_test_and_set): Implementation for Linux PPC from
Franz Sirl <Franz.Sirl-kernel@lauterbach.com>.

From-SVN: r28480

boehm-gc/ChangeLog
boehm-gc/gc_priv.h

index ba41a45dcf360a802f52e1415e90a5678caf0d97..1ddff1cf906be14696c7c39abac75ac32b3d5517 100644 (file)
@@ -1,3 +1,8 @@
+1999-08-03  Tom Tromey  <tromey@cygnus.com>
+
+       * gc_priv.h (GC_test_and_set): Implementation for Linux PPC from
+       Franz Sirl <Franz.Sirl-kernel@lauterbach.com>.
+
 1999-08-02  Tom Tromey  <tromey@cygnus.com>
 
        * aclocal.m4, configure: Rebuilt for new libtool.
index cc8b1476ddc2da6e56ab5b9751bc9168cea68e19..29035336f62a51ea792d831cfcde6b02b007b63e 100644 (file)
@@ -465,6 +465,29 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
           __asm__ __volatile__("mb": : :"memory");
           *(addr) = 0;
        }
+#    elif defined(__powerpc__)
+       inline static int GC_test_and_set(volatile unsigned int *addr) {
+        int ret, oldval=0, newval=1;
+  
+        __asm__ __volatile__("sync" : : : "memory");
+        __asm__ __volatile__(
+                             "0:    lwarx %0,0,%1 ;"
+                             "      xor. %0,%3,%0;"
+                             "      bne 1f;"
+                             "      stwcx. %2,0,%1;"
+                             "      bne- 0b;"
+                             "1:    "
+                             : "=&r"(ret)
+                             : "r"(addr), "r"(newval), "r"(oldval)
+                             : "cr0", "memory");
+        __asm__ __volatile__("sync" : : : "memory");
+        return ret == 0;
+       }
+       inline static void GC_clear(volatile unsigned int *addr) {
+          __asm__ __volatile__("sync": : :"memory");
+          *(addr) = 0;
+       }
+
 #    else
        -- > Need implementation of GC_test_and_set()
 #    endif