summaryrefslogtreecommitdiff
path: root/devel/papi/files/patch-x86_cpuid_info.c
blob: 886f11346835ae76d785f15765e5e38ba7a625ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- x86_cpuid_info.c.orig	2015-12-03 22:41:35 UTC
+++ x86_cpuid_info.c
@@ -1274,11 +1274,14 @@ cpuid2 ( unsigned int* eax, unsigned int
                     unsigned int* ecx, unsigned int* edx, 
                     unsigned int index, unsigned int ecx_in )
 {
-  unsigned int a,b,c,d;
-  __asm__ __volatile__ (".byte 0x53\n\tcpuid\n\tmovl %%ebx, %%esi\n\t.byte 0x5b"
-		: "=a" (a), "=S" (b), "=c" (c), "=d" (d) \
-		: "0" (index), "2"(ecx_in) );
-  *eax = a; *ebx = b; *ecx = c; *edx = d;
+  __asm__ __volatile__ (
+		"mov	%%ebx, %%esi;"
+		"cpuid;"
+		"mov	%%ebx, %3;"
+		"mov	%%esi, %%ebx;"
+		: "=a" (*eax), "=c" (*ecx), "=d" (*edx)
+		: "m" (*ebx), "0" (index), "1" (ecx_in), "2" (42)
+		: "esi", "memory" );
 }
 #endif