qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 15/16] i440fx: use new vmstate infrastructure


From: Juan Quintela
Subject: [Qemu-devel] [PATCH 15/16] i440fx: use new vmstate infrastructure
Date: Fri, 28 Aug 2009 15:28:26 +0200

Signed-off-by: Juan Quintela <address@hidden>
---
 hw/piix_pci.c |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index a044883..5c33741 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -154,21 +154,11 @@ static void i440fx_write_config(PCIDevice *dev,
         i440fx_update_memory_mappings(d);
 }

-static void i440fx_save(QEMUFile* f, void *opaque)
-{
-    PCII440FXState *d = opaque;
-
-    pci_device_save(&d->dev, f);
-    qemu_put_8s(f, &d->smm_enabled);
-}
-
-static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
+static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id)
 {
     PCII440FXState *d = opaque;
     int ret, i;

-    if (version_id > 3)
-        return -EINVAL;
     ret = pci_device_load(&d->dev, f);
     if (ret < 0)
         return ret;
@@ -182,6 +172,28 @@ static int i440fx_load(QEMUFile* f, void *opaque, int 
version_id)
     return 0;
 }

+static int i440fx_after_load(void *opaque)
+{
+    PCII440FXState *d = opaque;
+
+    i440fx_update_memory_mappings(d);
+    return 0;
+}
+
+static const VMStateDescription vmstate_i440fx = {
+    .name = "I440FX",
+    .version_id = 3,
+    .minimum_version_id = 3,
+    .minimum_version_id_old = 1,
+    .load_state_old = i440fx_load_old,
+    .run_after_load = i440fx_after_load,
+    .fields      = (VMStateField []) {
+        VMSTATE_PCI_DEVICE(dev, PCII440FXState),
+        VMSTATE_UINT8(smm_enabled, PCII440FXState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static int i440fx_pcihost_initfn(SysBusDevice *dev)
 {
     I440FXState *s = FROM_SYSBUS(I440FXState, dev);
@@ -210,7 +222,7 @@ static int i440fx_initfn(PCIDevice *dev)

     d->dev.config[0x72] = 0x02; /* SMRAM */

-    register_savevm("I440FX", 0, 3, i440fx_save, i440fx_load, d);
+    vmstate_register(0, &vmstate_i440fx, d);
     return 0;
 }

-- 
1.6.2.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]