pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

firefox-hg: make it work on sparc64



Module Name:	pkgsrc-wip
Committed By:	Martin Husemann <martin%NetBSD.org@localhost>
Pushed By:	martin
Date:		Sat Jan 23 08:39:46 2016 +0100
Changeset:	c678d74cfa93150e219fe1dfcc35dbf40e065d9b

Modified Files:
	firefox-hg/distinfo
	firefox-hg/patches/patch-xpcom_base_Logging.h
Added Files:
	firefox-hg/patches/patch-js_src_jit_AtomicOperations.h
	firefox-hg/patches/patch-js_src_jit_none_AtomicOperations-sparc.h
	firefox-hg/patches/patch-toolkit_components_protobuf_src_google_protobuf_stubs_platform_macros.h
	firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_Makefile.in
	firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__sparc64__netbsd.cpp
	firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_xptcstubs__asm__sparc64__netbsd.s

Log Message:
firefox-hg: make it work on sparc64

Work in progress

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=c678d74cfa93150e219fe1dfcc35dbf40e065d9b

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 firefox-hg/distinfo                                |   8 +-
 .../patches/patch-js_src_jit_AtomicOperations.h    |  14 ++
 .../patch-js_src_jit_none_AtomicOperations-sparc.h | 257 +++++++++++++++++++++
 ...buf_src_google_protobuf_stubs_platform_macros.h |  26 +++
 firefox-hg/patches/patch-xpcom_base_Logging.h      |   6 +-
 ...patch-xpcom_reflect_xptcall_md_unix_Makefile.in |  48 ++++
 ...xptcall_md_unix_xptcinvoke__sparc64__netbsd.cpp |  89 +++++++
 ...tcall_md_unix_xptcstubs__asm__sparc64__netbsd.s |  71 ++++++
 8 files changed, 515 insertions(+), 4 deletions(-)

diffs:
diff --git a/firefox-hg/distinfo b/firefox-hg/distinfo
index 43c4f49..9845807 100644
--- a/firefox-hg/distinfo
+++ b/firefox-hg/distinfo
@@ -24,20 +24,26 @@ SHA1 (patch-ipc_glue_GeckoChildProcessHost.cpp) = 2c0621c2002bfb77159f2f8f678532
 SHA1 (patch-ipc_ipdl_ipdl_cxx_ast.py) = c91e03a142d38e68f1bcaa4c3d0d0231445232b3
 SHA1 (patch-ipc_ipdl_ipdl_cxx_cgen.py) = d7f7dc85b1ff26c6d7e902f94c0ac09f04497105
 SHA1 (patch-js__src__vm__SPSProfiler.cpp) = 989ba25e4c5308d21d07baa802decce13609a475
+SHA1 (patch-js_src_jit_AtomicOperations.h) = 24f514387aef0d71b16999045e57ded994c9f59a
+SHA1 (patch-js_src_jit_none_AtomicOperations-sparc.h) = d4da2b09ddb2ab5b0e8d9e821c7815102f62d785
 SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = 57650470a96312fb1c4a2634711ede69e36666ff
 SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc) = 9ff1dcf200feaf67bf576f07beb612e0ec91d7d1
 SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_video__capture__linux.cc) = c7f8c14339c4cc5feb86c267aab300b06f9a7470
 SHA1 (patch-mfbt_Alignment.h) = 1d97ee858b62c31112fe90ebb2d8fe430c95ed56
 SHA1 (patch-mfbt_Attributes.h) = b587038d2f41d3cd4dbc346ac591088b2f36750c
 SHA1 (patch-ostream) = 593a114a31a0117af6c00cd12e3aed4565571288
+SHA1 (patch-toolkit_components_protobuf_src_google_protobuf_stubs_platform_macros.h) = 91c46217f5ea1e328a576b09a691d47ed58dd532
 SHA1 (patch-toolkit_library_moz.build) = 57017a6766a7d7a075bcd01d713c34cab5f45f2a
 SHA1 (patch-toolkit_toolkit.mozbuild) = a92b9f5114c3eab2c8e9f1d0eb21926235d2203a
 SHA1 (patch-unwind.h) = c7a606c83cb60d0d6bcc7babad8157097d9036a8
 SHA1 (patch-xg) = 2b472858270a109c2b317bb08698c12717174510
 SHA1 (patch-xl) = 337960ba518f1f142b45ae91d3f122ee5e0c9da3
 SHA1 (patch-xm) = 85000d412a7e7aa9ea8c337c9bc72b55d9e7ca63
