Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nnyh5-0004tp-Eb for qemu-devel@nongnu.org; Sat, 06 Mar 2010 13:25:43 -0500 Received: from [199.232.76.173] (port=39950 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nnyh5-0004tg-3e for qemu-devel@nongnu.org; Sat, 06 Mar 2010 13:25:43 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nnyh3-0003Xy-DG for qemu-devel@nongnu.org; Sat, 06 Mar 2010 13:25:42 -0500 Received: from hall.aurel32.net ([88.191.82.174]:56345) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nnyh2-0003Xq-Vj for qemu-devel@nongnu.org; Sat, 06 Mar 2010 13:25:41 -0500 Date: Sat, 6 Mar 2010 19:25:32 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 02/13] cpuid: replace magic number with named constant Message-ID: <20100306182532.GD14275@volta.aurel32.net> References: <1265105301-3455-1-git-send-email-andre.przywara@amd.com> <1265105301-3455-3-git-send-email-andre.przywara@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1265105301-3455-3-git-send-email-andre.przywara@amd.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andre Przywara Cc: john.cooper@redhat.com, qemu-devel@nongnu.org On Tue, Feb 02, 2010 at 11:08:10AM +0100, Andre Przywara wrote: > CPUID leaf Fn8000_0001.EDX contains a copy of many Fn0000_0001.EDX bits. > Define a name for the mask to improve readability and avoid typos. > > Signed-off-by: Andre Przywara Acked-by: Aurelien Jarno > --- > target-i386/cpuid.c | 11 ++++++----- > 1 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c > index aaa14ba..0a17020 100644 > --- a/target-i386/cpuid.c > +++ b/target-i386/cpuid.c > @@ -130,6 +130,7 @@ typedef struct x86_def_t { > CPUID_MSR | CPUID_MCE | CPUID_CX8 | CPUID_PGE | CPUID_CMOV | \ > CPUID_PAT | CPUID_FXSR | CPUID_MMX | CPUID_SSE | CPUID_SSE2 | \ > CPUID_PAE | CPUID_SEP | CPUID_APIC) > +#define EXT2_FEATURE_MASK 0x0183F3FF > static x86_def_t x86_defs[] = { > #ifdef TARGET_X86_64 > { > @@ -147,7 +148,7 @@ static x86_def_t x86_defs[] = { > /* this feature is needed for Solaris and isn't fully implemented */ > CPUID_PSE36, > .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_CX16 | CPUID_EXT_POPCNT, > - .ext2_features = (PPRO_FEATURES & 0x0183F3FF) | > + .ext2_features = (PPRO_FEATURES & EXT2_FEATURE_MASK) | > CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX, > .ext3_features = CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | > CPUID_EXT3_ABM | CPUID_EXT3_SSE4A, > @@ -170,7 +171,7 @@ static x86_def_t x86_defs[] = { > .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_MONITOR | CPUID_EXT_CX16 | > CPUID_EXT_POPCNT, > /* Missing: CPUID_EXT2_PDPE1GB, CPUID_EXT2_RDTSCP */ > - .ext2_features = (PPRO_FEATURES & 0x0183F3FF) | > + .ext2_features = (PPRO_FEATURES & EXT2_FEATURE_MASK) | > CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX | > CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT | CPUID_EXT2_MMXEXT | > CPUID_EXT2_FFXSR, > @@ -220,7 +221,7 @@ static x86_def_t x86_defs[] = { > /* Missing: CPUID_EXT_POPCNT, CPUID_EXT_MONITOR */ > .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_CX16, > /* Missing: CPUID_EXT2_PDPE1GB, CPUID_EXT2_RDTSCP */ > - .ext2_features = (PPRO_FEATURES & 0x0183F3FF) | > + .ext2_features = (PPRO_FEATURES & EXT2_FEATURE_MASK) | > CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX, > /* Missing: CPUID_EXT3_LAHF_LM, CPUID_EXT3_CMP_LEG, CPUID_EXT3_EXTAPIC, > CPUID_EXT3_CR8LEG, CPUID_EXT3_ABM, CPUID_EXT3_SSE4A, > @@ -308,7 +309,7 @@ static x86_def_t x86_defs[] = { > .stepping = 3, > .features = PPRO_FEATURES | CPUID_PSE36 | CPUID_VME | > CPUID_MTRR | CPUID_MCA, > - .ext2_features = (PPRO_FEATURES & 0x0183F3FF) | CPUID_EXT2_MMXEXT | > + .ext2_features = (PPRO_FEATURES & EXT2_FEATURE_MASK) | CPUID_EXT2_MMXEXT | > CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT, > .xlevel = 0x80000008, > /* XXX: put another string ? */ > @@ -330,7 +331,7 @@ static x86_def_t x86_defs[] = { > CPUID_EXT_SSE3 /* PNI */ | CPUID_EXT_SSSE3, > /* Missing: CPUID_EXT_DSCPL | CPUID_EXT_EST | > * CPUID_EXT_TM2 | CPUID_EXT_XTPR */ > - .ext2_features = (PPRO_FEATURES & 0x0183F3FF) | CPUID_EXT2_NX, > + .ext2_features = (PPRO_FEATURES & EXT2_FEATURE_MASK) | CPUID_EXT2_NX, > /* Missing: .ext3_features = CPUID_EXT3_LAHF_LM */ > .xlevel = 0x8000000A, > .model_id = "Intel(R) Atom(TM) CPU N270 @ 1.60GHz", > -- > 1.6.4 > > > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net