# HG changeset patch # User reimar # Date 1280770760 0 # Node ID f3aed7bffcbb2285753c5c4f6177b80d485b909d # Parent 544f29a58a6b20555ffc9dc0f4f0c1617c94727f Reuse do_cpuid from cpudetect.c in loader/win32.c. Also avoids several "used uninitialized" warnings. diff -r 544f29a58a6b -r f3aed7bffcbb cpudetect.c --- a/cpudetect.c Mon Aug 02 17:36:16 2010 +0000 +++ b/cpudetect.c Mon Aug 02 17:39:20 2010 +0000 @@ -89,7 +89,7 @@ #endif } -static void +void do_cpuid(unsigned int ax, unsigned int *p) { // code from libavcodec: diff -r 544f29a58a6b -r f3aed7bffcbb cpudetect.h --- a/cpudetect.h Mon Aug 02 17:36:16 2010 +0000 +++ b/cpudetect.h Mon Aug 02 17:39:20 2010 +0000 @@ -49,6 +49,8 @@ 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 -r 544f29a58a6b -r f3aed7bffcbb loader/win32.c --- a/loader/win32.c Mon Aug 02 17:36:16 2010 +0000 +++ b/loader/win32.c Mon Aug 02 17:39:20 2010 +0000 @@ -76,22 +76,8 @@ #endif #include "osdep/mmap_anon.h" #include "libavutil/avstring.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) - ); -} +#include "cpudetect.h" + static unsigned int c_localcount_tsc(void) { int a;