mplayer, amd64, and CPU flags [patch]

Michiel Boland michiel at boland.org
Sun May 22 12:22:00 PDT 2005


Rather than hack the port Makefile, I think it is better to fix cpuinfo.c. 
I placed the attached patch-TOOLS-cpuinfo.c in 
ports/multimedia/mplayer/files and then recompiled mplayer. It now detects 
the cpu properly. I am CC-ing this to the port maintainer; hopefully this 
can be merged into the real source somehow.

$ mplayer
MPlayer 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices  (Family: 8, Stepping: 0)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2
-------------- next part --------------
--- TOOLS/cpuinfo.c.orig	Mon Oct 11 21:26:13 2004
+++ TOOLS/cpuinfo.c	Sun May 22 20:57:11 2005
@@ -40,13 +40,9 @@
 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");
+	asm(CPUID
+		: "=a" (regs.eax), "=b" (regs.ebx), "=c" (regs.ecx), "=d" (regs.edx)
+		: "0" (func));
 	return regs;
 }
 


More information about the freebsd-amd64 mailing list