1 diff -durN mozilla.orig/config/mkdepend/imakemdep.h mozilla/config/mkdepend/imakemdep.h
2 --- mozilla.orig/config/mkdepend/imakemdep.h 1998-09-05 06:22:25.000000000 +0200
3 +++ mozilla/config/mkdepend/imakemdep.h 2005-01-01 01:18:35.345553032 +0100
14 diff -durN mozilla.orig/directory/c-sdk/ldap/libraries/liblber/lber-int.h mozilla/directory/c-sdk/ldap/libraries/liblber/lber-int.h
15 --- mozilla.orig/directory/c-sdk/ldap/libraries/liblber/lber-int.h 2002-03-26 22:53:23.000000000 +0100
16 +++ mozilla/directory/c-sdk/ldap/libraries/liblber/lber-int.h 2005-01-01 01:18:35.344553184 +0100
18 (((_l)&0xff0000)>>8) + (((_l)&0xff000000)>>24))
19 #define LBER_NTOHL(_l) LBER_HTONL(_l)
21 -#elif !defined(__alpha) || defined(VMS)
22 +#elif !defined(__x86_64__) && (!defined(__alpha) || defined(VMS))
24 #define LBER_HTONL( l ) htonl( l )
25 #define LBER_NTOHL( l ) ntohl( l )
29 - * htonl and ntohl on the DEC Alpha under OSF 1 seem to only swap the
30 - * lower-order 32-bits of a (64-bit) long, so we define correct versions
32 + * htonl and ntohl on the 64-bit UNIX platforms only swap the lower-order
33 + * 32-bits of a (64-bit) long, so we define correct versions here.
35 #define LBER_HTONL( l ) (((long)htonl( (l) & 0x00000000FFFFFFFF )) << 32 \
36 | htonl( ( (l) & 0xFFFFFFFF00000000 ) >> 32 ))
38 #define LBER_NTOHL( l ) (((long)ntohl( (l) & 0x00000000FFFFFFFF )) << 32 \
39 | ntohl( ( (l) & 0xFFFFFFFF00000000 ) >> 32 ))
41 +#endif /* __alpha || __x86_64__ */
44 /* function prototypes */
45 diff -durN mozilla.orig/nsprpub/configure mozilla/nsprpub/configure
46 --- mozilla.orig/nsprpub/configure 2003-08-30 02:18:12.000000000 +0200
47 +++ mozilla/nsprpub/configure 2005-01-01 01:18:35.337554248 +0100
50 PR_MD_ASFILES=os_Linux_ia64.s
53 + PR_MD_ASFILES=os_Linux_x86_64.s
56 CFLAGS="$CFLAGS -m68020-60"
57 CXXFLAGS="$CXXFLAGS -m68020-60"
58 diff -durN mozilla.orig/nsprpub/configure.in mozilla/nsprpub/configure.in
59 --- mozilla.orig/nsprpub/configure.in 2003-08-30 02:18:18.000000000 +0200
60 +++ mozilla/nsprpub/configure.in 2005-01-01 01:18:35.326555920 +0100
63 PR_MD_ASFILES=os_Linux_ia64.s
66 + PR_MD_ASFILES=os_Linux_x86_64.s
69 CFLAGS="$CFLAGS -m68020-60"
70 CXXFLAGS="$CXXFLAGS -m68020-60"
71 diff -durN mozilla.orig/nsprpub/pr/include/md/_linux.cfg mozilla/nsprpub/pr/include/md/_linux.cfg
72 --- mozilla.orig/nsprpub/pr/include/md/_linux.cfg 2003-02-27 00:53:38.000000000 +0100
73 +++ mozilla/nsprpub/pr/include/md/_linux.cfg 2005-01-01 01:18:35.323556376 +0100
75 #define PR_BYTES_PER_WORD_LOG2 3
76 #define PR_BYTES_PER_DWORD_LOG2 3
78 +#elif defined(__x86_64__)
80 +#define IS_LITTLE_ENDIAN 1
84 +#define PR_BYTES_PER_BYTE 1
85 +#define PR_BYTES_PER_SHORT 2
86 +#define PR_BYTES_PER_INT 4
87 +#define PR_BYTES_PER_INT64 8
88 +#define PR_BYTES_PER_LONG 8
89 +#define PR_BYTES_PER_FLOAT 4
90 +#define PR_BYTES_PER_DOUBLE 8
91 +#define PR_BYTES_PER_WORD 8
92 +#define PR_BYTES_PER_DWORD 8
94 +#define PR_BITS_PER_BYTE 8
95 +#define PR_BITS_PER_SHORT 16
96 +#define PR_BITS_PER_INT 32
97 +#define PR_BITS_PER_INT64 64
98 +#define PR_BITS_PER_LONG 64
99 +#define PR_BITS_PER_FLOAT 32
100 +#define PR_BITS_PER_DOUBLE 64
101 +#define PR_BITS_PER_WORD 64
103 +#define PR_BITS_PER_BYTE_LOG2 3
104 +#define PR_BITS_PER_SHORT_LOG2 4
105 +#define PR_BITS_PER_INT_LOG2 5
106 +#define PR_BITS_PER_INT64_LOG2 6
107 +#define PR_BITS_PER_LONG_LOG2 6
108 +#define PR_BITS_PER_FLOAT_LOG2 5
109 +#define PR_BITS_PER_DOUBLE_LOG2 6
110 +#define PR_BITS_PER_WORD_LOG2 6
112 +#define PR_ALIGN_OF_SHORT 2
113 +#define PR_ALIGN_OF_INT 4
114 +#define PR_ALIGN_OF_LONG 8
115 +#define PR_ALIGN_OF_INT64 8
116 +#define PR_ALIGN_OF_FLOAT 4
117 +#define PR_ALIGN_OF_DOUBLE 8
118 +#define PR_ALIGN_OF_POINTER 8
119 +#define PR_ALIGN_OF_WORD 8
121 +#define PR_BYTES_PER_WORD_LOG2 3
122 +#define PR_BYTES_PER_DWORD_LOG2 3
124 #elif defined(__mc68000__)
126 #undef IS_LITTLE_ENDIAN
127 diff -durN mozilla.orig/nsprpub/pr/include/md/_linux.h mozilla/nsprpub/pr/include/md/_linux.h
128 --- mozilla.orig/nsprpub/pr/include/md/_linux.h 2003-02-27 00:53:39.000000000 +0100
129 +++ mozilla/nsprpub/pr/include/md/_linux.h 2005-01-01 01:18:35.323556376 +0100
131 #define _PR_SI_ARCHITECTURE "alpha"
132 #elif defined(__ia64__)
133 #define _PR_SI_ARCHITECTURE "ia64"
134 +#elif defined(__x86_64__)
135 +#define _PR_SI_ARCHITECTURE "x86-64"
136 #elif defined(__mc68000__)
137 #define _PR_SI_ARCHITECTURE "m68k"
138 #elif defined(__sparc__)
140 #define _MD_ATOMIC_SET _PR_ia64_AtomicSet
143 +#if defined(__x86_64__)
144 +#define _PR_HAVE_ATOMIC_OPS
145 +#define _MD_INIT_ATOMIC()
146 +extern PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val);
147 +#define _MD_ATOMIC_INCREMENT _PR_x86_64_AtomicIncrement
148 +extern PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val);
149 +#define _MD_ATOMIC_DECREMENT _PR_x86_64_AtomicDecrement
150 +extern PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val);
151 +#define _MD_ATOMIC_ADD _PR_x86_64_AtomicAdd
152 +extern PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval);
153 +#define _MD_ATOMIC_SET _PR_x86_64_AtomicSet
157 #if defined(__GLIBC__) && __GLIBC__ >= 2
158 #define _PR_POLL_AVAILABLE
159 diff -durN mozilla.orig/nsprpub/pr/src/io/prprf.c mozilla/nsprpub/pr/src/io/prprf.c
160 --- mozilla.orig/nsprpub/pr/src/io/prprf.c 2003-02-27 00:53:42.000000000 +0100
161 +++ mozilla/nsprpub/pr/src/io/prprf.c 2005-01-01 01:18:35.324556224 +0100
163 ** Note: on some platforms va_list is defined as an array,
164 ** and requires array notation.
166 -#if (defined(LINUX) && defined(__powerpc__)) || \
167 +#if (defined(LINUX) && defined(__x86_64__))
169 +#define VARARGS_ASSIGN(foo, bar) __va_copy((foo), (bar))
170 +#elif (defined(LINUX) && defined(__powerpc__)) || \
171 (defined(LINUX) && defined(__s390__)) || \
172 (defined(LINUX) && defined(__s390x__)) || \
173 defined(WIN16) || defined(QNX) || \
174 diff -durN mozilla.orig/nsprpub/pr/src/md/unix/os_Linux_x86_64.s mozilla/nsprpub/pr/src/md/unix/os_Linux_x86_64.s
175 --- mozilla.orig/nsprpub/pr/src/md/unix/os_Linux_x86_64.s 1970-01-01 01:00:00.000000000 +0100
176 +++ mozilla/nsprpub/pr/src/md/unix/os_Linux_x86_64.s 2005-01-01 01:18:35.325556072 +0100
178 +/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
180 +/ The contents of this file are subject to the Mozilla Public
181 +/ License Version 1.1 (the "License"); you may not use this file
182 +/ except in compliance with the License. You may obtain a copy of
183 +/ the License at http://www.mozilla.org/MPL/
185 +/ Software distributed under the License is distributed on an "AS
186 +/ IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
187 +/ implied. See the License for the specific language governing
188 +/ rights and limitations under the License.
190 +/ The Original Code is the Netscape Portable Runtime (NSPR).
192 +/ The Initial Developer of the Original Code is Netscape
193 +/ Communications Corporation. Portions created by Netscape are
194 +/ Copyright (C) 2000 Netscape Communications Corporation. All
199 +/ Alternatively, the contents of this file may be used under the
200 +/ terms of the GNU General Public License Version 2 or later (the
201 +/ "GPL"), in which case the provisions of the GPL are applicable
202 +/ instead of those above. If you wish to allow use of your
203 +/ version of this file only under the terms of the GPL and not to
204 +/ allow others to use your version of this file under the MPL,
205 +/ indicate your decision by deleting the provisions above and
206 +/ replace them with the notice and other provisions required by
207 +/ the GPL. If you do not delete the provisions above, a recipient
208 +/ may use your version of this file under either the MPL or the
212 +/ PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val)
214 +/ Atomically increment the integer pointed to by 'val' and return
215 +/ the result of the increment.
218 + .globl _PR_x86_64_AtomicIncrement
220 +_PR_x86_64_AtomicIncrement:
227 +/ PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val)
229 +/ Atomically decrement the integer pointed to by 'val' and return
230 +/ the result of the decrement.
233 + .globl _PR_x86_64_AtomicDecrement
235 +_PR_x86_64_AtomicDecrement:
242 +/ PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval)
244 +/ Atomically set the integer pointed to by 'val' to the new
245 +/ value 'newval' and return the old value.
247 + .globl _PR_x86_64_AtomicSet
249 +_PR_x86_64_AtomicSet:
255 +/ PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val)
257 +/ Atomically add 'val' to the integer pointed to by 'ptr'
258 +/ and return the result of the addition.
261 + .globl _PR_x86_64_AtomicAdd
263 +_PR_x86_64_AtomicAdd:
269 diff -durN mozilla.orig/security/coreconf/Linux.mk mozilla/security/coreconf/Linux.mk
270 --- mozilla.orig/security/coreconf/Linux.mk 2003-05-01 02:31:20.000000000 +0200
271 +++ mozilla/security/coreconf/Linux.mk 2005-01-01 01:18:35.344553184 +0100
273 OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE
276 +ifeq ($(OS_TEST),x86_64)
277 + OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE
280 ifeq ($(OS_TEST),sparc)
281 OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE
291 diff -durN mozilla.orig/xpcom/reflect/xptcall/src/md/unix/Makefile.in mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in
292 --- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/Makefile.in 2003-08-15 06:00:23.000000000 +0200
293 +++ mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in 2005-01-01 01:18:35.345553032 +0100
295 # Migrate other platforms here after testing
297 ifneq (,$(filter Linux,$(OS_ARCH)))
299 +ifeq (x86_64,$(OS_TEST))
300 +CPPSRCS := xptcinvoke_x86_64_linux.cpp xptcstubs_x86_64_linux.cpp
302 ifeq (86,$(findstring 86,$(OS_TEST)))
303 CPPSRCS := xptcinvoke_gcc_x86_unix.cpp xptcstubs_gcc_x86_unix.cpp
308 ifneq (,$(filter Linux,$(OS_ARCH)))
309 ifneq (,$(findstring ia64,$(OS_TEST)))
310 diff -durN mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp
311 --- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp 1970-01-01 01:00:00.000000000 +0100
312 +++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp 2005-01-01 01:18:35.346552880 +0100
314 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
315 +// Platform specific code to invoke XPCOM methods on native objects
317 +#include "xptcprivate.h"
319 +// 6 integral parameters are passed in registers
320 +const PRUint32 GPR_COUNT = 6;
322 +// 8 floating point parameters are passed in SSE registers
323 +const PRUint32 FPR_COUNT = 8;
325 +// Remember that these 'words' are 64-bit long
327 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant * s,
328 + PRUint32 & nr_gpr, PRUint32 & nr_fpr, PRUint32 & nr_stack)
330 + nr_gpr = 1; // skip one GP register for 'that'
334 + /* Compute number of eightbytes of class MEMORY. */
335 + for (uint32 i = 0; i < paramCount; i++, s++) {
336 + if (!s->IsPtrData()
337 + && (s->type == nsXPTType::T_FLOAT || s->type == nsXPTType::T_DOUBLE)) {
338 + if (nr_fpr < FPR_COUNT)
344 + if (nr_gpr < GPR_COUNT)
353 +invoke_copy_to_stack(PRUint64 * d, PRUint32 paramCount, nsXPTCVariant * s,
354 + PRUint64 * gpregs, double * fpregs)
356 + PRUint32 nr_gpr = 1; // skip one GP register for 'that'
357 + PRUint32 nr_fpr = 0;
360 + for (uint32 i = 0; i < paramCount; i++, s++) {
361 + if (s->IsPtrData())
362 + value = (PRUint64) s->ptr;
365 + case nsXPTType::T_FLOAT: break;
366 + case nsXPTType::T_DOUBLE: break;
367 + case nsXPTType::T_I8: value = s->val.i8; break;
368 + case nsXPTType::T_I16: value = s->val.i16; break;
369 + case nsXPTType::T_I32: value = s->val.i32; break;
370 + case nsXPTType::T_I64: value = s->val.i64; break;
371 + case nsXPTType::T_U8: value = s->val.u8; break;
372 + case nsXPTType::T_U16: value = s->val.u16; break;
373 + case nsXPTType::T_U32: value = s->val.u32; break;
374 + case nsXPTType::T_U64: value = s->val.u64; break;
375 + case nsXPTType::T_BOOL: value = s->val.b; break;
376 + case nsXPTType::T_CHAR: value = s->val.c; break;
377 + case nsXPTType::T_WCHAR: value = s->val.wc; break;
378 + default: value = (PRUint64) s->val.p; break;
382 + if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) {
383 + if (nr_fpr < FPR_COUNT)
384 + fpregs[nr_fpr++] = s->val.d;
386 + *((double *)d) = s->val.d;
390 + else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
391 + if (nr_fpr < FPR_COUNT)
392 + // The value in %xmm register is already prepared to
393 + // be retrieved as a float. Therefore, we pass the
394 + // value verbatim, as a double without conversion.
395 + fpregs[nr_fpr++] = s->val.d;
397 + *((float *)d) = s->val.f;
402 + if (nr_gpr < GPR_COUNT)
403 + gpregs[nr_gpr++] = value;
411 +XPTC_PUBLIC_API(nsresult)
412 +XPTC_InvokeByIndex(nsISupports * that, PRUint32 methodIndex,
413 + PRUint32 paramCount, nsXPTCVariant * params)
415 + PRUint32 nr_gpr, nr_fpr, nr_stack;
416 + invoke_count_words(paramCount, params, nr_gpr, nr_fpr, nr_stack);
418 + // Stack, if used, must be 16-bytes aligned
420 + nr_stack = (nr_stack + 1) & ~1;
422 + // Load parameters to stack, if necessary
423 + PRUint64 *stack = (PRUint64 *) __builtin_alloca(nr_stack * 8);
424 + PRUint64 gpregs[GPR_COUNT];
425 + double fpregs[FPR_COUNT];
426 + invoke_copy_to_stack(stack, paramCount, params, gpregs, fpregs);
428 + // Load FPR registers from fpregs[]
429 + register double d0 asm("xmm0");
430 + register double d1 asm("xmm1");
431 + register double d2 asm("xmm2");
432 + register double d3 asm("xmm3");
433 + register double d4 asm("xmm4");
434 + register double d5 asm("xmm5");
435 + register double d6 asm("xmm6");
436 + register double d7 asm("xmm7");
439 +#define ARG_FPR(N) \
440 + case N+1: d##N = fpregs[N];
453 + // Load GPR registers from gpregs[]
454 + register PRUint64 a0 asm("rdi");
455 + register PRUint64 a1 asm("rsi");
456 + register PRUint64 a2 asm("rdx");
457 + register PRUint64 a3 asm("rcx");
458 + register PRUint64 a4 asm("r8");
459 + register PRUint64 a5 asm("r9");
462 +#define ARG_GPR(N) \
463 + case N+1: a##N = gpregs[N];
469 + case 1: a0 = (PRUint64) that;
474 + // Ensure that assignments to SSE registers won't be optimized away
476 + "x" (d0), "x" (d1), "x" (d2), "x" (d3),
477 + "x" (d4), "x" (d5), "x" (d6), "x" (d7));
479 + // Get pointer to method
480 + PRUint64 methodAddress = *((PRUint64 *)that);
481 + methodAddress += 8 * methodIndex;
482 + methodAddress = *((PRUint64 *)methodAddress);
484 + typedef PRUint32 (*Method)(PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, PRUint64);
485 + PRUint32 result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5);
488 diff -durN mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp
489 --- mozilla.orig/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp 1970-01-01 01:00:00.000000000 +0100
490 +++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp 2005-01-01 01:18:35.347552728 +0100
492 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
494 +// Implement shared vtbl methods.
496 +#include "xptcprivate.h"
498 +// The Linux/x86-64 ABI passes the first 6 integral parameters and the
499 +// first 8 floating point parameters in registers (rdi, rsi, rdx, rcx,
500 +// r8, r9 and xmm0-xmm7), no stack space is allocated for these by the
501 +// caller. The rest of the parameters are passed in the callers stack
504 +const PRUint32 PARAM_BUFFER_COUNT = 16;
505 +const PRUint32 GPR_COUNT = 6;
506 +const PRUint32 FPR_COUNT = 8;
508 +// PrepareAndDispatch() is called by SharedStub() and calls the actual method.
510 +// - 'args[]' contains the arguments passed on stack
511 +// - 'gpregs[]' contains the arguments passed in integer registers
512 +// - 'fpregs[]' contains the arguments passed in floating point registers
514 +// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
515 +// and then the method gets called.
518 +PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex,
519 + PRUint64 * args, PRUint64 * gpregs, double *fpregs)
521 + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
522 + nsXPTCMiniVariant* dispatchParams = NULL;
523 + nsIInterfaceInfo* iface_info = NULL;
524 + const nsXPTMethodInfo* info;
525 + PRUint32 paramCount;
527 + nsresult result = NS_ERROR_FAILURE;
529 + NS_ASSERTION(self,"no self");
531 + self->GetInterfaceInfo(&iface_info);
532 + NS_ASSERTION(iface_info,"no interface info");
534 + return NS_ERROR_UNEXPECTED;
536 + iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
537 + NS_ASSERTION(info,"no method info");
539 + return NS_ERROR_UNEXPECTED;
541 + paramCount = info->GetParamCount();
543 + // setup variant array pointer
544 + if(paramCount > PARAM_BUFFER_COUNT)
545 + dispatchParams = new nsXPTCMiniVariant[paramCount];
547 + dispatchParams = paramBuffer;
549 + NS_ASSERTION(dispatchParams,"no place for params");
550 + if (! dispatchParams)
551 + return NS_ERROR_OUT_OF_MEMORY;
553 + PRUint64* ap = args;
554 + PRUint32 nr_gpr = 1; // skip one GPR register for 'that'
555 + PRUint32 nr_fpr = 0;
558 + for(i = 0; i < paramCount; i++) {
559 + const nsXPTParamInfo& param = info->GetParam(i);
560 + const nsXPTType& type = param.GetType();
561 + nsXPTCMiniVariant* dp = &dispatchParams[i];
563 + if (!param.IsOut() && type == nsXPTType::T_DOUBLE) {
564 + if (nr_fpr < FPR_COUNT)
565 + dp->val.d = fpregs[nr_fpr++];
567 + dp->val.d = *(double*) ap++;
570 + else if (!param.IsOut() && type == nsXPTType::T_FLOAT) {
571 + if (nr_fpr < FPR_COUNT)
572 + // The value in %xmm register is already prepared to
573 + // be retrieved as a float. Therefore, we pass the
574 + // value verbatim, as a double without conversion.
575 + dp->val.d = *(double*) ap++;
577 + dp->val.f = *(float*) ap++;
581 + if (nr_gpr < GPR_COUNT)
582 + value = gpregs[nr_gpr++];
587 + if (param.IsOut() || !type.IsArithmetic()) {
588 + dp->val.p = (void*) value;
593 + case nsXPTType::T_I8: dp->val.i8 = (PRInt8) value; break;
594 + case nsXPTType::T_I16: dp->val.i16 = (PRInt16) value; break;
595 + case nsXPTType::T_I32: dp->val.i32 = (PRInt32) value; break;
596 + case nsXPTType::T_I64: dp->val.i64 = (PRInt64) value; break;
597 + case nsXPTType::T_U8: dp->val.u8 = (PRUint8) value; break;
598 + case nsXPTType::T_U16: dp->val.u16 = (PRUint16) value; break;
599 + case nsXPTType::T_U32: dp->val.u32 = (PRUint32) value; break;
600 + case nsXPTType::T_U64: dp->val.u64 = (PRUint64) value; break;
601 + case nsXPTType::T_BOOL: dp->val.b = (PRBool) value; break;
602 + case nsXPTType::T_CHAR: dp->val.c = (char) value; break;
603 + case nsXPTType::T_WCHAR: dp->val.wc = (wchar_t) value; break;
606 + NS_ASSERTION(0, "bad type");
611 + result = self->CallMethod((PRUint16) methodIndex, info, dispatchParams);
613 + NS_RELEASE(iface_info);
615 + if (dispatchParams != paramBuffer)
616 + delete [] dispatchParams;
621 +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
622 +// Linux/x86-64 uses gcc >= 3.1
623 +#define STUB_ENTRY(n) \
624 +asm(".section \".text\"\n\t" \
626 + ".if " #n " < 10\n\t" \
627 + ".globl _ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \
628 + ".type _ZN14nsXPTCStubBase5Stub" #n "Ev,@function\n" \
629 + "_ZN14nsXPTCStubBase5Stub" #n "Ev:\n\t" \
630 + ".elseif " #n " < 100\n\t" \
631 + ".globl _ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \
632 + ".type _ZN14nsXPTCStubBase6Stub" #n "Ev,@function\n" \
633 + "_ZN14nsXPTCStubBase6Stub" #n "Ev:\n\t" \
634 + ".elseif " #n " < 1000\n\t" \
635 + ".globl _ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \
636 + ".type _ZN14nsXPTCStubBase7Stub" #n "Ev,@function\n" \
637 + "_ZN14nsXPTCStubBase7Stub" #n "Ev:\n\t" \
639 + ".err \"stub number " #n " >= 1000 not yet supported\"\n\t" \
641 + "movl $" #n ", %eax\n\t" \
642 + "jmp SharedStub\n\t" \
643 + ".if " #n " < 10\n\t" \
644 + ".size _ZN14nsXPTCStubBase5Stub" #n "Ev,.-_ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \
645 + ".elseif " #n " < 100\n\t" \
646 + ".size _ZN14nsXPTCStubBase6Stub" #n "Ev,.-_ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \
648 + ".size _ZN14nsXPTCStubBase7Stub" #n "Ev,.-_ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \
651 +// static nsresult SharedStub(PRUint32 methodIndex)
652 +asm(".section \".text\"\n\t"
654 + ".type SharedStub,@function\n\t"
656 + // make room for gpregs (48), fpregs (64)
658 + "movq %rsp,%rbp\n\t"
659 + "subq $112,%rsp\n\t"
660 + // save GP registers
661 + "movq %rdi,-112(%rbp)\n\t"
662 + "movq %rsi,-104(%rbp)\n\t"
663 + "movq %rdx, -96(%rbp)\n\t"
664 + "movq %rcx, -88(%rbp)\n\t"
665 + "movq %r8 , -80(%rbp)\n\t"
666 + "movq %r9 , -72(%rbp)\n\t"
667 + "leaq -112(%rbp),%rcx\n\t"
668 + // save FP registers
669 + "movsd %xmm0,-64(%rbp)\n\t"
670 + "movsd %xmm1,-56(%rbp)\n\t"
671 + "movsd %xmm2,-48(%rbp)\n\t"
672 + "movsd %xmm3,-40(%rbp)\n\t"
673 + "movsd %xmm4,-32(%rbp)\n\t"
674 + "movsd %xmm5,-24(%rbp)\n\t"
675 + "movsd %xmm6,-16(%rbp)\n\t"
676 + "movsd %xmm7, -8(%rbp)\n\t"
677 + "leaq -64(%rbp),%r8\n\t"
678 + // rdi has the 'self' pointer already
679 + "movl %eax,%esi\n\t"
680 + "leaq 16(%rbp),%rdx\n\t"
681 + "call PrepareAndDispatch@plt\n\t"
684 + ".size SharedStub,.-SharedStub");
686 +#define SENTINEL_ENTRY(n) \
687 +nsresult nsXPTCStubBase::Sentinel##n() \
689 + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \
690 + return NS_ERROR_NOT_IMPLEMENTED; \
693 +#include "xptcstubsdef.inc"
696 +#error "can't find a compiler to use"
697 +#endif /* __GNUC__ */