]> wimlib.net Git - wimlib/blobdiff - src/x86_cpu_features.c
x86_cpu_features.c: include "config.h"
[wimlib] / src / x86_cpu_features.c
index aab200ffe5f2bb9b682592f8c4dee461234c2dbd..786dce2b1b43c9264ff2f310ed77f119aea2733c 100644 (file)
  * You can do whatever you want with this file.
  */
 
  * You can do whatever you want with this file.
  */
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include "wimlib/x86_cpu_features.h"
 
 #if defined(__i386__) || defined(__x86_64__)
 #include "wimlib/x86_cpu_features.h"
 
 #if defined(__i386__) || defined(__x86_64__)
@@ -47,7 +51,9 @@ read_xcr(u32 index)
 {
        u32 edx, eax;
 
 {
        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;
 }
 
        return ((u64)edx << 32) | eax;
 }