# HG changeset patch # User Wolfgang Rosenauer # Date 1309285488 -7200 # Node ID 0287f70d86e905a04b0e01e56a6699c3352db688 # Parent ccddc8555cdb8aa61fc4ddc3583d3293a4c80b5e SLE11 compatibility: - cpuid detection code - cairo undefined behaviour fix diff -r ccddc8555cdb -r 0287f70d86e9 MozillaFirefox/MozillaFirefox.spec --- a/MozillaFirefox/MozillaFirefox.spec Thu Jun 23 22:31:54 2011 +0200 +++ b/MozillaFirefox/MozillaFirefox.spec Tue Jun 28 20:24:48 2011 +0200 @@ -74,6 +74,7 @@ Patch11: mozilla-ppc-ipc.patch Patch12: mozilla-repo.patch Patch13: mozilla-dump_syms-static.patch +Patch14: mozilla-sle11.patch # Firefox/browser Patch30: firefox-linkorder.patch Patch31: firefox-browser-css.patch @@ -206,6 +207,9 @@ %patch11 -p1 %patch12 -p1 %patch13 -p1 +%if %suse_version < 1120 +%patch14 -p1 +%endif # %patch30 -p1 %patch31 -p1 diff -r ccddc8555cdb -r 0287f70d86e9 MozillaFirefox/mozilla-sle11.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MozillaFirefox/mozilla-sle11.patch Tue Jun 28 20:24:48 2011 +0200 @@ -0,0 +1,1 @@ +../mozilla-sle11.patch \ No newline at end of file diff -r ccddc8555cdb -r 0287f70d86e9 mozilla-cairo-return.patch --- a/mozilla-cairo-return.patch Thu Jun 23 22:31:54 2011 +0200 +++ b/mozilla-cairo-return.patch Tue Jun 28 20:24:48 2011 +0200 @@ -1,6 +1,6 @@ # HG changeset patch # User Wolfgang Rosenauer -# Parent e36e1a20cb5e1ba0e4bc3facac58029544d92e0a +# Parent 43cb27a012f2532add0e9791c1b5a7d0c3b03f9b Bug 631155 - undefined return value in function '_cairo_surface_wrapper_flush' diff --git a/gfx/cairo/cairo/src/cairo-surface-wrapper.c b/gfx/cairo/cairo/src/cairo-surface-wrapper.c diff -r ccddc8555cdb -r 0287f70d86e9 mozilla-cpuid.patch --- a/mozilla-cpuid.patch Thu Jun 23 22:31:54 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -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 - #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, ®s[0], ®s[1], ®s[2], ®s[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 - diff -r ccddc8555cdb -r 0287f70d86e9 mozilla-sle11.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mozilla-sle11.patch Tue Jun 28 20:24:48 2011 +0200 @@ -0,0 +1,112 @@ +Subject: Patches needed to build on SLE11/11.1 +References: +https://bugzilla.mozilla.org/show_bug.cgi?id=513422 + +diff --git a/gfx/cairo/cairo/src/cairo-xlib-surface.c b/gfx/cairo/cairo/src/cairo-xlib-surface.c +--- a/gfx/cairo/cairo/src/cairo-xlib-surface.c ++++ b/gfx/cairo/cairo/src/cairo-xlib-surface.c +@@ -4041,17 +4041,19 @@ _cairo_xlib_surface_add_glyph (Display * + new = malloc (4 * c); + if (unlikely (new == NULL)) { + status = _cairo_error (CAIRO_STATUS_NO_MEMORY); + goto BAIL; + } + n = new; + d = (uint32_t *) data; + do { +- *n++ = bswap_32 (*d++); ++ *n = bswap_32 (*d); ++ *n++; ++ *d++; + } while (--c); + data = (uint8_t *) new; + } + break; + case CAIRO_FORMAT_RGB24: + default: + ASSERT_NOT_REACHED; + break; +diff --git a/xpcom/glue/SSE.cpp b/xpcom/glue/SSE.cpp +--- a/xpcom/glue/SSE.cpp ++++ b/xpcom/glue/SSE.cpp +@@ -44,26 +44,77 @@ namespace { + // SSE.h has parallel #ifs which declare MOZILLA_SSE_HAVE_CPUID_DETECTION. + // We can't declare these functions in the header file, however, because + // conflicts with on MSVC 2005, and some files want to + // include both SSE.h and . + + #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && (defined(__i386__) || defined(__x86_64__)) + + // cpuid.h is available on gcc 4.3 and higher on i386 and x86_64 +-#include ++//#include + + enum CPUIDRegister { eax = 0, ebx = 1, ecx = 2, edx = 3 }; + ++#ifdef __i386__ ++#define _my_cpuid(level, a, b, c, d) \ ++ __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ ++ "cpuid\n\t" \ ++ "xchg{l}\t{%%}ebx, %1\n\t" \ ++ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ ++ : "0" (level)) ++#else ++#define _my_cpuid(level, a, b, c, d) \ ++ __asm__ ("cpuid\n\t" \ ++ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ ++ : "0" (level)) ++#endif ++ ++static __inline unsigned int ++my_cpuid_max (unsigned int __ext, unsigned int *__sig) ++{ ++ unsigned int __eax, __ebx, __ecx, __edx; ++ ++#ifdef __i386__ ++ __asm__ ("pushf{l|d}\n\t" ++ "pushf{l|d}\n\t" ++ "pop{l}\t%0\n\t" ++ "mov{l}\t{%0, %1|%1, %0}\n\t" ++ "xor{l}\t{%2, %0|%0, %2}\n\t" ++ "push{l}\t%0\n\t" ++ "popf{l|d}\n\t" ++ "pushf{l|d}\n\t" ++ "pop{l}\t%0\n\t" ++ "popf{l|d}\n\t" ++ : "=&r" (__eax), "=&r" (__ebx) ++ : "i" (0x00200000)); ++ ++ if (!((__eax ^ __ebx) & 0x00200000)) ++ return 0; ++#endif ++ ++ /* Host supports cpuid. Return highest supported cpuid input value. */ ++ _my_cpuid (__ext, __eax, __ebx, __ecx, __edx); ++ ++ if (__sig) ++ *__sig = __ebx; ++ ++ return __eax; ++} ++ + static bool + has_cpuid_bit(unsigned int level, CPUIDRegister reg, unsigned int bit) + { + unsigned int regs[4]; +- return __get_cpuid(level, ®s[0], ®s[1], ®s[2], ®s[3]) && +- (regs[reg] & bit); ++ ++ unsigned int __ext = level & 0x80000000; ++ if (my_cpuid_max(__ext, 0) < level) ++ return false; ++ ++ _my_cpuid(level, regs[0], regs[1], regs[2], regs[3]); ++ return !!(unsigned(regs[reg]) & bit); + } + + #elif defined(_MSC_VER) && _MSC_VER >= 1400 && (defined(_M_IX86) || defined(_M_AMD64)) + + // MSVC 2005 or newer on x86-32 or x86-64 + #include + + enum CPUIDRegister { eax = 0, ebx = 1, ecx = 2, edx = 3 }; diff -r ccddc8555cdb -r 0287f70d86e9 series --- a/series Thu Jun 23 22:31:54 2011 +0200 +++ b/series Tue Jun 28 20:24:48 2011 +0200 @@ -9,7 +9,6 @@ #mozilla-gconf-backend.patch #gecko-lockdown.patch #toolkit-ui-lockdown.patch -#mozilla-cpuid.patch mozilla-cairo-lcd.patch mozilla-language.patch mozilla-gio.patch @@ -18,6 +17,7 @@ mozilla-ppc-ipc.patch mozilla-repo.patch mozilla-dump_syms-static.patch +mozilla-sle11.patch # Firefox patches firefox-linkorder.patch