[patch] libgcj on powerpc linux

Brad Midgley brad@pht.com
Mon Aug 2 15:40:00 GMT 1999


hi,

the debian project provided an implementation of the test&set/clear
methods for powerpc linux. I just patched it in and included it.

the compile doesn't yet succeed; cc1 breaks on the -fuse-divide-subroutine
when gcj is called to link together .libs/jv-convert (i'm using gcc 2.95
but i'll look around to see why this happens in my build) 

Brad
brad@pht.com | http://www.pht.com/~brad/


--- boehm-gc/gc_priv.h.old	Mon Aug  2 16:05:14 1999
+++ boehm-gc/gc_priv.h	Mon Aug  2 16:20:37 1999
@@ -465,6 +465,25 @@
           __asm__ __volatile__("mb": : :"memory");
           *(addr) = 0;
        }
+#    elif defined(__powerpc__)
+       inline static int GC_test_and_set(volatile unsigned int *addr) {
+	  int oldval;
+	  __asm__ __volatile__(
+		"sync;"
+		"0:    lwarx %0,0,%1 ;"
+		"      xor. %0,%3,%0;"
+		"      bne 1f;"
+		"      stwcx. %2,0,%1;"
+		"      bne- 0b;"
+		"1:    sync"
+		: "=&r"(oldval)
+		: "r"(addr), "r"(1), "r"(0)
+		: "cr0", "memory");
+	  return oldval;
+       }
+       inline static void GC_clear(volatile unsigned int *addr) {
+          *(addr) = 0;
+       }
 #    else
        -- > Need implementation of GC_test_and_set()
 #    endif





More information about the Java-patches mailing list