[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/36] vmstate: introduce float32 arrays
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 09/36] vmstate: introduce float32 arrays |
Date: |
Mon, 19 Mar 2012 23:57:37 +0100 |
Signed-off-by: Juan Quintela <address@hidden>
---
savevm.c | 30 ++++++++++++++++++++++++++++++
vmstate.h | 5 +++++
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/savevm.c b/savevm.c
index 12fb209..09a2149 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1082,6 +1082,36 @@ const VMStateInfo vmstate_info_uint16_equal = {
.put = put_uint16,
};
+/* 32 bit float */
+
+typedef union {
+ float32 f;
+ uint32_t i;
+} VMStateFloat32;
+
+static int get_float32(QEMUFile *f, void *pv, size_t size)
+{
+ float32 *v = pv;
+ VMStateFloat32 u;
+ qemu_get_be32s(f, &u.i);
+ *v = u.f;
+ return 0;
+}
+
+static void put_float32(QEMUFile *f, void *pv, size_t size)
+{
+ float32 *v = pv;
+ VMStateFloat32 u;
+ u.f = *v;
+ qemu_put_be32s(f, &u.i);
+}
+
+const VMStateInfo vmstate_info_float32 = {
+ .name = "float32",
+ .get = get_float32,
+ .put = put_float32,
+};
+
/* timers */
static int get_timer(QEMUFile *f, void *pv, size_t size)
diff --git a/vmstate.h b/vmstate.h
index 1a4a60b..135c5aa 100644
--- a/vmstate.h
+++ b/vmstate.h
@@ -130,6 +130,8 @@ extern const VMStateInfo vmstate_info_uint16;
extern const VMStateInfo vmstate_info_uint32;
extern const VMStateInfo vmstate_info_uint64;
+extern const VMStateInfo vmstate_info_float32;
+
extern const VMStateInfo vmstate_info_timer;
extern const VMStateInfo vmstate_info_buffer;
extern const VMStateInfo vmstate_info_unused_buffer;
@@ -559,6 +561,9 @@ extern const VMStateDescription vmstate_cpu;
#define VMSTATE_INT64_ARRAY(_f, _s, _n) \
VMSTATE_INT64_ARRAY_V(_f, _s, _n, 0)
+#define VMSTATE_FLOAT32_ARRAY(_f, _s, _n) \
+ VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_float32, float32)
+
#define VMSTATE_BUFFER_V(_f, _s, _v) \
VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
--
1.7.7.6
- [Qemu-devel] [PATCH 27/36] vmstate: remove unneeded includes from target-*/machine.c, (continued)
- [Qemu-devel] [PATCH 27/36] vmstate: remove unneeded includes from target-*/machine.c, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 26/36] vmstate: fix vmstate formating for i386, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 01/36] vmstate: Simplify test for CPU_SAVE_VERSION, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 22/36] vmstate: port mips cpu, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 21/36] mips: bump migration version to 4, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 31/36] vmstate: Add copyright info for cris processor, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 10/36] vmstate: introduce float64 arrays, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 05/36] vmstate: use new style for lm32 cpus, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 28/36] vmstate: rename machine.c to vmstate-cpu.c, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 29/36] vmstate: Add copyright info for alpha processor, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 09/36] vmstate: introduce float32 arrays,
Juan Quintela <=
- [Qemu-devel] [PATCH 23/36] arm: save always 32 fpu registers, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 25/36] vmstate: all cpus converted, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 17/36] vmstate: make incompatible change for sparc, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 34/36] vmstate: Add copyright info for mips processor, Juan Quintela, 2012/03/19
- [Qemu-devel] [PATCH 24/36] vmstate: port arm cpu, Juan Quintela, 2012/03/19