From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KSXf4-0008Gc-Ol for qemu-devel@nongnu.org; Mon, 11 Aug 2008 09:42:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KSXf3-0008Eq-PJ for qemu-devel@nongnu.org; Mon, 11 Aug 2008 09:42:14 -0400 Received: from [199.232.76.173] (port=37706 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KSXf3-0008Ea-IU for qemu-devel@nongnu.org; Mon, 11 Aug 2008 09:42:13 -0400 Received: from bsdimp.com ([199.45.160.85]:58877 helo=harmony.bsdimp.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KSXf3-00035o-0t for qemu-devel@nongnu.org; Mon, 11 Aug 2008 09:42:13 -0400 Date: Mon, 11 Aug 2008 07:37:58 -0600 (MDT) Message-Id: <20080811.073758.179960465.imp@bsdimp.com> Subject: Re: [Qemu-devel] [PATCH 1/3] [x86] Clean up vendor identification From: "M. Warner Losh" In-Reply-To: <1218459039.3871.18.camel@frecb07144> References: <1218455786.3871.2.camel@frecb07144> <1218459039.3871.18.camel@frecb07144> Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 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: qemu-devel@nongnu.org, Laurent.Vivier@bull.net Cc: agraf@suse.de In message: <1218459039.3871.18.camel@frecb07144> Laurent Vivier writes: : Le lundi 11 ao=FBt 2008 =E0 14:32 +0200, Alexander Graf a =E9crit : : > On Aug 11, 2008, at 1:56 PM, Laurent Vivier wrote: : > = : > > Le lundi 11 ao=FBt 2008 =E0 12:37 +0200, Alexander Graf a =E9crit= : : > >> 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' : > > ... : > = : > Is that a real improvement? It won't make the code faster and the = : > 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. man ascii 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... Warner