summaryrefslogtreecommitdiff
path: root/kernels/xen/24344.patch
blob: 642b90867ae6ea39c48bb67d44588e465e7dd4c7 (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
32
33
--- a/tools/libxc/xc_cpuid_x86.c	      2011-10-20 15:05:42.000000000 -0200
+++ b/tools/libxc/xc_cpuid_x86.c	      2012-02-15 00:01:46.307514813 -0200
@@ -42,23 +42,23 @@
 static void cpuid(const unsigned int *input, unsigned int *regs)
 {
     unsigned int count = (input[1] == XEN_CPUID_INPUT_UNUSED) ? 0 : input[1];
-    asm (
 #ifdef __i386__
+/* Use the stack to avoid reg constraint failures with some gcc flags */
+    asm (
         "push %%ebx; push %%edx\n\t"
-#else
-        "push %%rbx; push %%rdx\n\t"
-#endif
         "cpuid\n\t"
         "mov %%ebx,4(%4)\n\t"
         "mov %%edx,12(%4)\n\t"
-#ifdef __i386__
         "pop %%edx; pop %%ebx\n\t"
+       : "=a" (regs[0]), "=c" (regs[2])
+       : "0" (input[0]), "1" (count), "S" (regs)
+       : "memory" );
 #else
-        "pop %%rdx; pop %%rbx\n\t"
+    asm (
+       "cpuid"
+       : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
+       : "0" (input[0]), "2" (count) );
 #endif
-        : "=a" (regs[0]), "=c" (regs[2])
-        : "0" (input[0]), "1" (count), "S" (regs)
-        : "memory" );
 }