From owner-freebsd-amd64@FreeBSD.ORG Sat May 21 17:44:24 2005 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4F55316A516 for ; Sat, 21 May 2005 17:44:23 +0000 (GMT) Received: from hood.oook.cz (hood.oook.cz [212.27.205.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8401C43D53 for ; Sat, 21 May 2005 17:44:21 +0000 (GMT) (envelope-from pav@oook.cz) Received: from hood.oook.cz (localhost.oook.cz [127.0.0.1]) by hood.oook.cz (8.13.3/8.13.3) with ESMTP id j4LHiCr4072453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 21 May 2005 19:44:13 +0200 (CEST) (envelope-from pav@oook.cz) Received: (from pav@localhost) by hood.oook.cz (8.13.3/8.13.3/Submit) id j4LHiCdO072452; Sat, 21 May 2005 19:44:12 +0200 (CEST) (envelope-from pav@oook.cz) X-Authentication-Warning: hood.oook.cz: pav set sender to pav@oook.cz using -f From: Pav Lucistnik To: Axel Gonzalez In-Reply-To: <200505211237.00974.loox@e-shell.net> References: <20050521022130.GW52914@afflictions.org> <20050521105451.V92958@fw.reifenberger.com> <200505211237.00974.loox@e-shell.net> Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable Date: Sat, 21 May 2005 19:44:12 +0200 Message-Id: <1116697452.79313.31.camel@hood.oook.cz> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 FreeBSD GNOME Team Port cc: freebsd-amd64@freebsd.org Subject: Re: mplayer, amd64, and CPU flags [patch] X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 May 2005 17:44:24 -0000 Axel Gonzalez p=ED=B9e v so 21. 05. 2005 v 12:37 -0500: > Maybe this is a little unnecesary since its amd64 and should support all = extra=20 > flags (at the end its a patch to the makefile), and the only file broken = is=20 > to get the configure arguments, cpu detection inside the mplayer binary w= orks=20 > perfectly >=20 > on TOOLS/cpuinfo.c: >=20 > 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" > : "=3Dm" (regs.eax), "=3Dm" (regs.ebx), "=3Dm" (regs.ecx)= ,=20 > "=3Dm" (regs.edx) > : "g" (func) > : "%eax", "%ecx", "%edx"); >=20 > printf(""); // **** NOTE this *extra* printf() > return regs; > } >=20 >=20 > with the printf: >=20 > # TOOLS/cpuinfo > vendor_id : AuthenticAMD > cpu family : 15 > model : 12 > stepping : 0 > flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mc= a=20 > cmov pat pse36 cflsh mmx fxsr sse sse2 mmxext 3dnowext 3dnow k6_mtrr > cpu MHz : 2000.021 > model name : AMD Athlon(tm) 64 Processor 3000+ >=20 > w/o the printf() >=20 > # TOOLS/cpuinfo > vendor_id :=20 > model name : Unknown CPU >=20 >=20 > why this works, i have no idea. Maybe its something to do with the regist= ers,=20 > etc. It don't work with any optimization level in gcc, ie. gcc -o cpuinfo cpuinfo.c works, but gcc -O -o cpuinfo cpuinfo.c prints garbage. > I won't try to debug it further since we already know the flags of the CP= U=20 > (and the printf seems to fix the problem anyways) >=20 >=20 > this is a commitable patch to the makefile: >=20 > --- Makefile.orig Sat May 21 10:58:38 2005 > +++ Makefile Sat May 21 11:01:44 2005 > @@ -353,6 +353,15 @@ > PLIST_SUB+=3D VIDIX=3D"@comment " > .endif > =20 > +.if ${ARCH} =3D=3D "amd64" > +CONFIGURE_ARGS+=3D --enable-mmx \ > + --enable-mmx2 \ > + --enable-3dnow \ > + --enable-3dnowex \ > + --enable-sse \ > + --enable-sse2 > +.endif > + > #.if exists(${LOCALBASE}/modules/rtc.ko) > #WITH_RTC=3D yes > #.endif I'll mail maintainer what he thinks about this Makefile patch. (I'd rather put inside WITHOUT_RUNTIME_CPUDETECTION section first.) --=20 Pav Lucistnik Legolas: Nazgulove museli otravit muj lembas...