summaryrefslogtreecommitdiffstats
path: root/recipes/mozilla/files/Fix-xptinvoke-and-xptstubs-on-mips-o32-big-endian.patch
blob: d373bddc1e6e73dfc3f67c674b0395480135b490 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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
         }
     }