32 extern "C" void __cpuid(
void *eax,
void *ebx,
void *ecx,
void *edx)
noexcept;
43 template<
class T1,
class T2,
class T3,
class T4,
44 class =
typename std::enable_if<std::is_integral<T1>::value>
::type,
45 class = typename
std::enable_if<std::is_integral<T2>::value>::type,
46 class = typename std::enable_if<std::is_integral<T3>::value>::type,
47 class = typename std::enable_if<std::is_integral<T4>::value>::type>
50 __cpuid(&eax, &ebx, &ecx, &edx);
51 return std::make_tuple(eax, ebx, ecx, edx);
56 template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
62 template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
68 template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
74 template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
80 constexpr
const auto addr = 0x80000008U;
81 constexpr
const auto name =
"addr_size";
85 constexpr
const auto mask = 0x000000FFU;
86 constexpr
const auto from = 0;
87 constexpr
const auto name =
"phys";
95 constexpr
const auto mask = 0x0000FF00U;
96 constexpr
const auto from = 8;
97 constexpr
const auto name =
"linear";
104 namespace feature_information
106 constexpr
const auto addr = 0x00000001U;
107 constexpr
const auto name =
"feature_information";
113 constexpr
const auto mask = 0x00000001U;
115 constexpr
const auto name =
"sse3";
123 constexpr
const auto mask = 0x00000002U;
125 constexpr
const auto name =
"pclmulqdq";
133 constexpr
const auto mask = 0x00000004U;
135 constexpr
const auto name =
"dtes64";
143 constexpr
const auto mask = 0x00000008U;
145 constexpr
const auto name =
"monitor";
153 constexpr
const auto mask = 0x00000010U;
155 constexpr
const auto name =
"ds_cpl";
163 constexpr
const auto mask = 0x00000020U;
165 constexpr
const auto name =
"vmx";
173 constexpr
const auto mask = 0x00000040U;
175 constexpr
const auto name =
"smx";
183 constexpr
const auto mask = 0x00000080U;
185 constexpr
const auto name =
"eist";
193 constexpr
const auto mask = 0x00000100U;
195 constexpr
const auto name =
"tm2";
203 constexpr
const auto mask = 0x00000200U;
205 constexpr
const auto name =
"ssse3";
213 constexpr
const auto mask = 0x00000400U;
214 constexpr
const auto from = 10;
215 constexpr
const auto name =
"cnxt_id";
223 constexpr
const auto mask = 0x00000800U;
224 constexpr
const auto from = 11;
225 constexpr
const auto name =
"sdbg";
233 constexpr
const auto mask = 0x00001000U;
234 constexpr
const auto from = 12;
235 constexpr
const auto name =
"fma";
243 constexpr
const auto mask = 0x00002000U;
244 constexpr
const auto from = 13;
245 constexpr
const auto name =
"cmpxchg16b";
251 namespace xtpr_update_control
253 constexpr
const auto mask = 0x00004000U;
254 constexpr
const auto from = 14;
255 constexpr
const auto name =
"xtpr_update_control";
263 constexpr
const auto mask = 0x00008000U;
264 constexpr
const auto from = 15;
265 constexpr
const auto name =
"pdcm";
273 constexpr
const auto mask = 0x00020000U;
274 constexpr
const auto from = 17;
275 constexpr
const auto name =
"pcid";
283 constexpr
const auto mask = 0x00040000U;
284 constexpr
const auto from = 18;
285 constexpr
const auto name =
"dca";
293 constexpr
const auto mask = 0x00080000U;
294 constexpr
const auto from = 19;
295 constexpr
const auto name =
"sse41";
303 constexpr
const auto mask = 0x00100000U;
304 constexpr
const auto from = 20;
305 constexpr
const auto name =
"sse42";
313 constexpr
const auto mask = 0x00200000U;
314 constexpr
const auto from = 21;
315 constexpr
const auto name =
"x2apic";
323 constexpr
const auto mask = 0x00400000U;
324 constexpr
const auto from = 22;
325 constexpr
const auto name =
"movbe";
333 constexpr
const auto mask = 0x00800000U;
334 constexpr
const auto from = 23;
335 constexpr
const auto name =
"popcnt";
341 namespace tsc_deadline
343 constexpr
const auto mask = 0x01000000U;
344 constexpr
const auto from = 24;
345 constexpr
const auto name =
"tsc_deadline";
353 constexpr
const auto mask = 0x02000000U;
354 constexpr
const auto from = 25;
355 constexpr
const auto name =
"aesni";
363 constexpr
const auto mask = 0x04000000U;
364 constexpr
const auto from = 26;
365 constexpr
const auto name =
"xsave";
373 constexpr
const auto mask = 0x08000000U;
374 constexpr
const auto from = 27;
375 constexpr
const auto name =
"osxsave";
383 constexpr
const auto mask = 0x10000000U;
384 constexpr
const auto from = 28;
385 constexpr
const auto name =
"avx";
393 constexpr
const auto mask = 0x20000000U;
394 constexpr
const auto from = 29;
395 constexpr
const auto name =
"f16c";
403 constexpr
const auto mask = 0x40000000U;
404 constexpr
const auto from = 30;
405 constexpr
const auto name =
"rdrand";
413 bfdebug <<
"cpuid::feature_information::ecx enabled flags:" << bfendl;
416 bfdebug <<
" - sse3" << bfendl;
419 bfdebug <<
" - pclmulqdq" << bfendl;
422 bfdebug <<
" - dtes64" << bfendl;
425 bfdebug <<
" - monitor" << bfendl;
428 bfdebug <<
" - ds_cpl" << bfendl;
431 bfdebug <<
" - vmx" << bfendl;
434 bfdebug <<
" - smx" << bfendl;
437 bfdebug <<
" - eist" << bfendl;
440 bfdebug <<
" - tm2" << bfendl;
443 bfdebug <<
" - ssse3" << bfendl;
446 bfdebug <<
" - cnxt_id" << bfendl;
449 bfdebug <<
" - sdbg" << bfendl;
452 bfdebug <<
" - fma" << bfendl;
455 bfdebug <<
" - cmpxchg16b" << bfendl;
458 bfdebug <<
" - xtpr_update_control" << bfendl;
461 bfdebug <<
" - pdcm" << bfendl;
464 bfdebug <<
" - pcid" << bfendl;
467 bfdebug <<
" - dca" << bfendl;
470 bfdebug <<
" - sse41" << bfendl;
473 bfdebug <<
" - sse42" << bfendl;
476 bfdebug <<
" - x2apic" << bfendl;
479 bfdebug <<
" - movbe" << bfendl;
482 bfdebug <<
" - popcnt" << bfendl;
485 bfdebug <<
" - tsc_deadline" << bfendl;
488 bfdebug <<
" - aesni" << bfendl;
491 bfdebug <<
" - xsave" << bfendl;
494 bfdebug <<
" - osxsave" << bfendl;
497 bfdebug <<
" - avx" << bfendl;
500 bfdebug <<
" - f16c" << bfendl;
503 bfdebug <<
" - rdrand" << bfendl;
508 namespace extended_feature_flags
510 constexpr
const auto addr = 0x00000007UL;
511 constexpr
const auto name =
"extended_feature_flags";
519 constexpr
const auto mask = 0x00000001UL;
521 constexpr
const auto name =
"fsgsbase";
530 __cpuid(&eax, &ebx, &ecx, &edx);
532 return (ebx & mask) != 0;
536 namespace ia32_tsc_adjust
538 constexpr
const auto mask = 0x00000002UL;
540 constexpr
const auto name =
"ia32_tsc_adjust";
549 __cpuid(&eax, &ebx, &ecx, &edx);
551 return (ebx & mask) != 0;
557 constexpr
const auto mask = 0x00000004UL;
559 constexpr
const auto name =
"sgx";
568 __cpuid(&eax, &ebx, &ecx, &edx);
570 return (ebx & mask) != 0;
576 constexpr
const auto mask = 0x00000008UL;
578 constexpr
const auto name =
"bmi1";
587 __cpuid(&eax, &ebx, &ecx, &edx);
589 return (ebx & mask) != 0;
595 constexpr
const auto mask = 0x00000010UL;
597 constexpr
const auto name =
"hle";
606 __cpuid(&eax, &ebx, &ecx, &edx);
608 return (ebx & mask) != 0;
614 constexpr
const auto mask = 0x00000020UL;
616 constexpr
const auto name =
"avx2";
625 __cpuid(&eax, &ebx, &ecx, &edx);
627 return (ebx & mask) != 0;
631 namespace fdp_excptn_only
633 constexpr
const auto mask = 0x00000040UL;
635 constexpr
const auto name =
"fdp_excptn_only";
644 __cpuid(&eax, &ebx, &ecx, &edx);
646 return (ebx & mask) != 0;
652 constexpr
const auto mask = 0x00000080UL;
654 constexpr
const auto name =
"smep";
663 __cpuid(&eax, &ebx, &ecx, &edx);
665 return (ebx & mask) != 0;
671 constexpr
const auto mask = 0x00000100UL;
673 constexpr
const auto name =
"bmi2";
682 __cpuid(&eax, &ebx, &ecx, &edx);
684 return (ebx & mask) != 0;
688 namespace enhanced_rep
690 constexpr
const auto mask = 0x00000200UL;
692 constexpr
const auto name =
"enhanced_rep";
701 __cpuid(&eax, &ebx, &ecx, &edx);
703 return (ebx & mask) != 0;
709 constexpr
const auto mask = 0x00000400UL;
710 constexpr
const auto from = 10;
711 constexpr
const auto name =
"invpcid";
720 __cpuid(&eax, &ebx, &ecx, &edx);
722 return (ebx & mask) != 0;
728 constexpr
const auto mask = 0x00000800UL;
729 constexpr
const auto from = 11;
730 constexpr
const auto name =
"rtm";
739 __cpuid(&eax, &ebx, &ecx, &edx);
741 return (ebx & mask) != 0;
747 constexpr
const auto mask = 0x00001000UL;
748 constexpr
const auto from = 12;
749 constexpr
const auto name =
"rdt_m";
758 __cpuid(&eax, &ebx, &ecx, &edx);
760 return (ebx & mask) != 0;
764 namespace depreciated_fpu_cs_ds
766 constexpr
const auto mask = 0x00002000UL;
767 constexpr
const auto from = 13;
768 constexpr
const auto name =
"depreciated_fpu_cs_ds";
777 __cpuid(&eax, &ebx, &ecx, &edx);
779 return (ebx & mask) != 0;
785 constexpr
const auto mask = 0x00004000UL;
786 constexpr
const auto from = 14;
787 constexpr
const auto name =
"mpx";
796 __cpuid(&eax, &ebx, &ecx, &edx);
798 return (ebx & mask) != 0;
804 constexpr
const auto mask = 0x00008000UL;
805 constexpr
const auto from = 15;
806 constexpr
const auto name =
"rdt_a";
815 __cpuid(&eax, &ebx, &ecx, &edx);
817 return (ebx & mask) != 0;
823 constexpr
const auto mask = 0x00040000UL;
824 constexpr
const auto from = 18;
825 constexpr
const auto name =
"rdseed";
834 __cpuid(&eax, &ebx, &ecx, &edx);
836 return (ebx & mask) != 0;
842 constexpr
const auto mask = 0x00080000UL;
843 constexpr
const auto from = 19;
844 constexpr
const auto name =
"adx";
853 __cpuid(&eax, &ebx, &ecx, &edx);
855 return (ebx & mask) != 0;
861 constexpr
const auto mask = 0x00100000UL;
862 constexpr
const auto from = 20;
863 constexpr
const auto name =
"smap";
872 __cpuid(&eax, &ebx, &ecx, &edx);
874 return (ebx & mask) != 0;
880 constexpr
const auto mask = 0x00800000UL;
881 constexpr
const auto from = 23;
882 constexpr
const auto name =
"clflushopt";
891 __cpuid(&eax, &ebx, &ecx, &edx);
893 return (ebx & mask) != 0;
899 constexpr
const auto mask = 0x01000000UL;
900 constexpr
const auto from = 24;
901 constexpr
const auto name =
"clwb";
910 __cpuid(&eax, &ebx, &ecx, &edx);
912 return (ebx & mask) != 0;
916 namespace processor_trace
918 constexpr
const auto mask = 0x02000000UL;
919 constexpr
const auto from = 25;
920 constexpr
const auto name =
"processor_trace";
929 __cpuid(&eax, &ebx, &ecx, &edx);
931 return (ebx & mask) != 0;
937 constexpr
const auto mask = 0x20000000UL;
938 constexpr
const auto from = 29;
939 constexpr
const auto name =
"sha";
948 __cpuid(&eax, &ebx, &ecx, &edx);
950 return (ebx & mask) != 0;
956 bfdebug <<
"cpuid::extended_feature_flags::subleaf0::ebx enabled flags:" << bfendl;
959 bfdebug <<
" - fsgsbase" << bfendl;
962 bfdebug <<
" - ia32_tsc_adjust" << bfendl;
965 bfdebug <<
" - sgx" << bfendl;
968 bfdebug <<
" - bmi1" << bfendl;
971 bfdebug <<
" - hle" << bfendl;
974 bfdebug <<
" - avx2" << bfendl;
977 bfdebug <<
" - fdp_excptn_only" << bfendl;
980 bfdebug <<
" - smep" << bfendl;
983 bfdebug <<
" - bmi2" << bfendl;
986 bfdebug <<
" - enhanced_rep" << bfendl;
989 bfdebug <<
" - invpcid" << bfendl;
992 bfdebug <<
" - rtm" << bfendl;
995 bfdebug <<
" - rtm" << bfendl;
998 bfdebug <<
" - rdt_m" << bfendl;
1001 bfdebug <<
" - depreciated_fpu_cs_ds" << bfendl;
1004 bfdebug <<
" - mpx" << bfendl;
1007 bfdebug <<
" - rdt_a" << bfendl;
1010 bfdebug <<
" - rdseed" << bfendl;
1013 bfdebug <<
" - adx" << bfendl;
1016 bfdebug <<
" - smap" << bfendl;
1019 bfdebug <<
" - clflushopt" << bfendl;
1022 bfdebug <<
" - clwb" << bfendl;
1025 bfdebug <<
" - processor_trace" << bfendl;
1028 bfdebug <<
" - sha" << bfendl;
1034 namespace arch_perf_monitoring
1036 constexpr
const auto addr = 0x0000000AUL;
1037 constexpr
const auto name =
"arch_perf_monitoring";
1041 namespace version_id
1043 constexpr
const auto mask = 0x000000FFUL;
1045 constexpr
const auto name =
"version_id";
1051 namespace gppmc_count
1053 constexpr
const auto mask = 0x0000FF00UL;
1055 constexpr
const auto name =
"gppmc_count";
1061 namespace gppmc_bit_width
1063 constexpr
const auto mask = 0x00FF0000UL;
1065 constexpr
const auto name =
"gppmc_bit_width";
1071 namespace ebx_enumeration_length
1073 constexpr
const auto mask = 0xFF000000UL;
1075 constexpr
const auto name =
"ebx_enumeration_length";
1084 namespace core_cycle_event
1086 constexpr
const auto mask = 0x00000001UL;
1088 constexpr
const auto name =
"core_cycle_event";
1094 namespace instr_retired_event
1096 constexpr
const auto mask = 0x00000002UL;
1098 constexpr
const auto name =
"instr_retired_event";
1104 namespace reference_cycles_event
1106 constexpr
const auto mask = 0x00000004UL;
1108 constexpr
const auto name =
"reference_cycles_event";
1114 namespace llc_reference_event
1116 constexpr
const auto mask = 0x00000008UL;
1118 constexpr
const auto name =
"llc_reference_event";
1124 namespace llc_misses_event
1126 constexpr
const auto mask = 0x00000010UL;
1128 constexpr
const auto name =
"llc_misses_event";
1134 namespace branch_instr_retired_event
1136 constexpr
const auto mask = 0x00000020UL;
1138 constexpr
const auto name =
"branch_instr_retired_event";
1144 namespace branch_mispredict_retired_event
1146 constexpr
const auto mask = 0x00000040UL;
1148 constexpr
const auto name =
"branch_mispredict_retired_event";
1157 namespace ffpmc_count
1159 constexpr
const auto mask = 0x0000001FUL;
1161 constexpr
const auto name =
"ffpmc_count";
1167 namespace ffpmc_bit_width
1169 constexpr
const auto mask = 0x00001FE0UL;
1171 constexpr
const auto name =
"ffpmc_bit_width";
constexpr const auto mask
constexpr const auto from
constexpr const auto mask
constexpr const auto from
constexpr const auto mask
constexpr const auto from
auto is_available() noexcept
constexpr const auto mask
constexpr const auto mask
constexpr const auto from
constexpr const auto from
constexpr const auto from
constexpr const auto from
constexpr const auto from
constexpr const auto from
constexpr const auto mask
constexpr const auto mask
constexpr const auto from
constexpr const auto from
auto is_available() noexcept
constexpr const auto mask
constexpr const auto from
constexpr const auto from
constexpr const auto from
constexpr const auto from
uint32_t __cpuid_ecx(uint32_t val) noexcept
constexpr const auto addr
constexpr const auto from
constexpr const auto mask
constexpr const auto addr
constexpr const auto mask
constexpr const auto mask
constexpr const auto mask
constexpr const auto mask
constexpr const auto from
constexpr const auto invpcid
constexpr const auto from
constexpr const auto mask
constexpr const auto name
void __cpuid(void *eax, void *ebx, void *ecx, void *edx) noexcept
constexpr const auto mask
constexpr const auto from
uint32_t __cpuid_eax(uint32_t val) noexcept
auto get_bit(T t, B b) noexcept
constexpr const auto from
constexpr const auto mask
constexpr const auto mask
void uint64_t uint64_t uint64_t *rdx noexcept
uint32_t __cpuid_edx(uint32_t val) noexcept
constexpr const auto from
auto is_available() noexcept
constexpr const auto addr
constexpr const auto monitor
constexpr const auto mask
constexpr const auto from
constexpr const auto mask
constexpr const auto mask
constexpr const auto mask
constexpr const auto rdrand
uint32_t __cpuid_ebx(uint32_t val) noexcept
constexpr const auto from
constexpr const auto from
constexpr const auto from
constexpr const auto mask
constexpr const auto mask
auto get(T1 eax, T2 ebx, T3 ecx, T4 edx) noexcept
constexpr const auto from
constexpr const auto from
constexpr const auto from
constexpr const auto mask
constexpr const auto mask
constexpr const auto from
auto get_bits(T t, M m) noexcept
constexpr const auto rdseed
constexpr const auto from
constexpr const auto mask
constexpr const auto name
constexpr const auto mask
constexpr const auto from
constexpr const auto name
constexpr const auto mask
constexpr const auto mask
constexpr const auto mask
constexpr const auto from
auto is_available() noexcept
constexpr const auto mask
constexpr const auto from
constexpr const auto from
constexpr const auto mask
constexpr const auto from
constexpr const auto from
constexpr const auto mask
constexpr const auto mask
auto is_available() noexcept
constexpr const auto mask
constexpr const auto from
constexpr const auto mask
auto is_available() noexcept
auto is_available() noexcept
constexpr const auto mask
constexpr const auto from
constexpr const auto mask