From 56c8b5eaacef8a5563261b9034a8a011480bba6e Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 22 Aug 2015 11:47:15 -0500 Subject: [PATCH] x86_cpu_features.c: xgetbv fix for old binutils --- src/x86_cpu_features.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/x86_cpu_features.c b/src/x86_cpu_features.c index aab200ff..5e434f9f 100644 --- a/src/x86_cpu_features.c +++ b/src/x86_cpu_features.c @@ -47,7 +47,9 @@ read_xcr(u32 index) { u32 edx, eax; - __asm__ ("xgetbv" : "=d" (edx), "=a" (eax) : "c" (index)); + /* Execute the "xgetbv" instruction. Old versions of binutils do not + * recognize this instruction, so list the raw bytes instead. */ + __asm__ (".byte 0x0f, 0x01, 0xd0" : "=d" (edx), "=a" (eax) : "c" (index)); return ((u64)edx << 32) | eax; } -- 2.43.0