mirror of
				https://github.com/google/cpu_features.git
				synced 2025-11-04 06:40:54 +01:00 
			
		
		
		
	Add cx16 (cmpxchg16b) cpuid flag. Fixes #30
This commit is contained in:
		@@ -54,6 +54,7 @@ typedef struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  int smx : 1;
 | 
					  int smx : 1;
 | 
				
			||||||
  int sgx : 1;
 | 
					  int sgx : 1;
 | 
				
			||||||
 | 
					  int cx16 : 1;  // aka. CMPXCHG16B
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Make sure to update X86FeaturesEnum below if you add a field here.
 | 
					  // Make sure to update X86FeaturesEnum below if you add a field here.
 | 
				
			||||||
} X86Features;
 | 
					} X86Features;
 | 
				
			||||||
@@ -138,6 +139,7 @@ typedef enum {
 | 
				
			|||||||
  X86_AVX512_4VBMI2,
 | 
					  X86_AVX512_4VBMI2,
 | 
				
			||||||
  X86_SMX,
 | 
					  X86_SMX,
 | 
				
			||||||
  X86_SGX,
 | 
					  X86_SGX,
 | 
				
			||||||
 | 
					  X86_CX16,
 | 
				
			||||||
  X86_LAST_,
 | 
					  X86_LAST_,
 | 
				
			||||||
} X86FeaturesEnum;
 | 
					} X86FeaturesEnum;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,6 +96,7 @@ static void ParseCpuId(const uint32_t max_cpuid_leaf, X86Info* info) {
 | 
				
			|||||||
  info->stepping = ExtractBitRange(leaf_1.eax, 3, 0);
 | 
					  info->stepping = ExtractBitRange(leaf_1.eax, 3, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  features->smx = IsBitSet(leaf_1.ecx, 6);
 | 
					  features->smx = IsBitSet(leaf_1.ecx, 6);
 | 
				
			||||||
 | 
					  features->cx16 = IsBitSet(leaf_1.ecx, 13);
 | 
				
			||||||
  features->aes = IsBitSet(leaf_1.ecx, 25);
 | 
					  features->aes = IsBitSet(leaf_1.ecx, 25);
 | 
				
			||||||
  features->f16c = IsBitSet(leaf_1.ecx, 29);
 | 
					  features->f16c = IsBitSet(leaf_1.ecx, 29);
 | 
				
			||||||
  features->sgx = IsBitSet(leaf_7.ebx, 2);
 | 
					  features->sgx = IsBitSet(leaf_7.ebx, 2);
 | 
				
			||||||
@@ -319,6 +320,8 @@ int GetX86FeaturesEnumValue(const X86Features* features,
 | 
				
			|||||||
      return features->smx;
 | 
					      return features->smx;
 | 
				
			||||||
    case X86_SGX:
 | 
					    case X86_SGX:
 | 
				
			||||||
      return features->sgx;
 | 
					      return features->sgx;
 | 
				
			||||||
 | 
					    case X86_CX16:
 | 
				
			||||||
 | 
					      return features->cx16;
 | 
				
			||||||
    case X86_LAST_:
 | 
					    case X86_LAST_:
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -385,6 +388,8 @@ const char* GetX86FeaturesEnumName(X86FeaturesEnum value) {
 | 
				
			|||||||
      return "smx";
 | 
					      return "smx";
 | 
				
			||||||
    case X86_SGX:
 | 
					    case X86_SGX:
 | 
				
			||||||
      return "sgx";
 | 
					      return "sgx";
 | 
				
			||||||
 | 
					    case X86_CX16:
 | 
				
			||||||
 | 
					      return "cx16";
 | 
				
			||||||
    case X86_LAST_:
 | 
					    case X86_LAST_:
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user