mirror of https://github.com/mpv-player/mpv
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
This commit is contained in:
parent
4843c8d7d9
commit
04ce30b2fd
|
@ -89,7 +89,7 @@ static int has_cpuid(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
do_cpuid(unsigned int ax, unsigned int *p)
|
do_cpuid(unsigned int ax, unsigned int *p)
|
||||||
{
|
{
|
||||||
// code from libavcodec:
|
// code from libavcodec:
|
||||||
|
|
|
@ -49,6 +49,8 @@ typedef struct cpucaps_s {
|
||||||
|
|
||||||
extern CpuCaps gCpuCaps;
|
extern CpuCaps gCpuCaps;
|
||||||
|
|
||||||
|
void do_cpuid(unsigned int ax, unsigned int *p);
|
||||||
|
|
||||||
void GetCpuCaps(CpuCaps *caps);
|
void GetCpuCaps(CpuCaps *caps);
|
||||||
|
|
||||||
/* returned value is malloc()'ed so free() it after use */
|
/* returned value is malloc()'ed so free() it after use */
|
||||||
|
|
|
@ -76,22 +76,8 @@ for DLL to know too much about its environment.
|
||||||
#endif
|
#endif
|
||||||
#include "osdep/mmap_anon.h"
|
#include "osdep/mmap_anon.h"
|
||||||
#include "libavutil/avstring.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)
|
static unsigned int c_localcount_tsc(void)
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
|
|
Loading…
Reference in New Issue