sparc v9 fixes for sun tools
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
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