diff -ur work.orig/MPlayer-1.0pre5/liba52/imdct.c work/MPlayer-1.0pre5/liba52/imdct.c --- work.orig/MPlayer-1.0pre5/liba52/imdct.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/liba52/imdct.c 2004-09-21 00:07:25.984943152 +0200 @@ -782,16 +782,27 @@ /* Pre IFFT complex multiply plus IFFT cmplx conjugate */ /* Bit reversed shuffling */ asm volatile( +#ifdef __PIC__ + "pushl %%ebx\n\t" +#endif "xorl %%esi, %%esi \n\t" "leal "MANGLE(bit_reverse_512)", %%eax \n\t" "movl $1008, %%edi \n\t" "pushl %%ebp \n\t" //use ebp without telling gcc ".balign 16 \n\t" "1: \n\t" +#ifndef __PIC__ "movlps (%0, %%esi), %%xmm0 \n\t" // XXXI "movhps 8(%0, %%edi), %%xmm0 \n\t" // RXXI "movlps 8(%0, %%esi), %%xmm1 \n\t" // XXXi "movhps (%0, %%edi), %%xmm1 \n\t" // rXXi +#else + "movl %[data], %%ebx\n\t" + "movlps (%%ebx, %%esi), %%xmm0 \n\t" // XXXI + "movhps 8(%%ebx, %%edi), %%xmm0 \n\t" // RXXI + "movlps 8(%%ebx, %%esi), %%xmm1 \n\t" // XXXi + "movhps (%%ebx, %%edi), %%xmm1 \n\t" // rXXi +#endif "shufps $0x33, %%xmm1, %%xmm0 \n\t" // irIR "movaps "MANGLE(sseSinCos1c)"(%%esi), %%xmm2\n\t" "mulps %%xmm0, %%xmm2 \n\t" @@ -807,7 +818,14 @@ "subl $16, %%edi \n\t" " jnc 1b \n\t" "popl %%ebp \n\t"//no we didnt touch ebp *g* +#ifdef __PIC__ + "popl %%ebx\n\t" +#endif +#ifndef __PIC__ :: "b" (data), "c" (buf) +#else + :: [data] "g" (data), "c" (buf) +#endif : "%esi", "%edi", "%eax", "%edx" ); diff -ur work.orig/MPlayer-1.0pre5/libavcodec/i386/dsputil_mmx.c work/MPlayer-1.0pre5/libavcodec/i386/dsputil_mmx.c --- work.orig/MPlayer-1.0pre5/libavcodec/i386/dsputil_mmx.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/libavcodec/i386/dsputil_mmx.c 2004-09-21 00:07:25.987942696 +0200 @@ -57,7 +57,7 @@ "pcmpeqd %%" #regd ", %%" #regd " \n\t"\ "paddb %%" #regd ", %%" #regd " \n\t" ::) -#ifndef PIC +#ifndef __PIC__ #define MOVQ_BONE(regd) __asm __volatile ("movq %0, %%" #regd " \n\t" ::"m"(mm_bone)) #define MOVQ_WTWO(regd) __asm __volatile ("movq %0, %%" #regd " \n\t" ::"m"(mm_wtwo)) #else diff -ur work.orig/MPlayer-1.0pre5/libavcodec/i386/dsputil_mmx_rnd.h work/MPlayer-1.0pre5/libavcodec/i386/dsputil_mmx_rnd.h --- work.orig/MPlayer-1.0pre5/libavcodec/i386/dsputil_mmx_rnd.h 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/libavcodec/i386/dsputil_mmx_rnd.h 2004-09-21 00:07:25.988942544 +0200 @@ -96,7 +96,7 @@ "addl %5, %3 \n\t" "subl $4, %0 \n\t" "jnz 1b \n\t" -#ifdef PIC //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cant be used +#ifdef __PIC__ //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cant be used :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst) #else :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) @@ -191,7 +191,7 @@ "addl $32, %2 \n\t" "subl $2, %0 \n\t" "jnz 1b \n\t" -#ifdef PIC //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cant be used +#ifdef __PIC__ //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cant be used :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst) #else :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) diff -ur work.orig/MPlayer-1.0pre5/libavcodec/msmpeg4.c work/MPlayer-1.0pre5/libavcodec/msmpeg4.c --- work.orig/MPlayer-1.0pre5/libavcodec/msmpeg4.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/libavcodec/msmpeg4.c 2004-09-21 00:07:25.990942240 +0200 @@ -716,7 +716,7 @@ necessitate to modify mpegvideo.c. The problem comes from the fact they decided to store the quantized DC (which would lead to problems if Q could vary !) */ -#if defined ARCH_X86 && !defined PIC +#if defined ARCH_X86 && !defined __PIC__ asm volatile( "movl %3, %%eax \n\t" "shrl $1, %%eax \n\t" diff -ur work.orig/MPlayer-1.0pre5/libmpcodecs/vf_decimate.c work/MPlayer-1.0pre5/libmpcodecs/vf_decimate.c --- work.orig/MPlayer-1.0pre5/libmpcodecs/vf_decimate.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/libmpcodecs/vf_decimate.c 2004-09-21 00:10:21.185308648 +0200 @@ -24,6 +24,10 @@ { volatile short out[4]; asm ( +#ifdef __PIC__ + "pushl %%ebx\n\t" + "movl %[ns],%%ebx\n\t" +#endif "movl $8, %%ecx \n\t" "pxor %%mm4, %%mm4 \n\t" "pxor %%mm7, %%mm7 \n\t" @@ -53,8 +57,15 @@ "jnz 1b \n\t" "movq %%mm4, (%%edx) \n\t" "emms \n\t" +#ifdef __PIC__ + "popl %%ebx" +#endif : +#ifndef __PIC__ : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out) +#else + : "S" (old), "D" (new), "a" (os), [ns] "g" (ns), "d" (out) +#endif : "memory" ); return out[0]+out[1]+out[2]+out[3]; diff -ur work.orig/MPlayer-1.0pre5/libmpcodecs/vf_divtc.c work/MPlayer-1.0pre5/libmpcodecs/vf_divtc.c --- work.orig/MPlayer-1.0pre5/libmpcodecs/vf_divtc.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/libmpcodecs/vf_divtc.c 2004-09-21 00:10:43.758876944 +0200 @@ -37,6 +37,10 @@ { volatile short out[4]; asm ( +#ifdef __PIC__ + "pushl %%ebx\n\t" + "movl %[ns],%%ebx\n\t" +#endif "movl $8, %%ecx \n\t" "pxor %%mm4, %%mm4 \n\t" "pxor %%mm7, %%mm7 \n\t" @@ -66,8 +70,15 @@ "jnz 1b \n\t" "movq %%mm4, (%%edx) \n\t" "emms \n\t" +#ifdef __PIC__ + "popl %%ebx" +#endif : +#ifndef __PIC__ : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out) +#else + : "S" (old), "D" (new), "a" (os), [ns] "g" (ns), "d" (out) +#endif : "memory" ); return out[0]+out[1]+out[2]+out[3]; diff -ur work.orig/MPlayer-1.0pre5/libmpcodecs/vf_ilpack.c work/MPlayer-1.0pre5/libmpcodecs/vf_ilpack.c --- work.orig/MPlayer-1.0pre5/libmpcodecs/vf_ilpack.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/libmpcodecs/vf_ilpack.c 2004-09-21 00:11:26.654355840 +0200 @@ -96,6 +96,10 @@ unsigned char *u, unsigned char *v, int w, int us, int vs) { asm volatile ("" +#ifdef __PIC__ + "pushl %%ebx\n\t" + "movl %[v],%%ebx\n\t" +#endif "pushl %%ebp \n\t" "movl 4(%%edx), %%ebp \n\t" "movl (%%edx), %%edx \n\t" @@ -184,8 +188,15 @@ "jnz .Lli0 \n\t" "emms \n\t" "popl %%ebp \n\t" +#ifdef __PIC__ + "pushl %%ebx" +#endif : +#ifndef __PIC__ : "S" (y), "D" (dst), "a" (u), "b" (v), "d" (&us), "c" (w/16) +#else + : "S" (y), "D" (dst), "a" (u), [v] "g" (v), "d" (&us), "c" (w/16) +#endif : "memory" ); pack_li_0_C(dst, y, u, v, (w&15), us, vs); @@ -195,6 +206,10 @@ unsigned char *u, unsigned char *v, int w, int us, int vs) { asm volatile ("" +#ifdef __PIC__ + "pushl %%ebx\n\t" + "movl %[v],%%ebx\n\t" +#endif "pushl %%ebp \n\t" "movl 4(%%edx), %%ebp \n\t" "movl (%%edx), %%edx \n\t" @@ -287,8 +302,15 @@ "jnz .Lli1 \n\t" "emms \n\t" "popl %%ebp \n\t" +#ifdef __PIC__ + "popl %%ebx" +#endif : +#ifndef __PIC__ : "S" (y), "D" (dst), "a" (u), "b" (v), "d" (&us), "c" (w/16) +#else + : "S" (y), "D" (dst), "a" (u), [v] "g" (v), "d" (&us), "c" (w/16) +#endif : "memory" ); pack_li_1_C(dst, y, u, v, (w&15), us, vs); diff -ur work.orig/MPlayer-1.0pre5/libmpcodecs/vf_ivtc.c work/MPlayer-1.0pre5/libmpcodecs/vf_ivtc.c --- work.orig/MPlayer-1.0pre5/libmpcodecs/vf_ivtc.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/libmpcodecs/vf_ivtc.c 2004-09-21 00:11:58.720481048 +0200 @@ -62,6 +62,10 @@ short out[24]; // output buffer for the partial metrics from the mmx code asm ( +#ifdef __PIC__ + "pushl %%ebx\n\t" + "movl %[ns],%%ebx\n\t" +#endif "movl $4, %%ecx \n\t" "pxor %%mm4, %%mm4 \n\t" // 4 even difference sums "pxor %%mm5, %%mm5 \n\t" // 4 odd difference sums @@ -112,8 +116,15 @@ "jnz 1b \n\t" "movq %%mm4, (%%edx) \n\t" "movq %%mm5, 8(%%edx) \n\t" +#ifdef __PIC__ + "popl %%ebx" +#endif : +#ifndef __PIC__ : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out) +#else + : "S" (old), "D" (new), "a" (os), [ns] "g" (ns), "d" (out) +#endif : "memory" ); m->e = out[0]+out[1]+out[2]+out[3]; @@ -121,6 +132,10 @@ m->d = m->e + m->o; asm ( +#ifdef __PIC__ + "pushl %%ebx\n\t" + "movl %[ns],%%ebx\n\t" +#endif // First loop to measure first four columns "movl $4, %%ecx \n\t" "pxor %%mm4, %%mm4 \n\t" // Past spacial noise @@ -223,8 +238,15 @@ "movq %%mm6, 40(%%edx) \n\t" "emms \n\t" +#ifdef __PIC__ + "popl %%ebx" +#endif : +#ifndef __PIC__ : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out) +#else + : "S" (old), "D" (new), "a" (os), [ns] "g" (ns), "d" (out) +#endif : "memory" ); m->p = m->t = m->s = 0; diff -ur work.orig/MPlayer-1.0pre5/libmpcodecs/vf_tfields.c work/MPlayer-1.0pre5/libmpcodecs/vf_tfields.c --- work.orig/MPlayer-1.0pre5/libmpcodecs/vf_tfields.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/libmpcodecs/vf_tfields.c 2004-09-21 00:12:37.188633000 +0200 @@ -197,6 +197,10 @@ d += ds; s += ss; for (i=h-3; i; i--) { asm volatile( +#ifdef __PIC__ + "pushl %%ebx\n\t" + "movl %[nssd],%%ebx\n\t" +#endif "pxor %%mm0, %%mm0 \n\t" "movq (%%edx), %%mm4 \n\t" "movq 8(%%edx), %%mm5 \n\t" @@ -244,8 +248,15 @@ "addl $8, %%edi \n\t" "decl %%ecx \n\t" "jnz 4b \n\t" +#ifdef __PIC__ + "popl %%ebx" +#endif : "=S"(crap1), "=D"(crap2) - : "c"(w>>3), "S"(s), "D"(d), "a"(ssd), "b"(-ssd), "d"(filter) +#ifndef __PIC__ + : "c"(w>>3), "S"(s), "D"(d), "a"(ssd), "g"(-ssd), "d"(filter) +#else + : "c"(w>>3), "S"(s), "D"(d), "a"(ssd), [nssd] "g"(-ssd), "d"(filter) +#endif ); for (j=w-(w&7); j>7; diff -ur work.orig/MPlayer-1.0pre5/libmpeg2/cpu_accel.c work/MPlayer-1.0pre5/libmpeg2/cpu_accel.c --- work.orig/MPlayer-1.0pre5/libmpeg2/cpu_accel.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/libmpeg2/cpu_accel.c 2004-09-21 00:13:18.497353120 +0200 @@ -35,7 +35,7 @@ int AMD; uint32_t caps; -#ifndef PIC +#ifndef __PIC__ #define cpuid(op,eax,ebx,ecx,edx) \ __asm__ ("cpuid" \ : "=a" (eax), \ @@ -46,10 +46,10 @@ : "cc") #else /* PIC version : save ebx */ #define cpuid(op,eax,ebx,ecx,edx) \ - __asm__ ("push %%ebx\n\t" \ + __asm__ ("pushl %%ebx\n\t" \ "cpuid\n\t" \ "movl %%ebx,%1\n\t" \ - "pop %%ebx" \ + "popl %%ebx" \ : "=a" (eax), \ "=r" (ebx), \ "=c" (ecx), \ diff -ur work.orig/MPlayer-1.0pre5/mp3lib/dct36_3dnow.c work/MPlayer-1.0pre5/mp3lib/dct36_3dnow.c --- work.orig/MPlayer-1.0pre5/mp3lib/dct36_3dnow.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/mp3lib/dct36_3dnow.c 2004-09-21 00:13:53.259068536 +0200 @@ -36,6 +36,10 @@ #endif { __asm__ __volatile__( +#ifdef __PIC__ + "pushl %%ebx\n\t" + "movl %[tsbuf],%%ebx\n\t" +#endif "movq (%%eax),%%mm0\n\t" "movq 4(%%eax),%%mm1\n\t" "pfadd %%mm1,%%mm0\n\t" @@ -491,7 +495,14 @@ "movd %%mm5,1664(%%ebx)\n\t" "femms\n\t" +#ifdef __PIC__ + "popl %%ebx" +#endif : +#ifndef __PIC__ : "a" (inbuf), "S" (o1), "c" (o2), "d" (wintab), "b" (tsbuf) +#else + : "a" (inbuf), "S" (o1), "c" (o2), "d" (wintab), [tsbuf] "g" (tsbuf) +#endif : "memory"); } diff -ur work.orig/MPlayer-1.0pre5/mp3lib/decode_MMX.c work/MPlayer-1.0pre5/mp3lib/decode_MMX.c --- work.orig/MPlayer-1.0pre5/mp3lib/decode_MMX.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/mp3lib/decode_MMX.c 2004-09-21 00:07:25.996941328 +0200 @@ -54,6 +54,9 @@ { __asm __volatile( +#ifdef __PIC__ + "pushl %%ebx\n\t" +#endif "movl %1,%%ecx\n\t" "movl %2,%%edi\n\t" "movl $15,%%ebx\n\t" @@ -242,7 +245,14 @@ "movd %%mm0,%%eax\n\t" "movw %%ax,(%%edi)\n\t" "emms\n\t" +#ifdef __PIC__ + "popl %%ebx" +#endif : :"m"(bandPtr),"m"(channel),"m"(samples),"m"(buffs),"m"(bo), "m"(temp) +#ifndef __PIC__ :"memory","%edi","%esi","%ebx","%esp"); +#else + :"memory","%edi","%esi","%esp"); +#endif } diff -ur work.orig/MPlayer-1.0pre5/mp3lib/tabinit_MMX.c work/MPlayer-1.0pre5/mp3lib/tabinit_MMX.c --- work.orig/MPlayer-1.0pre5/mp3lib/tabinit_MMX.c 2004-09-20 22:46:04.000000000 +0200 +++ work/MPlayer-1.0pre5/mp3lib/tabinit_MMX.c 2004-09-21 00:07:28.619542632 +0200 @@ -54,6 +54,8 @@ void make_decode_tables_MMX(long scaleval) { long intwinbase_step; + long *mp3lib_decwins_0=&mp3lib_decwins[0]; + real *mp3lib_decwin_0=&mp3lib_decwin[0]; intwinbase_step=2; scaleval =- scaleval; __asm __volatile( @@ -65,7 +67,13 @@ "cmpl $528,%%ecx\n\t" "jnc .L02\n\t" "movswl (%%edi),%%eax\n\t" +#ifndef __PIC__ "cmpl %0+444,%%edi\n\t" +#else + "movl %0,%%edx\n\t" // Using edx here is ok; it's overwritten in L02 anyway. + "addl $444,%%edx\n\t" + "cmpl %%edx,%%edi\n\t" +#endif "jc .L01\n\t" "addl $60000,%%eax\n\t" ".L01:\n\t" @@ -74,8 +82,15 @@ "fdivs "MANGLE(intwindiv)"\n\t" "popl %%eax\n\t" "fimull %2\n\t" +#ifndef __PIC__ "fsts %1(,%%ecx,4)\n\t" "fstps %1+64(,%%ecx,4)\n\t" +#else + "movl %1,%%edx\n\t" // Using edx here is ok; it's overwritten in L02 anyway. + "fsts (%%edx,%%ecx,4)\n\t" + "addl $64,%%edx\n\t" + "fstps (%%edx,%%ecx,4)\n\t" +#endif ".L02:\n\t" "leal -1(%%esi),%%edx\n\t" "and %%ebx,%%edx\n\t" @@ -96,7 +111,11 @@ "negl %3\n\t" "jmp .L00\n\t" ".L04:\n\t" +#ifndef __PIC__ ::"g"(intwinbase_MMX),"m"(mp3lib_decwin[0]),"m"(scaleval),"m"(intwinbase_step) +#else + ::"g"(intwinbase_MMX),"m"(mp3lib_decwin_0),"m"(scaleval),"m"(intwinbase_step) +#endif :"memory","%ebx","%esi","%edi"); intwinbase_step=2; __asm __volatile( @@ -106,10 +125,20 @@ "cmpl $528,%%ecx\n\t" "jnc .L11\n\t" "movswl (%%edi),%%eax\n\t" +#ifndef __PIC__ "cmpl %0+444,%%edi\n\t" +#else + "pushl %%edx\n\t" // Need to save edx here - it's already in use. Pop after L06. + "movl %0,%%edx\n\t" + "addl $444,%%edx\n\t" + "cmpl %%edx,%%edi\n\t" +#endif "jc .L06\n\t" "addl $60000,%%eax\n\t" ".L06:\n\t" +#ifdef __PIC__ + "popl %%edx\n\t" +#endif "cltd\n\t" "imull %2\n\t" "shrdl $17,%%edx,%%eax\n\t" @@ -126,15 +155,31 @@ "cmpl $512,%%ecx\n\t" "jnc .L09\n\t" "subl %%ecx,%%edx\n\t" +#ifndef __PIC__ "movw %%ax,%1(,%%edx,2)\n\t" "movw %%ax,%1-32(,%%edx,2)\n\t" +#else + "pushl %%ebx\n\t" // Save ebx here + "movl %1,%%ebx\n\t" + "movw %%ax,(%%ebx,%%edx,2)\n\t" + "addl $-32,%%ebx\n\t" + "movw %%ax,(%%ebx,%%edx,2)\n\t" +#endif ".L09:\n\t" "testl $1,%%ecx\n\t" "jnz .L10\n\t" "negl %%eax\n\t" ".L10:\n\t" +#ifndef __PIC__ "movw %%ax,%1(,%%ecx,2)\n\t" "movw %%ax,%1+32(,%%ecx,2)\n\t" +#else + "movl %1,%%ebx\n\t" + "movw %%ax,(%%ebx,%%ecx,2)\n\t" + "addl $32,%%ebx\n\t" + "movw %%ax,(%%ebx,%%ecx,2)\n\t" + "popl %%ebx\n\t" // Restore +#endif ".L11:\n\t" "leal -1(%%esi),%%edx\n\t" "and %%ebx,%%edx\n\t" @@ -155,6 +200,10 @@ "negl %3\n\t" "jmp .L05\n\t" ".L13:\n\t" +#ifndef __PIC__ ::"g"(intwinbase_MMX),"m"(mp3lib_decwins[0]),"m"(scaleval),"m"(intwinbase_step) +#else + ::"g"(intwinbase_MMX),"m"(mp3lib_decwins_0),"m"(scaleval),"m"(intwinbase_step) +#endif :"memory","%ebx","%esi","%edi"); }