-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()