From patchwork Tue Sep 29 20:48:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 34488 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 4757DB7C17 for ; Wed, 30 Sep 2009 08:00:28 +1000 (EST) Received: from localhost ([127.0.0.1]:37373 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MskkD-0006eH-8Q for incoming@patchwork.ozlabs.org; Tue, 29 Sep 2009 18:00:25 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsjeH-0005cJ-8H for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsjeC-0005WA-DX for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:12 -0400 Received: from [199.232.76.173] (port=55250 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsjeC-0005W0-83 for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48740) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MsjeB-0002bp-IU for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:07 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8TKo4lP026499; Tue, 29 Sep 2009 16:50:05 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8TKnHYB006885; Tue, 29 Sep 2009 16:50:03 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 29 Sep 2009 22:48:55 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Huang Ying Subject: [Qemu-devel] [PATCH 36/49] x86: mce_banks always have the same size 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 mce_banks is always MCE_BANKS_DEF * 4 in size, value never change CC: Huang Ying Signed-off-by: Juan Quintela --- target-i386/cpu.h | 2 +- target-i386/helper.c | 3 +-- target-i386/machine.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index af122a1..bea9ac3 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -697,7 +697,7 @@ typedef struct CPUX86State { uint64 mcg_cap; uint64 mcg_status; uint64 mcg_ctl; - uint64 *mce_banks; + uint64 mce_banks[MCE_BANKS_DEF*4]; } CPUX86State; CPUX86State *cpu_x86_init(const char *cpu_model); diff --git a/target-i386/helper.c b/target-i386/helper.c index 999c1bf..c961544 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1597,8 +1597,7 @@ static void mce_init(CPUX86State *cenv) && (cenv->cpuid_features&(CPUID_MCE|CPUID_MCA)) == (CPUID_MCE|CPUID_MCA)) { cenv->mcg_cap = MCE_CAP_DEF | MCE_BANKS_DEF; cenv->mcg_ctl = ~(uint64_t)0; - bank_num = cenv->mcg_cap & 0xff; - cenv->mce_banks = qemu_mallocz(bank_num * sizeof(uint64_t) * 4); + bank_num = MCE_BANKS_DEF; for (bank = 0; bank < bank_num; bank++) cenv->mce_banks[bank*4] = ~(uint64_t)0; } diff --git a/target-i386/machine.c b/target-i386/machine.c index 69e2620..88c085d 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -157,7 +157,7 @@ void cpu_save(QEMUFile *f, void *opaque) if (env->mcg_cap) { qemu_put_be64s(f, &env->mcg_status); qemu_put_be64s(f, &env->mcg_ctl); - for (i = 0; i < (env->mcg_cap & 0xff); i++) { + for (i = 0; i < MCE_BANKS_DEF; i++) { qemu_put_be64s(f, &env->mce_banks[4*i]); qemu_put_be64s(f, &env->mce_banks[4*i + 1]); qemu_put_be64s(f, &env->mce_banks[4*i + 2]); @@ -354,7 +354,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) if (env->mcg_cap) { qemu_get_be64s(f, &env->mcg_status); qemu_get_be64s(f, &env->mcg_ctl); - for (i = 0; i < (env->mcg_cap & 0xff); i++) { + for (i = 0; i < MCE_BANKS_DEF; i++) { qemu_get_be64s(f, &env->mce_banks[4*i]); qemu_get_be64s(f, &env->mce_banks[4*i + 1]); qemu_get_be64s(f, &env->mce_banks[4*i + 2]);