Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 101821 | Differences between
and this patch

Collapse All | Expand All

(-)mozilla.orig/xpcom/reflect/xptcall/src/md/unix/Makefile.in (+5 lines)
Lines 267-272 Link Here
267
ASFILES		:= xptcinvoke_asm_ppc_linux.s xptcstubs_asm_ppc_linux.s
267
ASFILES		:= xptcinvoke_asm_ppc_linux.s xptcstubs_asm_ppc_linux.s
268
AS		:= $(CC) -c -x assembler-with-cpp
268
AS		:= $(CC) -c -x assembler-with-cpp
269
endif
269
endif
270
ifeq ($(OS_ARCH)$(OS_TEST),Linuxppc64)
271
CPPSRCS		:= xptcinvoke_ppc64_linux.cpp xptcstubs_ppc64_linux.cpp
272
ASFILES		:= xptcinvoke_asm_ppc64_linux.s xptcstubs_asm_ppc64_linux.s
273
AS		:= $(CC) -c -x assembler-with-cpp
274
endif
270
275
271
#
276
#
272
# NetBSD/PPC
277
# NetBSD/PPC
(-)mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.s (+154 lines)
Line 0 Link Here
1
// -*- Mode: Asm -*-
2
//
3
// The contents of this file are subject to the Netscape Public
4
// License Version 1.1 (the "License"); you may not use this file
5
// except in compliance with the License. You may obtain a copy of
6
// the License at http://www.mozilla.org/NPL/
7
//
8
// Software distributed under the License is distributed on an "AS
9
// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
// implied. See the License for the specific language governing
11
// rights and limitations under the License.
12
//
13
// The Original Code is mozilla.org code.
14
//
15
// The Initial Developer of the Original Code is Netscape
16
// Communications Corporation.  Portions created by Netscape are
17
// Copyright (C) 1999 Netscape Communications Corporation. All
18
// Rights Reserved.
19
//
20
// Contributor(s):
21
//   dwmw2@infradead.org (David Woodhouse)
22
//   Franz.Sirl-kernel@lauterbach.com (Franz Sirl)
23
//   beard@netscape.com (Patrick Beard)
24
//   waterson@netscape.com (Chris Waterson)
25
//
26
27
.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4
28
.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
29
.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
30
.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
31
.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
32
.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
33
.set r30,30; .set r31,31
34
.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4
35
.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9
36
.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14
37
.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19
38
.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24
39
.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
40
.set f30,30; .set f31,31
41
42
43
//
44
// XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
45
//                    PRUint32 paramCount, nsXPTCVariant* params)
46
//
47
48
	.section ".toc","aw"
49
	.section ".text"
50
	.align 2
51
	.globl XPTC_InvokeByIndex
52
	.section ".opd","aw"
53
	.align 3
54
XPTC_InvokeByIndex:
55
	.quad   .XPTC_InvokeByIndex,.TOC.@tocbase
56
	.previous
57
	.type  XPTC_InvokeByIndex,@function
58
.XPTC_InvokeByIndex:
59
	mflr	0
60
	std	0,16(r1)
61
	
62
	std	r29,-24(r1)
63
	std	r30,-16(r1)
64
	std	r31,-8(r1)
65
66
	mr	r29,r3			// Save 'that' in r29
67
	mr	r30,r4			// Save 'methodIndex' in r30
68
	mr	r31,r1			// Save old frame
69
70
	// Allocate stack frame with space for params. Since at least the
71
	// first 7 parameters (not including 'that') will be in registers,
72
	// we don't actually need stack space for those. We must ensure
73
	// that the stack remains 16-byte aligned.
74
	//
75
	//  | ..128-byte stack frame.. |     | 7 GP | 13 FP | 3 NV |
76
	//  |               |(params)........| regs | regs  | regs |
77
	// (r1)...........(+112)....(+128)
78
	//                               (-23*8).(-16*8).(-3*8)..(r31)
79
80
	// +stack frame, -unused stack params, +regs storage, +1 for alignment
81
	addi	r7,r5,((112/8)-7+7+13+3+1)
82
	rldicr	r7,r7,3,59		// multiply by 8 and mask with ~15
83
	neg	r7,r7
84
	stdux	r1,r1,r7
85
86
	
87
	// Call invoke_copy_to_stack(PRUint64* gpregs, double* fpregs,
88
	//			     PRUint32 paramCount, nsXPTCVariant* s, 
