StuBS
CPUID Namespace Reference

Query information about the processor. More...

Classes

union  Reg
 Structure for register values returned by cpuid instruction. More...
 

Enumerations

enum  Function {
  HIGHEST_FUNCTION_PARAMETER = 0x0 , MANUFACTURER_ID = 0x0 , PROCESSOR_INFO = 0x1 , FEATURE_BITS = 0x1 ,
  CACHE_INFORMATION = 0x2 , PROCESSOR_SERIAL_NUMBER = 0x3 , HIGHEST_EXTENDED_FUNCTION = 0x80000000 , EXTENDED_PROCESSOR_INFO = 0x80000001 ,
  EXTENDED_FEATURE_BITS = 0x80000001 , PROCESSOR_BRAND_STRING_1 = 0x80000002 , PROCESSOR_BRAND_STRING_2 = 0x80000003 , PROCESSOR_BRAND_STRING_3 = 0x80000004 ,
  ADVANCED_POWER_MANAGEMENT = 0x80000007 , ADDRESS_SIZES = 0x80000008
}
 
enum  FeatureECX {
  FEATURE_SSE3 = 1 << 0 , FEATURE_PCLMUL = 1 << 1 , FEATURE_DTES64 = 1 << 2 , FEATURE_MONITOR = 1 << 3 ,
  FEATURE_DS_CPL = 1 << 4 , FEATURE_VMX = 1 << 5 , FEATURE_SMX = 1 << 6 , FEATURE_EST = 1 << 7 ,
  FEATURE_TM2 = 1 << 8 , FEATURE_SSSE3 = 1 << 9 , FEATURE_CID = 1 << 10 , FEATURE_SDBG = 1 << 11 ,
  FEATURE_FMA = 1 << 12 , FEATURE_CX16 = 1 << 13 , FEATURE_ETPRD = 1 << 14 , FEATURE_PDCM = 1 << 15 ,
  FEATURE_PCIDE = 1 << 17 , FEATURE_DCA = 1 << 18 , FEATURE_SSE4_1 = 1 << 19 , FEATURE_SSE4_2 = 1 << 20 ,
  FEATURE_X2APIC = 1 << 21 , FEATURE_MOVBE = 1 << 22 , FEATURE_POPCNT = 1 << 23 , FEATURE_TSC_DEADLINE = 1 << 24 ,
  FEATURE_AES = 1 << 25 , FEATURE_XSAVE = 1 << 26 , FEATURE_OSXSAVE = 1 << 27 , FEATURE_AVX = 1 << 28 ,
  FEATURE_F16C = 1 << 29 , FEATURE_RDRND = 1 << 30 , FEATURE_HYPERVISOR = 1 << 31
}
 
enum  FeatureEDX {
  FEATURE_FPU = 1 << 0 , FEATURE_VME = 1 << 1 , FEATURE_DE = 1 << 2 , FEATURE_PSE = 1 << 3 ,
  FEATURE_TSC = 1 << 4 , FEATURE_MSR = 1 << 5 , FEATURE_PAE = 1 << 6 , FEATURE_MCE = 1 << 7 ,
  FEATURE_CX8 = 1 << 8 , FEATURE_APIC = 1 << 9 , FEATURE_SEP = 1 << 11 , FEATURE_MTRR = 1 << 12 ,
  FEATURE_PGE = 1 << 13 , FEATURE_MCA = 1 << 14 , FEATURE_CMOV = 1 << 15 , FEATURE_PAT = 1 << 16 ,
  FEATURE_PSE36 = 1 << 17 , FEATURE_PSN = 1 << 18 , FEATURE_CLF = 1 << 19 , FEATURE_DTES = 1 << 21 ,
  FEATURE_ACPI = 1 << 22 , FEATURE_MMX = 1 << 23 , FEATURE_FXSR = 1 << 24 , FEATURE_SSE = 1 << 25 ,
  FEATURE_SSE2 = 1 << 26 , FEATURE_SS = 1 << 27 , FEATURE_HTT = 1 << 28 , FEATURE_TM1 = 1 << 29 ,
  FEATURE_IA64 = 1 << 30 , FEATURE_PBE = 1 << 31
}
 
