From patchwork Tue Sep 29 20:49:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 34494 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 0799BB7C1B for ; Wed, 30 Sep 2009 08:11:44 +1000 (EST) Received: from localhost ([127.0.0.1]:37750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mskv7-0005RA-7M for incoming@patchwork.ozlabs.org; Tue, 29 Sep 2009 18:11:41 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsjeO-0005l6-PW for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsjeJ-0005fU-MQ for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:20 -0400 Received: from [199.232.76.173] (port=55261 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsjeJ-0005ek-8s for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9757) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MsjeI-0002eP-57 for qemu-devel@nongnu.org; Tue, 29 Sep 2009 16:50:14 -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 n8TKoDj1002863 for ; Tue, 29 Sep 2009 16:50:13 -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 n8TKnHYH006885; Tue, 29 Sep 2009 16:50:11 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 29 Sep 2009 22:49:01 +0200 Message-Id: <86ed4fc56f0b8e6a0e809802ddcc210162253912.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 42/49] x86: port segments to 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 Signed-off-by: Juan Quintela --- target-i386/machine.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/target-i386/machine.c b/target-i386/machine.c index 3c0ffc2..35de2fb 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -7,20 +7,28 @@ #include "exec-all.h" #include "kvm.h" +static const VMStateDescription vmstate_segment = { + .name = "segment", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField []) { + VMSTATE_UINT32(selector, SegmentCache), + VMSTATE_UINTTL(base, SegmentCache), + VMSTATE_UINT32(limit, SegmentCache), + VMSTATE_UINT32(flags, SegmentCache), + VMSTATE_END_OF_LIST() + } +}; + static void cpu_put_seg(QEMUFile *f, SegmentCache *dt) { - qemu_put_be32(f, dt->selector); - qemu_put_betl(f, dt->base); - qemu_put_be32(f, dt->limit); - qemu_put_be32(f, dt->flags); + vmstate_save_state(f, &vmstate_segment, dt); } static void cpu_get_seg(QEMUFile *f, SegmentCache *dt) { - dt->selector = qemu_get_be32(f); - dt->base = qemu_get_betl(f); - dt->limit = qemu_get_be32(f); - dt->flags = qemu_get_be32(f); + vmstate_load_state(f, &vmstate_segment, dt, vmstate_segment.version_id); } void cpu_save(QEMUFile *f, void *opaque)