x86info-1.24-pic.patch 573 B

12345678910111213141516171819202122232425262728293031323334
  1. http://bugs.gentoo.org/270388
  2. --- cpuid.c
  3. +++ cpuid.c
  4. @@ -62,12 +62,28 @@
  5. sched_setaffinity(getpid(), sizeof(set), &set);
  6. }
  7. +#ifdef __PIC__
  8. + /* GCC on i386 bitches if you clobber ebx. So hide it behind
  9. + * gcc's back. */
  10. + asm(
  11. + "movl %%ebx,%%edi\n"
  12. + "cpuid\n"
  13. + "movl %%ebx,%1\n"
  14. + "movl %%edi,%%ebx\n"
  15. + : "=a" (a),
  16. + "=m" (b),
  17. + "+c" (c),
  18. + "=d" (d)
  19. + : "0" ((unsigned int)idx)
  20. + : "edi");
  21. +#else
  22. asm("cpuid"
  23. : "=a" (a),
  24. "=b" (b),
  25. "+c" (c),
  26. "=d" (d)
  27. : "0" ((unsigned int)idx));
  28. +#endif
  29. if (eax!=NULL)
  30. *eax = a;