diff mbox

[10/35] vmstate: introduce CPU_DoubleU arrays

Message ID cce0866eb5e8313aa59d408b536e4165c9909645.1336128412.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela May 4, 2012, 10:54 a.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 da8f234..0a00dec 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1132,6 +1132,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)))