From patchwork Tue Sep 29 20:48:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 34487 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 72D58B7C0E for ; Wed, 30 Sep 2009 07:58:49 +1000 (EST) Received: from localhost ([127.0.0.1]:36589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MskiZ-00062D-UE for incoming@patchwork.ozlabs.org; Tue, 29 Sep 2009 17:58:43 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsjeF-0005Zc-A4 for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsjeA-0005TC-8A for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:10 -0400 Received: from [199.232.76.173] (port=55248 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Msje9-0005Sy-Mt for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33685) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Msje8-0002b3-Bz for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:05 -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 n8TKo3x1021654 for ; Tue, 29 Sep 2009 16:50:03 -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 n8TKnHYA006885; Tue, 29 Sep 2009 16:50:02 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 29 Sep 2009 22:48:54 +0200 Message-Id: <7ef223438a54f88606934e70c44c015b161ed2e2.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 35/49] x86: add fpregs_format_vmstate 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 Don't even ask, being able to load/save between 64<->80bit floats should be forbidden Signed-off-by: Juan Quintela --- target-i386/cpu.h | 1 + target-i386/machine.c | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index e13f87b..af122a1 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -595,6 +595,7 @@ typedef struct CPUX86State { uint16_t fpus; uint16_t fpus_vmstate; uint16_t fptag_vmstate; + uint16_t fpregs_format_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 e1621d4..69e2620 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -26,7 +26,6 @@ static void cpu_get_seg(QEMUFile *f, SegmentCache *dt) void cpu_save(QEMUFile *f, void *opaque) { CPUState *env = opaque; - uint16_t fpregs_format; int i, bit; cpu_synchronize_state(env); @@ -49,11 +48,11 @@ void cpu_save(QEMUFile *f, void *opaque) qemu_put_be16s(f, &env->fptag_vmstate); #ifdef USE_X86LDOUBLE - fpregs_format = 0; + env->fpregs_format_vmstate = 0; #else - fpregs_format = 1; + env->fpregs_format_vmstate = 1; #endif - qemu_put_be16s(f, &fpregs_format); + qemu_put_be16s(f, &env->fpregs_format_vmstate); for(i = 0; i < 8; i++) { #ifdef USE_X86LDOUBLE @@ -195,7 +194,6 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) { CPUState *env = opaque; int i, guess_mmx; - uint16_t fpregs_format; cpu_synchronize_state(env); if (version_id < 3 || version_id > CPU_SAVE_VERSION) @@ -209,7 +207,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) qemu_get_be16s(f, &env->fpuc); qemu_get_be16s(f, &env->fpus_vmstate); qemu_get_be16s(f, &env->fptag_vmstate); - qemu_get_be16s(f, &fpregs_format); + qemu_get_be16s(f, &env->fpregs_format_vmstate); /* NOTE: we cannot always restore the FPU state if the image come from a host with a different 'USE_X86LDOUBLE' define. We guess @@ -219,7 +217,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) uint64_t mant; uint16_t exp; - switch(fpregs_format) { + switch(env->fpregs_format_vmstate) { case 0: mant = qemu_get_be64(f); exp = qemu_get_be16(f);