Commit 1d20b11a authored by Nick Kurshev's avatar Nick Kurshev

Suppressing external gas stuff to improve portability to Win32


Originally committed as revision 33 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 612476ef
...@@ -25,7 +25,7 @@ endif ...@@ -25,7 +25,7 @@ endif
# i386 mmx specific stuff # i386 mmx specific stuff
ifeq ($(TARGET_MMX),yes) ifeq ($(TARGET_MMX),yes)
ASM_OBJS += i386/fdct_mmx.o i386/sad_mmx.o i386/cpuid.o ASM_OBJS += i386/fdct_mmx.o i386/sad_mmx.o
OBJS += i386/fdctdata.o i386/cputest.o \ OBJS += i386/fdctdata.o i386/cputest.o \
i386/dsputil_mmx.o i386/mpegvideo_mmx.o i386/dsputil_mmx.o i386/mpegvideo_mmx.o
endif endif
...@@ -47,9 +47,6 @@ dsputil.o: dsputil.c dsputil.h ...@@ -47,9 +47,6 @@ dsputil.o: dsputil.c dsputil.h
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
i386/cpuid.o: i386/cpuid.s
$(CC) -c -o $@ $<
%.o: %.s %.o: %.s
nasm -f elf -o $@ $< nasm -f elf -o $@ $<
......
.file "cpuid.s"
.version "01.01"
gcc2_compiled.:
.text
.align 4
.globl cpuid
.type cpuid,@function
cpuid:
pushl %ebp
movl %esp,%ebp
pushl %edi
pushl %esi
pushl %ebx
movl 8(%ebp),%eax
movl 12(%ebp),%edi
movl 24(%ebp),%esi
cpuid
movl %eax,(%edi)
movl 16(%ebp),%eax
movl %ebx,(%eax)
movl 20(%ebp),%eax
movl %ecx,(%eax)
movl %edx,(%esi)
popl %ebx
popl %esi
popl %edi
leave
ret
.Lfe1:
.size cpuid,.Lfe1-cpuid
.align 4
...@@ -4,8 +4,15 @@ ...@@ -4,8 +4,15 @@
#include <stdlib.h> #include <stdlib.h>
#include "../dsputil.h" #include "../dsputil.h"
/* need this external function to solve -fPIC ebx issues ! */ /* ebx saving is necessary for PIC. gcc seems unable to see it alone */
extern void cpuid(int index, int *eax, int *ebx, int *ecx, int *edx); #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... */ /* Function to test if multimedia instructions are supported... */
int mm_support(void) int mm_support(void)
...@@ -37,7 +44,7 @@ int mm_support(void) ...@@ -37,7 +44,7 @@ int mm_support(void)
if (eax == ecx) if (eax == ecx)
return 0; /* CPUID not supported */ return 0; /* CPUID not supported */
cpuid(0, &eax, &ebx, &ecx, &edx); cpuid(0, eax, ebx, ecx, edx);
if (ebx == 0x756e6547 && if (ebx == 0x756e6547 &&
edx == 0x49656e69 && edx == 0x49656e69 &&
...@@ -45,7 +52,7 @@ int mm_support(void) ...@@ -45,7 +52,7 @@ int mm_support(void)
/* intel */ /* intel */
inteltest: inteltest:
cpuid(1, &eax, &ebx, &ecx, &edx); cpuid(1, eax, ebx, ecx, edx);
if ((edx & 0x00800000) == 0) if ((edx & 0x00800000) == 0)
return 0; return 0;
rval = MM_MMX; rval = MM_MMX;
...@@ -58,10 +65,10 @@ int mm_support(void) ...@@ -58,10 +65,10 @@ int mm_support(void)
edx == 0x69746e65 && edx == 0x69746e65 &&
ecx == 0x444d4163) { ecx == 0x444d4163) {
/* AMD */ /* AMD */
cpuid(0x80000000, &eax, &ebx, &ecx, &edx); cpuid(0x80000000, eax, ebx, ecx, edx);
if ((unsigned)eax < 0x80000001) if ((unsigned)eax < 0x80000001)
goto inteltest; goto inteltest;
cpuid(0x80000001, &eax, &ebx, &ecx, &edx); cpuid(0x80000001, eax, ebx, ecx, edx);
if ((edx & 0x00800000) == 0) if ((edx & 0x00800000) == 0)
return 0; return 0;
rval = MM_MMX; rval = MM_MMX;
...@@ -84,7 +91,7 @@ int mm_support(void) ...@@ -84,7 +91,7 @@ int mm_support(void)
*/ */
if (eax != 2) if (eax != 2)
goto inteltest; goto inteltest;
cpuid(0x80000001, &eax, &ebx, &ecx, &edx); cpuid(0x80000001, eax, ebx, ecx, edx);
if ((eax & 0x00800000) == 0) if ((eax & 0x00800000) == 0)
return 0; return 0;
rval = MM_MMX; rval = MM_MMX;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment