diff options
author | Michael Pratt <mpratt@google.com> | 2018-10-30 15:55:22 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-30 15:56:12 -0700 |
commit | 245d81561b521bb94e3aa88fb704b967b023b0f1 (patch) | |
tree | 3f28f86ef977a27ba82b2976536f9f1581462f1c /pkg/cpuid/cpuid.go | |
parent | 805a27c441c2ca133a3a37dc45f79286b5044a70 (diff) |
Clean up cpuid_parse_test
Actually parse flags from cpuinfo to avoid mistakenly matching
substrings in cpuinfo that happen to match a flags.
Some features were only exposed in recent versions of Linux. Don't
require them to appear in cpuinfo on old versions of Linux.
Move PREFETCHWT1 back to parse only features. It isn't actually exposed
in Linux yet. Move SDBG to shown features. It has been visible since
Linux 4.3.
PiperOrigin-RevId: 219381731
Change-Id: Ied7c0ee7c8a9879683e81933de56c9074b01108f
Diffstat (limited to 'pkg/cpuid/cpuid.go')
-rw-r--r-- | pkg/cpuid/cpuid.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pkg/cpuid/cpuid.go b/pkg/cpuid/cpuid.go index f4b1db896..c19606898 100644 --- a/pkg/cpuid/cpuid.go +++ b/pkg/cpuid/cpuid.go @@ -274,6 +274,7 @@ var x86FeatureStrings = map[Feature]string{ X86FeatureTM2: "tm2", X86FeatureSSSE3: "ssse3", X86FeatureCNXTID: "cid", + X86FeatureSDBG: "sdbg", X86FeatureFMA: "fma", X86FeatureCX16: "cx16", X86FeatureXTPR: "xtpr", @@ -352,10 +353,9 @@ var x86FeatureStrings = map[Feature]string{ X86FeatureAVX512VL: "avx512vl", // Block 3. - X86FeaturePREFETCHWT1: "prefetchwt1", - X86FeatureAVX512VBMI: "avx512vbmi", - X86FeatureUMIP: "umip", - X86FeaturePKU: "pku", + X86FeatureAVX512VBMI: "avx512vbmi", + X86FeatureUMIP: "umip", + X86FeaturePKU: "pku", // Block 4. X86FeatureXSAVEOPT: "xsaveopt", @@ -405,7 +405,6 @@ var x86FeatureStrings = map[Feature]string{ // flags, but will not get printed out in /proc/cpuinfo. var x86FeatureParseOnlyStrings = map[Feature]string{ // Block 0. - X86FeatureSDBG: "sdbg", X86FeatureOSXSAVE: "osxsave", // Block 2. @@ -414,6 +413,9 @@ var x86FeatureParseOnlyStrings = map[Feature]string{ X86FeatureIPT: "pt", X86FeatureCLFLUSHOPT: "clfushopt", + // Block 3. + X86FeaturePREFETCHWT1: "prefetchwt1", + // Block 4. X86FeatureXSAVES: "xsaves", } |