89
	//			     PRUint64* d))
90
	
91
	// r5, r6 are passed through intact (paramCount, params)
92
	// r7 (d) has to be r1+112 -- where parameters are passed on the stack.
93
	// r3, r4 are above that, easier to address from r31 than from r1
94
95
	subi	r3,r31,(23*8)		// r3 --> GPRS
96
	subi	r4,r31,(16*8)		// r4 --> FPRS
97
	addi	r7,r1,112		// r7 --> params
98
	bl	invoke_copy_to_stack
99
	nop
100
101
	// Set up to invoke function
102
	
103
	ld	r9,0(r29)		// vtable (r29 is 'that')
104
	mr	r3,r29		// self is first arg, obviously
105
106
	sldi	r30,r30,3	// Find function descriptor 
107
	add	r9,r9,r30
108
	ld	r9,0(r9)
109
	
110
	ld	r0,0(r9)	// Actual address from fd.
111
	std	r2,40(r1)	// Save r2 (TOC pointer)
112
113
	mtctr	0
114
	ld	r11,16(r9)	// Environment pointer from fd.
115
	ld	r2,8(r9)	// TOC pointer from fd.
116
117
	// Load FP and GP registers as required
118
	ld	r4, -(23*8)(r31) 
119
	ld	r5, -(22*8)(r31) 
120
	ld	r6, -(21*8)(r31) 
121
	ld	r7, -(20*8)(r31) 
122
	ld	r8, -(19*8)(r31) 
123
	ld	r9, -(18*8)(r31) 
124
	ld	r10, -(17*8)(r31) 
125
126
	lfd	f1, -(16*8)(r31)
127
	lfd	f2, -(15*8)(r31)
128
	lfd	f3, -(14*8)(r31)
129
	lfd	f4, -(13*8)(r31)
130
	lfd	f5, -(12*8)(r31)
131
	lfd	f6, -(11*8)(r31)
132
	lfd	f7, -(10*8)(r31)
133
	lfd	f8, -(9*8)(r31)
134
	lfd	f9, -(8*8)(r31)
135
	lfd	f10, -(7*8)(r31)
136
	lfd	f11, -(6*8)(r31)
137
	lfd	f12, -(5*8)(r31)
138
	lfd	f13, -(4*8)(r31)
139
140
	bctrl			// Do it
141
142
	ld	r2,40(r1)	// Load our own TOC pointer
143
	ld	r1,0(r1)	// Revert stack frame
144
	ld	0,16(r1)	// Reload lr
145
	ld	29,-24(r1)	// Restore NVGPRS
146
	ld	30,-16(r1)
147
	ld	31,-8(r1)
148
	mtlr	0
149
	blr
150
151
	.size   XPTC_InvokeByIndex,.-.XPTC_InvokeByIndex
152
153
	/* Magic indicating no need for an executable stack */
154
	.section .note.GNU-stack, "", @progbits ; .previous
(-)mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp (+127 lines)
Line 0 Link Here
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is mozilla.org code.
16
 *
17
 * The Initial Developer of the Original Code is
18
 * Netscape Communications Corporation.
19
 * Portions created by the Initial Developer are Copyright (C) 1998
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   dwmw2@infradead.org (David Woodhouse)
24
 *   Franz.Sirl-kernel@lauterbach.com (Franz Sirl)
25
 *   beard@netscape.com (Patrick Beard)
26
 *   waterson@netscape.com (Chris Waterson)
27
 *
28
 * Alternatively, the contents of this file may be used under the terms of
29
 * either of the GNU General Public License Version 2 or later (the "GPL"),
30
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31
 * in which case the provisions of the GPL or the LGPL are applicable instead
32
 * of those above. If you wish to allow use of your version of this file only
33
 * under the terms of either the GPL or the LGPL, and not to allow others to
34
 * use your version of this file under the terms of the MPL, indicate your
35
 * decision by deleting the provisions above and replace them with the notice
36
 * and other provisions required by the GPL or the LGPL. If you do not delete
37
 * the provisions above, a recipient may use your version of this file under
38
 * the terms of any one of the MPL, the GPL or the LGPL.
39
 *
40
 * ***** END LICENSE BLOCK ***** */
