From: Mike Hommey <mh@glandium.org>
Date: Sun, 14 Feb 2010 14:42:19 +0100
Subject: Fix xptinvoke and xptstubs on mips o32 big endian

---
 .../xptcall/src/md/unix/xptcinvoke_mips.cpp        |   10 +++++++++
 .../reflect/xptcall/src/md/unix/xptcstubs_mips.cpp |   21 ++++++++++++++++++-
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp
index 2c27a26..b2f0da7 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp
@@ -92,18 +92,28 @@ invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount,
 
         switch(s->type)
         {
+        case nsXPTType::T_I8     : *d = (PRUint32) s->val.i8;   break;
+        case nsXPTType::T_I16    : *d = (PRUint32) s->val.i16;  break;
+        case nsXPTType::T_I32    : *d = (PRUint32) s->val.i32;  break;
         case nsXPTType::T_I64    :
             if ((PRWord)d & 4) d++;
             *((PRInt64*) d)  = s->val.i64;    d++;
             break;
+        case nsXPTType::T_U8     : *d = (PRUint32) s->val.u8;   break;
+        case nsXPTType::T_U16    : *d = (PRUint32) s->val.u16;  break;
+        case nsXPTType::T_U32    : *d = (PRUint32) s->val.u32;  break;
         case nsXPTType::T_U64    :
             if ((PRWord)d & 4) d++;
             *((PRUint64*) d) = s->val.u64;    d++;
             break;
+        case nsXPTType::T_FLOAT  : *((float*)   d) = s->val.f;  break;
         case nsXPTType::T_DOUBLE :
             if ((PRWord)d & 4) d++;
             *((double*)   d) = s->val.d;      d++;
             break;
+        case nsXPTType::T_BOOL   : *d = (PRBool)  s->val.b;     break;
+        case nsXPTType::T_CHAR   : *d = (char)    s->val.c;     break;
+        case nsXPTType::T_WCHAR  : *d = (wchar_t) s->val.wc;    break;
         default:
             *((void**)d) = s->val.p;
             break;
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp
index bdce59c..730ab5d 100644
--- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp
@@ -87,8 +87,6 @@ PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args)
             continue;
         }
 
-        dp->val.p = (void*) *ap;
-
         switch(type)
         {
         case nsXPTType::T_I64   :
@@ -103,6 +101,25 @@ PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args)
             if ((PRWord)ap & 4) ap++;
             dp->val.d   = *((double*) ap);  ap++;
             break;
+#ifdef IS_LITTLE_ENDIAN
+        default:
+            dp->val.p = (void*) *ap;
+            break;
+#else
+        case nsXPTType::T_I8    : dp->val.i8  = (PRInt8)   *ap; break;
+        case nsXPTType::T_I16   : dp->val.i16 = (PRInt16)  *ap; break;
+        case nsXPTType::T_I32   : dp->val.i32 = (PRInt32)  *ap; break;
+        case nsXPTType::T_U8    : dp->val.u8  = (PRUint8)  *ap; break;
+        case nsXPTType::T_U16   : dp->val.u16 = (PRUint16) *ap; break;
+        case nsXPTType::T_U32   : dp->val.u32 = (PRUint32) *ap; break;
+        case nsXPTType::T_BOOL  : dp->val.b   = (PRBool)   *ap; break;
+        case nsXPTType::T_CHAR  : dp->val.c   = (char)     *ap; break;
+        case nsXPTType::T_WCHAR : dp->val.wc  = (wchar_t)  *ap; break;
+        case nsXPTType::T_FLOAT : dp->val.f   = *(float *)  ap; break;
+        default:
+            NS_ASSERTION(0, "bad type");
+            break;
+#endif
         }
     }
 
