diff -uNr SDL-1.2.7.orig/src/audio/SDL_mixer_MMX.c SDL-1.2.7/src/audio/SDL_mixer_MMX.c --- SDL-1.2.7.orig/src/audio/SDL_mixer_MMX.c 2002-11-09 07:13:28.000000000 +0100 +++ SDL-1.2.7/src/audio/SDL_mixer_MMX.c 2004-03-08 19:07:00.538098528 +0100 @@ -14,7 +14,9 @@ void SDL_MixAudio_MMX_S16(char* dst,char* src,unsigned int size,int volume) { __asm__ __volatile__ ( - +#ifdef __PIC__ +" pushl %%ebx\n" +#endif " movl %0,%%edi\n" // edi = dst " movl %1,%%esi\n" // esi = src " movl %3,%%eax\n" // eax = volume @@ -102,10 +104,16 @@ " emms\n" ".endS16:\n" +#ifdef __PIC__ +" popl %%ebx\n" +#endif : : "m" (dst), "m"(src),"m"(size), "m"(volume) - : "eax","ebx", "esi", "edi","memory" + : "eax", "esi", "edi", "memory" +#ifndef __PIC__ + , "ebx" +#endif ); } @@ -118,7 +126,9 @@ void SDL_MixAudio_MMX_S8(char* dst,char* src,unsigned int size,int volume) { __asm__ __volatile__ ( - +#ifdef __PIC__ +" pushl %%ebx\n" +#endif " movl %0,%%edi\n" // edi = dst " movl %1,%%esi\n" // esi = src " movl %3,%%eax\n" // eax = volume @@ -175,10 +185,16 @@ ".endS8:\n" " emms\n" +#ifdef __PIC__ +" popl %%ebx\n" +#endif : : "m" (dst), "m"(src),"m"(size), "m"(volume) - : "eax","ebx", "esi", "edi","memory" + : "eax", "esi", "edi", "memory" +#ifndef __PIC__ + , "ebx" +#endif ); } #endif diff -uNr SDL-1.2.7.orig/src/cpuinfo/SDL_cpuinfo.c SDL-1.2.7/src/cpuinfo/SDL_cpuinfo.c --- SDL-1.2.7.orig/src/cpuinfo/SDL_cpuinfo.c 2004-02-10 16:31:35.000000000 +0100 +++ SDL-1.2.7/src/cpuinfo/SDL_cpuinfo.c 2004-03-08 19:07:00.540098224 +0100 @@ -105,6 +105,9 @@ int features = 0; #if defined(__GNUC__) && defined(i386) __asm__ ( +#ifdef __PIC__ +" pushl %%ebx\n" +#endif " movl %%ebx,%%edi\n" " xorl %%eax,%%eax # Set up for CPUID instruction \n" " cpuid # Get and save vendor ID \n" @@ -116,9 +119,15 @@ " movl %%edx,%0 \n" "1: \n" " movl %%edi,%%ebx\n" +#ifdef __PIC__ +" popl %%ebx\n" +#endif : "=m" (features) : - : "%eax", "%ebx", "%ecx", "%edx", "%edi" + : "%eax", "%ecx", "%edx", "%edi" +#ifndef __PIC__ + , "%ebx" +#endif ); #elif defined(_MSC_VER) __asm { @@ -141,6 +150,9 @@ int features = 0; #if defined(__GNUC__) && defined(i386) __asm__ ( +#ifdef __PIC__ +" pushl %%ebx\n" +#endif " movl %%ebx,%%edi\n" " movl $0x80000000,%%eax # Query for extended functions \n" " cpuid # Get extended function limit \n" @@ -151,9 +163,15 @@ " movl %%edx,%0 \n" "1: \n" " movl %%edi,%%ebx\n" +#ifdef __PIC__ +" popl %%ebx\n" +#endif : "=m" (features) : - : "%eax", "%ebx", "%ecx", "%edx", "%edi" + : "%eax", "%ecx", "%edx", "%edi" +#ifndef __PIC__ + , "%ebx" +#endif ); #elif defined(_MSC_VER) __asm { diff -uNr SDL-1.2.7.orig/src/video/SDL_yuv_mmx.c SDL-1.2.7/src/video/SDL_yuv_mmx.c --- SDL-1.2.7.orig/src/video/SDL_yuv_mmx.c 2004-02-18 18:22:04.000000000 +0100 +++ SDL-1.2.7/src/video/SDL_yuv_mmx.c 2004-03-08 19:05:31.000000000 +0100 @@ -36,29 +36,29 @@ #define ASM_VAR(X) X #endif -static unsigned int ASM_VAR(MMX_0080w)[] = {0x00800080, 0x00800080}; -static unsigned int ASM_VAR(MMX_00FFw)[] = {0x00ff00ff, 0x00ff00ff}; -static unsigned int ASM_VAR(MMX_FF00w)[] = {0xff00ff00, 0xff00ff00}; - -static unsigned short ASM_VAR(MMX_Ycoeff)[] = {0x004a, 0x004a, 0x004a, 0x004a}; - -static unsigned short ASM_VAR(MMX_UbluRGB)[] = {0x0072, 0x0072, 0x0072, 0x0072}; -static unsigned short ASM_VAR(MMX_VredRGB)[] = {0x0059, 0x0059, 0x0059, 0x0059}; -static unsigned short ASM_VAR(MMX_UgrnRGB)[] = {0xffea, 0xffea, 0xffea, 0xffea}; -static unsigned short ASM_VAR(MMX_VgrnRGB)[] = {0xffd2, 0xffd2, 0xffd2, 0xffd2}; - -static unsigned short ASM_VAR(MMX_Ublu5x5)[] = {0x0081, 0x0081, 0x0081, 0x0081}; -static unsigned short ASM_VAR(MMX_Vred5x5)[] = {0x0066, 0x0066, 0x0066, 0x0066}; -static unsigned short ASM_VAR(MMX_Ugrn555)[] = {0xffe7, 0xffe7, 0xffe7, 0xffe7}; -static unsigned short ASM_VAR(MMX_Vgrn555)[] = {0xffcc, 0xffcc, 0xffcc, 0xffcc}; -static unsigned short ASM_VAR(MMX_Ugrn565)[] = {0xffe8, 0xffe8, 0xffe8, 0xffe8}; -static unsigned short ASM_VAR(MMX_Vgrn565)[] = {0xffcd, 0xffcd, 0xffcd, 0xffcd}; - -static unsigned short ASM_VAR(MMX_red555)[] = {0x7c00, 0x7c00, 0x7c00, 0x7c00}; -static unsigned short ASM_VAR(MMX_red565)[] = {0xf800, 0xf800, 0xf800, 0xf800}; -static unsigned short ASM_VAR(MMX_grn555)[] = {0x03e0, 0x03e0, 0x03e0, 0x03e0}; -static unsigned short ASM_VAR(MMX_grn565)[] = {0x07e0, 0x07e0, 0x07e0, 0x07e0}; -static unsigned short ASM_VAR(MMX_blu5x5)[] = {0x001f, 0x001f, 0x001f, 0x001f}; +unsigned int ASM_VAR(MMX_0080w)[] = {0x00800080, 0x00800080}; +unsigned int ASM_VAR(MMX_00FFw)[] = {0x00ff00ff, 0x00ff00ff}; +unsigned int ASM_VAR(MMX_FF00w)[] = {0xff00ff00, 0xff00ff00}; + +unsigned short ASM_VAR(MMX_Ycoeff)[] = {0x004a, 0x004a, 0x004a, 0x004a}; + +unsigned short ASM_VAR(MMX_UbluRGB)[] = {0x0072, 0x0072, 0x0072, 0x0072}; +unsigned short ASM_VAR(MMX_VredRGB)[] = {0x0059, 0x0059, 0x0059, 0x0059}; +unsigned short ASM_VAR(MMX_UgrnRGB)[] = {0xffea, 0xffea, 0xffea, 0xffea}; +unsigned short ASM_VAR(MMX_VgrnRGB)[] = {0xffd2, 0xffd2, 0xffd2, 0xffd2}; + +unsigned short ASM_VAR(MMX_Ublu5x5)[] = {0x0081, 0x0081, 0x0081, 0x0081}; +unsigned short ASM_VAR(MMX_Vred5x5)[] = {0x0066, 0x0066, 0x0066, 0x0066}; +unsigned short ASM_VAR(MMX_Ugrn555)[] = {0xffe7, 0xffe7, 0xffe7, 0xffe7}; +unsigned short ASM_VAR(MMX_Vgrn555)[] = {0xffcc, 0xffcc, 0xffcc, 0xffcc}; +unsigned short ASM_VAR(MMX_Ugrn565)[] = {0xffe8, 0xffe8, 0xffe8, 0xffe8}; +unsigned short ASM_VAR(MMX_Vgrn565)[] = {0xffcd, 0xffcd, 0xffcd, 0xffcd}; + +unsigned short ASM_VAR(MMX_red555)[] = {0x7c00, 0x7c00, 0x7c00, 0x7c00}; +unsigned short ASM_VAR(MMX_red565)[] = {0xf800, 0xf800, 0xf800, 0xf800}; +unsigned short ASM_VAR(MMX_grn555)[] = {0x03e0, 0x03e0, 0x03e0, 0x03e0}; +unsigned short ASM_VAR(MMX_grn565)[] = {0x07e0, 0x07e0, 0x07e0, 0x07e0}; +unsigned short ASM_VAR(MMX_blu5x5)[] = {0x001f, 0x001f, 0x001f, 0x001f}; /** This MMX assembler is my first assembler/MMX program ever. @@ -108,7 +108,9 @@ relative addressing for the static tables, so right now we take the COW hit on the pages this code resides. Big deal. This spill is just to reduce register pressure in the PIC case. */ +#ifdef __PIC__ "pushl %%ebx\n" +#endif "movl %0, %%ebx\n" ".align 8\n" @@ -235,11 +237,15 @@ "cmpl %7, %2\n" "jl 1b\n" "emms\n" +#ifdef __PIC__ "popl %%ebx\n" +#endif : : "m" (cr), "r"(cb),"r"(lum), "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod) +#ifndef __PIC__ : "%ebx" +#endif ); } @@ -259,7 +265,9 @@ __asm__ __volatile__( +#ifdef __PIC__ "pushl %%ebx\n" +#endif "movl %0, %%ebx\n" ".align 8\n" @@ -410,11 +418,15 @@ "cmpl %7, %2\n" "jl 1b\n" "emms\n" +#ifdef __PIC__ "popl %%ebx\n" +#endif : :"m" (cr), "r"(cb),"r"(lum), "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod) +#ifndef __PIC__ : "%ebx" +#endif ); }