changeset 31826:f3aed7bffcbb

Reuse do_cpuid from cpudetect.c in loader/win32.c. Also avoids several "used uninitialized" warnings.
author reimar
date Mon, 02 Aug 2010 17:39:20 +0000
parents 544f29a58a6b
children e70731bf56be
files cpudetect.c cpudetect.h loader/win32.c
diffstat 3 files changed, 5 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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:
--- 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 */
--- 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;