diff options
author | David Woodhouse <dwmw2@fedoraproject.org> | 2007-02-21 17:44:08 +0000 |
---|---|---|
committer | David Woodhouse <dwmw2@fedoraproject.org> | 2007-02-21 17:44:08 +0000 |
commit | fa5aab63530fe9c7327f347d648e8017323235d8 (patch) | |
tree | f26227dbdcb7f043ad3ea026c37b92988be90f02 /firefox-1.5-ppc64.patch | |
parent | - Start using the specified locale (diff) | |
download | librewolf-fedora-ff-fa5aab63530fe9c7327f347d648e8017323235d8.tar.gz librewolf-fedora-ff-fa5aab63530fe9c7327f347d648e8017323235d8.tar.bz2 librewolf-fedora-ff-fa5aab63530fe9c7327f347d648e8017323235d8.zip |
- Fix PPC64 runtime
- Fix firefox script to use 32-bit browser by default on PPC64 hardware
Diffstat (limited to 'firefox-1.5-ppc64.patch')
-rw-r--r-- | firefox-1.5-ppc64.patch | 663 |
1 files changed, 663 insertions, 0 deletions
diff --git a/firefox-1.5-ppc64.patch b/firefox-1.5-ppc64.patch new file mode 100644 index 0000000..ff77248 --- /dev/null +++ b/firefox-1.5-ppc64.patch @@ -0,0 +1,663 @@ +Updated version of patch, fixes 16-byte stack alignment after +XPTC_InvokeByIndex(). + +unchanged: +--- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/Makefile.in 2006-11-21 17:09:28.000000000 +0000 ++++ mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in 2006-11-20 10:13:38.000000000 +0000 +@@ -267,6 +267,11 @@ + ASFILES := xptcinvoke_asm_ppc_linux.s xptcstubs_asm_ppc_linux.s + AS := $(CC) -c -x assembler-with-cpp + endif ++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 + + # + # NetBSD/PPC +diff -u mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s +--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s 2006-11-21 14:01:45.000000000 +0000 ++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s 2006-11-22 10:43:26.000000000 +0000 +@@ -0,0 +1,154 @@ ++// -*- 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): ++// dwmw2@infradead.org (David Woodhouse) ++// Franz.Sirl-kernel@lauterbach.com (Franz Sirl) ++// beard@netscape.com (Patrick Beard) ++// waterson@netscape.com (Chris Waterson) ++// ++ ++.set r0,0; .set r1,1; .set r2,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 ++ ++ ++// ++// XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, ++// PRUint32 paramCount, nsXPTCVariant* params) ++// ++ ++ .section ".toc","aw" ++ .section ".text" ++ .align 2 ++ .globl XPTC_InvokeByIndex ++ .section ".opd","aw" ++ .align 3 ++XPTC_InvokeByIndex: ++ .quad .XPTC_InvokeByIndex,.TOC.@tocbase ++ .previous ++ .type XPTC_InvokeByIndex,@function ++.XPTC_InvokeByIndex: ++ mflr 0 ++ std 0,16(r1) ++ ++ std r29,-24(r1) ++ std r30,-16(r1) ++ std r31,-8(r1) ++ ++ mr r29,r3 // Save 'that' in r29 ++ mr r30,r4 // Save 'methodIndex' in r30 ++ mr r31,r1 // Save old frame ++ ++ // Allocate stack frame with space for params. Since at least the ++ // first 7 parameters (not including 'that') will be in registers, ++ // we don't actually need stack space for those. We must ensure ++ // that the stack remains 16-byte aligned. ++ // ++ // | ..128-byte stack frame.. | | 7 GP | 13 FP | 3 NV | ++ // | |(params)........| regs | regs | regs | ++ // (r1)...........(+112)....(+128) ++ // (-23*8).(-16*8).(-3*8)..(r31) ++ ++ // +stack frame, -unused stack params, +regs storage, +1 for alignment ++ addi r7,r5,((112/8)-7+7+13+3+1) ++ rldicr r7,r7,3,59 // multiply by 8 and mask with ~15 ++ neg r7,r7 ++ stdux r1,r1,r7 ++ ++ ++ // Call invoke_copy_to_stack(PRUint64* gpregs, double* fpregs, ++ // PRUint32 paramCount, nsXPTCVariant* s, ++ // PRUint64* d)) ++ ++ // r5, r6 are passed through intact (paramCount, params) ++ // r7 (d) has to be r1+112 -- where parameters are passed on the stack. ++ // r3, r4 are above that, easier to address from r31 than from r1 ++ ++ subi r3,r31,(23*8) // r3 --> GPRS ++ subi r4,r31,(16*8) // r4 --> FPRS ++ addi r7,r1,112 // r7 --> params ++ bl invoke_copy_to_stack ++ nop ++ ++ // Set up to invoke function ++ ++ ld r9,0(r29) // vtable (r29 is 'that') ++ mr r3,r29 // self is first arg, obviously ++ ++ sldi r30,r30,3 // Find function descriptor ++ add r9,r9,r30 ++ ld r9,0(r9) ++ ++ ld r0,0(r9) // Actual address from fd. ++ std r2,40(r1) // Save r2 (TOC pointer) ++ ++ mtctr 0 ++ ld r11,16(r9) // Environment pointer from fd. ++ ld r2,8(r9) // TOC pointer from fd. ++ ++ // Load FP and GP registers as required ++ ld r4, -(23*8)(r31) ++ ld r5, -(22*8)(r31) ++ ld r6, -(21*8)(r31) ++ ld r7, -(20*8)(r31) ++ ld r8, -(19*8)(r31) ++ ld r9, -(18*8)(r31) ++ ld r10, -(17*8)(r31) ++ ++ lfd f1, -(16*8)(r31) ++ lfd f2, -(15*8)(r31) ++ lfd f3, -(14*8)(r31) ++ lfd f4, -(13*8)(r31) ++ lfd f5, -(12*8)(r31) ++ lfd f6, -(11*8)(r31) ++ lfd f7, -(10*8)(r31) ++ lfd f8, -(9*8)(r31) ++ lfd f9, -(8*8)(r31) ++ lfd f10, -(7*8)(r31) ++ lfd f11, -(6*8)(r31) ++ lfd f12, -(5*8)(r31) ++ lfd f13, -(4*8)(r31) ++ ++ bctrl // Do it ++ ++ ld r2,40(r1) // Load our own TOC pointer ++ ld r1,0(r1) // Revert stack frame ++ ld 0,16(r1) // Reload lr ++ ld 29,-24(r1) // Restore NVGPRS ++ ld 30,-16(r1) ++ ld 31,-8(r1) ++ mtlr 0 ++ blr ++ ++ .size XPTC_InvokeByIndex,.-.XPTC_InvokeByIndex ++ ++ /* Magic indicating no need for an executable stack */ ++ .section .note.GNU-stack, "", @progbits ; .previous +--- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp 1970-01-01 01:00:00.000000000 +0100 ++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp 2006-11-21 17:00:06.000000000 +0000 +@@ -0,0 +1,127 @@ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla 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/MPL/ ++ * ++ * 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): ++ * dwmw2@infradead.org (David Woodhouse) ++ * Franz.Sirl-kernel@lauterbach.com (Franz Sirl) ++ * beard@netscape.com (Patrick Beard) ++ * waterson@netscape.com (Chris Waterson) ++ * ++ * 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"), ++ * 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 MPL, 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 MPL, 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 ++// independent 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 the native ABI. ++ ++#include <stdio.h> ++#include "xptcprivate.h" ++ ++// 8 integral parameters are passed in registers, not including 'that' ++#define GPR_COUNT 7 ++ ++// 8 floating point parameters are passed in registers, floats are ++// promoted to doubles when passed in registers ++#define FPR_COUNT 13 ++ ++extern "C" PRUint32 ++invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) ++{ ++ return PRUint32(((paramCount * 2) + 3) & ~3); ++} ++ ++extern "C" void ++invoke_copy_to_stack(PRUint64* gpregs, ++ double* fpregs, ++ PRUint32 paramCount, ++ nsXPTCVariant* s, ++ PRUint64* d) ++{ ++ PRUint64 tempu64; ++ ++ for(uint32 i = 0; i < paramCount; i++, s++) { ++ if(s->IsPtrData()) ++ tempu64 = (PRUint64) s->ptr; ++ else { ++ switch(s->type) { ++ case nsXPTType::T_FLOAT: break; ++ case nsXPTType::T_DOUBLE: break; ++ case nsXPTType::T_I8: tempu64 = s->val.i8; break; ++ case nsXPTType::T_I16: tempu64 = s->val.i16; break; ++ case nsXPTType::T_I32: tempu64 = s->val.i32; break; ++ case nsXPTType::T_I64: tempu64 = s->val.i64; break; ++ case nsXPTType::T_U8: tempu64 = s->val.u8; break; ++ case nsXPTType::T_U16: tempu64 = s->val.u16; break; ++ case nsXPTType::T_U32: tempu64 = s->val.u32; break; ++ case nsXPTType::T_U64: tempu64 = s->val.u64; break; ++ case nsXPTType::T_BOOL: tempu64 = s->val.b; break; ++ case nsXPTType::T_CHAR: tempu64 = s->val.c; break; ++ case nsXPTType::T_WCHAR: tempu64 = s->val.wc; break; ++ default: tempu64 = (PRUint64) s->val.p; break; ++ } ++ } ++ ++ if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) { ++ if (i < FPR_COUNT) ++ fpregs[i] = s->val.d; ++ else ++ *(double *)d = s->val.d; ++ } ++ else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) { ++ if (i < FPR_COUNT) { ++ fpregs[i] = s->val.f; // if passed in registers, floats are promoted to doubles ++ } else { ++ float *p = (float *)d; ++ p++; ++ *p = s->val.f; ++ } ++ } ++ else { ++ if (i < GPR_COUNT) ++ gpregs[i] = tempu64; ++ else ++ *d = tempu64; ++ } ++ if (i >= 7) ++ d++; ++ } ++} ++ ++extern "C" ++XPTC_PUBLIC_API(nsresult) ++XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex, ++ PRUint32 paramCount, nsXPTCVariant* params); ++ +diff -u mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.s mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.s +--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.s 2006-11-21 16:38:52.000000000 +0000 ++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.s 2006-11-22 10:51:14.000000000 +0000 +@@ -0,0 +1,102 @@ ++// -*- 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): ++// dwmw2@infradead.org (David Woodhouse) ++// Franz.Sirl-kernel@lauterbach.com (Franz Sirl) ++// beard@netscape.com (Patrick Beard) ++// waterson@netscape.com (Chris Waterson) ++// ++ ++.set r0,0; .set r1,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 2 ++ .globl SharedStub ++ .section ".opd","aw" ++ .align 3 ++ ++SharedStub: ++ .quad .SharedStub,.TOC.@tocbase ++ .previous ++ .type SharedStub,@function ++ ++.SharedStub: ++ mflr r0 ++ ++ std r4, -56(r1) // Save all GPRS ++ std r5, -48(r1) ++ std r6, -40(r1) ++ std r7, -32(r1) ++ std r8, -24(r1) ++ std r9, -16(r1) ++ std r10, -8(r1) ++ ++ stfd f13, -64(r1) // ... and FPRS ++ stfd f12, -72(r1) ++ stfd f11, -80(r1) ++ stfd f10, -88(r1) ++ stfd f9, -96(r1) ++ stfd f8, -104(r1) ++ stfd f7, -112(r1) ++ stfd f6, -120(r1) ++ stfd f5, -128(r1) ++ stfd f4, -136(r1) ++ stfd f3, -144(r1) ++ stfd f2, -152(r1) ++ stfd f1, -160(r1) ++ ++ subi r6,r1,56 // r6 --> gprData ++ subi r7,r1,160 // r7 --> fprData ++ addi r5,r1,112 // r5 --> extra stack args ++ ++ std r0, 16(r1) ++ ++ stdu r1,-288(r1) ++ // r3 has the 'self' pointer already ++ ++ mr r4,r11 // r4 is methodIndex selector, passed ++ // via r11 in the nsXPTCStubBase::StubXX() call ++ ++ bl PrepareAndDispatch ++ nop ++ ++ ld 1,0(r1) // restore stack ++ ld r0,16(r1) // restore LR ++ mtlr r0 ++ blr ++ ++ .size SharedStub,.-.SharedStub ++ ++ ++/* Magic indicating no need for an executable stack */ ++.section .note.GNU-stack, "", @progbits ; .previous +unchanged: +--- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc64_linux.cpp 1970-01-01 01:00:00.000000000 +0100 ++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc64_linux.cpp 2006-11-21 16:59:46.000000000 +0000 +@@ -0,0 +1,247 @@ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla 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/MPL/ ++ * ++ * 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): ++ * dwmw2@infradead.org (David Woodhouse) ++ * Franz.Sirl-kernel@lauterbach.com (Franz Sirl) ++ * beard@netscape.com (Patrick Beard) ++ * waterson@netscape.com (Chris Waterson) ++ * ++ * 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"), ++ * 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 MPL, 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 MPL, 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 13 floating point parameters in registers ++// (r3-r10 and f1-f13), 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 7 ++#define FPR_COUNT 13 ++ ++// 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. ++#include <stdio.h> ++extern "C" nsresult ++PrepareAndDispatch(nsXPTCStubBase* self, ++ PRUint64 methodIndex, ++ PRUint64* 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; ++ ++ PRUint64* ap = args; ++ 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 (i < FPR_COUNT) ++ dp->val.d = fprData[i]; ++ else ++ dp->val.d = *(double*) ap; ++ } else if (!param.IsOut() && type == nsXPTType::T_FLOAT) { ++ if (i < FPR_COUNT) ++ dp->val.f = (float) fprData[i]; // in registers floats are passed as doubles ++ else { ++ float *p = (float *)ap; ++ p++; ++ dp->val.f = *p; ++ } ++ } else { /* integer type or pointer */ ++ if (i < GPR_COUNT) ++ tempu64 = gprData[i]; ++ else ++ tempu64 = *ap; ++ ++ if (param.IsOut() || !type.IsArithmetic()) ++ dp->val.p = (void*) tempu64; ++ else if (type ==nsXPTType::T_I8) ++ dp->val.i8 = (PRInt8) tempu64; ++ else if (type ==nsXPTType::T_I16) ++ dp->val.i16 = (PRInt16) tempu64; ++ else if (type ==nsXPTType::T_I32) ++ dp->val.i32 = (PRInt32) tempu64; ++ else if (type ==nsXPTType::T_I64) ++ dp->val.i64 = (PRInt64) tempu64; ++ else if (type ==nsXPTType::T_U8) ++ dp->val.u8 = (PRUint8) tempu64; ++ else if (type ==nsXPTType::T_U16) ++ dp->val.u16 = (PRUint16) tempu64; ++ else if (type ==nsXPTType::T_U32) ++ dp->val.u32 = (PRUint32) tempu64; ++ else if (type ==nsXPTType::T_U64) ++ dp->val.u64 = (PRUint64) tempu64; ++ else if (type ==nsXPTType::T_BOOL) ++ dp->val.b = (PRBool) tempu64; ++ else if (type ==nsXPTType::T_CHAR) ++ dp->val.c = (char) tempu64; ++ else if (type ==nsXPTType::T_WCHAR) ++ dp->val.wc = (wchar_t) tempu64; ++ else ++ NS_ASSERTION(0, "bad type"); ++ } ++ ++ if (i >= 7) ++ ap++; ++ } ++ ++ 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 ++#error Prehistoric GCC not supported here ++#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__ ( \ ++ ".section \".toc\",\"aw\" \n\t" \ ++ ".section \".text\" \n\t" \ ++ ".align 2 \n\t" \ ++ ".if "#n" < 10 \n\t" \ ++ ".globl _ZN14nsXPTCStubBase5Stub"#n"Ev \n\t" \ ++ ".section \".opd\",\"aw\" \n\t" \ ++ ".align 3 \n\t" \ ++"_ZN14nsXPTCStubBase5Stub"#n"Ev: \n\t" \ ++ ".quad ._ZN14nsXPTCStubBase5Stub"#n"Ev,.TOC.@tocbase \n\t" \ ++ ".previous \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" \ ++ ".section \".opd\",\"aw\" \n\t" \ ++ ".align 3 \n\t" \ ++"_ZN14nsXPTCStubBase6Stub"#n"Ev: \n\t" \ ++ ".quad ._ZN14nsXPTCStubBase6Stub"#n"Ev,.TOC.@tocbase \n\t" \ ++ ".previous \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" \ ++ ".section \".opd\",\"aw\" \n\t" \ ++ ".align 3 \n\t" \ ++"_ZN14nsXPTCStubBase7Stub"#n"Ev: \n\t" \ ++ ".quad ._ZN14nsXPTCStubBase7Stub"#n"Ev,.TOC.@tocbase \n\t" \ ++ ".previous \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 ++ ++#define SENTINEL_ENTRY(n) \ ++nsresult nsXPTCStubBase::Sentinel##n() \ ++{ \ ++ NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ ++ return NS_ERROR_NOT_IMPLEMENTED; \ ++} ++ ++#include "xptcstubsdef.inc" |