Title: [208806] trunk/Source/WTF
Revision
208806
Author
clo...@igalia.com
Date
2016-11-16 13:00:56 -0800 (Wed, 16 Nov 2016)

Log Message

[JSC] Build broken for 32-bit x86 after r208306 with GCC 4.9
https://bugs.webkit.org/show_bug.cgi?id=164588

Reviewed by Mark Lam.

Provide assembly for executing the cpuid instruction when compiling
in PIC mode with the GCC 4.9 EBX on 32-bit x86.

Note that the values returned by cpuid here are not used. The purpose
of calling this instruction is to force the CPU to complete and sync
any buffered modifications on registers, memory or flags before
fetching and executing the next instruction.

* wtf/Atomics.h:
(WTF::x86_cpuid):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (208805 => 208806)


--- trunk/Source/WTF/ChangeLog	2016-11-16 20:58:33 UTC (rev 208805)
+++ trunk/Source/WTF/ChangeLog	2016-11-16 21:00:56 UTC (rev 208806)
@@ -1,3 +1,21 @@
+2016-11-16  Carlos Alberto Lopez Perez  <clo...@igalia.com>
+
+        [JSC] Build broken for 32-bit x86 after r208306 with GCC 4.9
+        https://bugs.webkit.org/show_bug.cgi?id=164588
+
+        Reviewed by Mark Lam.
+
+        Provide assembly for executing the cpuid instruction when compiling
+        in PIC mode with the GCC 4.9 EBX on 32-bit x86.
+
+        Note that the values returned by cpuid here are not used. The purpose
+        of calling this instruction is to force the CPU to complete and sync
+        any buffered modifications on registers, memory or flags before
+        fetching and executing the next instruction.
+
+        * wtf/Atomics.h:
+        (WTF::x86_cpuid):
+
 2016-11-15  Filip Pizlo  <fpi...@apple.com>
 
         Rename CONCURRENT_JIT/ConcurrentJIT to CONCURRENT_JS/ConcurrentJS

Modified: trunk/Source/WTF/wtf/Atomics.h (208805 => 208806)


--- trunk/Source/WTF/wtf/Atomics.h	2016-11-16 20:58:33 UTC (rev 208805)
+++ trunk/Source/WTF/wtf/Atomics.h	2016-11-16 21:00:56 UTC (rev 208806)
@@ -266,6 +266,18 @@
 #if OS(WINDOWS)
     int info[4];
     __cpuid(info, 0);
+#elif CPU(X86)
+    // GCC 4.9 on x86 in PIC mode can't use %ebx, so we have to save and restore it manually.
+    // But since we don't care about what cpuid returns (we use it as a serializing instruction),
+    // we can simply throw away what cpuid put in %ebx.
+    intptr_t a = 0, c, d;
+    asm volatile(
+        "pushl %%ebx\n\t"
+        "cpuid\n\t"
+        "popl %%ebx\n\t"
+        : "+a"(a), "=c"(c), "=d"(d)
+        :
+        : "memory");
 #else
     intptr_t a = 0, b, c, d;
     asm volatile(
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to