Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KSY1F-00062P-JO for qemu-devel@nongnu.org; Mon, 11 Aug 2008 10:05:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KSY1E-00061b-Vm for qemu-devel@nongnu.org; Mon, 11 Aug 2008 10:05:09 -0400 Received: from [199.232.76.173] (port=35765 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KSY1E-00061Q-QT for qemu-devel@nongnu.org; Mon, 11 Aug 2008 10:05:08 -0400 Received: from ecfrec.frec.bull.fr ([129.183.4.8]:55738) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KSY1E-00070B-54 for qemu-devel@nongnu.org; Mon, 11 Aug 2008 10:05:08 -0400 Subject: Re: [Qemu-devel] [PATCH 1/3] [x86] Clean up vendor identification From: Laurent Vivier In-Reply-To: <20080811.073758.179960465.imp@bsdimp.com> References: <1218455786.3871.2.camel@frecb07144> <1218459039.3871.18.camel@frecb07144> <20080811.073758.179960465.imp@bsdimp.com> Content-Type: text/plain; charset=utf-8 Date: Mon, 11 Aug 2008 16:05:04 +0200 Message-Id: <1218463504.3871.31.camel@frecb07144> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "M. Warner Losh" Cc: qemu-devel@nongnu.org, agraf@suse.de Le lundi 11 ao=C3=BBt 2008 =C3=A0 07:37 -0600, M. Warner Losh a =C3=A9cri= t : > In message: <1218459039.3871.18.camel@frecb07144> > Laurent Vivier writes: > : Le lundi 11 ao=C3=BBt 2008 =C3=A0 14:32 +0200, Alexander Graf a =C3=A9= crit : > : > On Aug 11, 2008, at 1:56 PM, Laurent Vivier wrote: > : >=20 > : > > Le lundi 11 ao=C3=BBt 2008 =C3=A0 12:37 +0200, Alexander Graf a =C3= =A9crit : > : > >> Right now CPU vendor identification contains a lot of magic numb= ers. > : > >> The > : > >> patch cleans them up to defines, so we can identify the CPU late= r on > : > >> without copying magic numbers. > : > >> > : > >> Signed-off-by: Alexander Graf > : > >> > : > >> > : > >> > : > >> diff --git a/qemu/target-i386/cpu.h b/qemu/target-i386/cpu.h > : > >> index 7e95900..3c84dc9 100644 > : > >> --- a/qemu/target-i386/cpu.h > : > >> +++ b/qemu/target-i386/cpu.h > : > >> @@ -339,6 +341,14 @@ > : > >> #define CPUID_EXT3_IBS (1 << 10) > : > >> #define CPUID_EXT3_SKINIT (1 << 12) > : > >> > : > >> +#define CPUID_VENDOR_INTEL_1 0x756e6547 /* "Genu" */ > : > >> +#define CPUID_VENDOR_INTEL_2 0x49656e69 /* "ineI" */ > : > >> +#define CPUID_VENDOR_INTEL_3 0x6c65746e /* "ntel" */ > : > >> + > : > >> +#define CPUID_VENDOR_AMD_1 0x68747541 /* "Auth" */ > : > >> +#define CPUID_VENDOR_AMD_2 0x69746e65 /* "enti" */ > : > >> +#define CPUID_VENDOR_AMD_3 0x444d4163 /* "cAMD" */ > : > > > : > > if you add "-Wno-multichar" in C flags, you can use: > : > > > : > > #define CPUID_VENDOR_INTEL_1 'Genu' > : > > ... > : >=20 > : > Is that a real improvement? It won't make the code faster and the =20 > : > readability doesn't improve that much either. > :=20 > : The code is not faster, it is not more readable, > : but when you read this, are you sure 0x756e6547 is equal to "Genu" ? > :=20 > : Personally, I'm not. >=20 > man ascii >=20 > and you'll be sure... Besides, you know you have an upper case > letter, followed by 3 lower case ones just by glancing at it... >=20 Well, this what I want to avoid. But the comment from Paul is the good one. Laurent --=20 ----------------- Laurent.Vivier@bull.net ------------------ "La perfection est atteinte non quand il ne reste rien =C3=A0 ajouter mais quand il ne reste rien =C3=A0 enlever." Saint Exup=C3=A9ry