aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kurshev <nickols_k@mail.ru>2001-08-05 16:49:57 +0000
committerNick Kurshev <nickols_k@mail.ru>2001-08-05 16:49:57 +0000
commit1d20b11aa4baddd14212c094e3da0a9891652089 (patch)
treefaf5cdb31ebbcf6e8829224f239bb4e49632b537
parent612476ef9b9a008e1f8703cd592d40377f6b1ebf (diff)
downloadffmpeg-1d20b11aa4baddd14212c094e3da0a9891652089.tar.gz
Suppressing external gas stuff to improve portability to Win32
Originally committed as revision 33 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/Makefile5
-rw-r--r--libavcodec/i386/cpuid.s31
-rw-r--r--libavcodec/i386/cputest.c21
3 files changed, 15 insertions, 42 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index de9376bb0d..251c3e6b99 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -25,7 +25,7 @@ endif
# i386 mmx specific stuff
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 \
i386/dsputil_mmx.o i386/mpegvideo_mmx.o
endif
@@ -47,9 +47,6 @@ dsputil.o: dsputil.c dsputil.h
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
-i386/cpuid.o: i386/cpuid.s
- $(CC) -c -o $@ $<
-
%.o: %.s
nasm -f elf -o $@ $<
diff --git a/libavcodec/i386/cpuid.s b/libavcodec/i386/cpuid.s
deleted file mode 100644
index c25367e0d5..0000000000
--- a/libavcodec/i386/cpuid.s
+++ /dev/null
@@ -1,31 +0,0 @@
- .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
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;