diff mbox

[11/36] vmstate: introduce CPU_DoubleU arrays

Message ID 13a12e41e391a9e50a2590a7c4f30c603f07fcc3.1332197811.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela March 19, 2012, 10:57 p.m. UTC
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 savevm.c  |   24 ++++++++++++++++++++++++
 vmstate.h |    4 ++++
 2 files changed, 28 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/savevm.c b/savevm.c
index 822f078..4c42076 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1142,6 +1142,30 @@  const VMStateInfo vmstate_info_float64 = {
     .put  = put_float64,
 };

+/* 64 bit CPUDouble */
+
+static int get_cpudouble(QEMUFile *f, void *pv, size_t size)
+{
+    CPU_DoubleU *v = pv;
+
+    qemu_get_be32s(f, &v->l.upper);
+    qemu_get_be32s(f, &v->l.lower);
+    return 0;
+}
+
+static void put_cpudouble(QEMUFile *f, void *pv, size_t size)
+{
+    CPU_DoubleU *v = pv;
+    qemu_put_be32s(f, &v->l.upper);
+    qemu_put_be32s(f, &v->l.lower);
+}
+
+const VMStateInfo vmstate_info_cpudouble = {
+    .name = "CPU_Double_U",
+    .get  = get_cpudouble,
+    .put  = put_cpudouble,
+};
+
 /* timers  */

 static int get_timer(QEMUFile *f, void *pv, size_t size)
diff --git a/vmstate.h b/vmstate.h
index d3fb88c..5c56f25 100644
--- a/vmstate.h
+++ b/vmstate.h
@@ -132,6 +132,7 @@  extern const VMStateInfo vmstate_info_uint64;

 extern const VMStateInfo vmstate_info_float32;
 extern const VMStateInfo vmstate_info_float64;
+extern const VMStateInfo vmstate_info_cpudouble;

 extern const VMStateInfo vmstate_info_timer;
 extern const VMStateInfo vmstate_info_buffer;
@@ -568,6 +569,9 @@  extern const VMStateDescription vmstate_cpu;
 #define VMSTATE_FLOAT64_ARRAY(_f, _s, _n)                             \
     VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_float64, float64)

+#define VMSTATE_CPUDOUBLE_ARRAY(_f, _s, _n)                             \
+    VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_cpudouble, CPU_DoubleU)
+
 #define VMSTATE_BUFFER_V(_f, _s, _v)                                  \
     VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))