File: 32_amd64-cpuid.diff

package info (click to toggle)
mpeg2dec 0.4.0b-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,624 kB
  • ctags: 1,741
  • sloc: ansic: 14,671; sh: 8,405; makefile: 344
file content (37 lines) | stat: -rw-r--r-- 1,085 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
diff -urN mpeg2dec-0.4.0.orig/libmpeg2/cpu_accel.c mpeg2dec-0.4.0/libmpeg2/cpu_accel.c
--- mpeg2dec-0.4.0.orig/libmpeg2/cpu_accel.c	2003-10-06 04:31:52.000000000 +0200
+++ mpeg2dec-0.4.0/libmpeg2/cpu_accel.c	2005-10-01 11:46:23.000000000 +0200
@@ -37,7 +37,7 @@
     int AMD;
     uint32_t caps;
 
-#if !defined(PIC) && !defined(__PIC__)
+#if defined(__x86_64__) || (!defined(PIC) && !defined(__PIC__))
 #define cpuid(op,eax,ebx,ecx,edx)	\
     __asm__ ("cpuid"			\
 	     : "=a" (eax),		\
@@ -46,7 +46,7 @@
 	       "=d" (edx)		\
 	     : "a" (op)			\
 	     : "cc")
-#else	/* PIC version : save ebx */
+#else	/* PIC version : save ebx (not needed on x86_64) */
 #define cpuid(op,eax,ebx,ecx,edx)	\
     __asm__ ("push %%ebx\n\t"		\
 	     "cpuid\n\t"		\
@@ -60,6 +60,7 @@
 	     : "cc")
 #endif
 
+#ifndef __x86_64__ /* x86_64 supports the cpuid op */
     __asm__ ("pushf\n\t"
 	     "pushf\n\t"
 	     "pop %0\n\t"
@@ -77,6 +78,7 @@
 
     if (eax == ebx)		/* no cpuid */
 	return 0;
+#endif
 
     cpuid (0x00000000, eax, ebx, ecx, edx);
     if (!eax)			/* vendor string only */