[mythtv] [PATCH] mythmusic fix ebx usage to allow compile w/ gcc-3.4.1+

Robert Hardy rhardy at webcon.ca
Sun Jan 23 19:22:09 EST 2005


Please find attached a patch which fixes mythmusic compile with gcc-3.4.1+.
Compiled and tested using gcc-3.4.3 here.

Could someone please apply it to CVS?

P.S. If anyone has a suggestion for fixing mythmusic's alsa mixer so it
works again that would be most appreciated. Volume control works fine in
mythtv however in mythmusic volume is always full and when I try to change
the volume I get: "Reading PCM volume: : Bad file descriptor"

diff -urNbBp mythmusic-0.16.1/mythmusic/goom/mmx.h.orig mythmusic-0.16.1/mythmusic/goom/mmx.h
--- mythmusic-0.16.1/mythmusic/goom/mmx.h.orig	2005-01-23 16:25:35.000000000 -0500
+++ mythmusic-0.16.1/mythmusic/goom/mmx.h	2005-01-23 16:25:35.000000000 -0500
@@ -70,6 +70,9 @@ mm_support(void)
  	register int rval = 0;

  	__asm__ __volatile__ (
+		/* ebx gets used by gcc 3.4+ so don't clobber it */
+		"pushl %%ebx\n\t"
+
  		/* See if CPUID instruction is supported ... */
  		/* ... Get copies of EFLAGS into eax and ecx */
  		"pushf\n\t"
@@ -212,9 +215,10 @@ mm_support(void)
  		"movl $0, %0\n\n\t"

  		"Return:\n\t"
+		"popl %%ebx\n\t"
  		: "=X" (rval)
  		: /* no input */
-		: "eax", "ebx", "ecx", "edx"
+		: "eax", "ecx", "edx"
  	);

  	/* Return */
diff -urNbBp mythmusic-0.16.1/mythmusic/goom/zoom_filter_xmmx.c.orig mythmusic-0.16.1/mythmusic/goom/zoom_filter_xmmx.c
--- mythmusic-0.16.1/mythmusic/goom/zoom_filter_xmmx.c.orig	2005-01-23 16:30:58.000000000 -0500
+++ mythmusic-0.16.1/mythmusic/goom/zoom_filter_xmmx.c	2005-01-23 16:30:58.000000000 -0500
@@ -107,24 +107,24 @@ void zoom_filter_xmmx (int prevX, int pr
  			 * post : mm3 & mm4 : coefs for this position
  			 *              mm1 : X vector [0|X]
  			 *
-			 * modif : eax,ebx
+			 * modif : eax,ecx
  			 */
  			__asm__ __volatile__ (
-				"movd %%mm0,%%ebx\n"
+				"movd %%mm0,%%ecx\n"
  				"movq %%mm0,%%mm1\n"

-				"andl $15,%%ebx\n"
+				"andl $15,%%ecx\n"
  				"psrlq $32,%%mm1\n"

-				"shll $6,%%ebx\n"
+				"shll $6,%%ecx\n"
  				"movd %%mm1,%%eax\n"

-				"addl %0,%%ebx\n"
+				"addl %0,%%ecx\n"
  				"andl $15,%%eax\n"

-				"movd (%%ebx,%%eax,4),%%mm3\n"
-				/* ::"X"(precalCoef):"eax","ebx"); */
-				::"m"(precalCoef):"eax","ebx");
+				"movd (%%ecx,%%eax,4),%%mm3\n"
+				/* ::"X"(precalCoef):"eax","ecx"); */
+				::"m"(precalCoef):"eax","ecx");


  			/*
@@ -153,7 +153,7 @@ void zoom_filter_xmmx (int prevX, int pr
  			 * post : mm0 : expix1[position]
  			 *        mm2 : expix1[position+largeur]
  			 *
-			 * modif : eax,ebx
+			 * modif : eax,ecx
  			 */
  			psrld_i2r (PERTEDEC,mm0);
  			psrld_i2r (PERTEDEC,mm1);
@@ -162,23 +162,23 @@ void zoom_filter_xmmx (int prevX, int pr
  				/*^*/ "movq %%mm3,%%mm5\n"       /*^*/

  				"mull %1\n"
-				"movd %%mm0,%%ebx\n"
+				"movd %%mm0,%%ecx\n"
  				/*^*/ "punpcklbw %%mm5, %%mm3\n" /*^*/

-				"addl %%ebx,%%eax\n"
+				"addl %%ecx,%%eax\n"
  				/*^*/ "movq %%mm3,%%mm4\n"       /*^*/
  				/*^*/ "movq %%mm3,%%mm5\n"       /*^*/

-				"movl %0,%%ebx\n"
+				"movl %0,%%ecx\n"
  				/*^*/ "punpcklbw %%mm5,%%mm3\n"  /*^*/

-				"movq (%%ebx,%%eax,4),%%mm0\n"
+				"movq (%%ecx,%%eax,4),%%mm0\n"
  				/*^*/ "punpckhbw %%mm5,%%mm4\n"  /*^*/

  				"addl %1,%%eax\n"
-				"movq (%%ebx,%%eax,4),%%mm2\n"
+				"movq (%%ecx,%%eax,4),%%mm2\n"

-				: : "X"(expix1), "X"(prevX):"eax","ebx"
+				: : "X"(expix1), "X"(prevX):"eax","ecx"
  				);

  			/*

Regards,
Rob

-- 
---------------------"Happiness is understanding."----------------------
Robert Hardy, B.Eng Computer Systems                  C.E.O. Webcon Inc.
rhardy <at> webcon <dot> ca    GPG Key available          (613) 276-7327
-------------- next part --------------
diff -urNbBp mythmusic-0.16.1/mythmusic/goom/mmx.h.orig mythmusic-0.16.1/mythmusic/goom/mmx.h
--- mythmusic-0.16.1/mythmusic/goom/mmx.h.orig	2005-01-23 16:25:35.000000000 -0500
+++ mythmusic-0.16.1/mythmusic/goom/mmx.h	2005-01-23 16:25:35.000000000 -0500
@@ -70,6 +70,9 @@ mm_support(void)
 	register int rval = 0;
 
 	__asm__ __volatile__ (
+		/* ebx gets used by gcc 3.4+ so don't clobber it */
+		"pushl %%ebx\n\t"
+
 		/* See if CPUID instruction is supported ... */
 		/* ... Get copies of EFLAGS into eax and ecx */
 		"pushf\n\t"
