Package: iceowl
Version: 1.0~b1+dfsg1-1
Severity: wishlist
Tags: patch sid
User: debian-powerpc...@breakpoint.cc
Usertags: powerpcspe

The attached patch contains two patches which for powerpcspe support.
The first fixes argument padding on powerpc the second patch adds soft
float abi calling convention which is required for powerpcspe.
Both patches are allready in upstream mozilla tree and in the Debian
xulrunner package (I extraced them from the xulrunner package).
Please apply them unless you plan to switch to the xulrunner package.

Sebastian
>From 2efd06682d56390d92ebc7316bcfb505d13ebb48 Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <bige...@linutronix.de>
Date: Sat, 7 Aug 2010 09:58:36 +0200
Subject: [PATCH] Add support for powerpcspe

- fix argument calling convention
- add support soft fpu

Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
---
 ...ding-of-long-long-arguments-on-ppc-xptcal.patch |  149 ++++++++++++
 ...om-PowerPC-lnx-add-support-for-soft-float.patch |  242 ++++++++++++++++++++
 debian/patches/series                              |    2 +
 3 files changed, 393 insertions(+), 0 deletions(-)
 create mode 100644 
debian/patches/0014-Fix-for-padding-of-long-long-arguments-on-ppc-xptcal.patch
 create mode 100644 
debian/patches/0015-xpcom-PowerPC-lnx-add-support-for-soft-float.patch

diff --git 
a/debian/patches/0014-Fix-for-padding-of-long-long-arguments-on-ppc-xptcal.patch
 
