analogtv compile problems against vdr-1.3.46

Message ID 200605021436.03328.zzam@gentoo.org
State New
Headers

Commit Message

Matthias Schwarzott May 2, 2006, 12:36 p.m. UTC
  On Tuesday 02 May 2006 02:18, Simon Baxter wrote:
> > [snip]
> >
> >> Nope - still have the same problem with cpu_accel.c
> >>
> >> g++  -fPIC -g -Os -Wall -Woverloaded-virtual -c -D_GNU_SOURCE
> >> -DPLUGIN_NAME_I18N='"analogtv"' -DHAVE_FAST_MEMCPY -DNEED_OWN_SIP
> >> -I../../../include cpu_accel.c cpu_accel.c: In function 'uint32_t
> >> mm_accel()':
> >> cpu_accel.c:76: error: can't find a register in class 'BREG' while
> >> reloading 'asm'
> >
> > [snip]
> >
> >> Any other ideas???
> >
> > Drop -g? Presuming i386, drop -fPIC?
>

On Gentoo we included the attached patches in out vdr-analogtv package.

They are created for analogtv-0.9.37 but apply without problems against 
0.9.38. I already sent them to the Author.

Matthias
  

Comments

Linux TV May 3, 2006, 3:58 a.m. UTC | #1
>> >> g++  -fPIC -g -Os -Wall -Woverloaded-virtual -c -D_GNU_SOURCE
>> >> -DPLUGIN_NAME_I18N='"analogtv"' -DHAVE_FAST_MEMCPY -DNEED_OWN_SIP
>> >> -I../../../include cpu_accel.c cpu_accel.c: In function 'uint32_t
>> >> mm_accel()':
>> >> cpu_accel.c:76: error: can't find a register in class 'BREG' while
>> >> reloading 'asm'
>> >
>> > [snip]
> On Gentoo we included the attached patches in out vdr-analogtv package.
> 
> They are created for analogtv-0.9.37 but apply without problems against 
> 0.9.38. I already sent them to the Author.
> 
> Matthias

Thanks - it's all working now...

:))
  

Patch

diff -ru analogtv-0.9.37.orig/cpu_accel.c analogtv-0.9.37/cpu_accel.c
--- analogtv-0.9.37.orig/cpu_accel.c	2005-05-13 23:49:38.000000000 +0200
+++ analogtv-0.9.37/cpu_accel.c	2005-05-13 23:57:49.000000000 +0200
@@ -50,30 +50,44 @@ 
     int AMD;
     uint32_t caps;
 
+#if !defined(PIC) && !defined(__PIC__)
 #define cpuid(op,eax,ebx,ecx,edx)	\
-    asm ("cpuid"			\
+    __asm__ ("cpuid"			\
 	 : "=a" (eax),			\
 	   "=b" (ebx),			\
 	   "=c" (ecx),			\
 	   "=d" (edx)			\
 	 : "a" (op)			\
 	 : "cc")
+#else   /* PIC version : save ebx */
+#define cpuid(op,eax,ebx,ecx,edx)       \
+    __asm__ ("push %%ebx\n\t"           \
+             "cpuid\n\t"                \
+             "movl %%ebx,%1\n\t"        \
+             "pop %%ebx"                \
+             : "=a" (eax),              \
+               "=r" (ebx),              \
+               "=c" (ecx),              \
+               "=d" (edx)               \
+             : "a" (op)                 \
+             : "cc")
+#endif
 
     
-    asm ("pushfl\n\t"
-	 "pushfl\n\t"
-	 "popl %0\n\t"
-	 "movl %0,%1\n\t"
-	 "xorl $0x200000,%0\n\t"
-	 "pushl %0\n\t"
-	 "popfl\n\t"
-	 "pushfl\n\t"
-	 "popl %0\n\t"
-	 "popfl"
-         : "=a" (eax),
-	   "=b" (ebx)
-	 :
-	 : "cc");
+   __asm__ ("pushf\n\t"
+             "pushf\n\t"
+             "pop %0\n\t"
+             "movl %0,%1\n\t"
+             "xorl $0x200000,%0\n\t"
+             "push %0\n\t"
+             "popf\n\t"
+             "pushf\n\t"
+             "pop %0\n\t"
+             "popf"
+             : "=r" (eax),
+               "=r" (ebx)
+             :
+             : "cc");
 
     if (eax == ebx)		/* no cpuid */
       return 0; 
diff -ru analogtv-0.9.37-orig/cpuinfo.c analogtv-0.9.37/cpuinfo.c
--- analogtv-0.9.37-orig/cpuinfo.c	2005-12-11 16:51:06.713174250 +0100
+++ analogtv-0.9.37/cpuinfo.c	2005-12-11 16:51:13.665608750 +0100
@@ -62,15 +62,18 @@ 
     unsigned int edx;
 } cpuid_regs_t;
 
-static cpuid_regs_t cpuid( int func ) {
-    cpuid_regs_t regs;
-#define CPUID ".byte 0x0f, 0xa2; "
-    asm("movl %4,%%eax; " CPUID
-        "movl %%eax,%0; movl %%ebx,%1; movl %%ecx,%2; movl %%edx,%3"
-            : "=m" (regs.eax), "=m" (regs.ebx), "=m" (regs.ecx), "=m" (regs.edx)
-            : "g" (func)
-            : "%eax", "%ebx", "%ecx", "%edx");
-    return regs;
+static cpuid_regs_t
+cpuid(int func) {
+	cpuid_regs_t regs;
+#define	CPUID	".byte 0x0f, 0xa2; "
+	__asm__("push %%ebx; "
+	    "movl %4,%%eax; " CPUID
+	    "movl %%eax,%0; movl %%ebx,%1; movl %%ecx,%2; movl %%edx,%3; "
+	    "pop %%ebx"
+		: "=m" (regs.eax), "=m" (regs.ebx), "=m" (regs.ecx), "=m" (regs.edx)
+		: "g" (func)
+		: "%eax", "%ecx", "%edx");
+	return regs;
 }
 
 #define X86_VENDOR_INTEL 0