From patchwork Tue Sep 29 20:48:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 34484 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 C6C7E1007D2 for ; Wed, 30 Sep 2009 07:53:56 +1000 (EST) Received: from localhost ([127.0.0.1]:36447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mskdt-00045t-TI for incoming@patchwork.ozlabs.org; Tue, 29 Sep 2009 17:53:53 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsjeA-0005U8-Le for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Msje5-0005OL-Pn for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:05 -0400 Received: from [199.232.76.173] (port=55242 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Msje5-0005O3-HY for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17536) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Msje4-0002Zm-AP for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:00 -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 n8TKnxKs028592 for ; Tue, 29 Sep 2009 16:49:59 -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 n8TKnHY7006885; Tue, 29 Sep 2009 16:49:58 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 29 Sep 2009 22:48:51 +0200 Message-Id: <125ffef04fae46382b3c9e56c6099b7adcb5f8e8.1254255997.git.quintela@redhat.com> 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. Subject: [Qemu-devel] [PATCH 32/49] x86: fpus is uint16_t not unsigned int 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 We save more that fpus on that 16 bits (fpstt), we need an additional field Signed-off-by: Juan Quintela --- target-i386/cpu.h | 3 ++- target-i386/machine.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 4969dd1..d5c64e6 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -592,7 +592,8 @@ typedef struct CPUX86State { /* FPU state */ unsigned int fpstt; /* top of stack index */ - unsigned int fpus; + uint16_t fpus; + uint16_t fpus_vmstate; uint16_t fpuc; uint8_t fptags[8]; /* 0 = valid, 1 = empty */ union { diff --git a/target-i386/machine.c b/target-i386/machine.c index 852eeb7..7da5d6a 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -26,7 +26,7 @@ static void cpu_get_seg(QEMUFile *f, SegmentCache *dt) void cpu_save(QEMUFile *f, void *opaque) { CPUState *env = opaque; - uint16_t fptag, fpus, fpregs_format; + uint16_t fptag, fpregs_format; int32_t pending_irq; int i, bit; @@ -39,14 +39,14 @@ void cpu_save(QEMUFile *f, void *opaque) qemu_put_be32s(f, &env->hflags); /* FPU */ - fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11; + env->fpus_vmstate = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11; fptag = 0; for(i = 0; i < 8; i++) { fptag |= ((!env->fptags[i]) << i); } qemu_put_be16s(f, &env->fpuc); - qemu_put_be16s(f, &fpus); + qemu_put_be16s(f, &env->fpus_vmstate); qemu_put_be16s(f, &fptag); #ifdef USE_X86LDOUBLE @@ -196,7 +196,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) { CPUState *env = opaque; int i, guess_mmx; - uint16_t fpus, fptag, fpregs_format; + uint16_t fptag, fpregs_format; int32_t pending_irq; cpu_synchronize_state(env); @@ -209,14 +209,14 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) qemu_get_be32s(f, &env->hflags); qemu_get_be16s(f, &env->fpuc); - qemu_get_be16s(f, &fpus); + qemu_get_be16s(f, &env->fpus_vmstate); qemu_get_be16s(f, &fptag); qemu_get_be16s(f, &fpregs_format); /* NOTE: we cannot always restore the FPU state if the image come from a host with a different 'USE_X86LDOUBLE' define. We guess if we are in an MMX state to restore correctly in that case. */ - guess_mmx = ((fptag == 0xff) && (fpus & 0x3800) == 0); + guess_mmx = ((fptag == 0xff) && (env->fpus_vmstate & 0x3800) == 0); for(i = 0; i < 8; i++) { uint64_t mant; uint16_t exp; @@ -259,8 +259,8 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) } /* XXX: restore FPU round state */ - env->fpstt = (fpus >> 11) & 7; - env->fpus = fpus & ~0x3800; + env->fpstt = (env->fpus_vmstate >> 11) & 7; + env->fpus = env->fpus_vmstate & ~0x3800; fptag ^= 0xff; for(i = 0; i < 8; i++) { env->fptags[i] = (fptag >> i) & 1;