From patchwork Thu Mar 11 13:38:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 47324 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A7A20B7CFA for ; Fri, 12 Mar 2010 01:00:39 +1100 (EST) Received: from localhost ([127.0.0.1]:48115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpivH-0002gu-Vj for incoming@patchwork.ozlabs.org; Thu, 11 Mar 2010 08:59:36 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Npic0-0005cL-P6 for qemu-devel@nongnu.org; Thu, 11 Mar 2010 08:39:41 -0500 Received: from [199.232.76.173] (port=45899 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Npibz-0005bM-0e for qemu-devel@nongnu.org; Thu, 11 Mar 2010 08:39:39 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Npibx-0001Tb-RQ for qemu-devel@nongnu.org; Thu, 11 Mar 2010 08:39:38 -0500 Received: from va3ehsobe005.messaging.microsoft.com ([216.32.180.15]:25810 helo=VA3EHSOBE006.bigfish.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.60) (envelope-from ) id 1Npibx-0001TV-G6 for qemu-devel@nongnu.org; Thu, 11 Mar 2010 08:39:37 -0500 Received: from mail172-va3-R.bigfish.com (10.7.14.239) by VA3EHSOBE006.bigfish.com (10.7.40.26) with Microsoft SMTP Server id 8.1.240.5; Thu, 11 Mar 2010 13:39:36 +0000 Received: from mail172-va3 (localhost [127.0.0.1]) by mail172-va3-R.bigfish.com (Postfix) with ESMTP id 951D31A8829F; Thu, 11 Mar 2010 13:39:35 +0000 (UTC) X-SpamScore: -1 X-BigFish: VPS-1(zz936eMab9bh853kzz1202hzzz32i2a8h6bh43h61h) X-FB-SS: 5, Received: from mail172-va3 (localhost.localdomain [127.0.0.1]) by mail172-va3 (MessageSwitch) id 1268314766430303_28730; Thu, 11 Mar 2010 13:39:26 +0000 (UTC) Received: from VA3EHSMHS032.bigfish.com (unknown [10.7.14.238]) by mail172-va3.bigfish.com (Postfix) with ESMTP id F2DCC1BA815D; Thu, 11 Mar 2010 13:39:11 +0000 (UTC) Received: from ausb3extmailp01.amd.com (163.181.251.8) by VA3EHSMHS032.bigfish.com (10.7.99.42) with Microsoft SMTP Server (TLS) id 14.0.482.39; Thu, 11 Mar 2010 13:39:09 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with SMTP id o2BDgiBe027828; Thu, 11 Mar 2010 07:42:47 -0600 X-WSS-ID: 0KZ4DX0-02-MXL-02 X-M-MSG: Received: from sausexhtp02.amd.com (sausexhtp02.amd.com [163.181.3.152]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2CDA6FCC0E3; Thu, 11 Mar 2010 07:39:00 -0600 (CST) Received: from storexhtp01.amd.com (172.24.4.3) by sausexhtp02.amd.com (163.181.3.152) with Microsoft SMTP Server (TLS) id 8.2.234.1; Thu, 11 Mar 2010 07:39:04 -0600 Received: from storexbh1.amd.com (10.1.1.17) by storexhtp01.amd.com (172.24.4.3) with Microsoft SMTP Server id 8.2.234.1; Thu, 11 Mar 2010 05:39:03 -0800 Received: from sausexmb1.amd.com ([163.181.3.156]) by storexbh1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 11 Mar 2010 08:39:03 -0500 Received: from seurexmb1.amd.com ([165.204.9.130]) by sausexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 11 Mar 2010 07:38:58 -0600 Received: from gwo.osrc.amd.com ([165.204.16.204]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 11 Mar 2010 14:38:55 +0100 Received: from localhost.localdomain (tronje.osrc.amd.com [165.204.15.48]) by gwo.osrc.amd.com (Postfix) with ESMTP id 89B6C49C12F; Thu, 11 Mar 2010 13:38:55 +0000 (GMT) From: Andre Przywara To: anthony@codemonkey.ws Date: Thu, 11 Mar 2010 14:38:56 +0100 Message-ID: <1268314747-11111-3-git-send-email-andre.przywara@amd.com> X-Mailer: git-send-email 1.6.4 In-Reply-To: <1268314747-11111-1-git-send-email-andre.przywara@amd.com> References: <1268314747-11111-1-git-send-email-andre.przywara@amd.com> X-OriginalArrivalTime: 11 Mar 2010 13:38:55.0746 (UTC) FILETIME=[321E9620:01CAC120] MIME-Version: 1.0 X-Reverse-DNS: unknown X-detected-operating-system: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ Cc: Andre Przywara , qemu-devel@nongnu.org, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 02/13] x86/cpuid: replace magic number with named constant X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org CPUID leaf Fn8000_0001.EDX contains a copy of many Fn0000_0001.EDX bits. Define a name for this mask to improve readability and avoid typos. Signed-off-by: Andre Przywara --- 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 ca1aedd..5e4f057 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -196,6 +196,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 /* maintains list of cpu model definitions */ @@ -220,7 +221,7 @@ static x86_def_t builtin_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, @@ -243,7 +244,7 @@ static x86_def_t builtin_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, @@ -293,7 +294,7 @@ static x86_def_t builtin_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, @@ -380,7 +381,7 @@ static x86_def_t builtin_x86_defs[] = { .model = 2, .stepping = 3, .features = PPRO_FEATURES | CPUID_PSE36 | CPUID_VME | CPUID_MTRR | CPUID_MCA, - .ext2_features = (PPRO_FEATURES & 0x0183F3FF) | CPUID_EXT2_MMXEXT | CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT, + .ext2_features = (PPRO_FEATURES & EXT2_FEATURE_MASK) | CPUID_EXT2_MMXEXT | CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT, .xlevel = 0x80000008, /* XXX: put another string ? */ .model_id = "QEMU Virtual CPU version " QEMU_VERSION, @@ -401,7 +402,7 @@ static x86_def_t builtin_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",