Patchwork [42/49] x86: port segments to vmstate

login
register
mail settings
Submitter Juan Quintela
Date Sept. 29, 2009, 8:49 p.m.
Message ID <86ed4fc56f0b8e6a0e809802ddcc210162253912.1254255997.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/34494/
State Superseded
Headers show

Comments

Juan Quintela - Sept. 29, 2009, 8:49 p.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 target-i386/machine.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

Patch

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)