qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/3] [x86] Clean up vendor identification


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH 1/3] [x86] Clean up vendor identification
Date: Mon, 11 Aug 2008 16:05:04 +0200

Le lundi 11 août 2008 à 07:37 -0600, M. Warner Losh a écrit :
> In message: <address@hidden>
>             Laurent Vivier <address@hidden> writes:
> : Le lundi 11 août 2008 à 14:32 +0200, Alexander Graf a écrit :
> : > On Aug 11, 2008, at 1:56 PM, Laurent Vivier wrote:
> : > 
> : > > Le lundi 11 août 2008 à 12:37 +0200, Alexander Graf a é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 <address@hidden>
> : > >>
> : > >>
> : > >>
> : > >> 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...
> 

Well, this what I want to avoid.
But the comment from Paul is the good one.

Laurent
-- 
----------------- address@hidden  ------------------
  "La perfection est atteinte non quand il ne reste rien à
ajouter mais quand il ne reste rien à enlever." Saint Exupéry





reply via email to

[Prev in Thread] Current Thread [Next in Thread]