[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/25] vmstate: introduce float64 arrays
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 11/25] vmstate: introduce float64 arrays |
Date: |
Tue, 25 Oct 2011 16:00:45 +0200 |
Signed-off-by: Juan Quintela <address@hidden>
---
hw/hw.h | 4 ++++
savevm.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/hw/hw.h b/hw/hw.h
index 014cdc1..3044cec 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -355,6 +355,7 @@ extern const VMStateInfo vmstate_info_uint32;
extern const VMStateInfo vmstate_info_uint64;
extern const VMStateInfo vmstate_info_float32;
+extern const VMStateInfo vmstate_info_float64;
extern const VMStateInfo vmstate_info_timer;
extern const VMStateInfo vmstate_info_ptimer;
@@ -880,6 +881,9 @@ extern const VMStateDescription vmstate_hid_ptr_device;
#define VMSTATE_FLOAT32_ARRAY(_f, _s, _n) \
VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_float32, float32)
+#define VMSTATE_FLOAT64_ARRAY(_f, _s, _n) \
+ VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_float64, float64)
+
#define VMSTATE_BUFFER_V(_f, _s, _v) \
VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
diff --git a/savevm.c b/savevm.c
index cd0178c..2e191ad 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1057,6 +1057,36 @@ const VMStateInfo vmstate_info_float32 = {
.put = put_float32,
};
+/* 64 bit float */
+
+typedef union {
+ float64 d;
+ uint64_t l;
+} VMStateFloat64;
+
+static int get_float64(QEMUFile *f, void *pv, size_t size)
+{
+ float64 *v = pv;
+ VMStateFloat64 u;
+ qemu_get_be64s(f, &u.l);
+ *v = u.d;
+ return 0;
+}
+
+static void put_float64(QEMUFile *f, void *pv, size_t size)
+{
+ float64 *v = pv;
+ VMStateFloat64 u;
+ u.d = *v;
+ qemu_put_be64s(f, &u.l);
+}
+
+const VMStateInfo vmstate_info_float64 = {
+ .name = "float64",
+ .get = get_float64,
+ .put = put_float64,
+};
+
/* timers */
static int get_timer(QEMUFile *f, void *pv, size_t size)
--
1.7.6.4
- Re: [Qemu-devel] [PATCH 06/25] vmstate: use new style for lm32 cpus, (continued)
- [Qemu-devel] [PATCH 03/25] vmstate: make all architectures export a way to migrate cpu's, Juan Quintela, 2011/10/25
- [Qemu-devel] [PATCH 08/25] vmstate: port cris cpu to vmstate, Juan Quintela, 2011/10/25
- [Qemu-devel] [PATCH 09/25] vmstate: machine.c is only compiled for !CONFIG_USER_ONLY, Juan Quintela, 2011/10/25
- [Qemu-devel] [PATCH 11/25] vmstate: introduce float64 arrays,
Juan Quintela <=
- [Qemu-devel] [PATCH 10/25] vmstate: introduce float32 arrays, Juan Quintela, 2011/10/25
- [Qemu-devel] [PATCH 17/25] vmstate: make incompatible change for sparc, Juan Quintela, 2011/10/25
- [Qemu-devel] [PATCH 20/25] mips: make tlb an embedded struct instead of a pointer, Juan Quintela, 2011/10/25
- [Qemu-devel] [PATCH 24/25] vmstate: port arm cpu, Juan Quintela, 2011/10/25
- [Qemu-devel] [PATCH 18/25] mips_fulong2e: cpu vmstate already registered in cpu_exec_init, Juan Quintela, 2011/10/25
- [Qemu-devel] [PATCH 19/25] mips: make mvp an embedded struct instead of pointer, Juan Quintela, 2011/10/25