Hi,

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. I've
done my best to update it to the current CVS HEAD (patch attached).
It builds and passes the test suite [1].

I hope this patch can be merged.

Personally, I don't have access to any avr32 hardware, but Debian has an
avr32 porterbox [2] that it was tested on. Should anyone want to make
any changes to it before merging, it can be tested again.

Thanks,

SR

[0]: 
http://git.chris-lamb.co.uk/?p=pkg-gc.git;a=blob;f=debian/patches/03-add-avr32-support.diff
[1]: http://paste.debian.net/73993/
[2]: http://db.debian.org/machines.cgi?host=xoothais

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  H: +27 21 465 6908 C: +27 72 419 8559  UCT: x3127
Index: mach_dep.c
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/mach_dep.c,v
retrieving revision 1.21
diff -u -a -p -r1.21 mach_dep.c
--- mach_dep.c	6 Nov 2009 07:16:05 -0000	1.21
+++ mach_dep.c	16 May 2010 21:20:54 -0000
@@ -173,7 +173,7 @@ asm static void PushMacRegisters()
 
 #if defined(UNIX_LIKE) && !defined(NO_GETCONTEXT) && \
         (defined(DARWIN) || defined(HURD) || defined(OPENBSD) \
-         || defined(ARM32) || defined(MIPS))
+         || defined(ARM32) || defined(MIPS) || defined(AVR32))
 # define NO_GETCONTEXT
 #endif
 
Index: include/private/gcconfig.h
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/include/private/gcconfig.h,v
retrieving revision 1.65
diff -u -a -p -r1.65 gcconfig.h
--- include/private/gcconfig.h	19 Mar 2010 19:21:02 -0000	1.65
+++ include/private/gcconfig.h	16 May 2010 21:20:56 -0000
@@ -281,6 +281,10 @@
 #    define SH
 #    define mach_type_known
 # endif
+# if defined(LINUX) && defined(__avr32__)
+#    define AVR32
+#    define mach_type_known
+# endif
 # if defined(LINUX) && defined(__m32r__)
 #    define M32R
 #    define mach_type_known
@@ -1965,6 +1969,19 @@
 #   define DATAEND /* not needed */
 # endif
 
+# ifdef AVR32
+#   define MACH_TYPE "AVR32"
+#   define CPP_WORDSZ 32
+#   define ALIGNMENT 4
+#   define OS_TYPE "LINUX"
+#   define DYNAMIC_LOADING
+#   define LINUX_STACKBOTTOM
+#   define USE_GENERIC_PUSH_REGS
+#   define SEARCH_FOR_DATA_START
+      extern int _end[];
+#   define DATAEND (_end)
+# endif
+
 # ifdef M32R
 #   define CPP_WORDSZ 32
 #   define MACH_TYPE "M32R"
Index: include/private/thread_local_alloc.h
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/include/private/thread_local_alloc.h,v
retrieving revision 1.16
diff -u -a -p -r1.16 thread_local_alloc.h
--- include/private/thread_local_alloc.h	22 Oct 2009 17:52:42 -0000	1.16
+++ include/private/thread_local_alloc.h	16 May 2010 21:20:56 -0000
@@ -42,7 +42,7 @@
 #     else
 #       define USE_WIN32_COMPILER_TLS
 #     endif /* !GNU */
-#   elif defined(LINUX) && !defined(ARM32) && \
+#   elif defined(LINUX) && !defined(ARM32) && !defined(AVR32) && \
                  (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >=3))
 #     define USE_COMPILER_TLS
 #   elif (defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) || \
Index: libatomic_ops/src/atomic_ops.h
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/libatomic_ops/src/atomic_ops.h,v
retrieving revision 1.4
diff -u -a -p -r1.4 atomic_ops.h
--- libatomic_ops/src/atomic_ops.h	19 Feb 2010 17:12:07 -0000	1.4
+++ libatomic_ops/src/atomic_ops.h	16 May 2010 21:20:56 -0000
@@ -252,6 +252,9 @@
 #   include "atomic_ops/sysdeps/gcc/sh.h"
 #   define AO_CAN_EMUL_CAS
 # endif /* __sh__ */
+# if defined(__avr32__)
+#   include "atomic_ops/sysdeps/gcc/avr32.h"
+# endif
 #endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */
 
 #if defined(__INTEL_COMPILER) && !defined(AO_USE_PTHREAD_DEFS)
Index: libatomic_ops/src/atomic_ops/sysdeps/gcc/avr32.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ libatomic_ops/src/atomic_ops/sysdeps/gcc/avr32.h	2009-08-12 20:10:18.000000000 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 Bradley Smith <b...@brad-smith.co.uk>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "../all_atomic_load_store.h"
+
+#include "../ordered.h"  /* There are no multiprocessor implementations. */
+
+#include "../test_and_set_t_is_ao_t.h"
+
+AO_INLINE AO_TS_VAL_t
+AO_test_and_set(volatile AO_TS_t *addr) {
+	int ret;
+
+	__asm__ __volatile__(
+		"xchg %[old], %[mem], %[newv]"
+		: [old] "=&r"(ret)
+		: [mem] "r"(addr), [newv] "r"(1)
+		: "memory");
+
+	return ret;
+}
+
+#define AO_HAVE_test_and_set

Attachment: signature.asc
Description: Digital signature

Reply via email to