[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/26] vmstate: port cpu_comon
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 12/26] vmstate: port cpu_comon |
Date: |
Thu, 10 Sep 2009 03:04:33 +0200 |
Signed-off-by: Juan Quintela <address@hidden>
---
exec.c | 39 +++++++++++++++++++++++++--------------
1 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/exec.c b/exec.c
index c5bc13a..6a62a8a 100644
--- a/exec.c
+++ b/exec.c
@@ -513,28 +513,25 @@ void cpu_exec_init_all(unsigned long tb_size)
#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
-#define CPU_COMMON_SAVE_VERSION 1
-
-static void cpu_common_save(QEMUFile *f, void *opaque)
+static void cpu_common_pre_save(const void *opaque)
{
- CPUState *env = opaque;
+ CPUState *env = (void *)opaque;
cpu_synchronize_state(env);
-
- qemu_put_be32s(f, &env->halted);
- qemu_put_be32s(f, &env->interrupt_request);
}
-static int cpu_common_load(QEMUFile *f, void *opaque, int version_id)
+static int cpu_common_pre_load(void *opaque)
{
CPUState *env = opaque;
cpu_synchronize_state(env);
- if (version_id != CPU_COMMON_SAVE_VERSION)
- return -EINVAL;
+ return 0;
+}
+
+static int cpu_common_post_load(void *opaque)
+{
+ CPUState *env = opaque;
- qemu_get_be32s(f, &env->halted);
- qemu_get_be32s(f, &env->interrupt_request);
/* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the
version_id is increased. */
env->interrupt_request &= ~0x01;
@@ -542,6 +539,21 @@ static int cpu_common_load(QEMUFile *f, void *opaque, int
version_id)
return 0;
}
+
+static const VMStateDescription vmstate_cpu_common = {
+ .name = "cpu_common",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .pre_save = cpu_common_pre_save,
+ .pre_load = cpu_common_pre_load,
+ .post_load = cpu_common_post_load,
+ .fields = (VMStateField []) {
+ VMSTATE_UINT32(halted, CPUState),
+ VMSTATE_UINT32(interrupt_request, CPUState),
+ VMSTATE_END_OF_LIST()
+ }
+};
#endif
CPUState *qemu_get_cpu(int cpu)
@@ -581,8 +593,7 @@ void cpu_exec_init(CPUState *env)
cpu_list_unlock();
#endif
#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
- register_savevm("cpu_common", cpu_index, CPU_COMMON_SAVE_VERSION,
- cpu_common_save, cpu_common_load, env);
+ vmstate_register(cpu_index, &vmstate_cpu_common, env);
register_savevm("cpu", cpu_index, CPU_SAVE_VERSION,
cpu_save, cpu_load, env);
#endif
--
1.6.2.5
- [Qemu-devel] Re: [PATCH 05/26] Unexport ticks_per_sec variable. Create get_ticks_per_sec() function, (continued)
[Qemu-devel] [PATCH 07/26] timers: move them to VMState, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 08/26] vmstate: add sensible arguments to vmstate_unregister(), Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 09/26] vmstate: rename run_after_load() -> post_load(), Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 10/26] vmstate: Add pre_load() hook, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 11/26] vmstate: Add pre/post_save() hooks, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 12/26] vmstate: port cpu_comon,
Juan Quintela <=
[Qemu-devel] [PATCH 14/26] vmstate: port i8259 device, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 13/26] vmstate: port fw_cfg device, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 15/26] vmstate: add support for uint8_t equal, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 17/26] vmstate: add support for arrays of uint16_t, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 16/26] vmstate: port fdc device, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 18/26] vmstate: port dma device, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 19/26] vmstate: port vmmouse device, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 20/26] vmstate: port pckbd device, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 21/26] vmstate: add uint64 array support, Juan Quintela, 2009/09/09
[Qemu-devel] [PATCH 22/26] vmstate: port ioapic device, Juan Quintela, 2009/09/09