41
42
// Platform specific code to invoke XPCOM methods on native objects
43
44
// The purpose of XPTC_InvokeByIndex() is to map a platform
45
// independent call to the platform ABI. To do that,
46
// XPTC_InvokeByIndex() has to determine the method to call via vtable
47
// access. The parameters for the method are read from the
48
// nsXPTCVariant* and prepared for the native ABI.
49
50
#include <stdio.h>
51
#include "xptcprivate.h"
52
53
// 8 integral parameters are passed in registers, not including 'that'
54
#define GPR_COUNT     7
55
56
// 8 floating point parameters are passed in registers, floats are
57
// promoted to doubles when passed in registers
58
#define FPR_COUNT     13
59
60
extern "C" PRUint32
61
invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s)
62
{
63
  return PRUint32(((paramCount * 2) + 3) & ~3);
64
}
65
66
extern "C" void
67
invoke_copy_to_stack(PRUint64* gpregs,
68
                     double* fpregs,
69
                     PRUint32 paramCount,
70
                     nsXPTCVariant* s, 
71
                     PRUint64* d)
72
{
73
    PRUint64 tempu64;
74
75
    for(uint32 i = 0; i < paramCount; i++, s++) {
76
        if(s->IsPtrData())
77
            tempu64 = (PRUint64) s->ptr;
78
        else {
79
            switch(s->type) {
80
            case nsXPTType::T_FLOAT:                                  break;
81
            case nsXPTType::T_DOUBLE:                                 break;
82
            case nsXPTType::T_I8:     tempu64 = s->val.i8;            break;
83
            case nsXPTType::T_I16:    tempu64 = s->val.i16;           break;
84
            case nsXPTType::T_I32:    tempu64 = s->val.i32;           break;
85
            case nsXPTType::T_I64:    tempu64 = s->val.i64;           break;
86
            case nsXPTType::T_U8:     tempu64 = s->val.u8;            break;
87
            case nsXPTType::T_U16:    tempu64 = s->val.u16;           break;
88
            case nsXPTType::T_U32:    tempu64 = s->val.u32;           break;
89
            case nsXPTType::T_U64:    tempu64 = s->val.u64;           break;
90
            case nsXPTType::T_BOOL:   tempu64 = s->val.b;             break;
91
            case nsXPTType::T_CHAR:   tempu64 = s->val.c;             break;
92
            case nsXPTType::T_WCHAR:  tempu64 = s->val.wc;            break;
93
            default:                  tempu64 = (PRUint64) s->val.p;  break;
94
            }
95
        }
96
97
        if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) {
98
            if (i < FPR_COUNT)
99
                fpregs[i]    = s->val.d;
100
            else
101
                *(double *)d = s->val.d;
102
        }
103
        else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
104
            if (i < FPR_COUNT) {
105
                fpregs[i]   = s->val.f; // if passed in registers, floats are promoted to doubles
106
            } else {
107
                float *p = (float *)d;
108
                p++;
109
                *p = s->val.f;
110
            }
111
        }
112
        else {
113
            if (i < GPR_COUNT)
114
                gpregs[i] = tempu64;
115
            else
116
                *d          = tempu64;
117
        }
118
        if (i >= 7)
119
            d++;
120
    }
121
}
122
123
extern "C"
124
XPTC_PUBLIC_API(nsresult)
125
XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
126
                   PRUint32 paramCount, nsXPTCVariant* params);
127
(-)mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.s (+102 lines)
Line 0 Link Here
1
// -*- Mode: Asm -*-
2
//
3
// The contents of this file are subject to the Netscape Public
4
// License Version 1.1 (the "License"); you may not use this file
5
// except in compliance with the License. You may obtain a copy of
6
// the License at http://www.mozilla.org/NPL/
7
//
8
// Software distributed under the License is distributed on an "AS
9
// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
// implied. See the License for the specific language governing
11
// rights and limitations under the License.
12
//
13
// The Original Code is mozilla.org code.
14
//
15
// The Initial Developer of the Original Code is Netscape
16
// Communications Corporation.  Portions created by Netscape are
17
// Copyright (C) 1999 Netscape Communications Corporation. All
18
// Rights Reserved.
19
//
20
// Contributor(s):
21
//   dwmw2@infradead.org (David Woodhouse)
22
//   Franz.Sirl-kernel@lauterbach.com (Franz Sirl)
23
//   beard@netscape.com (Patrick Beard)
24
//   waterson@netscape.com (Chris Waterson)
25
//
26
27
.set r0,0; .set r1,1; .set RTOC,2; .set r3,3; .set r4,4
28
.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
29
.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
30
.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
31
.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
32
.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
33
.set r30,30; .set r31,31
34
.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4
35
.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9
36
.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14
37
.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19
38
.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24
39
.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
40
.set f30,30; .set f31,31
41
42
	.section ".text"
