[Mplayer-cvslog] CVS: main/mp3lib Makefile,1.30,1.31 decod386.c,1.12,1.13 decode_i586.c,1.2,1.3

Arpi of Ize arpi at mplayerhq.hu
Tue Dec 24 01:06:00 CET 2002


Update of /cvsroot/mplayer/main/mp3lib
In directory mail:/var/tmp.root/cvs-serv30611

Modified Files:
	Makefile decod386.c decode_i586.c 
Log Message:
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


Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/mp3lib/Makefile,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- Makefile	1 Sep 2002 18:25:24 -0000	1.30
+++ Makefile	24 Dec 2002 00:05:43 -0000	1.31
@@ -27,9 +27,14 @@
 
 # .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 $@ $<
 
@@ -46,8 +51,6 @@
 
 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

Index: decod386.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp3lib/decod386.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- decod386.c	6 Sep 2002 17:34:52 -0000	1.12
+++ decod386.c	24 Dec 2002 00:05:43 -0000	1.13
@@ -164,18 +164,19 @@
   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 @@
       WRITE_SAMPLE(samples,sum,clip);
     }
   }
-  *pnt += 128;
 
   return clip;
 

Index: decode_i586.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp3lib/decode_i586.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- decode_i586.c	19 Jan 2002 04:47:32 -0000	1.2
+++ decode_i586.c	24 Dec 2002 00:05:43 -0000	1.3
@@ -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 @@
 "        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;
 }




More information about the MPlayer-cvslog mailing list