19 #define foreach_x86_cpu_uarch \ 20 _(0x06, 0x9e, "Kaby Lake", "Kaby Lake DT/H/S/X") \ 21 _(0x06, 0x8e, "Kaby Lake", "Kaby Lake Y/U") \ 22 _(0x06, 0x85, "Knights Mill", "Knights Mill") \ 23 _(0x06, 0x5f, "Goldmont", "Denverton") \ 24 _(0x06, 0x5e, "Skylake", "Skylake DT/H/S") \ 25 _(0x06, 0x5c, "Goldmont", "Apollo Lake") \ 26 _(0x06, 0x5a, "Silvermont", "Moorefield") \ 27 _(0x06, 0x57, "Knights Landing", "Knights Landing") \ 28 _(0x06, 0x56, "Broadwell", "Broadwell DE") \ 29 _(0x06, 0x55, "Skylake", "Skylake X/SP") \ 30 _(0x06, 0x4f, "Broadwell", "Broadwell EP/EX") \ 31 _(0x06, 0x4e, "Skylake", "Skylake Y/U") \ 32 _(0x06, 0x4d, "Silvermont", "Rangeley") \ 33 _(0x06, 0x4c, "Airmont", "Braswell") \ 34 _(0x06, 0x47, "Broadwell", "Broadwell H") \ 35 _(0x06, 0x46, "Haswell", "Crystalwell") \ 36 _(0x06, 0x45, "Haswell", "Haswell ULT") \ 37 _(0x06, 0x3f, "Haswell", "Haswell E") \ 38 _(0x06, 0x3e, "Ivy Bridge", "Ivy Bridge E/EN/EP") \ 39 _(0x06, 0x3d, "Broadwell", "Broadwell U") \ 40 _(0x06, 0x3c, "Haswell", "Haswell") \ 41 _(0x06, 0x3a, "Ivy Bridge", "IvyBridge") \ 42 _(0x06, 0x37, "Silvermont", "BayTrail") \ 43 _(0x06, 0x36, "Saltwell", "Cedarview,Centerton") \ 44 _(0x06, 0x35, "Saltwell", "Cloverview") \ 45 _(0x06, 0x2f, "Westmere", "Westmere EX") \ 46 _(0x06, 0x2e, "Nehalem", "Nehalem EX") \ 47 _(0x06, 0x2d, "Sandy Bridge", "SandyBridge E/EN/EP") \ 48 _(0x06, 0x2c, "Westmere", "Westmere EP/EX,Gulftown") \ 49 _(0x06, 0x2a, "Sandy Bridge", "Sandy Bridge") \ 50 _(0x06, 0x27, "Saltwell", "Medfield") \ 51 _(0x06, 0x26, "Bonnell", "Tunnel Creek") \ 52 _(0x06, 0x25, "Westmere", "Arrandale,Clarksdale") \ 53 _(0x06, 0x1e, "Nehalem", "Clarksfield,Lynnfield,Jasper Forest") \ 54 _(0x06, 0x1d, "Penryn", "Dunnington") \ 55 _(0x06, 0x1c, "Bonnell", "Pineview,Silverthorne") \ 56 _(0x06, 0x1a, "Nehalem", "Nehalem EP,Bloomfield)") \ 57 _(0x06, 0x17, "Penryn", "Yorkfield,Wolfdale,Penryn,Harpertown") 63 u32 __attribute__ ((unused)) eax, ebx, ecx, edx;
66 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0)
67 return format (s,
"unknown (missing cpuid)");
69 model = ((eax >> 4) & 0x0f) | ((eax >> 12) & 0xf0);
70 family = (eax >> 8) & 0x0f;
72 #define _(f,m,a,c) if ((model == m) && (family == f)) return format(s, "%s (%s)", a, c); 75 return format (s,
"unknown (family 0x%02x model 0x%02x)", family, model);
78 return format (s,
"unknown");
86 u32 __attribute__ ((unused)) eax, ebx, ecx, edx;
90 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0)
91 return format (s,
"unknown (missing cpuid)");
93 __get_cpuid (0x80000000, &eax, &ebx, &ecx, &edx);
95 return format (s,
"unknown (missing ext feature)");
98 name_u32 = (
u32 *) name;
100 __get_cpuid (0x80000002, &eax, &ebx, &ecx, &edx);
106 __get_cpuid (0x80000003, &eax, &ebx, &ecx, &edx);
112 __get_cpuid (0x80000004, &eax, &ebx, &ecx, &edx);
118 s =
format (s,
"%s", name);
122 #elif defined(__aarch64__) 123 return format (s,
"armv8");
125 return format (s,
"unknown");
130 static inline char const *
133 if (memcmp (flag,
"x86_",
sizeof (
"x86_") - 1) == 0)
134 return flag +
sizeof (
"x86_") - 1;
135 if (memcmp (flag,
"aarch64_",
sizeof (
"aarch64_") - 1) == 0)
136 return flag +
sizeof (
"aarch64_") - 1;
143 #if defined(__x86_64__) 144 #define _(flag, func, reg, bit) \ 145 if (clib_cpu_supports_ ## flag()) \ 146 s = format (s, "%s ", flag_skip_prefix(#flag)); 149 #elif defined(__aarch64__) 150 #define _(flag, bit) \ 151 if (clib_cpu_supports_ ## flag()) \ 152 s = format (s, "%s ", flag_skip_prefix(#flag)); 156 return format (s,
"unknown");
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static char const * flag_skip_prefix(char const *flag)
u8 * format_cpu_uarch(u8 *s, va_list *args)
#define foreach_aarch64_flags
u8 * format_cpu_model_name(u8 *s, va_list *args)
#define vec_free(V)
Free vector's memory (no header).
u8 * format_cpu_flags(u8 *s, va_list *args)
#define foreach_x86_64_flags
#define foreach_x86_cpu_uarch