From 8cdb79543823f1da894e18c6487a8d4d9cfdb1c3 Mon Sep 17 00:00:00 2001 From: Zhang Xianyi Date: Tue, 22 Jan 2013 00:18:21 +0800 Subject: [PATCH] Refs #187. Use binary code for xgetbv, which is compatible with old compiler. --- cpuid_x86.c | 3 ++- driver/others/dynamic.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cpuid_x86.c b/cpuid_x86.c index b3352244b..a19dedeee 100644 --- a/cpuid_x86.c +++ b/cpuid_x86.c @@ -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 diff --git a/driver/others/dynamic.c b/driver/others/dynamic.c index 28fdd30d8..b6f27d0ad 100644 --- a/driver/others/dynamic.c +++ b/driver/others/dynamic.c @@ -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