Hi gc (2010.05.20_22:13:14_+0200)
> Debian has been carrying a patch porting libgc to avr32 since August
> 2009 [0], which as far as I know has never been forwarded to you.

Whoops, looks like that patch was incomplete [0].

Here's an updated version [1] from the Debian avr32 porter.

SR

[0]: 
http://buildd.debian-ports.org/fetch.php?pkg=libatomic-ops&arch=avr32&ver=7.2~alpha5%2Bcvs20100523-1&stamp=1275228178&file=log&as=raw
[1]: http://files.brad-smith.co.uk/atomic-ops_avr32.h.txt

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  H: +27 21 465 6908 C: +27 72 419 8559  UCT: x3127
Index: libatomic_ops/src/atomic_ops/sysdeps/gcc/avr32.h
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/libatomic_ops/src/atomic_ops/sysdeps/gcc/avr32.h,v
retrieving revision 1.1
diff -u -a -p -r1.1 avr32.h
--- libatomic_ops/src/atomic_ops/sysdeps/gcc/avr32.h	21 May 2010 16:01:36 -0000	1.1
+++ libatomic_ops/src/atomic_ops/sysdeps/gcc/avr32.h	30 May 2010 14:26:09 -0000
@@ -29,16 +29,39 @@
 #include "../test_and_set_t_is_ao_t.h"
 
 AO_INLINE AO_TS_VAL_t
-AO_test_and_set(volatile AO_TS_t *addr)
+AO_test_and_set_full(volatile AO_TS_t *addr)
 {
-        int ret;
+        register unsigned long int ret;
 
         __asm__ __volatile__(
-                "xchg %[old], %[mem], %[newv]"
-                : [old] "=&r"(ret)
-                : [mem] "r"(addr), [newv] "r"(1)
+                "xchg %[oldval], %[mem], %[newval]"
+                : [oldval] "=&r"(ret)
+                : [mem] "r"(addr), [newval] "r"(1)
                 : "memory");
 
         return ret;
 }
-#define AO_HAVE_test_and_set
+#define AO_HAVE_test_and_set_full
+
+AO_INLINE AO_TS_VAL_t
+AO_compare_and_swap(volatile AO_TS_t *addr, long int oldval,
+	long int newval)
+{
+	register long int ret;
+
+	__asm__ __volatile__(
+		"1: ssrf    5\n"
+		"   ld.w    %[res], %[mem]\n"
+		"   eor     %[res], %[oldval]\n"
+		"   brne    2f\n"
+		"   stcond  %[mem], %[newval]\n"
+		"   brne    1b\n"
+		"2:\n"
+		: [res] "=&r"(ret), [mem] "=m"(*addr)
+		: "m"(*addr), [newval] "r"(newval), [oldval] "r"(oldval)
+		: "cc", "memory");
+
+	return ret;
+}
+
+#define AO_HAVE_compare_and_swap

Attachment: signature.asc
Description: Digital signature

Reply via email to