[Pkg-mono-svn-commits] [SCM] mono branch, master, updated. debian/2.4.4.svn151842-1-5-gf924035

Jo Shields directhex at apebox.org
Mon Mar 29 18:39:21 UTC 2010


The following commit has been merged in the master branch:
commit f9240353976148734f89c6d55dea1920d9a6c5d2
Author: Jo Shields <directhex at apebox.org>
Date:   Mon Mar 29 16:45:27 2010 +0100

    QEMU fixes from lool

diff --git a/debian/changelog b/debian/changelog
index 1eac445..0cac18e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,9 @@ mono (2.4.4~svn151842-2) UNRELEASED; urgency=low
       Alexander Sack <asac at ubuntu.com>)
   * debian/patches/mono-thumb2-jit-blx.dpatch:
     + Assorted JIT fixes for ARM (Thanks to Alexander Sack <asac at ubuntu.com>)
+  * debian/patches/arm-cpuinfo-parsing.dpatch:
+    + Smarter CPU detection, to allow Mono to run properly under QEMU without
+      asserting and dying (Thanks to Loïc Minier <loic.minier at ubuntu.com>)
 
  -- Mirco Bauer <meebey at debian.org>  Sat, 20 Feb 2010 12:13:59 +0100
 
diff --git a/debian/patches/00list b/debian/patches/00list
index 57ed8af..07dbaf7 100644
--- a/debian/patches/00list
+++ b/debian/patches/00list
@@ -25,3 +25,4 @@ dont_assert_on_empty_DGC_field_r146984
 skip_docs_build
 mono-arm-thumb2-ftbfs
 mono-thumb2-jit-blx
+arm-cpuinfo-parsing
diff --git a/debian/patches/arm-cpuinfo-parsing.dpatch b/debian/patches/arm-cpuinfo-parsing.dpatch
new file mode 100644
index 0000000..2dd4ab7
--- /dev/null
+++ b/debian/patches/arm-cpuinfo-parsing.dpatch
@@ -0,0 +1,96 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## arm-cpuinfo-parsing.dpatch by  <lool at dooz.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Nicer cpuinfo parsing, allowing to run mono under qemu-arm
+
+ at DPATCH@
+diff -urNad mono-2.4.3+dfsg~/mono/mini/mini-arm.c mono-2.4.3+dfsg/mono/mini/mini-arm.c
+--- mono-2.4.3+dfsg~/mono/mini/mini-arm.c	2010-02-26 13:00:34.000000000 +0100
++++ mono-2.4.3+dfsg/mono/mini/mini-arm.c	2010-02-26 13:05:41.489322938 +0100
+@@ -28,8 +28,12 @@
+ #define mono_mini_arch_unlock() LeaveCriticalSection (&mini_arch_mutex)
+ static CRITICAL_SECTION mini_arch_mutex;
+ 
+-static int v5_supported = 0;
+-static int thumb_supported = 0;
++#define MAYBE 2
++
++/* Assume v5 and Thumb are supported unless cpuinfo says otherwise (ARMv4
++ * without Thumb) */
++static int v5_supported = MAYBE;
++static int thumb_supported = MAYBE;
+ 
+ /*
+  * TODO:
+@@ -150,11 +154,11 @@
+ static guint8*
+ emit_call_reg (guint8 *code, int reg)
+ {
+-	if (v5_supported) {
++	if (v5_supported != FALSE) {
+ 		ARM_BLX_REG (code, reg);
+ 	} else {
+ 		ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_PC);
+-		if (thumb_supported)
++		if (thumb_supported != FALSE)
+ 			ARM_BX (code, reg);
+ 		else
+ 			ARM_MOV_REG_REG (code, ARMREG_PC, reg);
+@@ -461,19 +465,33 @@
+ 		while ((line = fgets (buf, 512, file))) {
+ 			if (strncmp (line, "Processor", 9) == 0) {
+ 				char *ver = strstr (line, "(v");
+-				if (ver && (ver [2] == '5' || ver [2] == '6' || ver [2] == '7')) {
++				if (!ver) {
++					/* invalid cpuinfo; perhaps running withing qemu-arm; skip */
++					break;
++				}
++				if (ver [2] == '5' || ver [2] == '6' || ver [2] == '7') {
+ 					v5_supported = TRUE;
++					/* present since ARMv5 for mono's practical purposes */
++					thumb_supported = TRUE;
++					break;
++				} else if (ver [2] == '4') {
++					v5_supported = FALSE;
++					/* continue scanning for Features */
++					continue;
+ 				}
+-				continue;
++				/* new or very old ARM architecture? */
++				g_assert_not_reached ();
+ 			}
+ 			if (strncmp (line, "Features", 8) == 0) {
++				/* Assume we already parsed Processor and it was v4 */
++				g_assert (v5_supported == FALSE);
+ 				char *th = strstr (line, "thumb");
+ 				if (th) {
+ 					thumb_supported = TRUE;
+-					if (v5_supported)
+-						break;
++				} else {
++					thumb_supported = FALSE;
+ 				}
+-				continue;
++				break;
+ 			}
+ 		}
+ 		fclose (file);
+@@ -1995,7 +2013,7 @@
+ 				 */
+ 				code = (guchar*)thunks;
+ 				ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
+-				if (thumb_supported)
++				if (thumb_supported != FALSE)
+ 					ARM_BX (code, ARMREG_IP);
+ 				else
+ 					ARM_MOV_REG_REG (code, ARMREG_PC, ARMREG_IP);
+@@ -2060,7 +2078,7 @@
+ 		gint tmask = 0xffffffff;
+ 		if (tval & 1) { /* entering thumb mode */
+ 			diff = target - 1 - code - 8;
+-			g_assert (thumb_supported);
++			g_assert (thumb_supported != FALSE);
+ 			tbits = 0xf << 28; /* bl->blx bit pattern */
+ 			g_assert ((ins & (1 << 24))); /* it must be a bl, not b instruction */
+ 			/* this low bit of the displacement is moved to bit 24 in the instruction encoding */

-- 
mono



More information about the Pkg-mono-svn-commits mailing list