components/desktop/firefox/patches/firefox31-sparc-ta-6.patch
changeset 5255 cea0e462549a
equal deleted inserted replaced
5252:947514442d05 5255:cea0e462549a
       
     1 Adds asm("ta 6") which suppresses bus error caused by misalignment.
       
     2 
       
     3 diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp
       
     4 --- a/js/xpconnect/src/XPCShellImpl.cpp
       
     5 +++ b/js/xpconnect/src/XPCShellImpl.cpp
       
     6 @@ -1320,16 +1320,22 @@ GetCurrentWorkingDirectory(nsAString& wo
       
     7      return true;
       
     8  }
       
     9  
       
    10  static JSSecurityCallbacks shellSecurityCallbacks;
       
    11  
       
    12  int
       
    13  XRE_XPCShellMain(int argc, char** argv, char** envp)
       
    14  {
       
    15 +
       
    16 +#if defined (__GNUC__) && (defined(__sparc) || defined(__sparc__))
       
    17 +    // make unaligned memory access no crash
       
    18 +    asm ( "ta 6" );
       
    19 +#endif
       
    20 +
       
    21      JSRuntime* rt;
       
    22      JSContext* cx;
       
    23      int result;
       
    24      nsresult rv;
       
    25  
       
    26      gErrFile = stderr;
       
    27      gOutFile = stdout;
       
    28      gInFile = stdin;
       
    29 diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c
       
    30 --- a/memory/mozjemalloc/jemalloc.c
       
    31 +++ b/memory/mozjemalloc/jemalloc.c
       
    32 @@ -5551,16 +5551,22 @@ malloc_init(void)
       
    33  #endif
       
    34  
       
    35  #if !defined(MOZ_MEMORY_WINDOWS)
       
    36  static
       
    37  #endif
       
    38  bool
       
    39  malloc_init_hard(void)
       
    40  {
       
    41 +
       
    42 +#if defined (__GNUC__) && (defined(__sparc) || defined(__sparc__))
       
    43 +    // make unaligned memory access no crash
       
    44 +    asm ( "ta 6" );
       
    45 +#endif
       
    46 +
       
    47  	unsigned i;
       
    48  	char buf[PATH_MAX + 1];
       
    49  	const char *opts;
       
    50  	long result;
       
    51  #ifndef MOZ_MEMORY_WINDOWS
       
    52  	int linklen;
       
    53  #endif
       
    54  #ifdef MOZ_MEMORY_DARWIN
       
    55 diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
       
    56 --- a/toolkit/xre/nsAppRunner.cpp
       
    57 +++ b/toolkit/xre/nsAppRunner.cpp
       
    58 @@ -4016,16 +4016,22 @@ XREMain::XRE_mainRun()
       
    59  }
       
    60  
       
    61  /*
       
    62   * XRE_main - A class based main entry point used by most platforms.
       
    63   */
       
    64  int
       
    65  XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
       
    66  {
       
    67 +
       
    68 +#if defined (__GNUC__) && (defined(__sparc) || defined(__sparc__))
       
    69 +    // make unaligned memory access no crash
       
    70 +    asm ( "ta 6" );
       
    71 +#endif
       
    72 +
       
    73    char aLocal;
       
    74    GeckoProfilerInitRAII profilerGuard(&aLocal);
       
    75    PROFILER_LABEL("Startup", "XRE_Main");
       
    76  
       
    77    mozilla::IOInterposerInit ioInterposerGuard;
       
    78  
       
    79    nsresult rv = NS_OK;
       
    80