You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/sys-apps/x86info/files/x86info-1.30-pic.patch

32 lines
512 B

--- a/cpuid.c
+++ b/cpuid.c
@@ -25,12 +25,28 @@
bind_cpu(cpunr);
+#ifdef __PIC__
+ /* GCC on i386 bitches if you clobber ebx. So hide it behind
+ * gcc's back. */
+ asm(
+ "movl %%ebx,%%edi\n"
+ "cpuid\n"
+ "movl %%ebx,%1\n"
+ "movl %%edi,%%ebx\n"
+ : "=a" (a),
+ "=m" (b),
+ "+c" (c),
+ "=d" (d)
+ : "0" ((unsigned int)idx)
+ : "edi");
+#else
asm("cpuid"
: "=a" (a),
"=b" (b),
"+c" (c),
"=d" (d)
: "0" ((unsigned int)idx));
+#endif
if (eax!=NULL)
*eax = a;