Bug 323737 (MONO81052) - [PATCH] wrong code generation because of endian problems on mipsel
Summary: [PATCH] wrong code generation because of endian problems on mipsel
Status: RESOLVED FIXED
Alias: MONO81052
Product: Mono: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Paolo Molaro
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-06 19:37 UTC by Thomas Kunze
Modified: 2007-10-04 14:38 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:30:23 UTC


---- Reported by thommy@tabao.de 2007-03-06 12:37:45 MST ----

mini-mips.c has a bug in function patch_lui_addiu:

This patch works for me:

--- 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);
 }


Unknown operating system unknown. Setting to default OS "Other".

Comment 1 Paolo Molaro 2007-10-04 14:38:58 UTC
Thanks for the patch and sorry for the delay.
I committed to svn a simplified change.