enum  ExtendedFeatureEDX {
  EXTENDED_FEATURE_FPU = 1 << 0 , EXTENDED_FEATURE_VME = 1 << 1 , EXTENDED_FEATURE_DE = 1 << 2 , EXTENDED_FEATURE_PSE = 1 << 3 ,
  EXTENDED_FEATURE_TSC = 1 << 4 , EXTENDED_FEATURE_MSR = 1 << 5 , EXTENDED_FEATURE_PAE = 1 << 6 , EXTENDED_FEATURE_MCE = 1 << 7 ,
  EXTENDED_FEATURE_CX8 = 1 << 8 , EXTENDED_FEATURE_APIC = 1 << 9 , EXTENDED_FEATURE_SYSCALL = 1 << 11 , EXTENDED_FEATURE_MTRR = 1 << 12 ,
  EXTENDED_FEATURE_PGE = 1 << 13 , EXTENDED_FEATURE_MCA = 1 << 14 , EXTENDED_FEATURE_CMOV = 1 << 15 , EXTENDED_FEATURE_PAT = 1 << 16 ,
  EXTENDED_FEATURE_PSE36 = 1 << 17 , EXTENDED_FEATURE_MP = 1 << 19 , EXTENDED_FEATURE_NX = 1 << 20 , EXTENDED_FEATURE_MMXEXT = 1 << 22 ,
  EXTENDED_FEATURE_MMX = 1 << 23 , EXTENDED_FEATURE_FXSR = 1 << 24 , EXTENDED_FEATURE_FXSR_OPT = 1 << 25 , EXTENDED_FEATURE_PDPE1GB = 1 << 26 ,
  EXTENDED_FEATURE_RDTSCP = 1 << 27 , EXTENDED_FEATURE_LM = 1 << 29 , EXTENDED_FEATURE_3DNOWEXT = 1 << 30 , EXTENDED_FEATURE_3DNOW = 1 << 31
}
 

Functions

Reg get (Function eax)
 Get CPU identification and feature information.
 
bool has (enum FeatureECX feature)
 Check if feature is provided by this system.
 
bool has (enum FeatureEDX feature)
 Check if feature is provided by this system.
 
bool has (enum ExtendedFeatureEDX feature)
 Check if feature is provided by this system.
 

Detailed Description

Query information about the processor.

Note
This is an interface to the cpuid instruction, which can return information about the processor. It should therefor not be confused with functionality to retrieve the ID of the current CPU (core)!

Enumeration Type Documentation

◆ ExtendedFeatureEDX

Enumerator
EXTENDED_FEATURE_FPU 

Onboard x87 FPU.

EXTENDED_FEATURE_VME 

Virtual 8086 mode extensions (such as VIF, VIP, PIV)

EXTENDED_FEATURE_DE 

Debugging extensions (CR4 bit 3)

EXTENDED_FEATURE_PSE 

Page Size Extension.

EXTENDED_FEATURE_TSC 

Time Stamp Counter.

EXTENDED_FEATURE_MSR 

Model-specific registers.

EXTENDED_FEATURE_PAE 

Physical Address Extension.

EXTENDED_FEATURE_MCE 

Machine Check Exception.

EXTENDED_FEATURE_CX8 

CMPXCHG8 (compare-and-swap) instruction.

EXTENDED_FEATURE_APIC 

Onboard Advanced Programmable Interrupt Controller.

EXTENDED_FEATURE_SYSCALL 

SYSCALL and SYSRET instructions.

EXTENDED_FEATURE_MTRR 

Memory Type Range Registers.

EXTENDED_FEATURE_PGE 

Page Global Enable bit in CR4.

EXTENDED_FEATURE_MCA 

Machine check architecture.

EXTENDED_FEATURE_CMOV 

Conditional move and FCMOV instructions.

EXTENDED_FEATURE_PAT 

Page Attribute Table.

EXTENDED_FEATURE_PSE36 

36-bit page size extension

EXTENDED_FEATURE_MP 

Multiprocessor Capable.

EXTENDED_FEATURE_NX 

Non-executable bit.

EXTENDED_FEATURE_MMXEXT 

extended MMX instructions

EXTENDED_FEATURE_MMX 

MMX instructions.

EXTENDED_FEATURE_FXSR 

FXSAVE, FXRESTOR instructions, CR4 bit 9.

EXTENDED_FEATURE_FXSR_OPT 

FXSAVE, FXRESTOR optimizations.

EXTENDED_FEATURE_PDPE1GB 

Gibibyte Pages.

EXTENDED_FEATURE_RDTSCP 

CPU cache implements self-snoop.

EXTENDED_FEATURE_LM 

Long Mode (x64)

EXTENDED_FEATURE_3DNOWEXT 

Extended 3DNow! instructions.

EXTENDED_FEATURE_3DNOW 

3DNow! instructions

◆ FeatureECX

Enumerator
FEATURE_SSE3 

Prescott New Instructions-SSE3 (PNI)

FEATURE_PCLMUL 

Carry-less Multiplication.

FEATURE_DTES64 

64-bit debug store (edx bit 21)

FEATURE_MONITOR 

MONITOR and MWAIT instructions (SSE3)

FEATURE_DS_CPL 

CPL qualified debug store.

FEATURE_VMX 

Virtual Machine eXtensions.

FEATURE_SMX 

Safer Mode Extensions (LaGrande)

FEATURE_EST 

Enhanced SpeedStep.

FEATURE_TM2 

Thermal Monitor 2.

FEATURE_SSSE3 

Supplemental SSE3 instructions.

FEATURE_CID 

L1 Context ID.

FEATURE_SDBG 

Silicon Debug interface.

FEATURE_FMA 

Fused multiply-add (FMA3)

FEATURE_CX16 

CMPXCHG16B instruction.

FEATURE_ETPRD 

Can disable sending task priority messages.

FEATURE_PDCM 

Perfmon & debug capability.

FEATURE_PCIDE 

Process context identifiers (CR4 bit 17)

FEATURE_DCA 

Direct cache access for DMA writes.

