Refs #187. Use binary code for xgetbv, which is compatible with old compiler.
authorZhang Xianyi <traits.zhang@gmail.com>
Mon, 21 Jan 2013 16:18:21 +0000 (00:18 +0800)
committerZhang Xianyi <traits.zhang@gmail.com>
Mon, 21 Jan 2013 16:25:08 +0000 (00:25 +0800)
cpuid_x86.c
driver/others/dynamic.c

index b335224..a19dede 100644 (file)
@@ -116,8 +116,9 @@ static inline int have_excpuid(void){
 
 #ifndef NO_AVX
 static inline void xgetbv(int op, int * eax, int * edx){
+  //Use binary code for xgetbv
   __asm__ __volatile__
-    ("xgetbv": "=a" (*eax), "=d" (*edx) : "c" (op) : "cc");
+    (".byte 0x0f, 0x01, 0xd0": "=a" (*eax), "=d" (*edx) : "c" (op) : "cc");
 }
 #endif
 
index 28fdd30..b6f27d0 100644 (file)
@@ -78,8 +78,9 @@ extern gotoblas_t  gotoblas_SANDYBRIDGE;
 
 #ifndef NO_AVX
 static inline void xgetbv(int op, int * eax, int * edx){
+  //Use binary code for xgetbv
   __asm__ __volatile__
-    ("xgetbv": "=a" (*eax), "=d" (*edx) : "c" (op) : "cc");
+    (".byte 0x0f, 0x01, 0xd0": "=a" (*eax), "=d" (*edx) : "c" (op) : "cc");
 }
 #endif