@@ -212,9 +215,10 @@ mm_support(void)
 		"movl $0, %0\n\n\t"
 
 		"Return:\n\t"
+		"popl %%ebx\n\t"
 		: "=X" (rval)
 		: /* no input */
-		: "eax", "ebx", "ecx", "edx"
+		: "eax", "ecx", "edx"
 	);
 
 	/* Return */
diff -urNbBp mythmusic-0.16.1/mythmusic/goom/zoom_filter_xmmx.c.orig mythmusic-0.16.1/mythmusic/goom/zoom_filter_xmmx.c
--- mythmusic-0.16.1/mythmusic/goom/zoom_filter_xmmx.c.orig	2005-01-23 16:30:58.000000000 -0500
+++ mythmusic-0.16.1/mythmusic/goom/zoom_filter_xmmx.c	2005-01-23 16:30:58.000000000 -0500
@@ -107,24 +107,24 @@ void zoom_filter_xmmx (int prevX, int pr
 			 * post : mm3 & mm4 : coefs for this position
 			 *              mm1 : X vector [0|X]
 			 *
-			 * modif : eax,ebx
+			 * modif : eax,ecx
 			 */
 			__asm__ __volatile__ (
-				"movd %%mm0,%%ebx\n"
+				"movd %%mm0,%%ecx\n"
 				"movq %%mm0,%%mm1\n"
 
-				"andl $15,%%ebx\n"
+				"andl $15,%%ecx\n"
 				"psrlq $32,%%mm1\n"
 
-				"shll $6,%%ebx\n"
+				"shll $6,%%ecx\n"
 				"movd %%mm1,%%eax\n"
 
-				"addl %0,%%ebx\n"
+				"addl %0,%%ecx\n"
 				"andl $15,%%eax\n"
 
-				"movd (%%ebx,%%eax,4),%%mm3\n"
-				/* ::"X"(precalCoef):"eax","ebx"); */
-				::"m"(precalCoef):"eax","ebx");
+				"movd (%%ecx,%%eax,4),%%mm3\n"
+				/* ::"X"(precalCoef):"eax","ecx"); */
+				::"m"(precalCoef):"eax","ecx");
 				
 
 			/*
@@ -153,7 +153,7 @@ void zoom_filter_xmmx (int prevX, int pr
 			 * post : mm0 : expix1[position]
 			 *        mm2 : expix1[position+largeur]
 			 *
-			 * modif : eax,ebx
+			 * modif : eax,ecx
 			 */
 			psrld_i2r (PERTEDEC,mm0);
 			psrld_i2r (PERTEDEC,mm1);
@@ -162,23 +162,23 @@ void zoom_filter_xmmx (int prevX, int pr
 				/*^*/ "movq %%mm3,%%mm5\n"       /*^*/
 
 				"mull %1\n"
-				"movd %%mm0,%%ebx\n"
+				"movd %%mm0,%%ecx\n"
 				/*^*/ "punpcklbw %%mm5, %%mm3\n" /*^*/
 
-				"addl %%ebx,%%eax\n"
+				"addl %%ecx,%%eax\n"
 				/*^*/ "movq %%mm3,%%mm4\n"       /*^*/
 				/*^*/ "movq %%mm3,%%mm5\n"       /*^*/
 
-				"movl %0,%%ebx\n"
+				"movl %0,%%ecx\n"
 				/*^*/ "punpcklbw %%mm5,%%mm3\n"  /*^*/
 
-				"movq (%%ebx,%%eax,4),%%mm0\n"
+				"movq (%%ecx,%%eax,4),%%mm0\n"
 				/*^*/ "punpckhbw %%mm5,%%mm4\n"  /*^*/
 
 				"addl %1,%%eax\n"
-				"movq (%%ebx,%%eax,4),%%mm2\n"
+				"movq (%%ecx,%%eax,4),%%mm2\n"
 				
-				: : "X"(expix1), "X"(prevX):"eax","ebx"
+				: : "X"(expix1), "X"(prevX):"eax","ecx"
 				);
 
 			/*


More information about the mythtv-dev mailing list