[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/26] timers: move them to VMState
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 07/26] timers: move them to VMState |
Date: |
Thu, 10 Sep 2009 03:04:28 +0200 |
Signed-off-by: Juan Quintela <address@hidden>
---
vl.c | 34 ++++++++++++----------------------
1 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/vl.c b/vl.c
index 19129ad..3828eb4 100644
--- a/vl.c
+++ b/vl.c
@@ -1074,28 +1074,18 @@ void qemu_get_timer(QEMUFile *f, QEMUTimer *ts)
}
}
-static void timer_save(QEMUFile *f, void *opaque)
-{
- struct TimersState *s = opaque;
-
- qemu_put_be64(f, s->cpu_ticks_offset);
- qemu_put_be64(f, s->ticks_per_sec);
- qemu_put_be64(f, s->cpu_clock_offset);
-}
-
-static int timer_load(QEMUFile *f, void *opaque, int version_id)
-{
- struct TimersState *s = opaque;
-
- if (version_id != 1 && version_id != 2)
- return -EINVAL;
- s->cpu_ticks_offset = qemu_get_be64(f);
- s->ticks_per_sec = qemu_get_be64(f);
- if (version_id == 2) {
- s->cpu_clock_offset = qemu_get_be64(f);
+static const VMStateDescription vmstate_timers = {
+ .name = "timer",
+ .version_id = 2,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .fields = (VMStateField []) {
+ VMSTATE_INT64(cpu_ticks_offset, TimersState),
+ VMSTATE_INT64(ticks_per_sec, TimersState),
+ VMSTATE_INT64_V(cpu_clock_offset, TimersState, 2),
+ VMSTATE_END_OF_LIST()
}
- return 0;
-}
+};
static void qemu_event_increment(void);
@@ -5621,7 +5611,7 @@ int main(int argc, char **argv, char **envp)
if (qemu_opts_foreach(&qemu_drive_opts, drive_init_func, machine, 1) != 0)
exit(1);
- register_savevm("timer", 0, 2, timer_save, timer_load, &timers_state);
+ vmstate_register(0, &vmstate_timers ,&timers_state);
register_savevm_live("ram", 0, 3, ram_save_live, NULL, ram_load, NULL);
/* Maintain compatibility with multiple stdio monitors */
--
1.6.2.5
- [Qemu-devel] Re: [PATCH 05/26] Unexport ticks_per_sec variable. Create get_ticks_per_sec() function, (continued)
- [Qemu-devel] Re: [PATCH 05/26] Unexport ticks_per_sec variable. Create get_ticks_per_sec() function, Juan Quintela, 2009/09/11
- [Qemu-devel] Re: [PATCH 05/26] Unexport ticks_per_sec variable. Create get_ticks_per_sec() function, Jan Kiszka, 2009/09/11
- [Qemu-devel] Re: [PATCH 05/26] Unexport ticks_per_sec variable. Create get_ticks_per_sec() function, Juan Quintela, 2009/09/10
- [Qemu-devel] Re: [PATCH 05/26] Unexport ticks_per_sec variable. Create get_ticks_per_sec() function, Paolo Bonzini, 2009/09/10
- [Qemu-devel] Re: [PATCH 05/26] Unexport ticks_per_sec variable. Create get_ticks_per_sec() function, malc, 2009/09/10
[Qemu-devel] Re: [PATCH 05/26] Unexport ticks_per_sec variable. Create get_ticks_per_sec() function, Jan Kiszka, 2009/09/11
[Qemu-devel] [PATCH 07/26] timers: move them to VMState,
Juan Quintela <=
[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, 2009/09/09
[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