[Mono-list] Mono on Sparc64/Debian

Mark Crichton crichton@fishysnax.com
Fri, 21 May 2004 13:14:28 -0400


This is a multi-part message in MIME format.
--------------000303040009080008070505
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Varga Zoltan wrote:

|                              Hi,
|
|   Sparc/linux is not yet supported as a JIT platform at the
| moment.
| Somebody who has access to such a configuration needs to
| cook up a patch.

Attached is one.  Note, Solaris and Linux seem to do something
differently w.r.t. ucontext.  Therefore, exception handling is probably
very, very broken.

Mark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFArjj0Ofj2Ja/u/oARAgEbAKCaloUI9oXi2rKYSNSDQV6kks2XaQCggWTd
nXZWm7uD3oR4myAcxNLKpSE=
=P7hU
-----END PGP SIGNATURE-----

--------------000303040009080008070505
Content-Type: text/plain;
 name="sparc.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="sparc.diff"

? _tmpinst
? diff
? tmpinst-dir.stamp
? mono/arch/sparc/.libs
? mono/arch/sparc/libmonoarch-sparc.la
? mono/arch/sparc/tramp.lo
? mono/mini/log
Index: configure.in
===================================================================
RCS file: /cvs/public/mono/configure.in,v
retrieving revision 1.247
diff -u -r1.247 configure.in
--- configure.in	20 May 2004 10:26:46 -0000	1.247
+++ configure.in	21 May 2004 16:27:13 -0000
@@ -92,7 +92,7 @@
 		platform_win32=no
 		CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
 		need_link_unlink=yes
-		libmono_cflags="-D_REENTRANT"
+		libmono_cflags="-D_REENTRANT -DMONO_SOLARIS"
 		libgc_threads=pthreads
 		;;
 	*-*-darwin*)
Index: mono/mini/exceptions-sparc.c
===================================================================
RCS file: /cvs/public/mono/mono/mini/exceptions-sparc.c,v
retrieving revision 1.17
diff -u -r1.17 exceptions-sparc.c
--- mono/mini/exceptions-sparc.c	18 May 2004 08:27:58 -0000	1.17
+++ mono/mini/exceptions-sparc.c	21 May 2004 16:27:14 -0000
@@ -26,6 +26,10 @@
 #include "mini.h"
 #include "mini-sparc.h"
 
+#ifndef REG_SP
+#define REG_SP REG_O6
+#endif
+
 /*
  * mono_arch_get_restore_context:
  *
@@ -371,7 +375,12 @@
 	 * under documented under solaris. The code below seems to work under
 	 * Solaris 9.
 	 */
+#ifdef MONO_SOLARIS
 	g_assert (!ctx->uc_mcontext.gwins);
+#else
+	/* better, but doesn't work all the time.  need to rethink! */
+	g_assert (!ctx->uc_mcontext.gregs);
+#endif
 
 	mctx.ip = ctx->uc_mcontext.gregs [REG_PC];
 	mctx.sp = ctx->uc_mcontext.gregs [REG_SP];
Index: mono/mini/mini-sparc.c
===================================================================
RCS file: /cvs/public/mono/mono/mini/mini-sparc.c,v
retrieving revision 1.36
diff -u -r1.36 mini-sparc.c
--- mono/mini/mini-sparc.c	7 May 2004 13:29:50 -0000	1.36
+++ mono/mini/mini-sparc.c	21 May 2004 16:27:14 -0000
@@ -14,7 +14,11 @@
  */
 #include "mini.h"
 #include <string.h>
+#include <unistd.h>
+
+#ifdef MONO_SOLARIS
 #include <sys/systeminfo.h>
+#endif
 
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/debug-helpers.h>
@@ -126,8 +130,21 @@
 
 	*exclude_mask = 0;
 
+#ifdef MONO_SOLARIS
 	if (!sysinfo (SI_ISALIST, buf, 1024))
 		g_assert_not_reached ();
+#else
+	/* From glibc.  If the getpagesize is 8192, we're on sparc64, which
+	 * (in)directly implies that we're a v9 or better.
+	 * Improvements to this are greatly accepted...
+	 * Also, we don't differentiate between v7 and v8.  I sense SIGILL
+	 * sniffing in my future.  
+	 */
+	if (getpagesize() == 8192)
+		strcpy (buf, "sparcv9");
+	else
+		strcpy (buf, "sparcv8");
+#endif
 
 	/* 
 	 * On some processors, the cmov instructions are even slower than the
Index: mono/tests/tests-config
===================================================================
RCS file: /cvs/public/mono/mono/tests/tests-config,v
retrieving revision 1.1
diff -u -r1.1 tests-config
--- mono/tests/tests-config	31 May 2002 07:51:40 -0000	1.1
+++ mono/tests/tests-config	21 May 2004 16:27:15 -0000
@@ -1,5 +1,5 @@
 <configuration>
-	<dllmap dll="cygwin1.dll" target="libc.so.6" />
-	<dllmap dll="libc" target="libc.so.6" />
+	<dllmap dll="cygwin1.dll" target="libc.so" />
+	<dllmap dll="libc" target="libc.so" />
 </configuration>
 

--------------000303040009080008070505--