Skip to content

Commit 9cda381

Browse files
authored
Add some Intel flags (#119)
1 parent f02e77d commit 9cda381

2 files changed

Lines changed: 161 additions & 130 deletions

File tree

cpuid.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,21 @@ const (
110110
ENQCMD // Enqueue Command
111111
ERMS // Enhanced REP MOVSB/STOSB
112112
F16C // Half-precision floating-point conversion
113+
FLUSH_L1D // Flush L1D cache
113114
FMA3 // Intel FMA 3. Does not imply AVX.
114115
FMA4 // Bulldozer FMA4 functions
116+
FSRM // Fast Short Rep Mov
115117
FXSR // FXSAVE, FXRESTOR instructions, CR4 bit 9
116118
FXSROPT // FXSAVE/FXRSTOR optimizations
117119
GFNI // Galois Field New Instructions. May require other features (AVX, AVX512VL,AVX512F) based on usage.
118120
HLE // Hardware Lock Elision
119121
HRESET // If set CPU supports history reset and the IA32_HRESET_ENABLE MSR
120122
HTT // Hyperthreading (enabled)
121123
HWA // Hardware assert supported. Indicates support for MSRC001_10
124+
HYBRID_CPU // This part has CPUs of more than one type.
122125
HYPERVISOR // This bit has been reserved by Intel & AMD for use by hypervisors
126+
IA32_ARCH_CAP // IA32_ARCH_CAPABILITIES MSR (Intel)
127+
IA32_CORE_CAP // IA32_CORE_CAPABILITIES MSR
123128
IBPB // Indirect Branch Restricted Speculation (IBRS) and Indirect Branch Predictor Barrier (IBPB)
124129
IBS // Instruction Based Sampling (AMD)
125130
IBSBRNTRGT // Instruction Based Sampling Feature (AMD)
@@ -138,7 +143,9 @@ const (
138143
LBRVIRT // LBR virtualization
139144
LZCNT // LZCNT instruction
140145
MCAOVERFLOW // MCA overflow recovery support.
146+
MCDT_NO // Processor do not exhibit MXCSR Configuration Dependent Timing behavior and do not need to mitigate it.
141147
MCOMMIT // MCOMMIT instruction supported
148+
MD_CLEAR // VERW clears CPU buffers
142149
MMX // standard MMX
143150
MMXEXT // SSE integer functions or AMD MMX ext
144151
MOVBE // MOVBE instruction (big-endian)
@@ -172,6 +179,8 @@ const (
172179
SHA // Intel SHA Extensions
173180
SME // AMD Secure Memory Encryption supported
174181
SME_COHERENT // AMD Hardware cache coherency across encryption domains enforced
182+
SPEC_CTRL_SSBD // Speculative Store Bypass Disable
183+
SRBDS_CTRL // SRBDS mitigation MSR available
175184
SSE // SSE functions
176185
SSE2 // P4 SSE functions
177186
SSE3 // Prescott SSE3 functions
@@ -192,8 +201,8 @@ const (
192201
SYSCALL // System-Call Extension (SCE): SYSCALL and SYSRET instructions.
193202
SYSEE // SYSENTER and SYSEXIT instructions
194203
TBM // AMD Trailing Bit Manipulation
195-
TOPEXT // TopologyExtensions: topology extensions support. Indicates support for CPUID Fn8000_001D_EAX_x[N:0]-CPUID Fn8000_001E_EDX.
196204
TME // Intel Total Memory Encryption. The following MSRs are supported: IA32_TME_CAPABILITY, IA32_TME_ACTIVATE, IA32_TME_EXCLUDE_MASK, and IA32_TME_EXCLUDE_BASE.
205+
TOPEXT // TopologyExtensions: topology extensions support. Indicates support for CPUID Fn8000_001D_EAX_x[N:0]-CPUID Fn8000_001E_EDX.
197206
TSCRATEMSR // MSR based TSC rate control. Indicates support for MSR TSC ratio MSRC000_0104
198207
TSXLDTRK // Intel TSX Suspend Load Address Tracking
199208
VAES // Vector AES. AVX(512) versions requires additional checks.
@@ -1093,13 +1102,21 @@ func support() flagSet {
10931102
fs.setIf(ecx&(1<<30) != 0, SGXLC)
10941103

10951104
// CPUID.(EAX=7, ECX=0).EDX
1105+
fs.setIf(edx&(1<<4) != 0, FSRM)
1106+
fs.setIf(edx&(1<<9) != 0, SRBDS_CTRL)
1107+
fs.setIf(edx&(1<<10) != 0, MD_CLEAR)
10961108
fs.setIf(edx&(1<<11) != 0, RTM_ALWAYS_ABORT)
10971109
fs.setIf(edx&(1<<14) != 0, SERIALIZE)
1110+
fs.setIf(edx&(1<<15) != 0, HYBRID_CPU)
10981111
fs.setIf(edx&(1<<16) != 0, TSXLDTRK)
10991112
fs.setIf(edx&(1<<18) != 0, PCONFIG)
11001113
fs.setIf(edx&(1<<20) != 0, CETIBT)
11011114
fs.setIf(edx&(1<<26) != 0, IBPB)
11021115
fs.setIf(edx&(1<<27) != 0, STIBP)
1116+
fs.setIf(edx&(1<<28) != 0, FLUSH_L1D)
1117+
fs.setIf(edx&(1<<29) != 0, IA32_ARCH_CAP)
1118+
fs.setIf(edx&(1<<30) != 0, IA32_CORE_CAP)
1119+
fs.setIf(edx&(1<<31) != 0, SPEC_CTRL_SSBD)
11031120

11041121
// CPUID.(EAX=7, ECX=1)
11051122
eax1, _, _, _ := cpuidex(7, 1)
@@ -1147,7 +1164,12 @@ func support() flagSet {
11471164
fs.setIf(eax1&(1<<5) != 0, AVX512BF16)
11481165
}
11491166
}
1167+
1168+
// CPUID.(EAX=7, ECX=2)
1169+
_, _, _, edx = cpuidex(7, 2)
1170+
fs.setIf(edx&(1<<5) != 0, MCDT_NO)
11501171
}
1172+
11511173
// Processor Extended State Enumeration Sub-leaf (EAX = 0DH, ECX = 1)
11521174
// EAX
11531175
// Bit 00: XSAVEOPT is available.

featureid_string.go

Lines changed: 138 additions & 129 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)