cpuid: parse additional feature information for pCPU_PROCINFO_AND_FEATUREBITS
authorAhmed Samy <f.fallen45@gmail.com>
Thu, 7 Nov 2013 17:14:17 +0000 (19:14 +0200)
committerAhmed Samy <f.fallen45@gmail.com>
Thu, 7 Nov 2013 17:14:17 +0000 (19:14 +0200)
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
ccan/cpuid/cpuid.c
ccan/cpuid/cpuid.h
ccan/cpuid/test/run.c

index bc44fcf2f9d7c264071cbc3cf67cf2e31022670c..59f7336346cb420e1c162a8d94e0610b15307d08 100644 (file)
@@ -29,7 +29,6 @@
 #include "cpuid.h"
 
 #include <string.h>
-#include <stdio.h>
 
 enum {
        CPU_PROC_BRAND_STRING_INTERNAL0                 = 0x80000003,
@@ -318,7 +317,12 @@ void cpuid(cpuid_t info, uint32_t *buf)
 
                        buf[5] = edx;                   /* Feature flags #1.  */
                        buf[6] = ecx;                   /* Feature flags #2.  */
-                       buf[7] = ebx;                   /* Additional feature information.  */
+
+                       /* 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;
index bf6c5113fb589a1de54071be8a7fa5b21a2e5c1e..a581a0e397b6ffef201a44a6978cfe8c4febeb1f 100644 (file)
@@ -180,8 +180,10 @@ uint32_t cpuid_highest_ext_func_supported(void);
  *     buf[4]: Extended Family
  *     buf[5] and buf[6]:
  *             Feature flags
- *     buf[7]:
- *             Additional feature information.
+ *     buf[7]: Brand Index
+ *     buf[8]: CL Flush Line Size
+ *     buf[9]: Logical Processors
+ *     buf[10]: Initial APICID
  *
  * For CPU_L1_CACHE_AND_TLB_IDS:
  *     buf[0]: (eax):
index 83b90f37ebd346c6c08a3bf9f33efa7fef3771d7..39a7af95ed4073765e451cb87f94a35e35e6ce8c 100644 (file)
@@ -18,10 +18,12 @@ int main(void)
        cpuid(CPU_PROC_BRAND_STRING, (uint32_t *)buf);
        printf ("Processor Brand: %s\n", buf);
 
-       uint32_t procinfo[8];
+       uint32_t procinfo[11];
        cpuid(CPU_PROCINFO_AND_FEATUREBITS, procinfo);
        printf("Stepping: %d Model: 0x%X Family: %d extended model: %d extended family: %d\n",
                procinfo[0], procinfo[1], procinfo[2], procinfo[3], procinfo[4]);
+       printf("Brand Index: %d CL Flush Line Size: %d Logical Processors: %d Initial APICID: %d\n",
+               procinfo[7], procinfo[8], procinfo[9], procinfo[10]);
 
        printf ("Highest extended function supported: %#010x\n", cpuid_highest_ext_func_supported());