|
Lines 44-53
Link Here
|
| 44 |
unsigned int *ecx, |
44 |
unsigned int *ecx, |
| 45 |
unsigned int *edx) |
45 |
unsigned int *edx) |
| 46 |
{ |
46 |
{ |
| 47 |
/* call the cpuid instruction with the registers as input and output */ |
47 |
/* call the cpuid instruction with the registers as input and output |
| 48 |
__asm__("cpuid" |
48 |
* modification by Dwokfur based on Sam Hocevar's discussion on |
|
|
49 |
* how to make Assemly code PIC compatible: |
| 50 |
* http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well |
| 51 |
*/ |
| 52 |
__asm__("pushl %%ebx \n\t" /* save %ebx */ |
| 53 |
"cpuid \n\t" |
| 54 |
"movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */ |
| 55 |
"popl %%ebx \n\t" /* restore the old %ebx */ |
| 49 |
: "=a" (*eax), |
56 |
: "=a" (*eax), |
| 50 |
"=b" (*ebx), |
57 |
"=r" (*ebx), |
| 51 |
"=c" (*ecx), |
58 |
"=c" (*ecx), |
| 52 |
"=d" (*edx) |
59 |
"=d" (*edx) |
| 53 |
: "0" (*eax), |
60 |
: "0" (*eax), |