From c0ee695bd7b278f83252c9f93803b107d7aa1e9a Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 9 Jul 2012 02:21:27 +0200 Subject: x86/cpu: implement support for cpuid through intrinsics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavutil/x86/cpu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libavutil/x86/cpu.c') diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c index dfdc12394c..7d65c6075e 100644 --- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -25,6 +25,7 @@ #include "libavutil/x86_cpu.h" #include "libavutil/cpu.h" +#if HAVE_INLINE_ASM /* ebx saving is necessary for PIC. gcc seems unable to see it alone */ #define cpuid(index, eax, ebx, ecx, edx) \ __asm__ volatile ( \ @@ -33,6 +34,19 @@ "xchg %%"REG_b", %%"REG_S \ : "=a" (eax), "=S" (ebx), "=c" (ecx), "=d" (edx) \ : "0" (index)) +#elif HAVE_CPUID +#include + +#define cpuid(index, eax, ebx, ecx, edx) \ + do { \ + int info[4]; \ + __cpuid(info, index); \ + eax = info[0]; \ + ebx = info[1]; \ + ecx = info[2]; \ + edx = info[3]; \ + } while (0) +#endif /* HAVE_CPUID */ #if HAVE_INLINE_ASM #define xgetbv(index, eax, edx) \ -- cgit v1.2.3