Skip to content

Commit 1a69123

Browse files
authored
Detect Control-flow Enforcement Technology (CET) bits (#93)
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
1 parent eb76847 commit 1a69123

2 files changed

Lines changed: 108 additions & 102 deletions

File tree

cpuid.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ const (
9595
AVXSLOW // Indicates the CPU performs 2 128 bit operations instead of one.
9696
BMI1 // Bit Manipulation Instruction Set 1
9797
BMI2 // Bit Manipulation Instruction Set 2
98+
CETIBT // Intel CET Indirect Branch Tracking
99+
CETSS // Intel CET Shadow Stack
98100
CLDEMOTE // Cache Line Demote
99101
CLMUL // Carry-less Multiplication
100102
CLZERO // CLZERO instruction supported
@@ -993,6 +995,7 @@ func support() flagSet {
993995
fs.setIf(ebx&(1<<29) != 0, SHA)
994996
// CPUID.(EAX=7, ECX=0).ECX
995997
fs.setIf(ecx&(1<<5) != 0, WAITPKG)
998+
fs.setIf(ecx&(1<<7) != 0, CETSS)
996999
fs.setIf(ecx&(1<<25) != 0, CLDEMOTE)
9971000
fs.setIf(ecx&(1<<27) != 0, MOVDIRI)
9981001
fs.setIf(ecx&(1<<28) != 0, MOVDIR64B)
@@ -1002,6 +1005,7 @@ func support() flagSet {
10021005
fs.setIf(edx&(1<<11) != 0, RTM_ALWAYS_ABORT)
10031006
fs.setIf(edx&(1<<14) != 0, SERIALIZE)
10041007
fs.setIf(edx&(1<<16) != 0, TSXLDTRK)
1008+
fs.setIf(edx&(1<<20) != 0, CETIBT)
10051009
fs.setIf(edx&(1<<26) != 0, IBPB)
10061010
fs.setIf(edx&(1<<27) != 0, STIBP)
10071011

featureid_string.go

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

0 commit comments

Comments
 (0)