X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fcpuid%2Fcpuid.c;h=df9b4aafc530268f96280e9bf52260c7477765dc;hb=715de3cf272d057e176d032986db45d2270494fc;hp=57883e2bd0982b17fccdeaf34fd5da945c1134ea;hpb=96a1ebd3354ef6250e94b509b4e0c0f1ea7e67bb;p=ccan diff --git a/ccan/cpuid/cpuid.c b/ccan/cpuid/cpuid.c index 57883e2b..df9b4aaf 100644 --- a/ccan/cpuid/cpuid.c +++ b/ccan/cpuid/cpuid.c @@ -160,8 +160,8 @@ bool cpuid_is_supported(void) pushfd pop eax xor eax, ecx - shr eax, 0x21 - and eax, 0x1 + shr eax, 21 + and eax, 1 push ecx popfd @@ -309,10 +309,20 @@ void cpuid(cpuid_t info, uint32_t *buf) buf[2] = ecx; break; case CPU_PROCINFO_AND_FEATUREBITS: - buf[0] = eax; /* The so called "signature" of the CPU. */ - buf[1] = edx; /* Feature flags #1. */ - buf[2] = ecx; /* Feature flags #2. */ - buf[3] = ebx; /* Additional feature information. */ + buf[0] = (eax & 0x0F); /* Stepping */ + buf[1] = (eax >> 4) & 0x0F; /* Model */ + buf[2] = (eax >> 8) & 0x0F; /* Family */ + buf[3] = (eax >> 16) & 0x0F; /* Extended Model. */ + buf[4] = (eax >> 24) & 0x0F; /* Extended Family. */ + + buf[5] = edx; /* Feature flags #1. */ + buf[6] = ecx; /* Feature flags #2. */ + + /* Additional Feature information. */ + buf[7] = ebx & 0xFF; + buf[8] = (ebx >> 8) & 0xFF; + buf[9] = (ebx >> 16) & 0xFF; + buf[10] = (ebx >> 24) & 0xFF; break; case CPU_CACHE_AND_TLBD_INFO: buf[0] = eax;