Commit 3bbbeb8e authored by peastman's avatar peastman
Browse files

cpuid() works correctly on both 32 and 64 bit OSes

parent a8ff237c
......@@ -95,6 +95,16 @@ static int getNumProcessors() {
#define cpuid __cpuid
#else
static void cpuid(int cpuInfo[4], int infoType){
#ifdef __LP64__
__asm__ __volatile__ (
"cpuid":
"=a" (cpuInfo[0]),
"=b" (cpuInfo[1]),
"=c" (cpuInfo[2]),
"=d" (cpuInfo[3]) :
"a" (infoType)
);
#else
__asm__ __volatile__ (
"pushl %%ebx\n"
"cpuid\n"
......@@ -106,6 +116,7 @@ static void cpuid(int cpuInfo[4], int infoType){
"=d" (cpuInfo[3]) :
"a" (infoType)
);
#endif
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment