CPUID: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
m Correction to cpuid_string. It was returning value of uninitialized local variable. |
m Correction to inline asm; input constraint for EAX input was "0" instead of "a" |
||
Line 157: | Line 157: | ||
*/ |
*/ |
||
static inline void cpuid(int code, dword *a, dword *d) { |
static inline void cpuid(int code, dword *a, dword *d) { |
||
asm volatile("cpuid":"=a"(*a),"=d"(*d):" |
asm volatile("cpuid":"=a"(*a),"=d"(*d):"a"(code):"ecx","ebx"); |
||
} |
} |
||
Line 164: | Line 164: | ||
static inline int cpuid_string(int code, dword where[4]) { |
static inline int cpuid_string(int code, dword where[4]) { |
||
asm volatile("cpuid":"=a"(*where),"=b"(*(where+1)), |
asm volatile("cpuid":"=a"(*where),"=b"(*(where+1)), |
||
"=c"(*(where+2)),"=d"(*(where+3)):" |
"=c"(*(where+2)),"=d"(*(where+3)):"a"(code)); |
||
return (int)where[0]; |
return (int)where[0]; |
||
} |
} |