43
	.align 2
44
	.globl SharedStub
45
	.section	".opd","aw"
46
	.align 3
47
48
SharedStub:
49
	.quad   .SharedStub,.TOC.@tocbase
50
	.previous
51
      	.type  SharedStub,@function
52
53
.SharedStub:
54
	mflr	r0
55
56
	std	r4, -56(r1)			// Save all GPRS
57
	std	r5, -48(r1)
58
	std	r6, -40(r1)
59
	std	r7, -32(r1)
60
	std	r8, -24(r1)
61
	std	r9, -16(r1)
62
	std	r10, -8(r1)
63
64
	stfd	f13, -64(r1)			// ... and FPRS
65
	stfd	f12, -72(r1)
66
	stfd	f11, -80(r1)
67
	stfd	f10, -88(r1)
68
	stfd	f9, -96(r1)
69
	stfd	f8, -104(r1)
70
	stfd	f7, -112(r1)
71
	stfd	f6, -120(r1)
72
	stfd	f5, -128(r1)
73
	stfd	f4, -136(r1)
74
	stfd	f3, -144(r1)
75
	stfd	f2, -152(r1)
76
	stfd	f1, -160(r1)
77
78
	subi	r6,r1,56			// r6 --> gprData
79
	subi	r7,r1,160			// r7 --> fprData
80
	addi	r5,r1,112			// r5 --> extra stack args
81
82
	std	r0, 16(r1)
83
	
84
	stdu	r1,-288(r1)
85
					// r3 has the 'self' pointer already
86
	
87
	mr      r4,r11		// r4 is methodIndex selector, passed
88
				// via r11 in the nsXPTCStubBase::StubXX() call
89
	
90
	bl	PrepareAndDispatch
91
	nop
92
93
	ld	1,0(r1)				// restore stack
94
	ld	r0,16(r1)			// restore LR
95
	mtlr	r0
96
	blr
97
98
	.size   SharedStub,.-.SharedStub
99
100
101
/* Magic indicating no need for an executable stack */
102
.section .note.GNU-stack, "", @progbits ; .previous
(-)mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc64_linux.cpp (+247 lines)
Line 0 Link Here
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is mozilla.org code.
16
 *
17
 * The Initial Developer of the Original Code is
18
 * Netscape Communications Corporation.
19
 * Portions created by the Initial Developer are Copyright (C) 1999
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   dwmw2@infradead.org (David Woodhouse)
24
 *   Franz.Sirl-kernel@lauterbach.com (Franz Sirl)
25
 *   beard@netscape.com (Patrick Beard)
26
 *   waterson@netscape.com (Chris Waterson)
27
 *
28
 * Alternatively, the contents of this file may be used under the terms of
29
 * either of the GNU General Public License Version 2 or later (the "GPL"),
30
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31
 * in which case the provisions of the GPL or the LGPL are applicable instead
32
 * of those above. If you wish to allow use of your version of this file only
33
 * under the terms of either the GPL or the LGPL, and not to allow others to
34
 * use your version of this file under the terms of the MPL, indicate your
35
 * decision by deleting the provisions above and replace them with the notice
36
 * and other provisions required by the GPL or the LGPL. If you do not delete
37
 * the provisions above, a recipient may use your version of this file under
38
 * the terms of any one of the MPL, the GPL or the LGPL.
39
 *
40
 * ***** END LICENSE BLOCK ***** */
41
42
// Implement shared vtbl methods.
43
44
#include "xptcprivate.h"
45
46
// The Linux/PPC ABI (aka PPC/SYSV ABI) passes the first 8 integral
47
// parameters and the first 13 floating point parameters in registers
48
// (r3-r10 and f1-f13), no stack space is allocated for these by the
49
// caller.  The rest of the parameters are passed in the callers stack
50
// area. The stack pointer has to retain 16-byte alignment, longlongs
51
// and doubles are aligned on 8-byte boundaries.
52
53
#define PARAM_BUFFER_COUNT     16
54
#define GPR_COUNT               7
55
#define FPR_COUNT               13
56
57
// PrepareAndDispatch() is called by SharedStub() and calls the actual method.
58
//
59
// - 'args[]' contains the arguments passed on stack
60
// - 'gprData[]' contains the arguments passed in integer registers
61
// - 'fprData[]' contains the arguments passed in floating point registers
62
// 
63
// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
64
// and then the method gets called.
65
#include <stdio.h>
66
extern "C" nsresult
67
PrepareAndDispatch(nsXPTCStubBase* self,
68
                   PRUint64 methodIndex,
69
                   PRUint64* args,
70
                   PRUint64 *gprData,
71
                   double *fprData)
