1
0
mirror of https://github.com/google/cpu_features.git synced 2025-04-27 23:22:31 +02:00

Add cx16 (cmpxchg16b) cpuid flag. Fixes #30

This commit is contained in:
Guillaume Chatelet 2018-03-13 10:58:42 +01:00
parent 68479a8cf9
commit 9b872ce0b2
2 changed files with 7 additions and 0 deletions

View File

@ -54,6 +54,7 @@ typedef struct {
int smx : 1;
int sgx : 1;
int cx16 : 1; // aka. CMPXCHG16B
// Make sure to update X86FeaturesEnum below if you add a field here.
} X86Features;
@ -138,6 +139,7 @@ typedef enum {
X86_AVX512_4VBMI2,
X86_SMX,
X86_SGX,
X86_CX16,
X86_LAST_,
} X86FeaturesEnum;

View File

@ -96,6 +96,7 @@ static void ParseCpuId(const uint32_t max_cpuid_leaf, X86Info* info) {
info->stepping = ExtractBitRange(leaf_1.eax, 3, 0);
features->smx = IsBitSet(leaf_1.ecx, 6);
features->cx16 = IsBitSet(leaf_1.ecx, 13);
features->aes = IsBitSet(leaf_1.ecx, 25);
features->f16c = IsBitSet(leaf_1.ecx, 29);
features->sgx = IsBitSet(leaf_7.ebx, 2);
@ -319,6 +320,8 @@ int GetX86FeaturesEnumValue(const X86Features* features,
return features->smx;
case X86_SGX:
return features->sgx;
case X86_CX16:
return features->cx16;
case X86_LAST_:
break;
}
@ -385,6 +388,8 @@ const char* GetX86FeaturesEnumName(X86FeaturesEnum value) {
return "smx";
case X86_SGX:
return "sgx";
case X86_CX16:
return "cx16";
case X86_LAST_:
break;
}