aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/compat/compat.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-31 21:45:42 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-31 21:45:42 +0200
commite2410120a89079056e554f8363c08477def685d3 (patch)
tree0d67d555a20e3b5f78906e3a388f144e15eeb0f8 /src/compat/compat.h
parentblake2s: add ssse3 to nobs (diff)
downloadwireguard-linux-compat-e2410120a89079056e554f8363c08477def685d3.tar.xz
wireguard-linux-compat-e2410120a89079056e554f8363c08477def685d3.zip
compat: don't call xgetbv on cpus with no XSAVE
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/compat/compat.h')
-rw-r--r--src/compat/compat.h2
1 files changed, 1 insertions, 1 deletions
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 <asm/xcr.h>
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