-SHA1 (patch-xpcom_base_Logging.h) = d7c1a7ac97a085a94ab7ce12c37f14a6569c8e20
+SHA1 (patch-xpcom_base_Logging.h) = 9f5a0137d40b6ad1787ca78bf5c532e20764398f
+SHA1 (patch-xpcom_reflect_xptcall_md_unix_Makefile.in) = 6083e298140357bc5f2fa018885fed42eecb1ac4
 SHA1 (patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__asm__mips.S) = 17becf7433af427289ee1e25c16600df468e2540
 SHA1 (patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__gcc__x86__unix.cpp) = 4d93c465be5fb5e6aaf0b12707a116c6b3ed4be8
+SHA1 (patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__sparc64__netbsd.cpp) = 0792c2c626d906e71c5183994cb32bf8cdb3e239
+SHA1 (patch-xpcom_reflect_xptcall_md_unix_xptcstubs__asm__sparc64__netbsd.s) = 522bc237bc90d85c98b61a467a431fddd91d8c3c
 SHA1 (patch-xptcinvoke__sparc64__netbsd.cpp) = a292378e1a882b273616f2b749d7785fda2ddf54
 SHA1 (patch-xptcstubs__asm__sparc64__netbsd.s) = 6df4c709e79320562c0fb544421fe53176da6b48
