From 7fcf98db0df9cc374e8afe88aa57a19b0768d5ee Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 31 May 2019 21:45:42 +0200 Subject: compat: don't call xgetbv on cpus with no XSAVE --- src/compat/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/compat/compat.h b/src/compat/compat.h index c34f754..861601c 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -599,7 +599,7 @@ static int wg_get_device_dump_real(a, b) #include static inline int cpu_has_xfeatures(u64 xfeatures_needed, const char **feature_name) { - return xgetbv(XCR_XFEATURE_ENABLED_MASK) & xfeatures_needed; + return boot_cpu_has(X86_FEATURE_XSAVE) && xgetbv(XCR_XFEATURE_ENABLED_MASK) & xfeatures_needed; } #endif #ifndef XFEATURE_MASK_YMM -- cgit v1.2.3-59-g8ed1b