This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] boehm gc support for CRIS


Hi all,

This patch adds support for CRIS platform to Boehm GC.

		Regards Simon

diff -uNr gcc/boehm-gc/include/private/gc_locks.h gcc_cris/boehm-gc/include/private/gc_locks.h
--- gcc/boehm-gc/include/private/gc_locks.h	2003-07-28 06:18:23.000000000 +0200
+++ gcc_cris/boehm-gc/include/private/gc_locks.h	2004-10-25 13:10:37.787187424 +0200
@@ -215,6 +215,28 @@
         }
 #       define GC_TEST_AND_SET_DEFINED
 #    endif /* ARM32 */
+#    ifdef CRIS32
+        inline static int GC_test_and_set(volatile unsigned int *addr) {
+	    /* Riped from linuxthreads/sysdeps/cris/pt-machine.h
+	    */
+	    register unsigned long int ret;
+
+	    /* Note the use of a dummy output of *spinlock to expose the write.  The
+    	    memory barrier is to stop *other* writes being moved past this code.  */
+	    __asm__ __volatile__("clearf\n"
+        		         "0:\n\t"
+                    		 "movu.b [%2],%0\n\t"
+                    		 "ax\n\t"
+                    		 "move.b %3,[%2]\n\t"
+                    		 "bwf 0b\n\t"
+                    		 "clearf"
+                    		 : "=&r" (ret), "=m" (*addr)
+                    		 : "r" (addr), "r" ((int) 1), "m" (*addr)
+                    		 : "memory");
+	    return ret;
+        }
+#       define GC_TEST_AND_SET_DEFINED
+#    endif /* CRIS32 */
 #    ifdef S390
        inline static int GC_test_and_set(volatile unsigned int *addr) {
          int ret;
diff -uNr gcc/boehm-gc/include/private/gcconfig.h gcc_cris/boehm-gc/include/private/gcconfig.h
--- gcc/boehm-gc/include/private/gcconfig.h	2004-10-13 12:34:21.000000000 +0200
+++ gcc_cris/boehm-gc/include/private/gcconfig.h	2004-10-25 13:10:37.791186816 +0200
@@ -229,6 +229,10 @@
 #    define ARM32
 #    define mach_type_known
 # endif
+# if defined(LINUX) && defined(__cris__)
+#    define CRIS32
+#    define mach_type_known
+# endif
 # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || defined(powerpc64) || defined(__powerpc64__))
 #    define POWERPC
 #    define mach_type_known
@@ -475,6 +479,7 @@
 		    /*		   POWERPC    ==> IBM/Apple PowerPC	*/
 		    /*			(MACOS(<=9),DARWIN(incl.MACOSX),*/
 		    /*			 LINUX, NETBSD, NOSYS variants)	*/
+		    /*		   CRIS32       ==> Axis Etrax 100LX 	*/
 
 
 /*
@@ -1797,6 +1802,19 @@
 #   endif
 #endif
 
+# ifdef CRIS32
+#   define MACH_TYPE "CRIS"
+#   define CPP_WORDSZ 32
+#   define ALIGNMENT 1
+#   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 SH
 #   define MACH_TYPE "SH"
 #   define ALIGNMENT 4
@@ -2062,7 +2080,7 @@
 # endif
 
 # if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(DARWIN) \
-	     || defined(LINT) || defined(MSWINCE) || defined(ARM32) \
+	     || defined(LINT) || defined(MSWINCE) || defined(ARM32) || defined(CRIS32) \
 	     || (defined(I386) && defined(__LCC__))
 	/* Use setjmp based hack to mark from callee-save registers.    */
 	/* The define should move to the individual platform 		*/
diff -uNr gcc/boehm-gc/os_dep.c gcc_cris/boehm-gc/os_dep.c
--- gcc/boehm-gc/os_dep.c	2004-08-14 01:05:30.000000000 +0200
+++ gcc_cris/boehm-gc/os_dep.c	2004-10-25 13:10:37.795186208 +0200
@@ -2510,7 +2510,11 @@
 #               if defined(ARM32)
                   char * addr = (char *)sc.fault_address;
 #               else
-		  --> architecture not supported
+#		  if defined(CRIS32)
+		    char * addr = (char *)sc.regs.csraddr;
+#		  else
+		    --> architecture not supported
+#		  endif
 #               endif
 #	      endif
 #	    endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]