[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 22/49] vmstate: add support for arrays of pointers
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 22/49] vmstate: add support for arrays of pointers |
Date: |
Tue, 29 Sep 2009 22:48:41 +0200 |
We need this to send arrays of timers
Signed-off-by: Juan Quintela <address@hidden>
---
hw/hw.h | 15 +++++++++++++++
savevm.c | 3 +++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/hw/hw.h b/hw/hw.h
index c33d8d1..6f4d9eb 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -286,6 +286,7 @@ enum VMStateFlags {
VMS_STRUCT = 0x008,
VMS_VARRAY = 0x010, /* Array with size in another field */
VMS_BUFFER = 0x020, /* static sized buffer */
+ VMS_ARRAY_OF_POINTER = 0x040,
};
typedef struct {
@@ -396,6 +397,17 @@ extern const VMStateInfo vmstate_info_buffer;
+ type_check(_type,typeof_field(_state, _field)) \
}
+#define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _version, _info, _type)
{\
+ .name = (stringify(_field)), \
+ .version_id = (_version), \
+ .num = (_num), \
+ .info = &(_info), \
+ .size = sizeof(_type), \
+ .flags = VMS_ARRAY|VMS_ARRAY_OF_POINTER, \
+ .offset = offsetof(_state, _field) \
+ + type_check_array(_type,typeof_field(_state, _field),_num) \
+}
+
#define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _version, _vmsd, _type) { \
.name = (stringify(_field)), \
.num = (_num), \
@@ -518,6 +530,9 @@ extern const VMStateDescription vmstate_i2c_slave;
#define VMSTATE_TIMER(_f, _s) \
VMSTATE_TIMER_V(_f, _s, 0)
+#define VMSTATE_TIMER_ARRAY(_f, _s, _n) \
+ VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *)
+
#define VMSTATE_PTIMER_V(_f, _s, _v) \
VMSTATE_POINTER(_f, _s, _v, vmstate_info_ptimer, ptimer_state *)
diff --git a/savevm.c b/savevm.c
index fefde7c..11b331b 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1070,6 +1070,9 @@ int vmstate_load_state(QEMUFile *f, const
VMStateDescription *vmsd,
for (i = 0; i < n_elems; i++) {
void *addr = base_addr + field->size * i;
+ if (field->flags & VMS_ARRAY_OF_POINTER) {
+ addr = *(void **)addr;
+ }
if (field->flags & VMS_STRUCT) {
ret = vmstate_load_state(f, field->vmsd, addr,
field->vmsd->version_id);
} else {
--
1.6.2.5
- [Qemu-devel] [PATCH 14/49] vmstate: create VMSTATE_STRUCT_POINTER, (continued)
- [Qemu-devel] [PATCH 14/49] vmstate: create VMSTATE_STRUCT_POINTER, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 13/49] vmstate: port max7310 device, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 15/49] vmstate: port pxa2xx_i2c device, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 17/49] vmstate: create VMSTATE_INT16_ARRAY, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 16/49] vmstate: port ssd0303 device, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 18/49] tmp105: change len and alorm to uint8_t, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 19/49] vmstate: port tmp105 device, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 20/49] twl92230: change pwrbtn_state to uint8_t, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 21/49] vmstate: port twl92230 device, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 24/49] vmstate: port lm832x device, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 22/49] vmstate: add support for arrays of pointers,
Juan Quintela <=
- [Qemu-devel] [PATCH 23/49] lm832x: make fields to have the same types that they are saved/loaded, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 25/49] vmstate: remove i2c_slave_load/save, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 26/49] vmstate: port audio/audio.c, Juan Quintela, 2009/09/29
- [Qemu-devel] [PATCH 27/49] ac97: add active to the state, Juan Quintela, 2009/09/29
- Re: [Qemu-devel] [PATCH 27/49] ac97: add active to the state, malc, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Juan Quintela, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, malc, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Juan Quintela, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, malc, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Juan Quintela, 2009/09/30