summaryrefslogtreecommitdiff
path: root/chromium/third_party/lzma_sdk/chromium.patch
blob: 1c5c880cc829cfb750e629aae46dcae402478efb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- /usr/local/google/home/waffles/Downloads/C/CpuArch.c	2015-03-25 05:17:41.000000000 -0700
+++ CpuArch.c	2016-02-19 12:42:20.327993932 -0800
@@ -45,7 +45,8 @@
     "push %%EDX\n\t"
     "popf\n\t"
     "andl %%EAX, %0\n\t":
-    "=c" (flag) : "c" (flag));
+    "=c" (flag) : "c" (flag):
+    "%eax", "%edx" );
   #endif
   return flag;
 }
@@ -78,8 +79,17 @@
 
   #else
 
+  // When built using GCC and -fPIC (until GCC 5.0), ebx points to the global
+  // offset table, so the value must be preserved before executing cpuid.
+  // Attempting to explicitly clobber ebx is a compile-time error.
   __asm__ __volatile__ (
-  #if defined(MY_CPU_X86) && defined(__PIC__)
+  #if defined(MY_CPU_AMD64) && defined(__PIC__)
+    "mov %%rbx, %%rdi\n"
+    "cpuid\n"
+    "xchg %%rdi, %%rbx\n"
+    : "=a" (*a) ,
+      "=D" (*b) ,
+  #elif defined(MY_CPU_X86) && defined(__PIC__)
     "mov %%ebx, %%edi;"
     "cpuid;"
     "xchgl %%ebx, %%edi;"