]> wimlib.net Git - wimlib/commitdiff
x86_cpu_features.c: xgetbv fix for old binutils
authorEric Biggers <ebiggers3@gmail.com>
Sat, 22 Aug 2015 16:47:15 +0000 (11:47 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 22 Aug 2015 16:47:50 +0000 (11:47 -0500)
src/x86_cpu_features.c

index aab200ffe5f2bb9b682592f8c4dee461234c2dbd..5e434f9f0b18cfcb36ca9559baed4d671d0ec1c7 100644 (file)
@@ -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;
 }