summaryrefslogtreecommitdiff
path: root/packages/mono/files/mono-mips-endian.patch
blob: c0f1d3c759ed93f0203c7fbe17fba1a5a721b7c2 (plain)
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
--- mono-1.2.20070131/mono/mini/mini-mips.c	2007-01-31 07:00:22.000000000 +0100
+++ mono-1.2.20070131.mod/mono/mini/mini-mips.c	2007-02-17 21:22:34.000000000 +0100
@@ -238,6 +238,11 @@
 patch_lui_addiu(guint32 *ip, guint32 val)
 {
 	guint16 *__lui_addiu = (guint16*)(void *)(ip);
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+ 	int index=1;
+#else
+	int index=0;
+#endif
 
 #if 0
 	printf ("patch_lui_addiu ip=0x%08x (0x%08x, 0x%08x) to point to 0x%08x\n",
@@ -245,10 +250,10 @@
 	fflush (stdout);
 #endif
 	if (((guint32)(val)) & (1 << 15))
-		__lui_addiu [1] = ((((guint32)(val)) >> 16) & 0xffff) + 1;
+		__lui_addiu [index] = ((((guint32)(val)) >> 16) & 0xffff) + 1;
 	else
-		__lui_addiu [1] = (((guint32)(val)) >> 16) & 0xffff;
-	__lui_addiu [3] = ((guint32)(val)) & 0xffff;
+		__lui_addiu [index] = (((guint32)(val)) >> 16) & 0xffff;
+	__lui_addiu [index+2] = ((guint32)(val)) & 0xffff;
 	mono_arch_flush_icache ((guint8 *)ip, 8);
 }