__cpuid, __cpuidex
[Cette documentation constitue un aperçu et peut faire l'objet de modifications avec les versions ultérieures. Blank topics are included as placeholders.]
Spécifique à Microsoft
Génère des instructions d' cpuid qui est disponible sur x86 et le x64. Ces instructions interroge le processeur pour plus d'informations sur les fonctionnalités prises en charge et type de processeur.
void __cpuid(
int CPUInfo[4],
int InfoType
);
void __cpuidex(
int CPUInfo[4],
int InfoType,
int ECXValue
);
Paramètres
[out] CPUInfo
Un tableau de quatre entiers qui contient les informations collectées sur les fonctionnalités prises en charge et de l'UC.[in] InfoType
Le code qui indique les informations cette instruction extrait.[in] ECXValue
La valeur du registre d'ECX avant cette intrinsèque génère des instructions d' cpuid .
Configuration requise
Intrinsèque |
Architecture |
---|---|
__cpuid |
x86, x64 |
__cpuidex |
x86, x64 |
Fichier d'en-tête <intrin.h>
Notes
Cette instruction stocke les fonctionnalités prises en charge et les informations d'UC dans CPUInfo, un tableau de quatre entiers 32 bits qui est rempli avec les valeurs des registres d'EAX, d'EBX, d'ECX, et d'EDX (dans cet ordre) après l'appel de l'instruction d' cpuid . Des informations ont une signification différente selon la valeur passée comme paramètre d' InfoType . Les informations retournées avec différentes valeurs d' InfoType sont processeur-dépendant.
L'intrinsèque de __cpuidex définit la valeur du registre d'ECX avant qu'elle génère des instructions d' cpuid . Cela vous permet de collecter des informations supplémentaires sur le processeur.
Lorsque l'argument d' InfoType est 0, le tableau suivant décrit la sortie.
Les informations retournées
Index du tableau |
Chaîne de bits |
Description |
---|---|---|
0 |
0-31 |
Valeur maximale du paramètre d' InfoType qui retourne les informations non valides. |
1 |
0-31 |
Chaîne d'identificateur (partie 1) |
2 |
0-31 |
Chaîne d'identificateur (partie 3) |
3 |
0-31 |
Chaîne d'identificateur (partie 2) |
Lorsque l'argument d' InfoType est 1, le tableau suivant décrit la sortie.
Les informations d'UC retournées
Index du tableau |
Chaîne de bits |
Description |
---|---|---|
0 |
0-3 |
ID de progression |
0 |
4-7 |
Modèle |
0 |
8-11 |
Famille |
0 |
12-13 |
Type de processeur Intel () réservé (AMD) |
0 |
14-15 |
Réservé. |
0 |
16-19 |
modèle étendu |
0 |
20-27 |
famille étendue |
0 |
28-31 |
Réservé. |
1 |
0-7 |
index de marque |
1 |
8-15 |
la taille de la ligne de cache de CLFLUSH, dans les mots quadruples |
1 |
16-23 |
nombre logique de processeur |
1 |
24-31 |
ID d'APIC initial |
2 |
0 |
nouvelle instruction SSE3 |
2 |
1-2 |
Réservé. |
2 |
3 |
MONITOR/MWAIT |
2 |
4 |
Le magasin qualifiée COMPLÈTE de débogage (Intel) réservé (AMD) |
2 |
5 |
extensions d'ordinateur virtuel (Intel) réservé (AMD) |
2 |
6 |
extensions de mode plus sécurisé (Intel) réservé (AMD) |
2 |
7 |
Technologie améliorée de SpeedStep Intel (Intel) réservé (AMD) |
2 |
8 |
moniteur thermique (Intel) (AMD 2) réservés |
2 |
9 |
extensions Streaming SIMD supplémentaires 3 (SSSE3) |
2 |
10 |
ID de contexte L1 (Intel) réservé (AMD) |
2 |
11 |
Réservé. |
2 |
12 |
extensions de 256 bits FMA (Intel) réservé (AMD) |
2 |
13 |
Prise en charge CMPXCHG16B |
2 |
14 |
vérification de xTPR |
2 |
15 |
fonction MSR de perforation/débogage |
2 |
16-17 |
Réservé. |
2 |
18 |
Prise en charge directe d' (DCA)accès du cache (Intel) réservé (AMD) |
2 |
19 |
extensions SSE4.1 |
2 |
20 |
extensions SSE4.2 |
2 |
21 |
prise en charge de x2APIC (Intel) réservé (AMD) |
2 |
22 |
prise en charge de MOVBE (Intel) réservé (AMD) |
2 |
23 |
Prise en charge du didacticiel de POPCNT |
2 |
24 |
Réservé. |
2 |
25 |
Prise en charge AES (Intel) réservé (AMD) |
2 |
26 |
prise en charge de XSAVE (Intel) réservé (AMD) |
2 |
27 |
prise en charge d'OSXSAVE (Intel) réservé (AMD) |
2 |
28 |
extensions 256 bits vectorielles avancées par Intel (Intel) réservé (AMD) |
2 |
29-31 |
Réservé. |
3 |
0-31 |
Les informations de fonctionnalités (consultez plus loin dans la rubrique) |
Le tableau suivant indique la signification de la valeur de l'information de fonctionnalité, la valeur d'EDX ce qui est écrit dans CPUInfo [3], lorsque l'argument d' InfoType est 1.
Les informations de fonctionnalité retournées
Bit |
mnémonique |
Description |
---|---|---|
0 |
FPU |
x87 FPU sur le processeur |
1 |
VME |
amélioration du mode Virtual-8086 |
2 |
DE |
Débogage d'extensions |
3 |
PSE |
extensions de Taille de page |
4 |
centre technique |
Horodatage compteur |
5 |
MSR |
prise en charge de RDMSR et de WRMSR |
6 |
PAE |
extensions d'adresse physique |
7 |
ECM |
exception de contrôle automatique |
8 |
CX8 |
instruction de CMPXCHG8 B |
9 |
APIC |
APIC sur le processeur |
10 |
N/A |
Réservé. |
11 |
SEPT |
SYSENTER et SYSEXIT |
12 |
MTRR |
Registres de plage du type de mémoire |
13 |
PGE |
Bit global PRIVATE |
14 |
MCA |
architecture de contrôle automatique |
15 |
CMOV |
Le déplacement conditionnel/comparent l'instruction |
16 |
PAT |
Table d'attributs de page |
17 |
PSE-36 |
extension de la Taille de page 36 bits |
18 |
LE RPC |
nombre de série de processeur |
19 |
CLFSH |
instruction de CFLUSH |
20 |
N/A |
Réservé. |
21 |
DS |
Le magasin de débogage |
22 |
ACPI |
Contrôle thermique du moniteur et de minutage |
23 |
MMX |
technologie MMX |
24 |
FXSR |
FXSAVE/FXRSTOR |
25 |
SSE |
extensions de SSE |
26 |
SSE2 |
extensions SSE2 |
27 |
SS |
Fureteur d'automatique |
28 |
HTT |
Multithreading |
29 |
LE TM |
moniteur thermique |
30 |
N/A |
Réservé. |
31 |
PBE |
Attendant le saut activez |
Notes
Avec le membre microprogrammé d'AMD, tout l'AMD multicœur UC définit les plateformes 28 bits des bits d'informations de fonctionnalités pour indiquer que le processeur contient plusieurs cœur.C'est le cas bien AMD ne prend pas en charge le multithreading simultané.
Certains processeurs, tels que les processeurs de SSE3 et de SSE4-enabled, prennent en charge les valeurs supplémentaires d' InfoType . Lorsque l'argument d' InfoType est 2, le retour de cette instruction met en cache les informations dans les formulaires codés.
Le tableau suivant indique les valeurs des retours de cette instruction lorsque vous InfoType la valeur 4. Il s'agit d'informations de cache est liée à un des niveaux de cache. Pour récupérer ces informations, vous devez définir le registre d'ECX. Utilisez l'intrinsèque de __cpuidex pour définir ECX à l'index de base zéro pour le cache au niveau pour interroger.
Les informations déterministes de cache
Index de tableau |
Chaîne de bits |
Description |
---|---|---|
0 |
0-4 |
Champ type de cache |
0 |
5-7 |
Cache au niveau |
0 |
8 |
Auto-initialiser le cache |
0 |
9 |
cache entièrement associatif |
0 |
10-13 |
Réservé. |
0 |
14-25 |
Nombre maximal de threads |
0 |
26-31 |
Nombre maximal d'identificateurs des cœurs de processeurs |
1 |
0-11 |
Taille de ligne de sécurité du système |
1 |
12-21 |
partitions de Ligne physique |
1 |
22-31 |
Façons d'associativité |
2 |
0-31 |
Nombre d'ensembles |
3 |
0-31 |
Réservé. |
Lorsque InfoType est 5, les informations de retour de ces processeurs sur les fonctionnalités du moniteur (consultez _mm_monitor).
Lorsque InfoType est 6, les processeurs retournent des informations sur la température et la gestion de l'alimentation numériques.
Lorsque InfoType est 0x0A, les informations de retour de ces processeurs ont obtenu en surveillant les performances de l'architecture.
Les informations de la fonction étendues par prise en charge CPUID de certains processeurs. Si cela est pris en charge, les valeurs d' InfoType de 0x80000000 peuvent être utilisées pour retourner les informations. Pour déterminer la valeur explicite maximale autorisée, définissez InfoType à 0x80000000. La valeur maximale d' InfoType l'a pris en charge est écrite dans CPUInfo[0]. Les valeurs de tableau suivant montre quels retournées à l'aide de les informations détaillées de la fonction CPUID.
Les informations détaillées de la fonction CPUID
InfoType |
Index du tableau |
Chaîne de bits |
Information |
---|---|---|---|
0x80000000 |
0 |
0-31 |
Valeur explicite maximale d'InfoType pour les informations détaillées de la fonction CPUID. |
0x80000000 |
1-3 |
0-31 |
Réservé. |
0x80000001 |
0 |
0-31 |
Signature étendue du processeur et de bits étendus de fonctionnalité |
0x80000001 |
1 |
0-31 |
Réservé. |
0x80000001 |
2 |
0 |
LAHF/SAHF disponible en mode 64 bits |
0x80000001 |
2 |
1 |
mode hérité de principal multitraitement (CmpLegacy) (AMD) réservé (Intel) |
0x80000001 |
2 |
2 |
sécurisez l'ordinateur virtuel (SVM) (AMD) réservé (Intel) |
0x80000001 |
2 |
3 |
L'espace étendu de registre d'APIC (ExtApicSpace) (AMD) réservé (Intel) |
0x80000001 |
2 |
4 |
AltMovCr8 (AMD) réservé (Intel) |
0x80000001 |
2 |
5 |
prise en charge de LZCNT (AMD) réservé (Intel) |
0x80000001 |
2 |
6 |
Prise en charge du didacticiel de SSE4A (EXTRQ, INSERTQ, MOVNTSD, MOVNTSS) (AMD) réservé (Intel) |
0x80000001 |
2 |
7 |
Mode mal alignés de support de SSE disponible (AMD) réservé (Intel) |
0x80000001 |
2 |
8 |
prise en charge de PREFETCH et de PREFETCHW (AMD) réservé (Intel) |
0x80000001 |
2 |
9-11 |
Réservé. |
0x80000001 |
2 |
12 |
Prise en charge de SKINIT et dev (AMD) réservé (Intel) |
0x80000001 |
2 |
13-31 |
Réservé. |
0x80000001 |
3 |
0-10 |
Réservé. |
0x80000001 |
3 |
11 |
SYSCALL/SYSRET disponible en mode 64 bits |
0x80000001 |
3 |
12-19 |
Réservé. |
0x80000001 |
3 |
20 |
Exécutez le bit de désactiver disponible |
0x80000001 |
3 |
21 |
Réservé. |
0x80000001 |
3 |
22 |
extensions MMX à l'instruction (AMD) réservé (Intel) |
0x80000001 |
3 |
23-24 |
Réservé. |
0x80000001 |
3 |
25 |
FFXSR (AMD) réservé (Intel) |
0x80000001 |
3 |
26 |
prise en charge de la page 1GB (AMD) réservé (Intel) |
0x80000001 |
3 |
27 |
prise en charge de RDTSCP (AMD) réservé (Intel) |
0x80000001 |
3 |
28 |
Réservé. |
0x80000001 |
3 |
29 |
technologie 64 bits disponible |
0x80000001 |
3 |
30 |
3DnowExt (AMD) réservé (Intel) |
0x80000001 |
3 |
31 |
3Dnow ! instruction (AMD) réservé (Intel) |
0x80000002 |
0-3 |
0-31 |
chaîne de marque de processeur |
0x80000003 |
0-3 |
0-31 |
chaîne de marque de processeur, continue |
0x80000004 |
0-3 |
0-31 |
chaîne de marque de processeur, continue |
0x80000005 |
0-3 |
0-31 |
Cache L1 et identificateurs TLB (AMD) réservé (Intel) |
0x80000006 |
0-1 |
0-31 |
Réservé. |
0x80000006 |
2 |
0-7 |
taille de ligne de cache |
0x80000006 |
2 |
8-11 |
Réservé. |
0x80000006 |
2 |
12-15 |
Associativité L2 |
0x80000006 |
2 |
16-31 |
Taille du cache dans les unités 1K |
0x80000006 |
3 |
0-31 |
Réservé. |
0x80000007 |
0-3 |
0-31 |
Les informations de gestion avancée de l'alimentation réservé (Intel) |
0x80000008 |
0 |
0-7 |
bits d'adresse physique |
0x80000008 |
0 |
8-15 |
bits d'adresse virtuelle |
0x80000008 |
0 |
16-31 |
Réservé. |
0x80000008 |
1-3 |
0-31 |
Réservé. |
0x8000000A |
0 |
0-7 |
révision de SVM (AMD) réservé (Intel) |
0x8000000A |
0 |
8-31 |
Réservé. |
0x8000000A |
1 |
0-31 |
NASID - numéro d'ID de l'espace d'adressage réservé (Intel) |
0x8000000A |
2 |
0-31 |
Réservé. |
0x8000000A |
3 |
0 |
pagination imbriquée (AMD) réservé (Intel) |
0x8000000A |
3 |
1 |
visualisation de LBR (AMD) réservé (Intel) |
0x8000000A |
3 |
2-31 |
Réservé. |
0x80000019 |
0-3 |
0-31 |
Identificateurs de page TLB 1GB (AMD) réservé (Intel) |
0x8000001A |
0 |
0 |
optimisation FP128 (AMD) réservé (Intel) |
0x8000001A |
0 |
1 |
MOVU, MOVUPS, optimisation de MOVUPD sur MOVL/MOVH, MOVHLPS/MOVHPS, MOVLPD/MOVHPD (AMD) réservé (Intel) |
0x8000001A |
0 |
2-31 |
Réservé. |
0x8000001A |
1-3 |
0-31 |
Réservé. |
Exemple
// cpuid.cpp
// processor: x86, x64
// Use the __cpuid intrinsic to get information about a CPU
#include <stdio.h>
#include <string.h>
#include <intrin.h>
const char* szFeatures[] =
{
"x87 FPU On Chip",
"Virtual-8086 Mode Enhancement",
"Debugging Extensions",
"Page Size Extensions",
"Time Stamp Counter",
"RDMSR and WRMSR Support",
"Physical Address Extensions",
"Machine Check Exception",
"CMPXCHG8B Instruction",
"APIC On Chip",
"Unknown1",
"SYSENTER and SYSEXIT",
"Memory Type Range Registers",
"PTE Global Bit",
"Machine Check Architecture",
"Conditional Move/Compare Instruction",
"Page Attribute Table",
"36-bit Page Size Extension",
"Processor Serial Number",
"CFLUSH Extension",
"Unknown2",
"Debug Store",
"Thermal Monitor and Clock Ctrl",
"MMX Technology",
"FXSAVE/FXRSTOR",
"SSE Extensions",
"SSE2 Extensions",
"Self Snoop",
"Multithreading Technology",
"Thermal Monitor",
"Unknown4",
"Pending Break Enable"
};
int main(int argc, char* argv[])
{
char CPUString[0x20];
char CPUBrandString[0x40];
int CPUInfo[4] = {-1};
int nSteppingID = 0;
int nModel = 0;
int nFamily = 0;
int nProcessorType = 0;
int nExtendedmodel = 0;
int nExtendedfamily = 0;
int nBrandIndex = 0;
int nCLFLUSHcachelinesize = 0;
int nLogicalProcessors = 0;
int nAPICPhysicalID = 0;
int nFeatureInfo = 0;
int nCacheLineSize = 0;
int nL2Associativity = 0;
int nCacheSizeK = 0;
int nPhysicalAddress = 0;
int nVirtualAddress = 0;
int nRet = 0;
int nCores = 0;
int nCacheType = 0;
int nCacheLevel = 0;
int nMaxThread = 0;
int nSysLineSize = 0;
int nPhysicalLinePartitions = 0;
int nWaysAssociativity = 0;
int nNumberSets = 0;
unsigned nIds, nExIds, i;
bool bSSE3Instructions = false;
bool bMONITOR_MWAIT = false;
bool bCPLQualifiedDebugStore = false;
bool bVirtualMachineExtensions = false;
bool bEnhancedIntelSpeedStepTechnology = false;
bool bThermalMonitor2 = false;
bool bSupplementalSSE3 = false;
bool bL1ContextID = false;
bool bCMPXCHG16B = false;
bool bxTPRUpdateControl = false;
bool bPerfDebugCapabilityMSR = false;
bool bSSE41Extensions = false;
bool bSSE42Extensions = false;
bool bPOPCNT = false;
bool bMultithreading = false;
bool bLAHF_SAHFAvailable = false;
bool bCmpLegacy = false;
bool bSVM = false;
bool bExtApicSpace = false;
bool bAltMovCr8 = false;
bool bLZCNT = false;
bool bSSE4A = false;
bool bMisalignedSSE = false;
bool bPREFETCH = false;
bool bSKINITandDEV = false;
bool bSYSCALL_SYSRETAvailable = false;
bool bExecuteDisableBitAvailable = false;
bool bMMXExtensions = false;
bool bFFXSR = false;
bool b1GBSupport = false;
bool bRDTSCP = false;
bool b64Available = false;
bool b3DNowExt = false;
bool b3DNow = false;
bool bNestedPaging = false;
bool bLBRVisualization = false;
bool bFP128 = false;
bool bMOVOptimization = false;
bool bSelfInit = false;
bool bFullyAssociative = false;
// __cpuid with an InfoType argument of 0 returns the number of
// valid Ids in CPUInfo[0] and the CPU identification string in
// the other three array elements. The CPU identification string is
// not in linear order. The code below arranges the information
// in a human readable form.
__cpuid(CPUInfo, 0);
nIds = CPUInfo[0];
memset(CPUString, 0, sizeof(CPUString));
*((int*)CPUString) = CPUInfo[1];
*((int*)(CPUString+4)) = CPUInfo[3];
*((int*)(CPUString+8)) = CPUInfo[2];
// Get the information associated with each valid Id
for (i=0; i<=nIds; ++i)
{
__cpuid(CPUInfo, i);
printf_s("\nFor InfoType %d\n", i);
printf_s("CPUInfo[0] = 0x%x\n", CPUInfo[0]);
printf_s("CPUInfo[1] = 0x%x\n", CPUInfo[1]);
printf_s("CPUInfo[2] = 0x%x\n", CPUInfo[2]);
printf_s("CPUInfo[3] = 0x%x\n", CPUInfo[3]);
// Interpret CPU feature information.
if (i == 1)
{
nSteppingID = CPUInfo[0] & 0xf;
nModel = (CPUInfo[0] >> 4) & 0xf;
nFamily = (CPUInfo[0] >> 8) & 0xf;
nProcessorType = (CPUInfo[0] >> 12) & 0x3;
nExtendedmodel = (CPUInfo[0] >> 16) & 0xf;
nExtendedfamily = (CPUInfo[0] >> 20) & 0xff;
nBrandIndex = CPUInfo[1] & 0xff;
nCLFLUSHcachelinesize = ((CPUInfo[1] >> 8) & 0xff) * 8;
nLogicalProcessors = ((CPUInfo[1] >> 16) & 0xff);
nAPICPhysicalID = (CPUInfo[1] >> 24) & 0xff;
bSSE3Instructions = (CPUInfo[2] & 0x1) || false;
bMONITOR_MWAIT = (CPUInfo[2] & 0x8) || false;
bCPLQualifiedDebugStore = (CPUInfo[2] & 0x10) || false;
bVirtualMachineExtensions = (CPUInfo[2] & 0x20) || false;
bEnhancedIntelSpeedStepTechnology = (CPUInfo[2] & 0x80) || false;
bThermalMonitor2 = (CPUInfo[2] & 0x100) || false;
bSupplementalSSE3 = (CPUInfo[2] & 0x200) || false;
bL1ContextID = (CPUInfo[2] & 0x300) || false;
bCMPXCHG16B= (CPUInfo[2] & 0x2000) || false;
bxTPRUpdateControl = (CPUInfo[2] & 0x4000) || false;
bPerfDebugCapabilityMSR = (CPUInfo[2] & 0x8000) || false;
bSSE41Extensions = (CPUInfo[2] & 0x80000) || false;
bSSE42Extensions = (CPUInfo[2] & 0x100000) || false;
bPOPCNT= (CPUInfo[2] & 0x800000) || false;
nFeatureInfo = CPUInfo[3];
bMultithreading = (nFeatureInfo & (1 << 28)) || false;
}
}
// Calling __cpuid with 0x80000000 as the InfoType argument
// gets the number of valid extended IDs.
__cpuid(CPUInfo, 0x80000000);
nExIds = CPUInfo[0];
memset(CPUBrandString, 0, sizeof(CPUBrandString));
// Get the information associated with each extended ID.
for (i=0x80000000; i<=nExIds; ++i)
{
__cpuid(CPUInfo, i);
printf_s("\nFor InfoType %x\n", i);
printf_s("CPUInfo[0] = 0x%x\n", CPUInfo[0]);
printf_s("CPUInfo[1] = 0x%x\n", CPUInfo[1]);
printf_s("CPUInfo[2] = 0x%x\n", CPUInfo[2]);
printf_s("CPUInfo[3] = 0x%x\n", CPUInfo[3]);
if (i == 0x80000001)
{
bLAHF_SAHFAvailable = (CPUInfo[2] & 0x1) || false;
bCmpLegacy = (CPUInfo[2] & 0x2) || false;
bSVM = (CPUInfo[2] & 0x4) || false;
bExtApicSpace = (CPUInfo[2] & 0x8) || false;
bAltMovCr8 = (CPUInfo[2] & 0x10) || false;
bLZCNT = (CPUInfo[2] & 0x20) || false;
bSSE4A = (CPUInfo[2] & 0x40) || false;
bMisalignedSSE = (CPUInfo[2] & 0x80) || false;
bPREFETCH = (CPUInfo[2] & 0x100) || false;
bSKINITandDEV = (CPUInfo[2] & 0x1000) || false;
bSYSCALL_SYSRETAvailable = (CPUInfo[3] & 0x800) || false;
bExecuteDisableBitAvailable = (CPUInfo[3] & 0x10000) || false;
bMMXExtensions = (CPUInfo[3] & 0x40000) || false;
bFFXSR = (CPUInfo[3] & 0x200000) || false;
b1GBSupport = (CPUInfo[3] & 0x400000) || false;
bRDTSCP = (CPUInfo[3] & 0x8000000) || false;
b64Available = (CPUInfo[3] & 0x20000000) || false;
b3DNowExt = (CPUInfo[3] & 0x40000000) || false;
b3DNow = (CPUInfo[3] & 0x80000000) || false;
}
// Interpret CPU brand string and cache information.
if (i == 0x80000002)
memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo));
else if (i == 0x80000003)
memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo));
else if (i == 0x80000004)
memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo));
else if (i == 0x80000006)
{
nCacheLineSize = CPUInfo[2] & 0xff;
nL2Associativity = (CPUInfo[2] >> 12) & 0xf;
nCacheSizeK = (CPUInfo[2] >> 16) & 0xffff;
}
else if (i == 0x80000008)
{
nPhysicalAddress = CPUInfo[0] & 0xff;
nVirtualAddress = (CPUInfo[0] >> 8) & 0xff;
}
else if (i == 0x8000000A)
{
bNestedPaging = (CPUInfo[3] & 0x1) || false;
bLBRVisualization = (CPUInfo[3] & 0x2) || false;
}
else if (i == 0x8000001A)
{
bFP128 = (CPUInfo[0] & 0x1) || false;
bMOVOptimization = (CPUInfo[0] & 0x2) || false;
}
}
// Display all the information in user-friendly format.
printf_s("\n\nCPU String: %s\n", CPUString);
if (nIds >= 1)
{
if (nSteppingID)
printf_s("Stepping ID = %d\n", nSteppingID);
if (nModel)
printf_s("Model = %d\n", nModel);
if (nFamily)
printf_s("Family = %d\n", nFamily);
if (nProcessorType)
printf_s("Processor Type = %d\n", nProcessorType);
if (nExtendedmodel)
printf_s("Extended model = %d\n", nExtendedmodel);
if (nExtendedfamily)
printf_s("Extended family = %d\n", nExtendedfamily);
if (nBrandIndex)
printf_s("Brand Index = %d\n", nBrandIndex);
if (nCLFLUSHcachelinesize)
printf_s("CLFLUSH cache line size = %d\n",
nCLFLUSHcachelinesize);
if (bMultithreading && (nLogicalProcessors > 0))
printf_s("Logical Processor Count = %d\n", nLogicalProcessors);
if (nAPICPhysicalID)
printf_s("APIC Physical ID = %d\n", nAPICPhysicalID);
if (nFeatureInfo || bSSE3Instructions ||
bMONITOR_MWAIT || bCPLQualifiedDebugStore ||
bVirtualMachineExtensions || bEnhancedIntelSpeedStepTechnology ||
bThermalMonitor2 || bSupplementalSSE3 || bL1ContextID ||
bCMPXCHG16B || bxTPRUpdateControl || bPerfDebugCapabilityMSR ||
bSSE41Extensions || bSSE42Extensions || bPOPCNT ||
bLAHF_SAHFAvailable || bCmpLegacy || bSVM ||
bExtApicSpace || bAltMovCr8 ||
bLZCNT || bSSE4A || bMisalignedSSE ||
bPREFETCH || bSKINITandDEV || bSYSCALL_SYSRETAvailable ||
bExecuteDisableBitAvailable || bMMXExtensions || bFFXSR || b1GBSupport ||
bRDTSCP || b64Available || b3DNowExt || b3DNow || bNestedPaging ||
bLBRVisualization || bFP128 || bMOVOptimization )
{
printf_s("\nThe following features are supported:\n");
if (bSSE3Instructions)
printf_s("\tSSE3\n");
if (bMONITOR_MWAIT)
printf_s("\tMONITOR/MWAIT\n");
if (bCPLQualifiedDebugStore)
printf_s("\tCPL Qualified Debug Store\n");
if (bVirtualMachineExtensions)
printf_s("\tVirtual Machine Extensions\n");
if (bEnhancedIntelSpeedStepTechnology)
printf_s("\tEnhanced Intel SpeedStep Technology\n");
if (bThermalMonitor2)
printf_s("\tThermal Monitor 2\n");
if (bSupplementalSSE3)
printf_s("\tSupplemental Streaming SIMD Extensions 3\n");
if (bL1ContextID)
printf_s("\tL1 Context ID\n");
if (bCMPXCHG16B)
printf_s("\tCMPXCHG16B Instruction\n");
if (bxTPRUpdateControl)
printf_s("\txTPR Update Control\n");
if (bPerfDebugCapabilityMSR)
printf_s("\tPerf\\Debug Capability MSR\n");
if (bSSE41Extensions)
printf_s("\tSSE4.1 Extensions\n");
if (bSSE42Extensions)
printf_s("\tSSE4.2 Extensions\n");
if (bPOPCNT)
printf_s("\tPPOPCNT Instruction\n");
i = 0;
nIds = 1;
while (i < (sizeof(szFeatures)/sizeof(const char*)))
{
if (nFeatureInfo & nIds)
{
printf_s("\t");
printf_s(szFeatures[i]);
printf_s("\n");
}
nIds <<= 1;
++i;
}
if (bLAHF_SAHFAvailable)
printf_s("\tLAHF/SAHF in 64-bit mode\n");
if (bCmpLegacy)
printf_s("\tCore multi-processing legacy mode\n");
if (bSVM)
printf_s("\tSecure Virtual Machine\n");
if (bExtApicSpace)
printf_s("\tExtended APIC Register Space\n");
if (bAltMovCr8)
printf_s("\tAltMovCr8\n");
if (bLZCNT)
printf_s("\tLZCNT instruction\n");
if (bSSE4A)
printf_s("\tSSE4A (EXTRQ, INSERTQ, MOVNTSD, MOVNTSS)\n");
if (bMisalignedSSE)
printf_s("\tMisaligned SSE mode\n");
if (bPREFETCH)
printf_s("\tPREFETCH and PREFETCHW Instructions\n");
if (bSKINITandDEV)
printf_s("\tSKINIT and DEV support\n");
if (bSYSCALL_SYSRETAvailable)
printf_s("\tSYSCALL/SYSRET in 64-bit mode\n");
if (bExecuteDisableBitAvailable)
printf_s("\tExecute Disable Bit\n");
if (bMMXExtensions)
printf_s("\tExtensions to MMX Instructions\n");
if (bFFXSR)
printf_s("\tFFXSR\n");
if (b1GBSupport)
printf_s("\t1GB page support\n");
if (bRDTSCP)
printf_s("\tRDTSCP instruction\n");
if (b64Available)
printf_s("\t64 bit Technology\n");
if (b3DNowExt)
printf_s("\t3Dnow Ext\n");
if (b3DNow)
printf_s("\t3Dnow! instructions\n");
if (bNestedPaging)
printf_s("\tNested Paging\n");
if (bLBRVisualization)
printf_s("\tLBR Visualization\n");
if (bFP128)
printf_s("\tFP128 optimization\n");
if (bMOVOptimization)
printf_s("\tMOVU Optimization\n");
}
}
if (nExIds >= 0x80000004)
printf_s("\nCPU Brand String: %s\n", CPUBrandString);
if (nExIds >= 0x80000006)
{
printf_s("Cache Line Size = %d\n", nCacheLineSize);
printf_s("L2 Associativity = %d\n", nL2Associativity);
printf_s("Cache Size = %dK\n", nCacheSizeK);
}
for (i=0;;i++)
{
__cpuidex(CPUInfo, 0x4, i);
if(!(CPUInfo[0] & 0xf0)) break;
if(i == 0)
{
nCores = CPUInfo[0] >> 26;
printf_s("\n\nNumber of Cores = %d\n", nCores + 1);
}
nCacheType = (CPUInfo[0] & 0x1f);
nCacheLevel = (CPUInfo[0] & 0xe0) >> 5;
bSelfInit = (CPUInfo[0] & 0x100) >> 8;
bFullyAssociative = (CPUInfo[0] & 0x200) >> 9;
nMaxThread = (CPUInfo[0] & 0x03ffc000) >> 14;
nSysLineSize = (CPUInfo[1] & 0x0fff);
nPhysicalLinePartitions = (CPUInfo[1] & 0x03ff000) >> 12;
nWaysAssociativity = (CPUInfo[1]) >> 22;
nNumberSets = CPUInfo[2];
printf_s("\n");
printf_s("ECX Index %d\n", i);
switch (nCacheType)
{
case 0:
printf_s(" Type: Null\n");
break;
case 1:
printf_s(" Type: Data Cache\n");
break;
case 2:
printf_s(" Type: Instruction Cache\n");
break;
case 3:
printf_s(" Type: Unified Cache\n");
break;
default:
printf_s(" Type: Unknown\n");
}
printf_s(" Level = %d\n", nCacheLevel + 1);
if (bSelfInit)
{
printf_s(" Self Initializing\n");
}
else
{
printf_s(" Not Self Initializing\n");
}
if (bFullyAssociative)
{
printf_s(" Is Fully Associatve\n");
}
else
{
printf_s(" Is Not Fully Associatve\n");
}
printf_s(" Max Threads = %d\n",
nMaxThread+1);
printf_s(" System Line Size = %d\n",
nSysLineSize+1);
printf_s(" Physical Line Partions = %d\n",
nPhysicalLinePartitions+1);
printf_s(" Ways of Associativity = %d\n",
nWaysAssociativity+1);
printf_s(" Number of Sets = %d\n",
nNumberSets+1);
}
return nRet;
}