diff options
author | Nick Kurshev <nickols_k@mail.ru> | 2001-08-05 16:49:57 +0000 |
---|---|---|
committer | Nick Kurshev <nickols_k@mail.ru> | 2001-08-05 16:49:57 +0000 |
commit | 1d20b11aa4baddd14212c094e3da0a9891652089 (patch) | |
tree | faf5cdb31ebbcf6e8829224f239bb4e49632b537 /libavcodec/i386/cputest.c | |
parent | 612476ef9b9a008e1f8703cd592d40377f6b1ebf (diff) | |
download | ffmpeg-1d20b11aa4baddd14212c094e3da0a9891652089.tar.gz |
Suppressing external gas stuff to improve portability to Win32
Originally committed as revision 33 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/i386/cputest.c')
-rw-r--r-- | libavcodec/i386/cputest.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libavcodec/i386/cputest.c b/libavcodec/i386/cputest.c index 3de21a708b..4847bac15d 100644 --- a/libavcodec/i386/cputest.c +++ b/libavcodec/i386/cputest.c @@ -4,8 +4,15 @@ #include <stdlib.h> #include "../dsputil.h" -/* need this external function to solve -fPIC ebx issues ! */ -extern void cpuid(int index, int *eax, int *ebx, int *ecx, int *edx); +/* ebx saving is necessary for PIC. gcc seems unable to see it alone */ +#define cpuid(index,eax,ebx,ecx,edx)\ + asm ("movl %%ebx, %%esi\n\t"\ + "cpuid\n\t"\ + "xchgl %%ebx, %%esi"\ + : "=a" (eax), "=S" (ebx),\ + "=c" (ecx), "=d" (edx)\ + : "0" (index)\ + : "cc")\ /* Function to test if multimedia instructions are supported... */ int mm_support(void) @@ -37,7 +44,7 @@ int mm_support(void) if (eax == ecx) return 0; /* CPUID not supported */ - cpuid(0, &eax, &ebx, &ecx, &edx); + cpuid(0, eax, ebx, ecx, edx); if (ebx == 0x756e6547 && edx == 0x49656e69 && @@ -45,7 +52,7 @@ int mm_support(void) /* intel */ inteltest: - cpuid(1, &eax, &ebx, &ecx, &edx); + cpuid(1, eax, ebx, ecx, edx); if ((edx & 0x00800000) == 0) return 0; rval = MM_MMX; @@ -58,10 +65,10 @@ int mm_support(void) edx == 0x69746e65 && ecx == 0x444d4163) { /* AMD */ - cpuid(0x80000000, &eax, &ebx, &ecx, &edx); + cpuid(0x80000000, eax, ebx, ecx, edx); if ((unsigned)eax < 0x80000001) goto inteltest; - cpuid(0x80000001, &eax, &ebx, &ecx, &edx); + cpuid(0x80000001, eax, ebx, ecx, edx); if ((edx & 0x00800000) == 0) return 0; rval = MM_MMX; @@ -84,7 +91,7 @@ int mm_support(void) */ if (eax != 2) goto inteltest; - cpuid(0x80000001, &eax, &ebx, &ecx, &edx); + cpuid(0x80000001, eax, ebx, ecx, edx); if ((eax & 0x00800000) == 0) return 0; rval = MM_MMX; |