b/debian/patches/0014-Fix-for-padding-of-long-long-arguments-on-ppc-xptcal.patch
new file mode 100644
index 0000000..f9de517
--- /dev/null
+++ 
b/debian/patches/0014-Fix-for-padding-of-long-long-arguments-on-ppc-xptcal.patch
@@ -0,0 +1,149 @@
+From: Mike Hommey <m...@glandium.org>
+Date: Fri, 5 Feb 2010 20:33:51 +0100
+Subject: Fix for padding of long long arguments on ppc xptcall
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=520367
+---
+ .../xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp   |    2 +-
+ xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp     |   86 ++++++++++++++++++++
+ 2 files changed, 87 insertions(+), 1 deletions(-)
+
+diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp 
b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp
+index 815bbfe..033bf4e 100644
+--- a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp
++++ b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp
+@@ -114,8 +114,8 @@ invoke_copy_to_stack(PRUint32* d,
+         }
+         else if (!s->IsPtrData() && (s->type == nsXPTType::T_I64
+                                      || s->type == nsXPTType::T_U64)) {
++            if (gpr & 1) gpr++; // longlongs are aligned in odd/even register 
pairs, eg. r5/r6
+             if ((gpr + 1) < GPR_COUNT) {
+-                if (gpr & 1) gpr++; // longlongs are aligned in odd/even 
register pairs, eg. r5/r6
+                 *((PRUint64*) &gpregs[gpr]) = tempu64;
+                 gpr += 2;
+             }
+diff --git a/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp 
b/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
+index 92ebaef..a0101ca 100644
+--- a/mozilla/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
++++ b/mozilla/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
+@@ -102,6 +102,9 @@ public:
+ 
+     NS_IMETHOD PassTwoStrings(const char* s1, const char* s2, char** retval) 
= 0;
+ 
++    NS_IMETHOD AddMixedInts3(PRInt64 p1, PRInt64 p2, PRInt32 p3, PRInt64 p4,
++                             PRInt32 p5, PRInt32 p6, PRInt64 p7, PRInt64 p8,
++                             PRInt32 p9, PRInt64 p10, PRInt64* retval) = 0;
+ };
+ 
+ NS_DEFINE_STATIC_IID_ACCESSOR(InvokeTestTargetInterface, INVOKETESTTARGET_IID)
+@@ -152,6 +155,10 @@ public:
+     NS_IMETHOD PassTwoStrings(const char* s1, const char* s2, char** retval);
+ 
+     InvokeTestTarget();
++
++    NS_IMETHOD AddMixedInts3(PRInt64 p1, PRInt64 p2, PRInt32 p3, PRInt64 p4,
++                             PRInt32 p5, PRInt32 p6, PRInt64 p7, PRInt64 p8,
++                             PRInt32 p9, PRInt64 p10, PRInt64* retval);
+ };
+ 
+ NS_IMPL_ISUPPORTS1(InvokeTestTarget, InvokeTestTargetInterface)
+@@ -290,6 +297,26 @@ InvokeTestTarget::AddMixedInts2(PRInt32 p1, PRInt64 p2, 
PRInt32 p3, PRInt64 p4,
+ }
+ 
+ NS_IMETHODIMP
++InvokeTestTarget::AddMixedInts3(PRInt64 p1, PRInt64 p2, PRInt32 p3, PRInt64 
p4,
++                             PRInt32 p5, PRInt32 p6, PRInt64 p7, PRInt64 p8,
++                             PRInt32 p9, PRInt64 p10, PRInt64* retval)
++{
++      printf("P1 : %lld\n", p1);
++      printf("P2 : %lld\n", p2);
++      printf("P3 : %d\n",   p3);
++      printf("P4 : %lld\n", p4);
++      printf("P5 : %d\n",   p5);
++      printf("P6 : %d\n",   p6);
++      printf("P7 : %lld\n", p7);
++      printf("P8 : %lld\n", p8);
++      printf("P9 : %d\n",   p9);
++      printf("P10: %lld\n", p10);
++      printf("ret: %p\n",   retval);
++    *retval = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10;
++    return NS_OK;
++}
++
++NS_IMETHODIMP
+ InvokeTestTarget::PassTwoStrings(const char* s1, const char* s2, char** 
retval)
+ {
+     const char milk[] = "milk";
+@@ -385,6 +412,14 @@ int main()
+      else
+          printf("\tFAILED");
+ 
++     if(NS_SUCCEEDED(test->AddMixedInts3(3,5,7,11,13,17,19,23,29,31,&out64)))
++     {
++          LL_L2I(tmp32, out64);
++         printf("\t3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 = %d\n", 
(int)tmp32);
++     }
++     else
++         printf("\tFAILED");
++
+      if(NS_SUCCEEDED(test->AddMixedFloats(1,2,3,4,5,6,7,8,9,10,11,&outD)))
+          printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 = %f\n", 
(double)outD);
+      else
+@@ -905,6 +940,57 @@ int main()
+     else
+         printf("\tFAILED");
+ 
++    var[0].val.i64 = 3;
++    var[0].type = nsXPTType::T_I64;
++    var[0].flags = 0;
++
++    var[1].val.i64 = 5;
++    var[1].type = nsXPTType::T_I64;
++    var[1].flags = 0;
++
++    var[2].val.i32 = 7;
++    var[2].type = nsXPTType::T_I32;
++    var[2].flags = 0;
++
++    var[3].val.i64 = 11;
++    var[3].type = nsXPTType::T_I64;
++    var[3].flags = 0;
++
++    var[4].val.i32 = 13;
++    var[4].type = nsXPTType::T_I32;
++    var[4].flags = 0;
++
++    var[5].val.i32 = 17;
++    var[5].type = nsXPTType::T_I32;
++    var[5].flags = 0;
++
++    var[6].val.i64 = 19;
++    var[6].type = nsXPTType::T_I64;
++    var[6].flags = 0;
++
++    var[7].val.i64 = 23;
++    var[7].type = nsXPTType::T_I64;
++    var[7].flags = 0;
++
++    var[8].val.i32 = 29;
++    var[8].type = nsXPTType::T_I32;
++    var[8].flags = 0;
++
++    var[9].val.i64 = 31;
++    var[9].type = nsXPTType::T_I64;
++    var[9].flags = 0;
++
++    var[10].val.i64 = 0;
++    var[10].type = nsXPTType::T_I64;
++    var[10].flags = nsXPTCVariant::PTR_IS_DATA;
++    var[10].ptr = &var[10].val.i64;
++
++    if(NS_SUCCEEDED(NS_InvokeByIndex(test, 16, 11, var)))
++        printf("\t3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29+ 31 = %d\n",
++             (int)var[10].val.i64);
++    else
++        printf("\tFAILED");
++
+     DoMultipleInheritenceTest();
+     DoMultipleInheritenceTest2();
+     // Disabled by default - takes too much time on slow machines
diff --git 
a/debian/patches/0015-xpcom-PowerPC-lnx-add-support-for-soft-float.patch 
b/debian/patches/0015-xpcom-PowerPC-lnx-add-support-for-soft-float.patch
new file mode 100644
index 0000000..78c5dff
--- /dev/null
+++ b/debian/patches/0015-xpcom-PowerPC-lnx-add-support-for-soft-float.patch
@@ -0,0 +1,242 @@
+From: Sebastian Andrzej Siewior <bige...@linutronix.de>
+Date: Fri, 2 Oct 2009 23:50:34 +0200
+Subject: [PATCH] xpcom/PowerPC lnx: add support for soft-float
+
+current implemention assumes hard float what means dedicated floating
+point registers are used for floating point numbers. This does not work
+on soft float toolchains where dedicated floating point registers and
+opcodes are not used and/or available. On such toolchains the gcc
+compiler provides a built-in define __NO_FPRS__ to signalize such a
+behavior.
+
+http://hg.mozilla.org/mozilla-central/rev/38b06fd30c16
+https://bugzilla.mozilla.org/show_bug.cgi?id=492299
+Target Milestone: mozilla1.9.3a1
+
+Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
+---
+ .../xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s |    9 +++++-
+ .../xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp   |   25 +++++++++++++++++--
+ .../xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s  |    8 +++++-
+ .../xptcall/src/md/unix/xptcstubs_ppc_linux.cpp    |   24 +++++++++++++++++-
+ 4 files changed, 58 insertions(+), 8 deletions(-)
+
+diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s 
b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s
+index 9ffd7ed..1f1f6c3 100644
+--- a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s
++++ b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.s
+@@ -24,6 +24,7 @@
+ //   franz.sirl-ker...@lauterbach.com (Franz Sirl)
+ //   be...@netscape.com (Patrick Beard)
+ //   water...@netscape.com (Chris Waterson)
++//   bige...@linutronix.de (Sebastian Andrzej Siewior)
+ //
+ // Alternatively, the contents of this file may be used under the terms of
+ // either the GNU General Public License Version 2 or later (the "GPL"), or
+@@ -86,10 +87,14 @@ NS_InvokeByIndex_P:
+       mr      r5,r6                           // r5 <= params
+       add     r6,r3,r10                       // r6 <= gpregs ( == args + r10 
)
+       mr      r30,r6                          // store in r30 for use later...
++#ifndef __NO_FPRS__
+       addi    r7,r6,32                        // r7 <= fpregs ( == gpregs + 
32 )
++#else
++      li      r7, 0
++#endif
+ 
+       bl      invoke_copy_to_st...@local      // (args, paramCount, params, 
gpregs, fpregs)
+-
++#ifndef __NO_FPRS__
+       lfd     f1,32(r30)                      // load FP registers with 
method parameters
+       lfd     f2,40(r30)   
+       lfd     f3,48(r30)  
+@@ -98,7 +103,7 @@ NS_InvokeByIndex_P:
+       lfd     f6,72(r30)  
+       lfd     f7,80(r30)  
+       lfd     f8,88(r30)
+-
++#endif
+       lwz     r3,8(r31)                       // r3 <= that
+       lwz     r4,12(r31)                      // r4 <= methodIndex
+       lwz     r5,0(r3)                        // r5 <= vtable ( == *that )
+diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp 
b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp
+index 033bf4e..e7946b7 100644
+--- a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp
++++ b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp
+@@ -23,6 +23,7 @@
+  *   franz.sirl-ker...@lauterbach.com (Franz Sirl)
+  *   be...@netscape.com (Patrick Beard)
+  *   water...@netscape.com (Chris Waterson)
++ *   bige...@linutronix.de (Sebastian Andrzej Siewior)
+  *
+  * Alternatively, the contents of this file may be used under the terms of
+  * either of the GNU General Public License Version 2 or later (the "GPL"),
+@@ -53,10 +54,12 @@
+ // 8 integral parameters are passed in registers
+ #define GPR_COUNT     8
+ 
+-// 8 floating point parameters are passed in registers, floats are
+-// promoted to doubles when passed in registers
++// With hardfloat support 8 floating point parameters are passed in registers,
++// floats are promoted to doubles when passed in registers
++// In Softfloat mode, everything is handled via gprs
++#ifndef __NO_FPRS__
+ #define FPR_COUNT     8
+-
++#endif
+ extern "C" PRUint32
+ invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s)
+ {
+@@ -71,7 +74,9 @@ invoke_copy_to_stack(PRUint32* d,
+                      double* fpregs)
+ {
+     PRUint32 gpr = 1; // skip one GP reg for 'that'
++#ifndef __NO_FPRS__
+     PRUint32 fpr = 0;
++#endif
+     PRUint32 tempu32;
+     PRUint64 tempu64;
+     
+@@ -98,8 +103,17 @@ invoke_copy_to_stack(PRUint32* d,
+         }
+ 
+         if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) {
++#ifndef __NO_FPRS__
+             if (fpr < FPR_COUNT)
+                 fpregs[fpr++]    = s->val.d;
++#else
++            if (gpr & 1)
++                gpr++;
++            if ((gpr + 1) < GPR_COUNT) {
++                *((double*) &gpregs[gpr]) = s->val.d;
++                gpr += 2;
++            }
++#endif
+             else {
+                 if ((PRUint32) d & 4) d++; // doubles are 8-byte aligned on 
stack
+                 *((double*) d) = s->val.d;
+@@ -107,8 +121,13 @@ invoke_copy_to_stack(PRUint32* d,
+             }
+         }
+         else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
++#ifndef __NO_FPRS__
+             if (fpr < FPR_COUNT)
+                 fpregs[fpr++]   = s->val.f; // if passed in registers, floats 
are promoted to doubles
++#else
++            if (gpr < GPR_COUNT)
++                *((float*) &gpregs[gpr++]) = s->val.f;
++#endif
+             else
+                 *((float*) d++) = s->val.f;
+         }
+diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s 
b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s
+index d5834a1..6aff42c 100644
+--- a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s
++++ b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.s
+@@ -24,6 +24,7 @@
+ //   franz.sirl-ker...@lauterbach.com (Franz Sirl)
+ //   be...@netscape.com (Patrick Beard)
+ //   water...@netscape.com (Chris Waterson)
++//   bige...@linutronix.de (Sebastian Andrzej Siewior)
+ //
+ // Alternatively, the contents of this file may be used under the terms of
+ // either the GNU General Public License Version 2 or later (the "GPL"), or
+@@ -75,7 +76,7 @@ SharedStub:
+       stw     r8,28(sp)
+       stw     r9,32(sp)
+       stw     r10,36(sp)
+-
++#ifndef __NO_FPRS__
+       stfd    f1,40(sp)                       // save FP registers
+       stfd    f2,48(sp)
+       stfd    f3,56(sp)
+@@ -84,6 +85,7 @@ SharedStub:
+       stfd    f6,80(sp)
+       stfd    f7,88(sp)
+       stfd    f8,96(sp)
++#endif
+ 
+                                               // r3 has the 'self' pointer 
already
+       
+@@ -94,7 +96,11 @@ SharedStub:
+                                               // beyond r3-r10/f1-f8 mapped 
range
+       
+       addi    r6,sp,8                         // r6 <= gprData
++#ifndef __NO_FPRS__
+       addi    r7,sp,40                        // r7 <= fprData
++#else
++      li      r7, 0                           // r7 should be unused
++#endif
+       
+       bl      prepareanddispa...@local        // Go!
+     
+diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_linux.cpp 
b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_linux.cpp
+index 846583b..8a65994 100644
+--- a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_linux.cpp
++++ b/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_linux.cpp
+@@ -23,6 +23,7 @@
+  *   franz.sirl-ker...@lauterbach.com (Franz Sirl)
+  *   be...@netscape.com (Patrick Beard)
+  *   water...@netscape.com (Chris Waterson)
++ *   bige...@linutronix.de (Sebastian Andrzej Siewior)
+  *
+  * Alternatively, the contents of this file may be used under the terms of
+  * either of the GNU General Public License Version 2 or later (the "GPL"),
+@@ -49,11 +50,14 @@
+ // caller.  The rest of the parameters are passed in the callers stack
+ // area. The stack pointer has to retain 16-byte alignment, longlongs
+ // and doubles are aligned on 8-byte boundaries.
+-
++#ifndef __NO_FPRS__
+ #define PARAM_BUFFER_COUNT     16
+ #define GPR_COUNT               8
+ #define FPR_COUNT               8
+-
++#else
++#define PARAM_BUFFER_COUNT      8
++#define GPR_COUNT               8
++#endif
+ // PrepareAndDispatch() is called by SharedStub() and calls the actual method.
+ //
+ // - 'args[]' contains the arguments passed on stack
+@@ -98,7 +102,9 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+ 
+     PRUint32* ap = args;
+     PRUint32 gpr = 1;    // skip one GPR register
++#ifndef __NO_FPRS__
+     PRUint32 fpr = 0;
++#endif
+     PRUint32 tempu32;
+     PRUint64 tempu64;
+ 
+@@ -108,8 +114,17 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+         nsXPTCMiniVariant* dp = &dispatchParams[i];
+       
+         if (!param.IsOut() && type == nsXPTType::T_DOUBLE) {
++#ifndef __NO_FPRS__
+             if (fpr < FPR_COUNT)
+                 dp->val.d = fprData[fpr++];
++#else
++            if (gpr & 1)
++                gpr++;
++            if (gpr + 1 < GPR_COUNT) {
++                dp->val.d = *(double*) &gprData[gpr];
++                gpr += 2;
++            }
++#endif
+             else {
+                 if ((PRUint32) ap & 4) ap++; // doubles are 8-byte aligned on 
stack
+                 dp->val.d = *(double*) ap;
+@@ -118,8 +133,13 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+             continue;
+         }
+         else if (!param.IsOut() && type == nsXPTType::T_FLOAT) {
++#ifndef __NO_FPRS__
+             if (fpr < FPR_COUNT)
+                 dp->val.f = (float) fprData[fpr++]; // in registers floats 
are passed as doubles
++#else
++            if (gpr  < GPR_COUNT)
++                dp->val.f = *(float*) &gprData[gpr++];
++#endif
+             else
+                 dp->val.f = *(float*) ap++;
+             continue;
diff --git a/debian/patches/series b/debian/patches/series
index eeb1d6c..5f92f8e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,5 @@
 0011-Build-xptcstubs-with-less-optimizations-on-hppa.patch
 0012-Support-building-on-GNU-kFreeBSD-and-GNU-Hurd.patch
 0013-Rerun-autoconf-for-changed-configure.in.patch
+0014-Fix-for-padding-of-long-long-arguments-on-ppc-xptcal.patch
+0015-xpcom-PowerPC-lnx-add-support-for-soft-float.patch
-- 
1.5.6.5

Reply via email to