Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KSWzJ-00089L-7f for qemu-devel@nongnu.org; Mon, 11 Aug 2008 08:59:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KSWzF-00087f-Cv for qemu-devel@nongnu.org; Mon, 11 Aug 2008 08:59:03 -0400 Received: from [199.232.76.173] (port=56254 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KSWzE-00087Q-LL for qemu-devel@nongnu.org; Mon, 11 Aug 2008 08:59:00 -0400 Received: from ecfrec.frec.bull.fr ([129.183.4.8]:50797) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KSWzD-0004HK-GC for qemu-devel@nongnu.org; Mon, 11 Aug 2008 08:59:00 -0400 Subject: Re: [Qemu-devel] [PATCH 1/3] [x86] Clean up vendor identification From: Laurent Vivier In-Reply-To: References: <48A01658.6030308@suse.de> <1218455786.3871.2.camel@frecb07144> Content-Type: text/plain; charset=utf-8 Date: Mon, 11 Aug 2008 14:50:39 +0200 Message-Id: <1218459039.3871.18.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: Alexander Graf Cc: qemu-devel@nongnu.org Le lundi 11 ao=C3=BBt 2008 =C3=A0 14:32 +0200, Alexander Graf a =C3=A9cri= t : > 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=A9= crit : > >> Right now CPU vendor identification contains a lot of magic numbers. > >> The > >> patch cleans them up to defines, so we can identify the CPU later 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. The code is not faster, it is not more readable, but when you read this, are you sure 0x756e6547 is equal to "Genu" ? Personally, I'm not. But I agree using 'Genu' can have an impact on portability. Regards, 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