xorg-server: enable some more extensions.
[pkgfs.git] / templates / firefox-fix-build.diff
blob55e9bfeee13ea4fd33833c538b02cc6828e38bd8
1 --- toolkit/mozapps/installer/packager.mk.orig 2008-10-09 01:20:03.000000000 +0200
2 +++ toolkit/mozapps/installer/packager.mk 2008-10-09 01:20:16.000000000 +0200
3 @@ -426,7 +426,7 @@ ifdef INSTALL_SDK # Here comes the hard
4 (cd $(DIST)/sdk/include && tar $(TAR_CREATE_FLAGS) - .) | \
5 (cd $(DESTDIR)$(includedir)/stable && tar -xf -)
6 # The dist/include has module subdirectories that we need to flatten
7 - find $(DIST)/include -xtype f -exec $(SYSINSTALL) $(IFLAGS1) {} $(DESTDIR)$(includedir)/unstable \;
8 + find $(DIST)/include -type f -exec $(SYSINSTALL) $(IFLAGS1) {} $(DESTDIR)$(includedir)/unstable \;
9 # IDL directory is stable (dist/sdk/idl) and unstable (dist/idl)
10 $(NSINSTALL) -D $(DESTDIR)$(idldir)/stable
11 $(NSINSTALL) -D $(DESTDIR)$(idldir)/unstable
12 $NetBSD: patch-aa,v 1.1.1.1 2008/06/28 10:01:07 tnn Exp $
14 --- config/autoconf.mk.in.orig 2008-02-26 19:30:21.000000000 +0100
15 +++ config/autoconf.mk.in
16 @@ -58,14 +58,14 @@ MOZ_PKG_SPECIAL = @MOZ_PKG_SPECIAL@
17 prefix = @prefix@
18 exec_prefix = @exec_prefix@
19 bindir = @bindir@
20 -includedir = @includedir@/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
21 +includedir = @includedir@/$(MOZILLA_PKG_NAME)
22 libdir = @libdir@
23 datadir = @datadir@
24 mandir = @mandir@
25 -idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
26 +idldir = @datadir@/idl/$(MOZILLA_PKG_NAME)
28 -installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
29 -sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
30 +installdir = $(libdir)/$(MOZILLA_PKG_NAME)
31 +sdkdir = $(libdir)/$(MOZILLA_PKG_NAME)-sdk
33 DIST = $(DEPTH)/dist
34 LIBXUL_SDK = @LIBXUL_SDK@
35 $NetBSD: patch-ac,v 1.1.1.1 2008/06/28 10:01:07 tnn Exp $
37 --- xpcom/reflect/xptcall/src/md/unix/Makefile.in.orig 2008-02-28 02:21:16.000000000 -0600
38 +++ xpcom/reflect/xptcall/src/md/unix/Makefile.in 2008-03-14 14:27:45.000000000 -0500
39 @@ -64,14 +64,21 @@
41 # Lots of Unixish x86 flavors
43 -ifneq (,$(filter FreeBSD NetBSD OpenBSD BSD_OS Darwin,$(OS_ARCH)))
44 +ifneq (,$(filter DragonFly FreeBSD NetBSD OpenBSD BSD_OS Darwin,$(OS_ARCH)))
45 +ifeq (x86_64,$(OS_TEST))
46 +CPPSRCS := xptcinvoke_x86_64_linux.cpp xptcstubs_x86_64_linux.cpp
47 +else
48 ifeq (86,$(findstring 86,$(OS_TEST)))
49 CPPSRCS := xptcinvoke_unixish_x86.cpp xptcstubs_unixish_x86.cpp
50 +endif
51 +ifeq (amd64,$(OS_TEST))
52 +CPPSRCS := xptcinvoke_x86_64_linux.cpp xptcstubs_x86_64_linux.cpp
53 +endif
54 +endif
55 ifeq (Darwin,$(OS_ARCH))
56 DEFINES += -DKEEP_STACK_16_BYTE_ALIGNED
57 endif
58 endif
59 -endif
61 # New code for Linux, et. al., with gcc
62 # Migrate other platforms here after testing
63 @@ -185,7 +192,7 @@
64 # NetBSD/ARM
66 ifeq ($(OS_ARCH),NetBSD)
67 -ifneq (,$(filter arm% sa110,$(OS_TEST)))
68 +ifneq (,$(filter arm%,$(TARGET_CPU)))
69 CPPSRCS := xptcinvoke_arm_netbsd.cpp xptcstubs_arm_netbsd.cpp
70 endif
71 endif
72 @@ -240,7 +247,7 @@
73 # NetBSD/m68k
75 ifeq ($(OS_ARCH),NetBSD)
76 -ifneq (,$(filter amiga atari hp300 mac68k mvme68k next68k sun3 sun3x x68k,$(OS_TEST)))
77 +ifneq (,$(filter m68k,$(TARGET_CPU)))
78 CPPSRCS := xptcinvoke_netbsd_m68k.cpp xptcstubs_netbsd_m68k.cpp
79 endif
80 endif
81 @@ -332,6 +339,7 @@
82 ifneq (,$(filter NetBSDmacppc NetBSDbebox NetBSDofppc NetBSDprep NetBSDamigappc,$(OS_ARCH)$(OS_TEST)))
83 CPPSRCS := xptcinvoke_ppc_netbsd.cpp xptcstubs_ppc_netbsd.cpp
84 ASFILES := xptcinvoke_asm_ppc_netbsd.s xptcstubs_asm_ppc_netbsd.s
85 +AS := $(CC) -c -x assembler-with-cpp
86 endif
89 @@ -403,6 +411,13 @@
90 ASFILES := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_openbsd.s
91 endif
93 +# NetBSD/SPARC64
95 +ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc64)
96 +CPPSRCS := xptcinvoke_sparc64_netbsd.cpp xptcstubs_sparc64_netbsd.cpp
97 +ASFILES := xptcinvoke_asm_sparc64_netbsd.s xptcstubs_asm_sparc64_netbsd.s
98 +endif
100 # Solaris/SPARC
102 ifeq ($(OS_ARCH),SunOS)
103 $NetBSD: patch-ba,v 1.1.1.1 2008/06/28 10:01:07 tnn Exp $
105 --- nsprpub/pr/include/md/_netbsd.cfg.orig 2007-11-26 19:17:17.000000000 +0100
106 +++ nsprpub/pr/include/md/_netbsd.cfg
107 @@ -52,7 +52,8 @@
108 #define HAVE_LONG_LONG
109 #endif
111 -#if defined(__i386__) || defined(__arm32__) || defined(__MIPSEL__)
112 +#if defined(__i386__) || defined(__arm32__) || defined(__MIPSEL__) || \
113 + defined(__ARMEL__)
115 #define IS_LITTLE_ENDIAN 1
116 #undef IS_BIG_ENDIAN
117 @@ -97,7 +98,53 @@
118 #define PR_ALIGN_OF_DOUBLE 4
119 #define PR_ALIGN_OF_POINTER 4
121 -#elif defined(__sparc__) || defined(__MIPSEB__)
122 +#elif defined(__sparc_v9__)
124 +#undef IS_LITTLE_ENDIAN
125 +#define IS_BIG_ENDIAN 1
126 +#define HAVE_LONG_LONG
127 +#define HAVE_ALIGNED_DOUBLES
128 +#define HAVE_ALIGNED_LONGLONGS
130 +#define PR_BYTES_PER_BYTE 1
131 +#define PR_BYTES_PER_SHORT 2
132 +#define PR_BYTES_PER_INT 4
133 +#define PR_BYTES_PER_INT64 8
134 +#define PR_BYTES_PER_LONG 8
135 +#define PR_BYTES_PER_FLOAT 4
136 +#define PR_BYTES_PER_DOUBLE 8
137 +#define PR_BYTES_PER_WORD 8
138 +#define PR_BYTES_PER_DWORD 8
139 +#define PR_BYTES_PER_WORD_LOG2 3
140 +#define PR_BYTES_PER_DWORD_LOG2 3
142 +#define PR_BITS_PER_BYTE 8
143 +#define PR_BITS_PER_SHORT 16
144 +#define PR_BITS_PER_INT 32
145 +#define PR_BITS_PER_INT64 64
146 +#define PR_BITS_PER_LONG 64
147 +#define PR_BITS_PER_FLOAT 32
148 +#define PR_BITS_PER_DOUBLE 64
149 +#define PR_BITS_PER_WORD 64
151 +#define PR_BITS_PER_BYTE_LOG2 3
152 +#define PR_BITS_PER_SHORT_LOG2 4
153 +#define PR_BITS_PER_INT_LOG2 5
154 +#define PR_BITS_PER_INT64_LOG2 6
155 +#define PR_BITS_PER_LONG_LOG2 6
156 +#define PR_BITS_PER_FLOAT_LOG2 5
157 +#define PR_BITS_PER_DOUBLE_LOG2 6
158 +#define PR_BITS_PER_WORD_LOG2 6
160 +#define PR_ALIGN_OF_SHORT 2
161 +#define PR_ALIGN_OF_INT 4
162 +#define PR_ALIGN_OF_LONG 8
163 +#define PR_ALIGN_OF_INT64 8
164 +#define PR_ALIGN_OF_FLOAT 4
165 +#define PR_ALIGN_OF_DOUBLE 8
166 +#define PR_ALIGN_OF_POINTER 8
168 +#elif defined(__sparc__) || defined(__MIPSEB__) || defined(__ARMEB__)
170 #undef IS_LITTLE_ENDIAN
171 #define IS_BIG_ENDIAN 1
172 @@ -188,6 +235,55 @@
173 #define PR_BYTES_PER_WORD_LOG2 3
174 #define PR_BYTES_PER_DWORD_LOG2 3
176 +#elif defined(__amd64__)
177 +#define IS_LITTLE_ENDIAN 1
178 +#undef IS_BIG_ENDIAN
179 +#define IS_64
181 +#define PR_BYTES_PER_BYTE 1
182 +#define PR_BYTES_PER_SHORT 2
183 +#define PR_BYTES_PER_INT 4
184 +#define PR_BYTES_PER_INT64 8
185 +#define PR_BYTES_PER_LONG 8
186 +#define PR_BYTES_PER_FLOAT 4
187 +#define PR_BYTES_PER_DOUBLE 8
188 +#define PR_BYTES_PER_WORD 8
189 +#define PR_BYTES_PER_DWORD 8
191 +#define PR_BITS_PER_BYTE 8
192 +#define PR_BITS_PER_SHORT 16
193 +#define PR_BITS_PER_INT 32
194 +#define PR_BITS_PER_INT64 64
195 +#define PR_BITS_PER_LONG 64
196 +#define PR_BITS_PER_FLOAT 32
197 +#define PR_BITS_PER_DOUBLE 64
198 +#define PR_BITS_PER_WORD 64
200 +#define PR_BITS_PER_BYTE_LOG2 3
201 +#define PR_BITS_PER_SHORT_LOG2 4
202 +#define PR_BITS_PER_INT_LOG2 5
203 +#define PR_BITS_PER_INT64_LOG2 6
204 +#define PR_BITS_PER_LONG_LOG2 6
205 +#define PR_BITS_PER_FLOAT_LOG2 5
206 +#define PR_BITS_PER_DOUBLE_LOG2 6
207 +#define PR_BITS_PER_WORD_LOG2 6
209 +#define PR_ALIGN_OF_SHORT 2
210 +#define PR_ALIGN_OF_INT 4
211 +#define PR_ALIGN_OF_LONG 8
212 +#define PR_ALIGN_OF_INT64 8
213 +#define PR_ALIGN_OF_FLOAT 4
214 +#define PR_ALIGN_OF_DOUBLE 8
215 +#define PR_ALIGN_OF_POINTER 8
216 +#define PR_ALIGN_OF_WORD 8
218 +#define PR_BYTES_PER_WORD_LOG2 3
219 +#define PR_BYTES_PER_DWORD_LOG2 3
221 +#define HAVE_LONG_LONG
222 +#define HAVE_ALIGNED_DOUBLES
223 +#define HAVE_ALIGNED_LONGLONGS
225 #elif defined(__powerpc__) || defined(__m68k__)
227 #undef IS_LITTLE_ENDIAN
228 $NetBSD: patch-bb,v 1.1.1.1 2008/06/28 10:01:07 tnn Exp $
230 --- nsprpub/pr/include/md/_netbsd.h.orig 2006-03-31 10:35:02.000000000 +0200
231 +++ nsprpub/pr/include/md/_netbsd.h
232 @@ -47,6 +47,8 @@
233 #define _PR_SI_ARCHITECTURE "x86"
234 #elif defined(__alpha__)
235 #define _PR_SI_ARCHITECTURE "alpha"
236 +#elif defined(__amd64__)
237 +#define _PR_SI_ARCHITECTURE "amd64"
238 #elif defined(__m68k__)
239 #define _PR_SI_ARCHITECTURE "m68k"
240 #elif defined(__powerpc__)
241 @@ -98,6 +100,12 @@
242 #define _PR_HAVE_GETPROTO_R_INT
243 #endif
245 +#if __NetBSD_Version__ >= 106370000
246 +/* NetBSD 1.6ZK */
247 +#define _PR_HAVE_GETPROTO_R
248 +#define _PR_HAVE_GETPROTO_R_INT
249 +#endif
251 #define USE_SETJMP
253 #ifndef _PR_PTHREADS
254 @@ -111,6 +119,8 @@
255 #define JB_SP_INDEX 2
256 #elif defined(__mips__)
257 #define JB_SP_INDEX 4
258 +#elif defined(__amd64__)
259 +#define JB_SP_INDEX 6
260 #elif defined(__alpha__)
261 #define JB_SP_INDEX 34
262 #elif defined(__arm32__)
263 $NetBSD: patch-bu,v 1.1.1.1 2008/06/28 10:01:07 tnn Exp $
265 diff -ruN ../Orig/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_amd64.cpp ./xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_amd64.cpp
266 --- ../Orig/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_amd64.cpp 1970-01-01 09:00:00.000000000 +0900
267 +++ ./xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_amd64.cpp 2005-12-07 00:07:35.000000000 +0900
268 @@ -0,0 +1,174 @@
269 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
270 +// Platform specific code to invoke XPCOM methods on native objects
272 +#include "xptcprivate.h"
274 +// 6 integral parameters are passed in registers
275 +const PRUint32 GPR_COUNT = 6;
277 +// 8 floating point parameters are passed in SSE registers
278 +const PRUint32 FPR_COUNT = 8;
280 +// Remember that these 'words' are 64-bit long
281 +static inline void
282 +invoke_count_words(PRUint32 paramCount, nsXPTCVariant * s,
283 + PRUint32 & nr_gpr, PRUint32 & nr_fpr, PRUint32 & nr_stack)
285 + nr_gpr = 1; // skip one GP register for 'that'
286 + nr_fpr = 0;
287 + nr_stack = 0;
289 + /* Compute number of eightbytes of class MEMORY. */
290 + for (uint32 i = 0; i < paramCount; i++, s++) {
291 + if (!s->IsPtrData()
292 + && (s->type == nsXPTType::T_FLOAT || s->type == nsXPTType::T_DOUBLE)) {
293 + if (nr_fpr < FPR_COUNT)
294 + nr_fpr++;
295 + else
296 + nr_stack++;
298 + else {
299 + if (nr_gpr < GPR_COUNT)
300 + nr_gpr++;
301 + else
302 + nr_stack++;
307 +static void
308 +invoke_copy_to_stack(PRUint64 * d, PRUint32 paramCount, nsXPTCVariant * s,
309 + PRUint64 * gpregs, double * fpregs)
311 + PRUint32 nr_gpr = 1; // skip one GP register for 'that'
312 + PRUint32 nr_fpr = 0;
313 + PRUint64 value;
315 + for (uint32 i = 0; i < paramCount; i++, s++) {
316 + if (s->IsPtrData())
317 + value = (PRUint64) s->ptr;
318 + else {
319 + switch (s->type) {
320 + case nsXPTType::T_FLOAT: break;
321 + case nsXPTType::T_DOUBLE: break;
322 + case nsXPTType::T_I8: value = s->val.i8; break;
323 + case nsXPTType::T_I16: value = s->val.i16; break;
324 + case nsXPTType::T_I32: value = s->val.i32; break;
325 + case nsXPTType::T_I64: value = s->val.i64; break;
326 + case nsXPTType::T_U8: value = s->val.u8; break;
327 + case nsXPTType::T_U16: value = s->val.u16; break;
328 + case nsXPTType::T_U32: value = s->val.u32; break;
329 + case nsXPTType::T_U64: value = s->val.u64; break;
330 + case nsXPTType::T_BOOL: value = s->val.b; break;
331 + case nsXPTType::T_CHAR: value = s->val.c; break;
332 + case nsXPTType::T_WCHAR: value = s->val.wc; break;
333 + default: value = (PRUint64) s->val.p; break;
337 + if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) {
338 + if (nr_fpr < FPR_COUNT)
339 + fpregs[nr_fpr++] = s->val.d;
340 + else {
341 + *((double *)d) = s->val.d;
342 + d++;
345 + else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
346 + if (nr_fpr < FPR_COUNT)
347 + // The value in %xmm register is already prepared to
348 + // be retrieved as a float. Therefore, we pass the
349 + // value verbatim, as a double without conversion.
350 + fpregs[nr_fpr++] = s->val.d;
351 + else {
352 + *((float *)d) = s->val.f;
353 + d++;
356 + else {
357 + if (nr_gpr < GPR_COUNT)
358 + gpregs[nr_gpr++] = value;
359 + else
360 + *d++ = value;
365 +extern "C"
366 +XPTC_PUBLIC_API(nsresult)
367 +XPTC_InvokeByIndex(nsISupports * that, PRUint32 methodIndex,
368 + PRUint32 paramCount, nsXPTCVariant * params)
370 + PRUint32 nr_gpr, nr_fpr, nr_stack;
371 + invoke_count_words(paramCount, params, nr_gpr, nr_fpr, nr_stack);
373 + // Stack, if used, must be 16-bytes aligned
374 + if (nr_stack)
375 + nr_stack = (nr_stack + 1) & ~1;
377 + // Load parameters to stack, if necessary
378 + PRUint64 *stack = (PRUint64 *) __builtin_alloca(nr_stack * 8);
379 + PRUint64 gpregs[GPR_COUNT];
380 + double fpregs[FPR_COUNT];
381 + invoke_copy_to_stack(stack, paramCount, params, gpregs, fpregs);
383 + // Load FPR registers from fpregs[]
384 + register double d0 asm("xmm0");
385 + register double d1 asm("xmm1");
386 + register double d2 asm("xmm2");
387 + register double d3 asm("xmm3");
388 + register double d4 asm("xmm4");
389 + register double d5 asm("xmm5");
390 + register double d6 asm("xmm6");
391 + register double d7 asm("xmm7");
393 + switch (nr_fpr) {
394 +#define ARG_FPR(N) \
395 + case N+1: d##N = fpregs[N];
396 + ARG_FPR(7);
397 + ARG_FPR(6);
398 + ARG_FPR(5);
399 + ARG_FPR(4);
400 + ARG_FPR(3);
401 + ARG_FPR(2);
402 + ARG_FPR(1);
403 + ARG_FPR(0);
404 + case 0:;
405 +#undef ARG_FPR
408 + // Load GPR registers from gpregs[]
409 + register PRUint64 a0 asm("rdi");
410 + register PRUint64 a1 asm("rsi");
411 + register PRUint64 a2 asm("rdx");
412 + register PRUint64 a3 asm("rcx");
413 + register PRUint64 a4 asm("r8");
414 + register PRUint64 a5 asm("r9");
416 + switch (nr_gpr) {
417 +#define ARG_GPR(N) \
418 + case N+1: a##N = gpregs[N];
419 + ARG_GPR(5);
420 + ARG_GPR(4);
421 + ARG_GPR(3);
422 + ARG_GPR(2);
423 + ARG_GPR(1);
424 + case 1: a0 = (PRUint64) that;
425 + case 0:;
426 +#undef ARG_GPR
429 + // Ensure that assignments to SSE registers won't be optimized away
430 + asm("" ::
431 + "x" (d0), "x" (d1), "x" (d2), "x" (d3),
432 + "x" (d4), "x" (d5), "x" (d6), "x" (d7));
434 + // Get pointer to method
435 + PRUint64 methodAddress = *((PRUint64 *)that);
436 + methodAddress += 8 * methodIndex;
437 + methodAddress = *((PRUint64 *)methodAddress);
439 + typedef PRUint32 (*Method)(PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, PRUint64);
440 + PRUint32 result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5);
441 + return result;
443 $NetBSD: patch-bv,v 1.1.1.1 2008/06/28 10:01:07 tnn Exp $
445 diff -ruN ../Orig/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_amd64.cpp ./xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_amd64.cpp
446 --- ../Orig/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_amd64.cpp 1970-01-01 09:00:00.000000000 +0900
447 +++ ./xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_amd64.cpp 2005-12-04 19:32:22.000000000 +0900
448 @@ -0,0 +1,206 @@
449 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
451 +// Implement shared vtbl methods.
453 +#include "xptcprivate.h"
455 +// The Linux/x86-64 ABI passes the first 6 integral parameters and the
456 +// first 8 floating point parameters in registers (rdi, rsi, rdx, rcx,
457 +// r8, r9 and xmm0-xmm7), no stack space is allocated for these by the
458 +// caller. The rest of the parameters are passed in the callers stack
459 +// area.
461 +const PRUint32 PARAM_BUFFER_COUNT = 16;
462 +const PRUint32 GPR_COUNT = 6;
463 +const PRUint32 FPR_COUNT = 8;
465 +// PrepareAndDispatch() is called by SharedStub() and calls the actual method.
467 +// - 'args[]' contains the arguments passed on stack
468 +// - 'gpregs[]' contains the arguments passed in integer registers
469 +// - 'fpregs[]' contains the arguments passed in floating point registers
470 +//
471 +// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
472 +// and then the method gets called.
474 +extern "C" nsresult
475 +PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex,
476 + PRUint64 * args, PRUint64 * gpregs, double *fpregs)
478 + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
479 + nsXPTCMiniVariant* dispatchParams = NULL;
480 + nsIInterfaceInfo* iface_info = NULL;
481 + const nsXPTMethodInfo* info;
482 + PRUint32 paramCount;
483 + PRUint32 i;
484 + nsresult result = NS_ERROR_FAILURE;
486 + NS_ASSERTION(self,"no self");
488 + self->GetInterfaceInfo(&iface_info);
489 + NS_ASSERTION(iface_info,"no interface info");
490 + if (! iface_info)
491 + return NS_ERROR_UNEXPECTED;
493 + iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
494 + NS_ASSERTION(info,"no method info");
495 + if (! info)
496 + return NS_ERROR_UNEXPECTED;
498 + paramCount = info->GetParamCount();
500 + // setup variant array pointer
501 + if(paramCount > PARAM_BUFFER_COUNT)
502 + dispatchParams = new nsXPTCMiniVariant[paramCount];
503 + else
504 + dispatchParams = paramBuffer;
506 + NS_ASSERTION(dispatchParams,"no place for params");
507 + if (! dispatchParams)
508 + return NS_ERROR_OUT_OF_MEMORY;
510 + PRUint64* ap = args;
511 + PRUint32 nr_gpr = 1; // skip one GPR register for 'that'
512 + PRUint32 nr_fpr = 0;
513 + PRUint64 value;
515 + for(i = 0; i < paramCount; i++) {
516 + const nsXPTParamInfo& param = info->GetParam(i);
517 + const nsXPTType& type = param.GetType();
518 + nsXPTCMiniVariant* dp = &dispatchParams[i];
520 + if (!param.IsOut() && type == nsXPTType::T_DOUBLE) {
521 + if (nr_fpr < FPR_COUNT)
522 + dp->val.d = fpregs[nr_fpr++];
523 + else
524 + dp->val.d = *(double*) ap++;
525 + continue;
527 + else if (!param.IsOut() && type == nsXPTType::T_FLOAT) {
528 + if (nr_fpr < FPR_COUNT)
529 + // The value in %xmm register is already prepared to
530 + // be retrieved as a float. Therefore, we pass the
531 + // value verbatim, as a double without conversion.
532 + dp->val.d = *(double*) ap++;
533 + else
534 + dp->val.f = *(float*) ap++;
535 + continue;
537 + else {
538 + if (nr_gpr < GPR_COUNT)
539 + value = gpregs[nr_gpr++];
540 + else
541 + value = *ap++;
544 + if (param.IsOut() || !type.IsArithmetic()) {
545 + dp->val.p = (void*) value;
546 + continue;
549 + switch (type) {
550 + case nsXPTType::T_I8: dp->val.i8 = (PRInt8) value; break;
551 + case nsXPTType::T_I16: dp->val.i16 = (PRInt16) value; break;
552 + case nsXPTType::T_I32: dp->val.i32 = (PRInt32) value; break;
553 + case nsXPTType::T_I64: dp->val.i64 = (PRInt64) value; break;
554 + case nsXPTType::T_U8: dp->val.u8 = (PRUint8) value; break;
555 + case nsXPTType::T_U16: dp->val.u16 = (PRUint16) value; break;
556 + case nsXPTType::T_U32: dp->val.u32 = (PRUint32) value; break;
557 + case nsXPTType::T_U64: dp->val.u64 = (PRUint64) value; break;
558 + case nsXPTType::T_BOOL: dp->val.b = (PRBool) value; break;
559 + case nsXPTType::T_CHAR: dp->val.c = (char) value; break;
560 + case nsXPTType::T_WCHAR: dp->val.wc = (wchar_t) value; break;
562 + default:
563 + NS_ASSERTION(0, "bad type");
564 + break;
568 + result = self->CallMethod((PRUint16) methodIndex, info, dispatchParams);
570 + NS_RELEASE(iface_info);
572 + if (dispatchParams != paramBuffer)
573 + delete [] dispatchParams;
575 + return result;
578 +#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
579 +// Linux/x86-64 uses gcc >= 3.1
580 +#define STUB_ENTRY(n) \
581 +asm(".section \".text\"\n\t" \
582 + ".align 2\n\t" \
583 + ".if " #n " < 10\n\t" \
584 + ".globl _ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \
585 + ".type _ZN14nsXPTCStubBase5Stub" #n "Ev,@function\n" \
586 + "_ZN14nsXPTCStubBase5Stub" #n "Ev:\n\t" \
587 + ".elseif " #n " < 100\n\t" \
588 + ".globl _ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \
589 + ".type _ZN14nsXPTCStubBase6Stub" #n "Ev,@function\n" \
590 + "_ZN14nsXPTCStubBase6Stub" #n "Ev:\n\t" \
591 + ".elseif " #n " < 1000\n\t" \
592 + ".globl _ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \
593 + ".type _ZN14nsXPTCStubBase7Stub" #n "Ev,@function\n" \
594 + "_ZN14nsXPTCStubBase7Stub" #n "Ev:\n\t" \
595 + ".else\n\t" \
596 + ".err \"stub number " #n " >= 1000 not yet supported\"\n\t" \
597 + ".endif\n\t" \
598 + "movl $" #n ", %eax\n\t" \
599 + "jmp SharedStub\n\t" \
600 + ".if " #n " < 10\n\t" \
601 + ".size _ZN14nsXPTCStubBase5Stub" #n "Ev,.-_ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \
602 + ".elseif " #n " < 100\n\t" \
603 + ".size _ZN14nsXPTCStubBase6Stub" #n "Ev,.-_ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \
604 + ".else\n\t" \
605 + ".size _ZN14nsXPTCStubBase7Stub" #n "Ev,.-_ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \
606 + ".endif");
608 +// static nsresult SharedStub(PRUint32 methodIndex)
609 +asm(".section \".text\"\n\t"
610 + ".align 2\n\t"
611 + ".type SharedStub,@function\n\t"
612 + "SharedStub:\n\t"
613 + // make room for gpregs (48), fpregs (64)
614 + "pushq %rbp\n\t"
615 + "movq %rsp,%rbp\n\t"
616 + "subq $112,%rsp\n\t"
617 + // save GP registers
618 + "movq %rdi,-112(%rbp)\n\t"
619 + "movq %rsi,-104(%rbp)\n\t"
620 + "movq %rdx, -96(%rbp)\n\t"
621 + "movq %rcx, -88(%rbp)\n\t"
622 + "movq %r8 , -80(%rbp)\n\t"
623 + "movq %r9 , -72(%rbp)\n\t"
624 + "leaq -112(%rbp),%rcx\n\t"
625 + // save FP registers
626 + "movsd %xmm0,-64(%rbp)\n\t"
627 + "movsd %xmm1,-56(%rbp)\n\t"
628 + "movsd %xmm2,-48(%rbp)\n\t"
629 + "movsd %xmm3,-40(%rbp)\n\t"
630 + "movsd %xmm4,-32(%rbp)\n\t"
631 + "movsd %xmm5,-24(%rbp)\n\t"
632 + "movsd %xmm6,-16(%rbp)\n\t"
633 + "movsd %xmm7, -8(%rbp)\n\t"
634 + "leaq -64(%rbp),%r8\n\t"
635 + // rdi has the 'self' pointer already
636 + "movl %eax,%esi\n\t"
637 + "leaq 16(%rbp),%rdx\n\t"
638 + "call PrepareAndDispatch\n\t"
639 + "leave\n\t"
640 + "ret\n\t"
641 + ".size SharedStub,.-SharedStub");
643 +#define SENTINEL_ENTRY(n) \
644 +nsresult nsXPTCStubBase::Sentinel##n() \
645 +{ \
646 + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \
647 + return NS_ERROR_NOT_IMPLEMENTED; \
650 +#include "xptcstubsdef.inc"
652 +#else
653 +#error "can't find a compiler to use"
654 +#endif /* __GNUC__ */
655 $NetBSD: patch-wf,v 1.1.1.1 2008/06/28 10:01:07 tnn Exp $
657 --- nsprpub/pr/src/md/unix/uxrng.c.orig 2005-12-24 09:25:29.000000000 +0100
658 +++ nsprpub/pr/src/md/unix/uxrng.c
659 @@ -149,7 +149,7 @@ static PRCallOnceType coOpenDevRandom;
661 static PRStatus OpenDevRandom( void )
663 - fdDevRandom = open( "/dev/random", O_RDONLY );
664 + fdDevRandom = open( "/dev/urandom", O_RDONLY );
665 return((-1 == fdDevRandom)? PR_FAILURE : PR_SUCCESS );
666 } /* end OpenDevRandom() */