summaryrefslogtreecommitdiffhomepage
path: root/pkg/cpuid/cpuid.go
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2021-09-01 10:27:30 -0700
committergVisor bot <gvisor-bot@google.com>2021-09-01 10:29:51 -0700
commit810ea0957517bcfc459627aeb10a3594340c895b (patch)
treef82824f83afb1241fd66b8271b262a4eb5dc2a91 /pkg/cpuid/cpuid.go
parentc5cc6a65664fed83932596abf2a446a93e357bbe (diff)
Cache cpuid.HostFeatureSet().
PiperOrigin-RevId: 394261815
Diffstat (limited to 'pkg/cpuid/cpuid.go')
-rw-r--r--pkg/cpuid/cpuid.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/cpuid/cpuid.go b/pkg/cpuid/cpuid.go
index 69eeb7528..4d5e062a8 100644
--- a/pkg/cpuid/cpuid.go
+++ b/pkg/cpuid/cpuid.go
@@ -37,6 +37,14 @@ package cpuid
// arch/arm64/include/uapi/asm/hwcap.h
type Feature int
+// HostFeatureSet returns a FeatureSet that matches that of the host machine.
+// Callers must not mutate the returned FeatureSet.
+func HostFeatureSet() *FeatureSet {
+ return hostFeatureSet
+}
+
+var hostFeatureSet = getHostFeatureSet()
+
// ErrIncompatible is returned by FeatureSet.HostCompatible if fs is not a
// subset of the host feature set.
type ErrIncompatible struct {