FEATURE_SSE4_1 

SSE4.1 instructions.

FEATURE_SSE4_2 

SSE4.2 instructions.

FEATURE_X2APIC 

x2APIC

FEATURE_MOVBE 

MOVBE instruction (big-endian)

FEATURE_POPCNT 

POPCNT instruction.

FEATURE_TSC_DEADLINE 

APIC implements one-shot operation using a TSC deadline value.

FEATURE_AES 

AES instruction set.

FEATURE_XSAVE 

XSAVE, XRESTOR, XSETBV, XGETBV.

FEATURE_OSXSAVE 

XSAVE enabled by OS.

FEATURE_AVX 

Advanced Vector Extensions.

FEATURE_F16C 

F16C (half-precision) FP feature.

FEATURE_RDRND 

RDRAND (on-chip random number generator) feature.

FEATURE_HYPERVISOR 

Hypervisor present (always zero on physical CPUs)

◆ FeatureEDX

Enumerator
FEATURE_FPU 

Onboard x87 FPU.

FEATURE_VME 

Virtual 8086 mode extensions (such as VIF, VIP, PIV)

FEATURE_DE 

Debugging extensions (CR4 bit 3)

FEATURE_PSE 

Page Size Extension.

FEATURE_TSC 

Time Stamp Counter.

FEATURE_MSR 

Model-specific registers.

FEATURE_PAE 

Physical Address Extension.

FEATURE_MCE 

Machine Check Exception.

FEATURE_CX8 

CMPXCHG8 (compare-and-swap) instruction.

FEATURE_APIC 

Onboard Advanced Programmable Interrupt Controller.

FEATURE_SEP 

SYSENTER and SYSEXIT instructions.

FEATURE_MTRR 

Memory Type Range Registers.

FEATURE_PGE 

Page Global Enable bit in CR4.

FEATURE_MCA 

Machine check architecture.

FEATURE_CMOV 

Conditional move and FCMOV instructions.

FEATURE_PAT 

Page Attribute Table.

FEATURE_PSE36 

36-bit page size extension

FEATURE_PSN 

Processor Serial Number.

FEATURE_CLF 

CLFLUSH instruction (SSE2)

FEATURE_DTES 

Debug store: save trace of executed jumps.

FEATURE_ACPI 

Onboard thermal control MSRs for ACPI.

FEATURE_MMX 

MMX instructions.

FEATURE_FXSR 

FXSAVE, FXRESTOR instructions, CR4 bit 9.

FEATURE_SSE 

SSE instructions (a.k.a. Katmai New Instructions)

FEATURE_SSE2 

SSE2 instructions.

FEATURE_SS 

CPU cache implements self-snoop.

FEATURE_HTT 

Hyper-threading.

FEATURE_TM1 

Thermal monitor automatically limits temperature.

FEATURE_IA64 

IA64 processor emulating x86.

FEATURE_PBE 

Pending Break Enable (PBE# pin) wakeup capability.

◆ Function

Enumerator
HIGHEST_FUNCTION_PARAMETER 

Maximum Input Value for Basic CPUID Information (in register eax)

MANUFACTURER_ID 

CPU String (in register ebx, ecx and edx)

PROCESSOR_INFO 

Version Information like Type, Family, Model (in register eax)

FEATURE_BITS 

Feature Information (in register ecx and edx)

CACHE_INFORMATION 

Cache and TLB Information.

PROCESSOR_SERIAL_NUMBER 

deprecated

HIGHEST_EXTENDED_FUNCTION 

Maximum Input Value for Extended Function CPUID (in register eax)

EXTENDED_PROCESSOR_INFO 

Extended Processor Signature and Feature Bits (in register eax)

EXTENDED_FEATURE_BITS 

Extended Feature Information (in register ecx and edx)

PROCESSOR_BRAND_STRING_1 

Processor Brand String (1/3)

PROCESSOR_BRAND_STRING_2 

Processor Brand String (2/3)

PROCESSOR_BRAND_STRING_3 

Processor Brand String (3/3)

ADVANCED_POWER_MANAGEMENT 

Advanced Power Management (with Invariant TSC in register edx)

ADDRESS_SIZES 

Linear/Physical Address size (in register eax)

Function Documentation

◆ get()

Reg CPUID::get ( Function  eax)
inline

Get CPU identification and feature information.

Parameters
eaxRequested feature
Returns
Register values filled by instruction cpuid for the requested feature
See also
ISDMv2, Chapter 3. CPUID - CPU Identification

◆ has() [1/3]

bool CPUID::has ( enum ExtendedFeatureEDX  feature)
inline

Check if feature is provided by this system.

Parameters
featureExtended feature to test
Returns
true if available, false if either feature or extended features are unavailable

◆ has() [2/3]

bool CPUID::has ( enum FeatureECX  feature)
inline

Check if feature is provided by this system.

Parameters
featureFeature to test
Returns
true if available, false otherwise

◆ has() [3/3]

bool CPUID::has ( enum FeatureEDX  feature)
inline

Check if feature is provided by this system.

Parameters
featureFeature to test
Returns
true if available, false otherwise