72
{
73
    nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
74
    nsXPTCMiniVariant* dispatchParams = NULL;
75
    nsIInterfaceInfo* iface_info = NULL;
76
    const nsXPTMethodInfo* info;
77
    PRUint32 paramCount;
78
    PRUint32 i;
79
    nsresult result = NS_ERROR_FAILURE;
80
81
    NS_ASSERTION(self,"no self");
82
83
    self->GetInterfaceInfo(&iface_info);
84
    NS_ASSERTION(iface_info,"no interface info");
85
    if (! iface_info)
86
        return NS_ERROR_UNEXPECTED;
87
88
    iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
89
    NS_ASSERTION(info,"no method info");
90
    if (! info)
91
        return NS_ERROR_UNEXPECTED;
92
93
    paramCount = info->GetParamCount();
94
95
    // setup variant array pointer
96
    if(paramCount > PARAM_BUFFER_COUNT)
97
        dispatchParams = new nsXPTCMiniVariant[paramCount];
98
    else
99
        dispatchParams = paramBuffer;
100
101
    NS_ASSERTION(dispatchParams,"no place for params");
102
    if (! dispatchParams)
103
        return NS_ERROR_OUT_OF_MEMORY;
104
105
    PRUint64* ap = args;
106
    PRUint64 tempu64;
107
108
    for(i = 0; i < paramCount; i++) {
109
        const nsXPTParamInfo& param = info->GetParam(i);
110
        const nsXPTType& type = param.GetType();
111
        nsXPTCMiniVariant* dp = &dispatchParams[i];
112
	
113
        if (!param.IsOut() && type == nsXPTType::T_DOUBLE) {
114
            if (i < FPR_COUNT)
115
                dp->val.d = fprData[i];
116
            else
117
                dp->val.d = *(double*) ap;
118
        } else if (!param.IsOut() && type == nsXPTType::T_FLOAT) {
119
            if (i < FPR_COUNT)
120
                dp->val.f = (float) fprData[i]; // in registers floats are passed as doubles
121
            else {
122
                float *p = (float *)ap;
123
                p++;
124
                dp->val.f = *p;
125
            }
126
        } else { /* integer type or pointer */
127
            if (i < GPR_COUNT)
128
                tempu64 = gprData[i];
129
            else
130
                tempu64 = *ap;
131
132
            if (param.IsOut() || !type.IsArithmetic())
133
                dp->val.p = (void*) tempu64;
134
            else if (type ==nsXPTType::T_I8)
135
                dp->val.i8  = (PRInt8)   tempu64;
136
            else if (type ==nsXPTType::T_I16)
137
                dp->val.i16 = (PRInt16)  tempu64;
138
            else if (type ==nsXPTType::T_I32)
139
                dp->val.i32 = (PRInt32)  tempu64;
140
            else if (type ==nsXPTType::T_I64)
141
                dp->val.i64 = (PRInt64)  tempu64;
142
            else if (type ==nsXPTType::T_U8)
143
                dp->val.u8  = (PRUint8)  tempu64;
144
            else if (type ==nsXPTType::T_U16)
145
                dp->val.u16 = (PRUint16) tempu64;
146
            else if (type ==nsXPTType::T_U32)
147
                dp->val.u32 = (PRUint32) tempu64;
148
            else if (type ==nsXPTType::T_U64)
149
                dp->val.u64 = (PRUint64) tempu64;
150
            else if (type ==nsXPTType::T_BOOL)
151
                dp->val.b   = (PRBool)   tempu64;
152
            else if (type ==nsXPTType::T_CHAR)
153
                dp->val.c   = (char)     tempu64;
154
            else if (type ==nsXPTType::T_WCHAR)
155
                dp->val.wc  = (wchar_t)  tempu64;
156
            else
157
                NS_ASSERTION(0, "bad type");
158
        }
159
160
        if (i >= 7)
161
            ap++;
162
    }
163
164
    result = self->CallMethod((PRUint16) methodIndex, info, dispatchParams);
165
166
    NS_RELEASE(iface_info);
167
168
    if (dispatchParams != paramBuffer)
169
        delete [] dispatchParams;
170
171
    return result;
172
}
173
174
// Load r11 with the constant 'n' and branch to SharedStub().
175
//
176
// XXX Yes, it's ugly that we're relying on gcc's name-mangling here;
177
// however, it's quick, dirty, and'll break when the ABI changes on
178
// us, which is what we want ;-).
179
180
#if __GXX_ABI_VERSION < 100
181
#error Prehistoric GCC not supported here
182
#else
183
// gcc-3 version
184
//
185
// As G++3 ABI contains the length of the functionname in the mangled
186
// name, it is difficult to get a generic assembler mechanism like
187
// in the G++ 2.95 case.
188
// Create names would be like:
189
// _ZN14nsXPTCStubBase5Stub1Ev
190
// _ZN14nsXPTCStubBase6Stub12Ev
191
// _ZN14nsXPTCStubBase7Stub123Ev
192
// _ZN14nsXPTCStubBase8Stub1234Ev
193
// etc.
194
// Use assembler directives to get the names right...
195
196
# define STUB_ENTRY(n)							\
197
__asm__ (								\
198
        ".section \".toc\",\"aw\" \n\t"                                 \
199
        ".section \".text\" \n\t"                                       \
200
	".align	2 \n\t"							\
201
	".if	"#n" < 10 \n\t"						\
202
	".globl	_ZN14nsXPTCStubBase5Stub"#n"Ev \n\t"			\
203
        ".section \".opd\",\"aw\" \n\t"                                 \
204
	".align	3 \n\t"							\
205
"_ZN14nsXPTCStubBase5Stub"#n"Ev: \n\t"					\
206
        ".quad  ._ZN14nsXPTCStubBase5Stub"#n"Ev,.TOC.@tocbase \n\t"     \
207
	".previous \n\t"						\
208
	".type	_ZN14nsXPTCStubBase5Stub"#n"Ev,@function \n\n"		\
209
"._ZN14nsXPTCStubBase5Stub"#n"Ev: \n\t"					\
210
									\
211
	".elseif "#n" < 100 \n\t"					\
212
	".globl	_ZN14nsXPTCStubBase6Stub"#n"Ev \n\t"			\
213
        ".section \".opd\",\"aw\" \n\t"                                 \
214
	".align	3 \n\t"							\
215
"_ZN14nsXPTCStubBase6Stub"#n"Ev: \n\t"					\
216
        ".quad  ._ZN14nsXPTCStubBase6Stub"#n"Ev,.TOC.@tocbase \n\t"     \
217
	".previous \n\t"						\
218
	".type	_ZN14nsXPTCStubBase6Stub"#n"Ev,@function \n\n"		\
219
"._ZN14nsXPTCStubBase6Stub"#n"Ev: \n\t"					\
220
									\
221
	".elseif "#n" < 1000 \n\t"					\
222
	".globl	_ZN14nsXPTCStubBase7Stub"#n"Ev \n\t"			\
223
        ".section \".opd\",\"aw\" \n\t"                                 \
224
	".align	3 \n\t"							\
225
"_ZN14nsXPTCStubBase7Stub"#n"Ev: \n\t"					\
226
        ".quad  ._ZN14nsXPTCStubBase7Stub"#n"Ev,.TOC.@tocbase \n\t"     \
227
	".previous \n\t"						\
228
	".type	_ZN14nsXPTCStubBase7Stub"#n"Ev,@function \n\n"		\
229
"._ZN14nsXPTCStubBase7Stub"#n"Ev: \n\t"					\
230
									\
231
	".else \n\t"							\
232
	".err	\"stub number "#n" >= 1000 not yet supported\"\n"	\
233
	".endif \n\t"							\
234
									\
235
	"li	11,"#n" \n\t"						\
236
	"b	SharedStub \n"					\
237
);
238
#endif
239
240
#define SENTINEL_ENTRY(n)                            \
241
nsresult nsXPTCStubBase::Sentinel##n()               \
242
{                                                    \
243
  NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \
244
  return NS_ERROR_NOT_IMPLEMENTED;                   \
245
}
246
247
#include "xptcstubsdef.inc"

Return to bug 101821