r31905 - in trunk: cpudetect.c cpudetect.h loader/win32.c
Author: reimar Date: Mon Aug 2 19:39:20 2010 New Revision: 31905 Log: Reuse do_cpuid from cpudetect.c in loader/win32.c. Also avoids several "used uninitialized" warnings. Modified: trunk/cpudetect.c trunk/cpudetect.h trunk/loader/win32.c Modified: trunk/cpudetect.c ============================================================================== --- trunk/cpudetect.c Mon Aug 2 19:36:16 2010 (r31904) +++ trunk/cpudetect.c Mon Aug 2 19:39:20 2010 (r31905) @@ -89,7 +89,7 @@ static int has_cpuid(void) #endif } -static void +void do_cpuid(unsigned int ax, unsigned int *p) { // code from libavcodec: Modified: trunk/cpudetect.h ============================================================================== --- trunk/cpudetect.h Mon Aug 2 19:36:16 2010 (r31904) +++ trunk/cpudetect.h Mon Aug 2 19:39:20 2010 (r31905) @@ -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 */ Modified: trunk/loader/win32.c ============================================================================== --- trunk/loader/win32.c Mon Aug 2 19:36:16 2010 (r31904) +++ trunk/loader/win32.c Mon Aug 2 19:39:20 2010 (r31905) @@ -76,22 +76,8 @@ for DLL to know too much about its envir #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;
participants (1)
-
reimar