Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 65505 Details for
Bug 101821
firefox support on ppc64 platform
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
ppc64 mozilla-firefox-1.0.6
mozilla-ppc64.patch (text/plain), 27.56 KB, created by
Markus Rothe (RETIRED)
on 2005-08-09 00:50:15 UTC
(
hide
)
Description:
ppc64 mozilla-firefox-1.0.6
Filename:
MIME Type:
Creator:
Markus Rothe (RETIRED)
Created:
2005-08-09 00:50:15 UTC
Size:
27.56 KB
patch
obsolete
>diff -ruN mozilla.orig/nsprpub/pr/include/md/_linux.cfg mozilla/nsprpub/pr/include/md/_linux.cfg >--- mozilla.orig/nsprpub/pr/include/md/_linux.cfg 2005-05-04 18:06:17.000000000 +0000 >+++ mozilla/nsprpub/pr/include/md/_linux.cfg 2005-08-06 18:37:15.000000000 +0000 >@@ -45,7 +45,52 @@ > > #define PR_AF_INET6 10 /* same as AF_INET6 */ > >-#ifdef __powerpc__ >+#ifdef __powerpc64__ >+ >+#undef IS_LITTLE_ENDIAN >+#define IS_BIG_ENDIAN 1 >+#define IS_64 >+ >+#define PR_BYTES_PER_BYTE 1 >+#define PR_BYTES_PER_SHORT 2 >+#define PR_BYTES_PER_INT 4 >+#define PR_BYTES_PER_INT64 8 >+#define PR_BYTES_PER_LONG 8 >+#define PR_BYTES_PER_FLOAT 4 >+#define PR_BYTES_PER_DOUBLE 8 >+#define PR_BYTES_PER_WORD 8 >+#define PR_BYTES_PER_DWORD 8 >+ >+#define PR_BITS_PER_BYTE 8 >+#define PR_BITS_PER_SHORT 16 >+#define PR_BITS_PER_INT 32 >+#define PR_BITS_PER_INT64 64 >+#define PR_BITS_PER_LONG 64 >+#define PR_BITS_PER_FLOAT 32 >+#define PR_BITS_PER_DOUBLE 64 >+#define PR_BITS_PER_WORD 64 >+ >+#define PR_BITS_PER_BYTE_LOG2 3 >+#define PR_BITS_PER_SHORT_LOG2 4 >+#define PR_BITS_PER_INT_LOG2 5 >+#define PR_BITS_PER_INT64_LOG2 6 >+#define PR_BITS_PER_LONG_LOG2 6 >+#define PR_BITS_PER_FLOAT_LOG2 5 >+#define PR_BITS_PER_DOUBLE_LOG2 6 >+#define PR_BITS_PER_WORD_LOG2 6 >+ >+#define PR_ALIGN_OF_SHORT 2 >+#define PR_ALIGN_OF_INT 4 >+#define PR_ALIGN_OF_LONG 8 >+#define PR_ALIGN_OF_INT64 8 >+#define PR_ALIGN_OF_FLOAT 4 >+#define PR_ALIGN_OF_DOUBLE 8 >+#define PR_ALIGN_OF_POINTER 8 >+#define PR_ALIGN_OF_WORD 8 >+#define PR_BYTES_PER_WORD_LOG2 3 >+#define PR_BYTES_PER_DWORD_LOG2 3 >+ >+#elif defined(__powerpc__) > > #undef IS_LITTLE_ENDIAN > #define IS_BIG_ENDIAN 1 >diff -ruN mozilla.orig/nsprpub/pr/include/md/_linux.h mozilla/nsprpub/pr/include/md/_linux.h >--- mozilla.orig/nsprpub/pr/include/md/_linux.h 2005-05-04 18:06:17.000000000 +0000 >+++ mozilla/nsprpub/pr/include/md/_linux.h 2005-08-06 18:37:15.000000000 +0000 >@@ -43,7 +43,9 @@ > > #define PR_LINKER_ARCH "linux" > #define _PR_SI_SYSNAME "LINUX" >-#ifdef __powerpc__ >+#ifdef __powerpc64__ >+#define _PR_SI_ARCHITECTURE "ppc64" >+#elif defined(__powerpc__) > #define _PR_SI_ARCHITECTURE "ppc" > #elif defined(__alpha) > #define _PR_SI_ARCHITECTURE "alpha" >diff -ruN mozilla.orig/nsprpub/pr/src/io/prprf.c mozilla/nsprpub/pr/src/io/prprf.c >--- mozilla.orig/nsprpub/pr/src/io/prprf.c 2004-03-09 03:18:19.000000000 +0000 >+++ mozilla/nsprpub/pr/src/io/prprf.c 2005-08-06 18:37:09.000000000 +0000 >@@ -51,7 +51,8 @@ > ** Note: on some platforms va_list is defined as an array, > ** and requires array notation. > */ >-#if (defined(LINUX) && defined(__x86_64__)) >+#if (defined(LINUX) && defined(__x86_64__)) || \ >+ (defined(LINUX) && defined(__powerpc64__)) > #define VARARGS_ASSIGN(foo, bar) __va_copy((foo), (bar)) > #elif (defined(LINUX) && defined(__powerpc__)) || \ > (defined(LINUX) && defined(__s390__)) || \ >diff -ruN mozilla.orig/security/coreconf/Linux.mk mozilla/security/coreconf/Linux.mk >--- mozilla.orig/security/coreconf/Linux.mk 2004-02-11 02:33:51.000000000 +0000 >+++ mozilla/security/coreconf/Linux.mk 2005-08-06 18:37:05.000000000 +0000 >@@ -54,6 +54,10 @@ > OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE > CPU_ARCH = m68k > else >+ifeq ($(OS_TEST),ppc64) >+ OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE >+ CPU_ARCH = ppc64 >+else > ifeq ($(OS_TEST),ppc) > OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE > CPU_ARCH = ppc >@@ -117,6 +121,7 @@ > endif > endif > endif >+endif > > > LIBC_TAG = _glibc >diff -ruN mozilla.orig/xpcom/reflect/xptcall/src/md/unix/Makefile.in mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in >--- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/Makefile.in 2005-04-28 16:01:33.000000000 +0000 >+++ mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in 2005-08-06 18:41:46.000000000 +0000 >@@ -243,6 +243,15 @@ > endif > > # >+# Linux/PPC64 >+# >+ifeq ($(OS_ARCH)$(OS_TEST),Linuxppc64) >+CPPSRCS := xptcinvoke_ppc64_linux.cpp xptcstubs_ppc64_linux.cpp >+ASFILES := xptcinvoke_asm_ppc64_linux.s xptcstubs_asm_ppc64_linux.s >+AS := $(CC) -c -x assembler-with-cpp >+endif >+ >+# > # Linux/PPC > # > ifeq ($(OS_ARCH)$(OS_TEST),Linuxppc) >diff -ruN mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s >--- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s 1970-01-01 00:00:00.000000000 +0000 >+++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s 2005-08-06 18:44:44.000000000 +0000 >@@ -0,0 +1,113 @@ >+// -*- Mode: Asm -*- >+// >+// The contents of this file are subject to the Netscape Public >+// License Version 1.1 (the "License"); you may not use this file >+// except in compliance with the License. You may obtain a copy of >+// the License at http://www.mozilla.org/NPL/ >+// >+// Software distributed under the License is distributed on an "AS >+// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or >+// implied. See the License for the specific language governing >+// rights and limitations under the License. >+// >+// The Original Code is mozilla.org code. >+// >+// The Initial Developer of the Original Code is Netscape >+// Communications Corporation. Portions created by Netscape are >+// Copyright (C) 1999 Netscape Communications Corporation. All >+// Rights Reserved. >+// >+// Contributor(s): >+// Franz.Sirl-kernel@lauterbach.com (Franz Sirl) >+// beard@netscape.com (Patrick Beard) >+// waterson@netscape.com (Chris Waterson) >+// tom_gall@mac.com (Tom Gall) >+ >+.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 >+.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 >+.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 >+.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 >+.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 >+.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 >+.set r30,30; .set r31,31 >+.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 >+.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 >+.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 >+.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 >+.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 >+.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 >+.set f30,30; .set f31,31 >+ >+ .section ".text" >+ .align 4 >+ .globl XPTC_InvokeByIndex >+ .type XPTC_InvokeByIndex,@function >+ >+// >+// XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, >+// PRUint32 paramCount, nsXPTCVariant* params) >+// >+ >+XPTC_InvokeByIndex: >+ stdu sp,-64(sp) // setup standard stack frame >+ mflr r0 // save LR >+ std r3,16(sp) // r3 <= that >+ std r4,24(sp) // r4 <= methodIndex >+ std r30,32(sp) >+ std r31,40(sp) >+ >+ std r0,72(sp) // store LR backchain >+ mr r31,sp >+ >+ rlwinm r10,r5,4,0,27 // r10 = (ParamCount * 2 * 8) & ~0x0f >+ addi r0,r10,192 // reserve stack for GPR and FPR register save area r0 = r10 + 192 (24 registers) >+ ld r9,0(sp) // r9 = backchain >+ neg r0,r0 >+ stdux r9,sp,r0 // reserve stack space and save SP backchain >+ >+ addi r3,sp,16 // r3 <= args >+ mr r4,r5 // r4 <= paramCount >+ mr r5,r6 // r5 <= params >+ add r6,r3,r10 // r6 <= gpregs ( == args + r10 ) >+ mr r30,r6 // store in r30 for use later... >+ addi r7,r6,64 // r7 <= fpregs ( == gpregs + 32 ) >+ >+ bl invoke_copy_to_stack // (args, paramCount, params, gpregs, fpregs) >+ >+ lfd f1,64(r30) // load FP registers with method parameters >+ lfd f2,80(r30) >+ lfd f3,88(r30) >+ lfd f4,96(r30) >+ lfd f5,104(r30) >+ lfd f6,112(r30) >+ lfd f7,120(r30) >+ lfd f8,128(r30) >+ >+ ld r3,16(r31) // r3 <= that >+ ld r4,24(r31) // r4 <= methodIndex >+ ld r5,0(r3) // r5 <= vtable ( == *that ) >+#if !((__GNUC__ == 3 && __GNUC_MINOR__ < 2) || __GXX_ABI_VERSION >= 100) // G++ pre-V3 ABI >+ addi r4,r4,2 // skip first two vtable entries >+#endif >+ sldi r4,r4,3 // convert to offset ( *= 8 ) >+ ldx r0,r5,r4 // r0 <= methodpointer ( == vtable + offset ) >+ >+ ld r4,8(r30) // load GP regs with method parameters >+ ld r5,16(r30) >+ ld r6,24(r30) >+ ld r7,32(r30) >+ ld r8,40(r30) >+ ld r9,48(r30) >+ ld r10,56(r30) >+ >+ mtlr r0 // copy methodpointer to LR >+ blrl // call method >+ >+ ld r30,32(r31) // restore r30 & r31 >+ ld r31,40(r31) >+ >+ ld r11,0(sp) // clean up the stack >+ ld r0,4(r11) >+ mtlr r0 >+ mr sp,r11 >+ blr >diff -ruN mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp >--- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp 1970-01-01 00:00:00.000000000 +0000 >+++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp 2005-08-06 18:44:44.000000000 +0000 >@@ -0,0 +1,140 @@ >+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ >+/* ***** BEGIN LICENSE BLOCK ***** >+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1 >+ * >+ * The contents of this file are subject to the Netscape Public License >+ * Version 1.1 (the "License"); you may not use this file except in >+ * compliance with the License. You may obtain a copy of the License at >+ * http://www.mozilla.org/NPL/ >+ * >+ * Software distributed under the License is distributed on an "AS IS" basis, >+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License >+ * for the specific language governing rights and limitations under the >+ * License. >+ * >+ * The Original Code is mozilla.org code. >+ * >+ * The Initial Developer of the Original Code is >+ * Netscape Communications Corporation. >+ * Portions created by the Initial Developer are Copyright (C) 1998 >+ * the Initial Developer. All Rights Reserved. >+ * >+ * Contributor(s): >+ * Franz.Sirl-kernel@lauterbach.com (Franz Sirl) >+ * beard@netscape.com (Patrick Beard) >+ * waterson@netscape.com (Chris Waterson) >+ * tom_gall@mac.com (Tom Gall) >+ * >+ * 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 >+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), >+ * in which case the provisions of the GPL or the LGPL are applicable instead >+ * of those above. If you wish to allow use of your version of this file only >+ * under the terms of either the GPL or the LGPL, and not to allow others to >+ * use your version of this file under the terms of the NPL, indicate your >+ * decision by deleting the provisions above and replace them with the notice >+ * and other provisions required by the GPL or the LGPL. If you do not delete >+ * the provisions above, a recipient may use your version of this file under >+ * the terms of any one of the NPL, the GPL or the LGPL. >+ * >+ * ***** END LICENSE BLOCK ***** */ >+ >+// Platform specific code to invoke XPCOM methods on native objects >+ >+// The purpose of XPTC_InvokeByIndex() is to map a platform >+// indepenpent call to the platform ABI. To do that, >+// XPTC_InvokeByIndex() has to determine the method to call via vtable >+// access. The parameters for the method are read from the >+// nsXPTCVariant* and prepared for th native ABI. For the Linux/PPC >+// ABI this means that the first 8 integral and floating point >+// parameters are passed in registers. >+ >+#include "xptcprivate.h" >+ >+// 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 >+#define FPR_COUNT 8 >+ >+extern "C" PRUint32 >+invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) >+{ >+ return PRUint32(((paramCount * 2) + 3) & ~3); >+} >+ >+extern "C" void >+invoke_copy_to_stack(PRUint32* d, >+ PRUint32 paramCount, >+ nsXPTCVariant* s, >+ PRUint64* gpregs, >+ double* fpregs) >+{ >+ PRUint32 gpr = 1; // skip one GP reg for 'that' >+ PRUint32 fpr = 0; >+ PRUint32 tempu32; >+ PRUint64 tempu64; >+ >+ for(uint32 i = 0; i < paramCount; i++, s++) { >+ if(s->IsPtrData()) >+ tempu32 = (PRUint32) s->ptr; >+ else { >+ switch(s->type) { >+ case nsXPTType::T_FLOAT: break; >+ case nsXPTType::T_DOUBLE: break; >+ case nsXPTType::T_I8: tempu32 = s->val.i8; break; >+ case nsXPTType::T_I16: tempu32 = s->val.i16; break; >+ case nsXPTType::T_I32: tempu32 = s->val.i32; break; >+ case nsXPTType::T_I64: tempu64 = s->val.i64; break; >+ case nsXPTType::T_U8: tempu32 = s->val.u8; break; >+ case nsXPTType::T_U16: tempu32 = s->val.u16; break; >+ case nsXPTType::T_U32: tempu32 = s->val.u32; break; >+ case nsXPTType::T_U64: tempu64 = s->val.u64; break; >+ case nsXPTType::T_BOOL: tempu32 = s->val.b; break; >+ case nsXPTType::T_CHAR: tempu32 = s->val.c; break; >+ case nsXPTType::T_WCHAR: tempu32 = s->val.wc; break; >+ default: tempu32 = (PRUint32) s->val.p; break; >+ } >+ } >+ >+ if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) { >+ if (fpr < FPR_COUNT) >+ fpregs[fpr++] = s->val.d; >+ else { >+ if ((PRUint32) d & 4) d++; // doubles are 8-byte aligned on stack >+ *((double*) d) = s->val.d; >+ d += 2; >+ } >+ } >+ else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) { >+ if (fpr < FPR_COUNT) >+ fpregs[fpr++] = s->val.f; // if passed in registers, floats are promoted to doubles >+ else >+ *((float*) d++) = s->val.f; >+ } >+ else if (!s->IsPtrData() && (s->type == nsXPTType::T_I64 >+ || s->type == nsXPTType::T_U64)) { >+ if (gpr < GPR_COUNT) { >+ gpregs[gpr++] = tempu64; >+ } >+ else { >+ if ((PRUint32) d & 4) d++; // longlongs are 8-byte aligned on stack >+ *((PRUint64*) d) = tempu64; >+ d += 2; >+ } >+ } >+ else { >+ if (gpr < GPR_COUNT) >+ gpregs[gpr++] = tempu32; >+ else >+ *d++ = tempu32; >+ } >+ >+ } >+} >+ >+extern "C" >+XPTC_PUBLIC_API(nsresult) >+XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, >+ PRUint32 paramCount, nsXPTCVariant* params); >diff -ruN mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.s mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.s >--- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.s 1970-01-01 00:00:00.000000000 +0000 >+++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.s 2005-08-06 18:44:44.000000000 +0000 >@@ -0,0 +1,90 @@ >+// -*- Mode: Asm -*- >+// >+// The contents of this file are subject to the Netscape Public >+// License Version 1.1 (the "License"); you may not use this file >+// except in compliance with the License. You may obtain a copy of >+// the License at http://www.mozilla.org/NPL/ >+// >+// Software distributed under the License is distributed on an "AS >+// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or >+// implied. See the License for the specific language governing >+// rights and limitations under the License. >+// >+// The Original Code is mozilla.org code. >+// >+// The Initial Developer of the Original Code is Netscape >+// Communications Corporation. Portions created by Netscape are >+// Copyright (C) 1999 Netscape Communications Corporation. All >+// Rights Reserved. >+// >+// Contributor(s): >+// Franz.Sirl-kernel@lauterbach.com (Franz Sirl) >+// beard@netscape.com (Patrick Beard) >+// waterson@netscape.com (Chris Waterson) >+// tom_gall@mac.com (Tom Gall) >+// >+ >+.set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4 >+.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 >+.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 >+.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 >+.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 >+.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 >+.set r30,30; .set r31,31 >+.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4 >+.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9 >+.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14 >+.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19 >+.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24 >+.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29 >+.set f30,30; .set f31,31 >+ >+ .section ".text" >+ .align 4 >+ .globl SharedStub >+ .type SharedStub,@function >+ >+SharedStub: >+ stdu sp,-160(sp) // room for >+ // linkage (16), >+ // gprData (64), >+ // fprData (64), >+ // stack alignment(16) >+ mflr r0 >+ std r0,168(sp) // save LR backchain >+ >+ std r4,24(sp) // save GP registers >+ std r5,32(sp) // (n.b. that we don't save r3 >+ stw r6,40(sp) // because PrepareAndDispatch() is savvy) >+ std r7,48(sp) >+ std r8,56(sp) >+ std r9,64(sp) >+ std r10,72(sp) >+ >+ stfd f1,80(sp) // save FP registers >+ stfd f2,88(sp) >+ stfd f3,96(sp) >+ stfd f4,104(sp) >+ stfd f5,112(sp) >+ stfd f6,120(sp) >+ stfd f7,128(sp) >+ stfd f8,136(sp) >+ >+ // r3 has the 'self' pointer already >+ >+ mr r4,r11 // r4 <= methodIndex selector, passed >+ // via r11 in the nsXPTCStubBase::StubXX() call >+ >+ addi r5,sp,172 // r5 <= pointer to callers args area, >+ // beyond r3-r10/f1-f8 mapped range >+ >+ addi r6,sp,16 // r6 <= gprData >+ addi r7,sp,80 // r7 <= fprData >+ >+ bl PrepareAndDispatch // Go! >+ >+ ld r0,168(sp) // restore LR >+ mtlr r0 >+ la sp,160(sp) // clean up the stack >+ blr >+ >diff -ruN mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc64_linux.cpp mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc64_linux.cpp >--- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc64_linux.cpp 1970-01-01 00:00:00.000000000 +0000 >+++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc64_linux.cpp 2005-08-06 18:44:44.000000000 +0000 >@@ -0,0 +1,254 @@ >+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ >+/* ***** BEGIN LICENSE BLOCK ***** >+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1 >+ * >+ * The contents of this file are subject to the Netscape Public License >+ * Version 1.1 (the "License"); you may not use this file except in >+ * compliance with the License. You may obtain a copy of the License at >+ * http://www.mozilla.org/NPL/ >+ * >+ * Software distributed under the License is distributed on an "AS IS" basis, >+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License >+ * for the specific language governing rights and limitations under the >+ * License. >+ * >+ * The Original Code is mozilla.org code. >+ * >+ * The Initial Developer of the Original Code is >+ * Netscape Communications Corporation. >+ * Portions created by the Initial Developer are Copyright (C) 1999 >+ * the Initial Developer. All Rights Reserved. >+ * >+ * Contributor(s): >+ * Franz.Sirl-kernel@lauterbach.com (Franz Sirl) >+ * beard@netscape.com (Patrick Beard) >+ * waterson@netscape.com (Chris Waterson) >+ * tom_gall@mac.com (Tom Gall) >+ * >+ * 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 >+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), >+ * in which case the provisions of the GPL or the LGPL are applicable instead >+ * of those above. If you wish to allow use of your version of this file only >+ * under the terms of either the GPL or the LGPL, and not to allow others to >+ * use your version of this file under the terms of the NPL, indicate your >+ * decision by deleting the provisions above and replace them with the notice >+ * and other provisions required by the GPL or the LGPL. If you do not delete >+ * the provisions above, a recipient may use your version of this file under >+ * the terms of any one of the NPL, the GPL or the LGPL. >+ * >+ * ***** END LICENSE BLOCK ***** */ >+ >+// Implement shared vtbl methods. >+ >+#include "xptcprivate.h" >+ >+// The Linux/PPC ABI (aka PPC/SYSV ABI) passes the first 8 integral >+// parameters and the first 8 floating point parameters in registers >+// (r3-r10 and f1-f8), no stack space is allocated for these by the >+// 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. >+ >+#define PARAM_BUFFER_COUNT 16 >+#define GPR_COUNT 8 >+#define FPR_COUNT 8 >+ >+// PrepareAndDispatch() is called by SharedStub() and calls the actual method. >+// >+// - 'args[]' contains the arguments passed on stack >+// - 'gprData[]' contains the arguments passed in integer registers >+// - 'fprData[]' contains the arguments passed in floating point registers >+// >+// The parameters are mapped into an array of type 'nsXPTCMiniVariant' >+// and then the method gets called. >+ >+extern "C" nsresult >+PrepareAndDispatch(nsXPTCStubBase* self, >+ PRUint32 methodIndex, >+ PRUint32* args, >+ PRUint64 *gprData, >+ double *fprData) >+{ >+ nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; >+ nsXPTCMiniVariant* dispatchParams = NULL; >+ nsIInterfaceInfo* iface_info = NULL; >+ const nsXPTMethodInfo* info; >+ PRUint32 paramCount; >+ PRUint32 i; >+ nsresult result = NS_ERROR_FAILURE; >+ >+ NS_ASSERTION(self,"no self"); >+ >+ self->GetInterfaceInfo(&iface_info); >+ NS_ASSERTION(iface_info,"no interface info"); >+ if (! iface_info) >+ return NS_ERROR_UNEXPECTED; >+ >+ iface_info->GetMethodInfo(PRUint16(methodIndex), &info); >+ NS_ASSERTION(info,"no method info"); >+ if (! info) >+ return NS_ERROR_UNEXPECTED; >+ >+ paramCount = info->GetParamCount(); >+ >+ // setup variant array pointer >+ if(paramCount > PARAM_BUFFER_COUNT) >+ dispatchParams = new nsXPTCMiniVariant[paramCount]; >+ else >+ dispatchParams = paramBuffer; >+ >+ NS_ASSERTION(dispatchParams,"no place for params"); >+ if (! dispatchParams) >+ return NS_ERROR_OUT_OF_MEMORY; >+ >+ PRUint32* ap = args; >+ PRUint32 gpr = 1; // skip one GPR register >+ PRUint32 fpr = 0; >+ PRUint32 tempu32; >+ PRUint64 tempu64; >+ >+ for(i = 0; i < paramCount; i++) { >+ const nsXPTParamInfo& param = info->GetParam(i); >+ const nsXPTType& type = param.GetType(); >+ nsXPTCMiniVariant* dp = &dispatchParams[i]; >+ >+ if (!param.IsOut() && type == nsXPTType::T_DOUBLE) { >+ if (fpr < FPR_COUNT) >+ dp->val.d = fprData[fpr++]; >+ else { >+ if ((PRUint32) ap & 4) ap++; // doubles are 8-byte aligned on stack >+ dp->val.d = *(double*) ap; >+ ap += 2; >+ } >+ continue; >+ } >+ else if (!param.IsOut() && type == nsXPTType::T_FLOAT) { >+ if (fpr < FPR_COUNT) >+ dp->val.f = (float) fprData[fpr++]; // in registers floats are passed as doubles >+ else >+ dp->val.f = *(float*) ap++; >+ continue; >+ } >+ else if (!param.IsOut() && (type == nsXPTType::T_I64 >+ || type == nsXPTType::T_U64)) { >+ if (gpr < GPR_COUNT) { >+ tempu64 = gprData[gpr++]; >+ } >+ else { >+ if ((PRUint32) ap & 4) ap++; // longlongs are 8-byte aligned on stack >+ tempu64 = *(PRUint64*) ap; >+ ap += 2; >+ } >+ } >+ else { >+ if (gpr < GPR_COUNT) >+ tempu32 = gprData[gpr++]; >+ else >+ tempu32 = *ap++; >+ } >+ >+ if(param.IsOut() || !type.IsArithmetic()) { >+ dp->val.p = (void*) tempu32; >+ continue; >+ } >+ >+ switch(type) { >+ case nsXPTType::T_I8: dp->val.i8 = (PRInt8) tempu32; break; >+ case nsXPTType::T_I16: dp->val.i16 = (PRInt16) tempu32; break; >+ case nsXPTType::T_I32: dp->val.i32 = (PRInt32) tempu32; break; >+ case nsXPTType::T_I64: dp->val.i64 = (PRInt64) tempu64; break; >+ case nsXPTType::T_U8: dp->val.u8 = (PRUint8) tempu32; break; >+ case nsXPTType::T_U16: dp->val.u16 = (PRUint16) tempu32; break; >+ case nsXPTType::T_U32: dp->val.u32 = (PRUint32) tempu32; break; >+ case nsXPTType::T_U64: dp->val.u64 = (PRUint64) tempu64; break; >+ case nsXPTType::T_BOOL: dp->val.b = (PRBool) tempu32; break; >+ case nsXPTType::T_CHAR: dp->val.c = (char) tempu32; break; >+ case nsXPTType::T_WCHAR: dp->val.wc = (wchar_t) tempu32; break; >+ >+ default: >+ NS_ASSERTION(0, "bad type"); >+ break; >+ } >+ } >+ >+ result = self->CallMethod((PRUint16) methodIndex, info, dispatchParams); >+ >+ NS_RELEASE(iface_info); >+ >+ if (dispatchParams != paramBuffer) >+ delete [] dispatchParams; >+ >+ return result; >+} >+ >+// Load r11 with the constant 'n' and branch to SharedStub(). >+// >+// XXX Yes, it's ugly that we're relying on gcc's name-mangling here; >+// however, it's quick, dirty, and'll break when the ABI changes on >+// us, which is what we want ;-). >+ >+#if __GXX_ABI_VERSION < 100 >+// gcc-2 version >+# define STUB_ENTRY(n) \ >+__asm__ ( \ >+ ".section \".text\" \n\t" \ >+ ".align 4 \n\t" \ >+ ".globl Stub"#n"__14nsXPTCStubBase \n\t" \ >+ ".type Stub"#n"__14nsXPTCStubBase,@function \n\n" \ >+ \ >+"Stub"#n"__14nsXPTCStubBase: \n\t" \ >+ "li 11,"#n" \n\t" \ >+ "b SharedStub@local \n" \ >+); >+#else >+// gcc-3 version >+// >+// As G++3 ABI contains the length of the functionname in the mangled >+// name, it is difficult to get a generic assembler mechanism like >+// in the G++ 2.95 case. >+// Create names would be like: >+// _ZN14nsXPTCStubBase5Stub1Ev >+// _ZN14nsXPTCStubBase6Stub12Ev >+// _ZN14nsXPTCStubBase7Stub123Ev >+// _ZN14nsXPTCStubBase8Stub1234Ev >+// etc. >+// Use assembler directives to get the names right... >+ >+# define STUB_ENTRY(n) \ >+__asm__ ( \ >+ ".align 4 \n\t" \ >+ ".if "#n" < 10 \n\t" \ >+ ".globl _ZN14nsXPTCStubBase5Stub"#n"Ev \n\t" \ >+ ".type _ZN14nsXPTCStubBase5Stub"#n"Ev,@function \n\n" \ >+"_ZN14nsXPTCStubBase5Stub"#n"Ev: \n\t" \ >+ \ >+ ".elseif "#n" < 100 \n\t" \ >+ ".globl _ZN14nsXPTCStubBase6Stub"#n"Ev \n\t" \ >+ ".type _ZN14nsXPTCStubBase6Stub"#n"Ev,@function \n\n" \ >+"_ZN14nsXPTCStubBase6Stub"#n"Ev: \n\t" \ >+ \ >+ ".elseif "#n" < 1000 \n\t" \ >+ ".globl _ZN14nsXPTCStubBase7Stub"#n"Ev \n\t" \ >+ ".type _ZN14nsXPTCStubBase7Stub"#n"Ev,@function \n\n" \ >+"_ZN14nsXPTCStubBase7Stub"#n"Ev: \n\t" \ >+ \ >+ ".else \n\t" \ >+ ".err \"stub number "#n" >= 1000 not yet supported\"\n" \ >+ ".endif \n\t" \ >+ \ >+ "li 11,"#n" \n\t" \ >+ "b SharedStub \n" \ >+); >+#endif >+ >+// "b SharedStub@local \n" >+ >+#define SENTINEL_ENTRY(n) \ >+nsresult nsXPTCStubBase::Sentinel##n() \ >+{ \ >+ NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ >+ return NS_ERROR_NOT_IMPLEMENTED; \ >+} >+ >+#include "xptcstubsdef.inc"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 101821
:
65501
|
65505
|
86059
|
86413
|
94300
|
102624
|
102626
|
103344
|
103502
|
103585