diff --git a/firefox-hg/patches/patch-js_src_jit_AtomicOperations.h b/firefox-hg/patches/patch-js_src_jit_AtomicOperations.h
new file mode 100644
index 0000000..a9a4296
--- /dev/null
+++ b/firefox-hg/patches/patch-js_src_jit_AtomicOperations.h
@@ -0,0 +1,14 @@
+# See https://bugzilla.mozilla.org/show_bug.cgi?id=1232150
+
+diff -r c5da92c5b490 js/src/jit/AtomicOperations.h
+--- js/src/jit/AtomicOperations.h	Thu Jan 21 14:38:56 2016 -0500
++++ js/src/jit/AtomicOperations.h	Fri Jan 22 08:52:19 2016 +0100
+@@ -316,6 +316,8 @@
+     || defined(__ppc64le__) || defined(__PPC64LE__) \
+     || defined(__ppc__) || defined(__PPC__)
+ # include "jit/none/AtomicOperations-ppc.h"
++#elif defined(__sparc__)
++# include "jit/none/AtomicOperations-sparc.h"
+ #elif defined(JS_CODEGEN_NONE)
+ # include "jit/none/AtomicOperations-none.h"
+ #elif defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
diff --git a/firefox-hg/patches/patch-js_src_jit_none_AtomicOperations-sparc.h b/firefox-hg/patches/patch-js_src_jit_none_AtomicOperations-sparc.h
new file mode 100644
index 0000000..5c6d4f0
--- /dev/null
+++ b/firefox-hg/patches/patch-js_src_jit_none_AtomicOperations-sparc.h
@@ -0,0 +1,257 @@
+# See https://bugzilla.mozilla.org/show_bug.cgi?id=1232150
+
+diff -r c5da92c5b490 js/src/jit/none/AtomicOperations-sparc.h
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ js/src/jit/none/AtomicOperations-sparc.h	Fri Jan 22 08:52:19 2016 +0100
+@@ -0,0 +1,251 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
++ * vim: set ts=8 sts=4 et sw=4 tw=99:
++ * This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++/* For documentation, see jit/AtomicOperations.h */
++
++#ifndef jit_sparc_AtomicOperations_sparc_h
++#define jit_sparc_AtomicOperations_sparc_h
++
++#include "mozilla/Assertions.h"
++#include "mozilla/Types.h"
++
++#if defined(__clang__) || defined(__GNUC__)
++
++// The default implementation tactic for gcc/clang is to use the newer
++// __atomic intrinsics added for use in C++11 <atomic>.  Where that
++// isn't available, we use GCC's older __sync functions instead.
++//
++// ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS is kept as a backward
++// compatible option for older compilers: enable this to use GCC's old
++// __sync functions instead of the newer __atomic functions.  This
++// will be required for GCC 4.6.x and earlier, and probably for Clang
++// 3.1, should we need to use those versions.
++
++//#define ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++
++inline bool
++js::jit::AtomicOperations::isLockfree8()
++{
++# ifndef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    MOZ_ASSERT(__atomic_always_lock_free(sizeof(int8_t), 0));
++    MOZ_ASSERT(__atomic_always_lock_free(sizeof(int16_t), 0));
++    MOZ_ASSERT(__atomic_always_lock_free(sizeof(int32_t), 0));
++#  if defined(__LP64__)
++    MOZ_ASSERT(__atomic_always_lock_free(sizeof(int64_t), 0));
++#  endif
++    return true;
++# else
++    return false;
++# endif
++}
++
++inline void
++js::jit::AtomicOperations::fenceSeqCst()
++{
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    __sync_synchronize();
++# else
++    __atomic_thread_fence(__ATOMIC_SEQ_CST);
++# endif
++}
++
++template<typename T>
++inline T
++js::jit::AtomicOperations::loadSeqCst(T* addr)
++{
++    MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    __sync_synchronize();
++    T v = *addr;
++    __sync_synchronize();
++# else
++    T v;
++    __atomic_load(addr, &v, __ATOMIC_SEQ_CST);
++# endif
++    return v;
++}
++
++template<typename T>
++inline void
++js::jit::AtomicOperations::storeSeqCst(T* addr, T val)
++{
++    MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    __sync_synchronize();
++    *addr = val;
++    __sync_synchronize();
++# else
++    __atomic_store(addr, &val, __ATOMIC_SEQ_CST);
++# endif
++}
++
++template<typename T>
++inline T
++js::jit::AtomicOperations::compareExchangeSeqCst(T* addr, T oldval, T newval)
++{
++    MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    return __sync_val_compare_and_swap(addr, oldval, newval);
++# else
++    __atomic_compare_exchange(addr, &oldval, &newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
++    return oldval;
++# endif
++}
++
++template<typename T>
++inline T
++js::jit::AtomicOperations::fetchAddSeqCst(T* addr, T val)
++{
++#if !defined( __LP64__)
++    static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
++#endif
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    return __sync_fetch_and_add(addr, val);
++# else
++    return __atomic_fetch_add(addr, val, __ATOMIC_SEQ_CST);
++# endif
++}
++
++template<typename T>
++inline T
++js::jit::AtomicOperations::fetchSubSeqCst(T* addr, T val)
++{
++#if !defined( __LP64__)
++    static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
++#endif
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    return __sync_fetch_and_sub(addr, val);
++# else
++    return __atomic_fetch_sub(addr, val, __ATOMIC_SEQ_CST);
++# endif
++}
++
++template<typename T>
++inline T
++js::jit::AtomicOperations::fetchAndSeqCst(T* addr, T val)
++{
++#if !defined( __LP64__)
++    static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
++#endif
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    return __sync_fetch_and_and(addr, val);
++# else
++    return __atomic_fetch_and(addr, val, __ATOMIC_SEQ_CST);
++# endif
++}
++
++template<typename T>
++inline T
++js::jit::AtomicOperations::fetchOrSeqCst(T* addr, T val)
++{
++#if !defined( __LP64__)
++    static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
++#endif
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    return __sync_fetch_and_or(addr, val);
++# else
++    return __atomic_fetch_or(addr, val, __ATOMIC_SEQ_CST);
++# endif
++}
++
++template<typename T>
++inline T
++js::jit::AtomicOperations::fetchXorSeqCst(T* addr, T val)
++{
++#if !defined( __LP64__)
++    static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
++#endif
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    return __sync_fetch_and_xor(addr, val);
++# else
++    return __atomic_fetch_xor(addr, val, __ATOMIC_SEQ_CST);
++# endif
++}
++
++template<typename T>
++inline T
++js::jit::AtomicOperations::loadSafeWhenRacy(T* addr)
++{
++    return *addr;               // FIXME (1208663): not yet safe
++}
++
++template<typename T>
++inline void
++js::jit::AtomicOperations::storeSafeWhenRacy(T* addr, T val)
++{
++    *addr = val;                // FIXME (1208663): not yet safe
++}
++
++inline void
++js::jit::AtomicOperations::memcpySafeWhenRacy(void* dest, const void* src, size_t nbytes)
++{
++    ::memcpy(dest, src, nbytes); // FIXME (1208663): not yet safe
++}
++
++inline void
++js::jit::AtomicOperations::memmoveSafeWhenRacy(void* dest, const void* src, size_t nbytes)
++{
++    ::memmove(dest, src, nbytes); // FIXME (1208663): not yet safe
++}
++
++template<typename T>
++inline T
++js::jit::AtomicOperations::exchangeSeqCst(T* addr, T val)
++{
++    MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    T v;
++    __sync_synchronize();
++    do {
++	v = *addr;
++    } while (__sync_val_compare_and_swap(addr, v, val) != v);
++    return v;
++# else
++    T v;
++    __atomic_exchange(addr, &val, &v, __ATOMIC_SEQ_CST);
++    return v;
++# endif
++}
++
++template<size_t nbytes>
++inline void
++js::jit::RegionLock::acquire(void* addr)
++{
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    while (!__sync_bool_compare_and_swap(&spinlock, 0, 1))
++        ;
++# else
++    uint32_t zero = 0;
++    uint32_t one = 1;
++    while (!__atomic_compare_exchange(&spinlock, &zero, &one, false, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE)) {
++        zero = 0;
++        continue;
++    }
++# endif
++}
++
++template<size_t nbytes>
++inline void
++js::jit::RegionLock::release(void* addr)
++{
++    MOZ_ASSERT(AtomicOperations::loadSeqCst(&spinlock) == 1, "releasing unlocked region lock");
++# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++    __sync_sub_and_fetch(&spinlock, 1);
++# else
++    uint32_t zero = 0;
++    __atomic_store(&spinlock, &zero, __ATOMIC_SEQ_CST);
++# endif
++}
++
++# undef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
++
++#elif defined(ENABLE_SHARED_ARRAY_BUFFER)
++
++# error "Either disable JS shared memory, use GCC or Clang, or add code here"
++
++#endif
++
++#endif // jit_sparc_AtomicOperations_sparc_h
diff --git a/firefox-hg/patches/patch-toolkit_components_protobuf_src_google_protobuf_stubs_platform_macros.h b/firefox-hg/patches/patch-toolkit_components_protobuf_src_google_protobuf_stubs_platform_macros.h
new file mode 100644
index 0000000..83e8734
--- /dev/null
+++ b/firefox-hg/patches/patch-toolkit_components_protobuf_src_google_protobuf_stubs_platform_macros.h
@@ -0,0 +1,26 @@
+# see upstream pull request #780 : not all __sparc__ are running Solaris
+# https://github.com/google/protobuf/pull/780
+
+--- toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h.orig	2016-01-21 15:05:05.000000000 +0100
++++ toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h	2016-01-21 16:17:05.000000000 +0100
+@@ -67,11 +67,20 @@
+ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
+ #elif defined(sparc)
+ #define GOOGLE_PROTOBUF_ARCH_SPARC 1
++#ifdef sun
+ #ifdef SOLARIS_64BIT_ENABLED
+ #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
+ #else
+ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
+ #endif
++#else
++// sparc, but not solaris
++# if __LP64__
++#  define GOOGLE_PROTOBUF_ARCH_64_BIT 1
++# else
++#  define GOOGLE_PROTOBUF_ARCH_32_BIT 1
++# endif
++#endif
+ #elif defined(__GNUC__)
+ # if (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4))
+ // We fallback to the generic Clang/GCC >= 4.7 implementation in atomicops.h
diff --git a/firefox-hg/patches/patch-xpcom_base_Logging.h b/firefox-hg/patches/patch-xpcom_base_Logging.h
index 35815d4..3b9dfdd 100644
--- a/firefox-hg/patches/patch-xpcom_base_Logging.h
+++ b/firefox-hg/patches/patch-xpcom_base_Logging.h
@@ -1,7 +1,7 @@
-$NetBSD$
+# Needed for va_list later used in this file
 
---- xpcom/base/Logging.h.orig	2016-01-22 10:25:27.000000000 +0000
-+++ xpcom/base/Logging.h
+--- xpcom/base/Logging.h.orig	2016-01-21 15:05:53.000000000 +0100
++++ xpcom/base/Logging.h	2016-01-21 15:36:24.000000000 +0100
 @@ -7,6 +7,7 @@
  #ifndef mozilla_logging_h
  #define mozilla_logging_h
diff --git a/firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_Makefile.in b/firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_Makefile.in
new file mode 100644
index 0000000..78fc6f7
--- /dev/null
+++ b/firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_Makefile.in
@@ -0,0 +1,48 @@
+$NetBSD: patch-xpcom_reflect_xptcall_md_unix_Makefile.in,v 1.2 2015/09/23 06:44:42 ryoon Exp $
+
+--- xpcom/reflect/xptcall/md/unix/Makefile.in.orig	2015-08-24 21:53:22.000000000 +0000
++++ xpcom/reflect/xptcall/md/unix/Makefile.in
+@@ -42,6 +42,43 @@ ifeq ($(OS_ARCH),AIX)
+ CXXFLAGS 	:=  $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(CXXFLAGS))
+ endif
+ 
++######################################################################
++# SPARC
++######################################################################
++#
++# Linux/SPARC
++#
++ifeq ($(OS_ARCH),Linux)
++ifneq (,$(findstring sparc,$(OS_TEST)))
++ASFILES		:= xptcinvoke_asm_sparc_linux_GCC3.s xptcstubs_asm_sparc_solaris.s
++endif
++endif
++#
++# NetBSD/SPARC
++#
++ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc)
++ASFILES		:= xptcinvoke_asm_sparc_netbsd.s xptcstubs_asm_sparc_netbsd.s
++endif
++#
++# OpenBSD/SPARC
++#
++ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDsparc)
++ASFILES		:= xptcinvoke_asm_sparc_openbsd.s xptcstubs_asm_sparc_openbsd.s
++endif
++#
++# OpenBSD/SPARC64
++#
++ifneq (,$(filter OpenBSDsparc64 FreeBSDsparc64,$(OS_ARCH)$(OS_TEST)))
++ASFILES		:= xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_openbsd.s
++endif
++#
++# NetBSD/SPARC64
++#
++ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc64)
++CPPSRCS                := xptcinvoke_sparc64_netbsd.cpp xptcstubs_sparc64_openbsd.cpp
++ASFILES                := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_netbsd.s
++endif
++
+ include $(topsrcdir)/config/rules.mk
+ 
+ ifeq ($(OS_ARCH),Linux)
diff --git a/firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__sparc64__netbsd.cpp b/firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__sparc64__netbsd.cpp
new file mode 100644
index 0000000..4f1d2a4
--- /dev/null
+++ b/firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__sparc64__netbsd.cpp
@@ -0,0 +1,89 @@
+$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__sparc64__netbsd.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
+
+--- xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_netbsd.cpp.orig	2014-10-14 18:49:14.000000000 +0000
++++ xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_netbsd.cpp
+@@ -0,0 +1,84 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
++ *
++ * The contents of this file are subject to the Netscape Public
++ * License Version 1.1 (the "License"); you may not use this file
++ * except in compliance with the License. You may obtain a copy of
++ * the License at http://www.mozilla.org/NPL/
++ *
++ * Software distributed under the License is distributed on an "AS
++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
++ * implied. See the License for the specific language governing
++ * rights and limitations under the License.
++ *
++ * The Original Code is mozilla.org code.
++ *
++ * The Initial Developer of the Original Code is Netscape
++ * Communications Corporation.  Portions created by Netscape are
++ * Copyright (C) 1998 Netscape Communications Corporation. All
++ * Rights Reserved.
++ *
++ * Contributor(s): 
++ */
++
++/* Platform specific code to invoke XPCOM methods on native objects */
++
++#include "xptcprivate.h"
++
++#if !defined(__sparc64__) && !defined(_LP64)
++#error "This code is for Sparc64 only"
++#endif
++
++extern "C" PRUint32
++invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s)
++{
++  /*
++    We need to copy the parameters for this function to locals and use them
++    from there since the parameters occupy the same stack space as the stack
++    we're trying to populate.
++  */
++  PRUint64 *l_d = d;
++  nsXPTCVariant *l_s = s;
++  PRUint64 l_paramCount = paramCount;
++  PRUint64 regCount = 0;  // return the number of registers to load from the stack
++
++  for(PRUint64 i = 0; i < l_paramCount; i++, l_d++, l_s++)
++  {
++    if (regCount < 5) regCount++;
++
++    if (l_s->IsPtrData())
++    {
++      *l_d = (PRUint64)l_s->ptr;
++      continue;
++    }
++    switch (l_s->type)
++    {
++      case nsXPTType::T_I8    : *((PRInt64*)l_d)     = l_s->val.i8;    break;
++      case nsXPTType::T_I16   : *((PRInt64*)l_d)     = l_s->val.i16;   break;
++      case nsXPTType::T_I32   : *((PRInt64*)l_d)     = l_s->val.i32;   break;
++      case nsXPTType::T_I64   : *((PRInt64*)l_d)     = l_s->val.i64;   break;
++      
++      case nsXPTType::T_U8    : *((PRUint64*)l_d)    = l_s->val.u8;    break;
++      case nsXPTType::T_U16   : *((PRUint64*)l_d)    = l_s->val.u16;   break;
++      case nsXPTType::T_U32   : *((PRUint64*)l_d)    = l_s->val.u32;   break;
++      case nsXPTType::T_U64   : *((PRUint64*)l_d)    = l_s->val.u64;   break;
++
++      /* in the case of floats, we want to put the bits in to the
++         64bit space right justified... floats in the paramter array on
++         sparcv9 use odd numbered registers.. %f1, %f3, so we have to skip
++         the space that would be occupied by %f0, %f2, etc.
++      */
++      case nsXPTType::T_FLOAT : *(((float*)l_d) + 1) = l_s->val.f;     break;
++      case nsXPTType::T_DOUBLE: *((double*)l_d)      = l_s->val.d;     break;
++      case nsXPTType::T_BOOL  : *((PRInt64*)l_d)      = l_s->val.b;     break;
++      case nsXPTType::T_CHAR  : *((PRUint64*)l_d)    = l_s->val.c;     break;
++      case nsXPTType::T_WCHAR : *((PRInt64*)l_d)     = l_s->val.wc;    break;
++
++      default:
++        // all the others are plain pointer types
++        *((void**)l_d) = l_s->val.p;
++        break;
++    }
++  }
++  
++  return regCount;
++}
diff --git a/firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_xptcstubs__asm__sparc64__netbsd.s b/firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_xptcstubs__asm__sparc64__netbsd.s
new file mode 100644
index 0000000..32e6044
--- /dev/null
+++ b/firefox-hg/patches/patch-xpcom_reflect_xptcall_md_unix_xptcstubs__asm__sparc64__netbsd.s
@@ -0,0 +1,71 @@
+$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcstubs__asm__sparc64__netbsd.s,v 1.1 2014/10/15 13:43:32 ryoon Exp $
+
+--- xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc64_netbsd.s.orig	2014-10-14 18:49:14.000000000 +0000
++++ xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc64_netbsd.s
+@@ -0,0 +1,66 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
++ *
++ * The contents of this file are subject to the Netscape Public
++ * License Version 1.1 (the "License"); you may not use this file
++ * except in compliance with the License. You may obtain a copy of
++ * the License at http://www.mozilla.org/NPL/
++ *
++ * Software distributed under the License is distributed on an "AS
++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
++ * implied. See the License for the specific language governing
++ * rights and limitations under the License.
++ *
++ * The Original Code is mozilla.org code.
++ *
++ * The Initial Developer of the Original Code is Netscape
++ * Communications Corporation.  Portions created by Netscape are
++ * Copyright (C) 1999 Netscape Communications Corporation. All
++ * Rights Reserved.
++ *
++ * Contributor(s): 
++ */
++
++        .global SharedStub
++
++/*
++    in the frame for the function that called SharedStub are the
++    rest of the parameters we need
++
++*/
++
++SharedStub:
++! we don't create a new frame yet, but work within the frame of the calling
++! function to give ourselves the other parameters we want
++
++	mov	%o0, %o1	       ! shuffle the index up to 2nd place
++	mov	%i0, %o0	       ! the original 'this'
++	add	%fp, 0x7ff + 136, %o2  ! previous stack top adjusted to the first argument slot (beyond 'this')
++
++! save off the original incoming parameters that arrived in 
++! registers, the ABI guarantees the space for us to do this
++	stx	%i1, [%fp + 0x7ff + 136]
++	stx	%i2, [%fp + 0x7ff + 144]
++	stx	%i3, [%fp + 0x7ff + 152]
++	stx	%i4, [%fp + 0x7ff + 160]
++	stx	%i5, [%fp + 0x7ff + 168]
++! now we can build our own stack frame
++	save	%sp,-(128 + 64),%sp    ! room for the register window and
++				       ! struct pointer, rounded up to 0 % 64
++! our function now appears to have been called
++! as SharedStub(nsISupports* that, PRUint32 index, PRUint32* args)
++! so we can just copy these through
++
++	mov	%i0, %o0
++	mov	%i1, %o1
++	mov	%i2, %o2
++	call	PrepareAndDispatch
++	 nop
++	mov	%o0,%i0 	    ! propagate return value
++	b .LL1
++	 nop
++.LL1:
++	ret
++	 restore
++
++       .size	SharedStub, .-SharedStub
++       .type	SharedStub, #function


Home | Main Index | Thread Index | Old Index