@@ -201,6 +201,20 @@ extern const VMStateInfo vmstate_info_bitmap;
.offset = vmstate_offset_value(_state, _field, _type), \
}
+/*
+ * This is used for fields synthetized from the state, but that don't
+ * exist as such. That is the reaso of offset 0. They get the whole
+ * struct.
+ */
+
+#define VMSTATE_SYNTHETIC(_name, _info, _size) { \
+ .name = (_name), \
+ .size = (_size), \
+ .info = &(_info), \
+ .flags = VMS_SINGLE, \
+ .offset = 0, \
+}
+
#define VMSTATE_POINTER(_field, _state, _test, _info, _type) { \
.name = (stringify(_field)), \
.info = &(_info), \
@@ -23,20 +23,10 @@ static const VMStateInfo vmstate_fpcr = {
static VMStateField vmstate_env_fields[] = {
VMSTATE_UINTTL_ARRAY(ir, CPUAlphaState, 31),
VMSTATE_UINTTL_ARRAY(fir, CPUAlphaState, 31),
+
/* Save the architecture value of the fpcr, not the internally
- expanded version. Since this architecture value does not
- exist in memory to be stored, this requires a but of hoop
- jumping. We want OFFSET=0 so that we effectively pass ENV
- to the helper functions, and we need to fill in the name by
- hand since there's no field of that name. */
- {
- .name = "fpcr",
- .version_id = 0,
- .size = sizeof(uint64_t),
- .info = &vmstate_fpcr,
- .flags = VMS_SINGLE,
- .offset = 0
- },
+ expanded version. */
+ VMSTATE_SYNTHETIC("fpcr", vmstate_fpcr, sizeof(uint64_t)),
VMSTATE_UINTTL(pc, CPUAlphaState),
VMSTATE_UINTTL(unique, CPUAlphaState),
VMSTATE_UINTTL(lock_addr, CPUAlphaState),
@@ -47,14 +47,7 @@ static const VMStateDescription vmstate_vfp = {
*/
VMSTATE_UINT32(env.vfp.xregs[0], ARMCPU),
VMSTATE_UINT32_SUB_ARRAY(env.vfp.xregs, ARMCPU, 2, 14),
- {
- .name = "fpscr",
- .version_id = 0,
- .size = sizeof(uint32_t),
- .info = &vmstate_fpscr,
- .flags = VMS_SINGLE,
- .offset = 0,
- },
+ VMSTATE_SYNTHETIC("fpscr", vmstate_fpscr, sizeof(uint32)),
VMSTATE_END_OF_LIST()
}
};
@@ -224,14 +217,7 @@ const VMStateDescription vmstate_arm_cpu = {
.post_load = cpu_post_load,
.fields = (VMStateField[]) {
VMSTATE_UINT32_ARRAY(env.regs, ARMCPU, 16),
- {
- .name = "cpsr",
- .version_id = 0,
- .size = sizeof(uint32_t),
- .info = &vmstate_cpsr,
- .flags = VMS_SINGLE,
- .offset = 0,
- },
+ VMSTATE_SYNTHETIC("cpsr", vmstate_cpsr, sizeof(uint32_t)),
VMSTATE_UINT32(env.spsr, ARMCPU),
VMSTATE_UINT64_ARRAY(env.banked_spsr, ARMCPU, 6),
VMSTATE_UINT32_ARRAY(env.banked_r13, ARMCPU, 6),
It is used for fields that don't exist on the State. They are generated on the fly for migration. Signed-off-by: Juan Quintela <quintela@redhat.com> --- include/migration/vmstate.h | 14 ++++++++++++++ target-alpha/machine.c | 16 +++------------- target-arm/machine.c | 18 ++---------------- 3 files changed, 19 insertions(+), 29 deletions(-)