components/desktop/thunderbird/patches/firefox31-sparc-ta-6.patch
author Stacy Yeh <stacy.yeh@oracle.com>
Mon, 11 Jan 2016 09:27:45 -0800
changeset 5255 cea0e462549a
permissions -rw-r--r--
22322082 Move Firefox/Thunderbird from Desktop consolidation to Userland

Adds asm("ta 6") which suppresses bus error caused by misalignment.

diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp
--- a/mozilla/js/xpconnect/src/XPCShellImpl.cpp
+++ b/mozilla/js/xpconnect/src/XPCShellImpl.cpp
@@ -1325,6 +1325,12 @@
 int
 XRE_XPCShellMain(int argc, char **argv, char **envp)
 {
+
+#if defined (__GNUC__) && (defined(__sparc) || defined(__sparc__))
+    // make unaligned memory access no crash
+    asm ( "ta 6" );
+#endif
+        
     JSRuntime *rt;
     JSContext *cx;
     int result;
diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c
--- a/mozilla/memory/mozjemalloc/jemalloc.c
+++ b/mozilla/memory/mozjemalloc/jemalloc.c
@@ -5551,16 +5551,22 @@ malloc_init(void)
 #endif
 
 #if !defined(MOZ_MEMORY_WINDOWS)
 static
 #endif
 bool
 malloc_init_hard(void)
 {
+
+#if defined (__GNUC__) && (defined(__sparc) || defined(__sparc__))
+    // make unaligned memory access no crash
+    asm ( "ta 6" );
+#endif
+
 	unsigned i;
 	char buf[PATH_MAX + 1];
 	const char *opts;
 	long result;
 #ifndef MOZ_MEMORY_WINDOWS
 	int linklen;
 #endif
 #ifdef MOZ_MEMORY_DARWIN
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
--- a/mozilla/toolkit/xre/nsAppRunner.cpp
+++ b/mozilla/toolkit/xre/nsAppRunner.cpp
@@ -4016,16 +4016,22 @@ XREMain::XRE_mainRun()
 }
 
 /*
  * XRE_main - A class based main entry point used by most platforms.
  */
 int
 XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
 {
+
+#if defined (__GNUC__) && (defined(__sparc) || defined(__sparc__))
+    // make unaligned memory access no crash
+    asm ( "ta 6" );
+#endif
+
   char aLocal;
   GeckoProfilerInitRAII profilerGuard(&aLocal);
   PROFILER_LABEL("Startup", "XRE_Main");
 
   mozilla::IOInterposerInit ioInterposerGuard;
 
   nsresult rv = NS_OK;