@@ -192,7 +192,7 @@ func Detect() {
192192 CPU .CacheLine = cacheLine ()
193193 CPU .Family , CPU .Model = familyModel ()
194194 CPU .Features = support ()
195- CPU .SGX = sgx (CPU .Features & SGX != 0 )
195+ CPU .SGX = hasSGX (CPU .Features & SGX != 0 )
196196 CPU .ThreadsPerCore = threadsPerCore ()
197197 CPU .LogicalCores = logicalCores ()
198198 CPU .PhysicalCores = physicalCores ()
@@ -437,14 +437,22 @@ func (c CPUInfo) ERMS() bool {
437437 return c .Features & ERMS != 0
438438}
439439
440+ // RDTSCP Instruction is available.
440441func (c CPUInfo ) RDTSCP () bool {
441442 return c .Features & RDTSCP != 0
442443}
443444
445+ // CX16 indicates if CMPXCHG16B instruction is available.
444446func (c CPUInfo ) CX16 () bool {
445447 return c .Features & CX16 != 0
446448}
447449
450+ // TSX is split into HLE (Hardware Lock Elision) and RTM (Restricted Transactional Memory) detection.
451+ // So TSX simply checks that.
452+ func (c CPUInfo ) TSX () bool {
453+ return c .Features & (MPX | RTM ) == MPX | RTM
454+ }
455+
448456// Atom indicates an Atom processor
449457func (c CPUInfo ) Atom () bool {
450458 return c .Features & ATOM != 0
@@ -757,7 +765,7 @@ type SGXSupport struct {
757765 MaxEnclaveSize64 int64
758766}
759767
760- func sgx (available bool ) (rval SGXSupport ) {
768+ func hasSGX (available bool ) (rval SGXSupport ) {
761769 rval .Available = available
762770
763771 if ! available {
0 commit comments