use mozilla-cpuid.patch for 11.1 and older
authorWolfgang Rosenauer <wr@rosenauer.org>
Wed, 09 Jun 2010 11:59:44 +0200
changeset 79 bc6311ee4f5e
parent 78 e0271a18500f
child 80 67e4ee440947
use mozilla-cpuid.patch for 11.1 and older
mozilla-cpuid.patch
mozilla-xulrunner193/mozilla-cpuid.patch
mozilla-xulrunner193/mozilla-xulrunner193.spec
series
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-cpuid.patch	Wed Jun 09 11:59:44 2010 +0200
@@ -0,0 +1,84 @@
+References:
+https://bugzilla.mozilla.org/show_bug.cgi?id=513422
+
+diff --git a/xpcom/glue/SSE.h b/xpcom/glue/SSE.h
+--- a/xpcom/glue/SSE.h
++++ b/xpcom/glue/SSE.h
+@@ -234,32 +234,73 @@
+ #endif
+ #ifdef __SSE4_2__
+   // It's ok to use SSE4.2 instructions based on the -march option.
+   #define MOZILLA_PRESUME_SSE4_2 1
+ #endif
+ 
+ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+ 
+-// cpuid.h is available on gcc 4.3 and higher on i386 and x86_64
+-#include <cpuid.h>
+ #define MOZILLA_SSE_HAVE_CPUID_DETECTION
+ 
+ namespace mozilla {
+ 
+   namespace sse_private {
+ 
+     enum CPUIDRegister { eax = 0, ebx = 1, ecx = 2, edx = 3 };
+ 
++    inline void my__cpuid(unsigned int* regs, unsigned int level)
++    {
++      regs[0] = level;
++#     if defined(__i386__)
++      __asm__ __volatile__(
++        "pushl %%ebx"             "\n\t"
++        "movl  %0, %%edi"         "\n\t"
++        "movl  0(%%edi), %%eax"   "\n\t"
++        "cpuid"                   "\n\t"
++        "movl  %%eax, 0(%%edi)"   "\n\t"
++        "movl  %%ebx, 4(%%edi)"   "\n\t"
++        "movl  %%ecx, 8(%%edi)"   "\n\t"
++        "movl  %%edx, 12(%%edi)"  "\n\t"
++        "popl  %%ebx"             "\n"
++        : /*out*/
++        : /*in*/"r"(regs)
++        : /*trash*/"edi","eax","ecx","edx","memory","cc"
++      );
++#     elif defined(__x86_64__)
++      __asm__ __volatile__(
++        "pushq %%rbx"             "\n\t"
++        "movq  %0, %%rdi"         "\n\t"
++        "movl  0(%%rdi), %%eax"   "\n\t"
++        "cpuid"                   "\n\t"
++        "movl  %%eax, 0(%%rdi)"   "\n\t"
++        "movl  %%ebx, 4(%%rdi)"   "\n\t"
++        "movl  %%ecx, 8(%%rdi)"   "\n\t"
++        "movl  %%edx, 12(%%rdi)"  "\n\t"
++        "popq  %%rbx"             "\n"
++        : /*out*/
++        : /*in*/"r"(regs)
++        : /*trash*/"rdi","rax","rcx","rdx","memory","cc"
++      );
++#     else
++#       error "Hmm, unsupported x86-esque platform"
++#     endif
++    }
++
+     inline bool
+     has_cpuid_bit(unsigned int level, CPUIDRegister reg, unsigned int bit)
+     {
++      // Check that the level in question is supported.
+       unsigned int regs[4];
+-      return __get_cpuid(level, &regs[0], &regs[1], &regs[2], &regs[3]) &&
+-             (regs[reg] & bit);
++      my__cpuid(regs, level & 0x80000000u);
++      if (unsigned(regs[0]) < level)
++        return false;
++
++      my__cpuid(regs, level);
++      return !!(unsigned(regs[reg]) & bit);
+     }
+ 
+   }
+ 
+ }
+ 
+ #endif
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-xulrunner193/mozilla-cpuid.patch	Wed Jun 09 11:59:44 2010 +0200
@@ -0,0 +1,1 @@
+../mozilla-cpuid.patch
\ No newline at end of file
--- a/mozilla-xulrunner193/mozilla-xulrunner193.spec	Wed Jun 09 10:40:14 2010 +0200
+++ b/mozilla-xulrunner193/mozilla-xulrunner193.spec	Wed Jun 09 11:59:44 2010 +0200
@@ -75,6 +75,7 @@
 Patch12:        gecko-lockdown.patch
 Patch13:        toolkit-ui-lockdown.patch
 # ---
+Patch14:        mozilla-cpuid.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Requires:       mozilla-js193
 Requires(post):  update-alternatives coreutils
@@ -213,6 +214,9 @@
 #%patch11 -p1
 #%patch12 -p1
 #%patch13 -p1
+%if %suse_version < 1120
+%patch14 -p1
+%endif
 
 %build
 #%if %suse_version >= 1110
--- a/series	Wed Jun 09 10:40:14 2010 +0200
+++ b/series	Wed Jun 09 11:59:44 2010 +0200
@@ -11,6 +11,7 @@
 #mozilla-gconf-backend.patch
 #gecko-lockdown.patch
 #toolkit-ui-lockdown.patch
+mozilla-cpuid.patch
 
 # Firefox patches
 firefox-libxul-sdk.patch