Commit cb03ea8f4eb08024e44abe4392edc77b89fbfbad

Anthony Green 2013-02-08T12:25:18

sparc v9 fixes for sun tools

diff --git a/ChangeLog b/ChangeLog
index 824d30a..072eba4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-02-08  Anthony Green <green@moxielogic.com>
+
+	* configure.ac: Move sparc asm config checks to within functions
+	for compatibility with sun tools.
+	* configure: Rebuilt.
+	* src/sparc/ffi.c (ffi_prep_closure_loc): Flush cache on v9
+	systems.
+	* src/sparc/v8.S (ffi_flush_icache): Implement a sparc v9 cache
+	flusher.
+
 2013-02-08  Nathan Rossi <nathan.rossi@xilinx.com>
 
 	* src/microblaze/ffi.c (ffi_closure_call_SYSV): Fix handling of
diff --git a/configure b/configure
index 2908c45..771398a 100755
--- a/configure
+++ b/configure
@@ -14450,11 +14450,11 @@ else
        # Check if we have .register
        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-asm (".register %g2, #scratch");
+
 int
 main ()
 {
-
+asm (".register %g2, #scratch");
   ;
   return 0;
 }
@@ -14508,11 +14508,11 @@ else
        # Check if we have .ascii
        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-asm (".ascii \\"string\\"");
+
 int
 main ()
 {
-
+asm (".ascii \\"string\\"");
   ;
   return 0;
 }
@@ -14543,11 +14543,11 @@ else
        # Check if we have .string
        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-asm (".string \\"string\\"");
+
 int
 main ()
 {
-
+asm (".string \\"string\\"");
   ;
   return 0;
 }
diff --git a/configure.ac b/configure.ac
index 1d1eed2..c3cd132 100644
--- a/configure.ac
+++ b/configure.ac
@@ -338,7 +338,7 @@ if test x$TARGET = xSPARC; then
        libffi_cv_as_register_pseudo_op, [
        libffi_cv_as_register_pseudo_op=unknown
        # Check if we have .register
-       AC_TRY_COMPILE([asm (".register %g2, #scratch");],,
+       AC_TRY_COMPILE(,[asm (".register %g2, #scratch");],
 		       [libffi_cv_as_register_pseudo_op=yes],
 		       [libffi_cv_as_register_pseudo_op=no])
     ])
@@ -366,7 +366,7 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64
        libffi_cv_as_ascii_pseudo_op, [
        libffi_cv_as_ascii_pseudo_op=unknown
        # Check if we have .ascii
-       AC_TRY_COMPILE([asm (".ascii \\"string\\"");],,
+       AC_TRY_COMPILE(,[asm (".ascii \\"string\\"");],
 		       [libffi_cv_as_ascii_pseudo_op=yes],
 		       [libffi_cv_as_ascii_pseudo_op=no])
     ])
@@ -379,7 +379,7 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64
        libffi_cv_as_string_pseudo_op, [
        libffi_cv_as_string_pseudo_op=unknown
        # Check if we have .string
-       AC_TRY_COMPILE([asm (".string \\"string\\"");],,
+       AC_TRY_COMPILE(,[asm (".string \\"string\\"");],
 		       [libffi_cv_as_string_pseudo_op=yes],
 		       [libffi_cv_as_string_pseudo_op=no])
     ])
diff --git a/doc/stamp-vti b/doc/stamp-vti
index 38f07d7..883a8ff 100644
--- a/doc/stamp-vti
+++ b/doc/stamp-vti
@@ -1,4 +1,4 @@
 @set UPDATED 6 February 2013
 @set UPDATED-MONTH February 2013
-@set EDITION 3.0.12-rc2
-@set VERSION 3.0.12-rc2
+@set EDITION 3.0.12-rc3
+@set VERSION 3.0.12-rc3
diff --git a/doc/version.texi b/doc/version.texi
index 38f07d7..883a8ff 100644
--- a/doc/version.texi
+++ b/doc/version.texi
@@ -1,4 +1,4 @@
 @set UPDATED 6 February 2013
 @set UPDATED-MONTH February 2013
-@set EDITION 3.0.12-rc2
-@set VERSION 3.0.12-rc2
+@set EDITION 3.0.12-rc3
+@set VERSION 3.0.12-rc3
diff --git a/src/sparc/ffi.c b/src/sparc/ffi.c
index 7c384ef..564be13 100644
--- a/src/sparc/ffi.c
+++ b/src/sparc/ffi.c
@@ -521,16 +521,15 @@ ffi_prep_closure_loc (ffi_closure* closure,
   closure->user_data = user_data;
 
   /* Flush the Icache.  closure is 8 bytes aligned.  */
+#ifdef __GNUC__
 #ifdef SPARC64
   asm volatile ("flush	%0; flush %0+8" : : "r" (closure) : "memory");
 #else
-#ifdef __GNUC__
   asm volatile ("iflush	%0; iflush %0+8" : : "r" (closure) : "memory");
   /* SPARC v8 requires 5 instructions for flush to be visible */
   asm volatile ("nop; nop; nop; nop; nop");
-#else
-  ffi_flush_icache (closure, 16);
 #endif
+  ffi_flush_icache (closure, 16);
 #endif
 
   return FFI_OK;
diff --git a/src/sparc/v8.S b/src/sparc/v8.S
index 4faf3bd..ba3cdac 100644
--- a/src/sparc/v8.S
+++ b/src/sparc/v8.S
@@ -41,7 +41,11 @@
 ffi_flush_icache:
 _ffi_flush_icache:	
         add %o0, %o1, %o2
+#ifdef SPARC64	
+1:	flush %o0
+#else	
 1:	iflush %o0
+#endif
 	add %o0, 8, %o0
 	cmp %o0, %o2
 	blt 1b