summaryrefslogtreecommitdiffstats
path: root/mp3lib
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-24 00:05:43 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-24 00:05:43 +0000
commite12f387870ff1bc1356e0dd514870c06b24aa2c2 (patch)
tree32599635c88fa0bf43c64db640fb571659ece2eb /mp3lib
parent6ebd5ba5f32a573b422e73390d5b4761afdc3bf4 (diff)
downloadmpv-e12f387870ff1bc1356e0dd514870c06b24aa2c2.tar.bz2
mpv-e12f387870ff1bc1356e0dd514870c06b24aa2c2.tar.xz
decode_i586.c version uses %ebp for its own use, so:
- we need to compile this with -fomit-frame-pointer or we cannot access the function parameters - we need to save & restore %ebp, or we'll destroy the caller's stack ptr git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8544 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mp3lib')
-rw-r--r--mp3lib/Makefile7
-rw-r--r--mp3lib/decod386.c12
-rw-r--r--mp3lib/decode_i586.c5
3 files changed, 15 insertions, 9 deletions
diff --git a/mp3lib/Makefile b/mp3lib/Makefile
index f56d2ffd7f..4a7737a2e2 100644
--- a/mp3lib/Makefile
+++ b/mp3lib/Makefile
@@ -27,9 +27,14 @@ endif
# .PHONY: all clean
+all: libMP3.a
+
.c.o:
$(CC) -c $(CFLAGS) -o $@ $<
+decode_i586.o: decode_i586.c
+ $(CC) -c $(CFLAGS) -fomit-frame-pointer -o $@ $<
+
.s.o:
$(CC) -c $(CFLAGS) -o $@ $<
@@ -47,8 +52,6 @@ test1: libMP3.a test.c
test2: libMP3.a test2.c
$(CC) $(CFLAGS) test2.c ../libvo/aclib.c -o test2 -I.. ./libMP3.a ../mp_msg-mencoder.o ../cpudetect.o -lm
-all: libMP3.a
-
clean:
rm -f *~ *.o *.a
diff --git a/mp3lib/decod386.c b/mp3lib/decod386.c
index ca9979b2a4..efbcae0f3b 100644
--- a/mp3lib/decod386.c
+++ b/mp3lib/decod386.c
@@ -164,18 +164,19 @@ static int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt)
static const int step = 2;
static int bo = 1;
short *samples = (short *) (out + *pnt);
-
real *b0,(*buf)[0x110];
int clip = 0;
int bo1;
+
+ *pnt += 128;
+
/* optimized for x86 */
#if defined(CAN_COMPILE_X86_ASM)
if ( synth_func )
{
- int ret;
- ret=(*synth_func)( bandPtr,channel,samples);
- *pnt+=128;
- return ret;
+// printf("Calling %p, bandPtr=%p channel=%d samples=%p\n",synth_func,bandPtr,channel,samples);
+ // FIXME: synth_func() may destroy EBP, don't rely on stack contents!!!
+ return (*synth_func)( bandPtr,channel,samples);
}
#endif
if(!channel) { /* channel=0 */
@@ -264,7 +265,6 @@ static int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt)
WRITE_SAMPLE(samples,sum,clip);
}
}
- *pnt += 128;
return clip;
diff --git a/mp3lib/decode_i586.c b/mp3lib/decode_i586.c
index c898085ff5..a2d0a65b43 100644
--- a/mp3lib/decode_i586.c
+++ b/mp3lib/decode_i586.c
@@ -28,12 +28,14 @@
static long buffs[1088];
static long bo=1;
+static long saved_ebp;
int synth_1to1_pent(real *bandPtr, int channel, short *samples)
{
real tmp[3];
register int retval;
__asm __volatile(
+" movl %%ebp,"MANGLE(saved_ebp)"\n\t"
" movl %1,%%eax\n\t"/*bandPtr*/
" movl %3,%%esi\n\t"
" xorl %%edi,%%edi\n\t"
@@ -301,8 +303,9 @@ int synth_1to1_pent(real *bandPtr, int channel, short *samples)
" decl %%ebp\n\t"
" jnz .L68\n\t"
" movl %%edi,%%eax\n\t"
+" movl "MANGLE(saved_ebp)",%%ebp\n\t"
:"=a"(retval)
:"m"(bandPtr),"m"(channel),"m"(samples),"m"(tmp[0])
- :"memory","%ebp","%edi","%esi","%ebx");
+ :"memory","%edi","%esi","%ebx");
return retval;
}