aboutsummaryrefslogtreecommitdiffstats
path: root/main/gdb/cpuid-pic.patch
blob: e250a95098e797d3c93f945958a21172f53d0ff8 (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
34
35
36
37
38
39
40
41
--- ./gdb/common/linux-btrace.c.orig	2013-04-29 07:44:49.320273451 +0000
+++ ./gdb/common/linux-btrace.c	2013-04-29 08:05:02.111631215 +0000
@@ -342,10 +342,12 @@
 #if defined __i386__ || defined __x86_64__
     unsigned int cpuid, model, family;
 
-    __asm__ __volatile__ ("movl   $1, %%eax;"
+    __asm__ __volatile__ ("movl   %%ebx, %%edi;"
+                          "movl   $1, %%eax;"
 			  "cpuid;"
+			  "movl   %%edi, %%ebx;"
 			  : "=a" (cpuid)
-			  :: "%ebx", "%ecx", "%edx");
+			  :: "%ecx", "%edx", "%edi");
 
     family = (cpuid >> 8) & 0xf;
     model = (cpuid >> 4) & 0xf;
@@ -392,7 +394,8 @@
 #if defined __i386__ || defined __x86_64__
   char vendor[13];
 
-  __asm__ __volatile__ ("xorl   %%ebx, %%ebx;"
+  __asm__ __volatile__ ("movl   %%ebx, %%edi;"
+                        "xorl   %%ebx, %%ebx;"
 			"xorl   %%ecx, %%ecx;"
 			"xorl   %%edx, %%edx;"
 			"movl   $0,    %%eax;"
@@ -400,11 +403,12 @@
 			"movl   %%ebx,  %0;"
 			"movl   %%edx,  %1;"
 			"movl   %%ecx,  %2;"
+			"movl   %%edi,  %%ebx;"
 			: "=m" (vendor[0]),
 			  "=m" (vendor[4]),
 			  "=m" (vendor[8])
 			:
-			: "%eax", "%ebx", "%ecx", "%edx");
+			: "%eax", "%ecx", "%edx", "%edi");
   vendor[12] = '\0';
 
   if (strcmp (vendor, "GenuineIntel") == 0)