On Wed, 2007-09-19 at 16:41 +0100, David Woodhouse wrote: > Actually the patch in question seems to be applied already -- the only > problem seems to be that while $(OS_TEST) used to be set to 'ppc' it's > now set to 'powerpc', so the makefile fails to select a set of stubs > and the build aborts (yay, aborts rather than silently building a > broken library, like it used to). I assume it'll be the same issue for > ppc64/powerpc64. but will let the 32-bit build finish first. Ah, the patch also needs to be updated to the one from mozilla bug #361415, rather than the older patch for firefox 1.5 thru 2.0. One more minor change to a function name and it seems to build the xptc bits fine (with the attached patch). It still fails for me in in mock, but I hereby declare this error to be Someone Else's Problem™: /usr/include/bits/unistd.h: In function 'int gethostname(char*, size_t)': /usr/include/bits/unistd.h:225: error: declaration of 'int gethostname(char*, size_t) throw ()' throws different exceptions /usr/include/unistd.h:845: error: from previous declaration 'int gethostname(char*, size_t)' /usr/include/bits/unistd.h: In function 'int getdomainname(char*, size_t)': /usr/include/bits/unistd.h:243: error: declaration of 'int getdomainname(char*, size_t) throw ()' throws different exceptions /usr/include/unistd.h:864: error: from previous declaration 'int getdomainname(char*, size_t)' gmake[5]: *** [nsGREGlue.o] Error 1 -- dwmw2
Index: xpcom/reflect/xptcall/src/md/unix/Makefile.in =================================================================== RCS file: /cvsroot/mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in,v retrieving revision 1.92 diff -u -B -u -p -r1.92 Makefile.in --- xpcom/reflect/xptcall/src/md/unix/Makefile.in 14 Dec 2006 19:13:43 -0000 1.92 +++ xpcom/reflect/xptcall/src/md/unix/Makefile.in 29 Jan 2007 17:49:54 -0000 @@ -268,11 +268,16 @@ endif # # Linux/PPC # -ifeq ($(OS_ARCH)$(OS_TEST),Linuxppc) +ifeq ($(OS_ARCH)$(OS_TEST),Linuxpowerpc) CPPSRCS := xptcinvoke_ppc_linux.cpp xptcstubs_ppc_linux.cpp ASFILES := xptcinvoke_asm_ppc_linux.s xptcstubs_asm_ppc_linux.s AS := $(CC) -c -x assembler-with-cpp endif +ifeq ($(OS_ARCH)$(OS_TEST),Linuxpowerpc64) +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 Index: xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp =================================================================== RCS file: /cvsroot/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp,v retrieving revision 1.3 diff -u -B -u -p -r1.3 xptcinvoke_ppc_netbsd.cpp --- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp 18 Apr 2004 14:18:18 -0000 1.3 +++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp 29 Jan 2007 17:49:55 -0000 @@ -44,7 +44,7 @@ // 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 +// nsXPTCVariant* and prepared for the native ABI. For the Linux/PPC // ABI this means that the first 8 integral and floating point // parameters are passed in registers. --- /dev/null 2000-10-22 01:01:00.000000000 +0000 +++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s 2007-01-29 17:36:50.000000000 +0000 @@ -0,0 +1,164 @@ +## ***** 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 + # dwmw2@xxxxxxxxxxxxx (David Woodhouse). + # Portions created by the Initial Developer are Copyright (C) 2006 + # the Initial Developer. All Rights Reserved. + # + # Contributor(s): + # + # 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 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 ***** + +.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 + + +# +# NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex, +# PRUint32 paramCount, nsXPTCVariant* params) +# + + .section ".toc","aw" + .section ".text" + .align 2 + .globl NS_InvokeByIndex_P + .section ".opd","aw" + .align 3 +NS_InvokeByIndex_P: + .quad .NS_InvokeByIndex_P,.TOC.@tocbase + .previous + .type NS_InvokeByIndex_P,@function +.NS_InvokeByIndex_P: + 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 NS_InvokeByIndex_P,.-.NS_InvokeByIndex_P + + # Magic indicating no need for an executable stack + .section .note.GNU-stack, "", @progbits ; .previous --- /dev/null 2000-10-22 01:01:00.000000000 +0000 +++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp 2007-01-29 17:36:50.000000000 +0000 @@ -0,0 +1,131 @@ +/* -*- 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@xxxxxxxxxxxxx (David Woodhouse) + * Franz.Sirl-kernel@xxxxxxxxxxxxxx (Franz Sirl) + * beard@xxxxxxxxxxxx (Patrick Beard) + * waterson@xxxxxxxxxxxx (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 NS_InvokeByIndex_P() is to map a platform +// independent call to the platform ABI. To do that, +// NS_InvokeByIndex_P() 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. + +// The PowerPC64 platform ABI can be found here: +// http://www.freestandards.org/spec/ELF/ppc64/ +// and in particular: +// http://www.freestandards.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-CALL + +#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++; + } +} + +EXPORT_XPCOM_API(nsresult) +NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + --- /dev/null 2000-10-22 01:01:00.000000000 +0000 +++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.s 2007-01-29 17:36:50.000000000 +0000 @@ -0,0 +1,113 @@ +## ***** 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 + # dwmw2@xxxxxxxxxxxxx (David Woodhouse). + # Portions created by the Initial Developer are Copyright (C) 2006 + # the Initial Developer. All Rights Reserved. + # + # Contributor(s): + # + # 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 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 ***** + +.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 + # nsNSStubBase::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 --- /dev/null 2000-10-22 01:01:00.000000000 +0000 +++ xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc64_linux.cpp 2007-01-29 17:36:50.000000000 +0000 @@ -0,0 +1,245 @@ +/* -*- 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@xxxxxxxxxxxxx (David Woodhouse) + * Franz.Sirl-kernel@xxxxxxxxxxxxxx (Franz Sirl) + * beard@xxxxxxxxxxxx (Patrick Beard) + * waterson@xxxxxxxxxxxx (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" +#include "xptiprivate.h" + +// The Linux/PPC64 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 caller's stack +// area. The stack pointer has to retain 16-byte alignment. + +// The PowerPC64 platform ABI can be found here: +// http://www.freestandards.org/spec/ELF/ppc64/ +// and in particular: +// http://www.freestandards.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-CALL + +#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; + const nsXPTMethodInfo* info; + PRUint32 paramCount; + PRUint32 i; + nsresult result = NS_ERROR_FAILURE; + + NS_ASSERTION(self,"no self"); + + self->mEntry->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->mOuter->CallMethod((PRUint16) methodIndex, info, + dispatchParams); + + 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"
-- fedora-devel-list mailing list fedora-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-devel-list