From 04ce30b2fd2d47138da25b759d20d68a89feacdb Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 2 Aug 2010 17:39:20 +0000 Subject: loader: Reuse do_cpuid from cpudetect.c in loader/win32.c Also avoids several "used uninitialized" warnings. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31905 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cpudetect.c | 2 +- cpudetect.h | 2 ++ loader/win32.c | 16 +--------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/cpudetect.c b/cpudetect.c index d39026ea40..d394bdcdab 100644 --- a/cpudetect.c +++ b/cpudetect.c @@ -89,7 +89,7 @@ static int has_cpuid(void) #endif } -static void +void do_cpuid(unsigned int ax, unsigned int *p) { // code from libavcodec: diff --git a/cpudetect.h b/cpudetect.h index 38a7b79d11..5ff6c5a78b 100644 --- a/cpudetect.h +++ b/cpudetect.h @@ -49,6 +49,8 @@ typedef struct cpucaps_s { extern CpuCaps gCpuCaps; +void do_cpuid(unsigned int ax, unsigned int *p); + void GetCpuCaps(CpuCaps *caps); /* returned value is malloc()'ed so free() it after use */ diff --git a/loader/win32.c b/loader/win32.c index becfd51e85..13ac8d4a28 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -76,22 +76,8 @@ for DLL to know too much about its environment. #endif #include "osdep/mmap_anon.h" #include "libavutil/avstring.h" +#include "cpudetect.h" -static void do_cpuid(unsigned int ax, unsigned int *regs) -{ - __asm__ volatile - ( - "pushl %%ebx; pushl %%ecx; pushl %%edx;" - ".byte 0x0f, 0xa2;" - "movl %%eax, (%2);" - "movl %%ebx, 4(%2);" - "movl %%ecx, 8(%2);" - "movl %%edx, 12(%2);" - "popl %%edx; popl %%ecx; popl %%ebx;" - : "=a" (ax) - : "0" (ax), "S" (regs) - ); -} static unsigned int c_localcount_tsc(void) { int a; -- cgit v1.2.3