diff options
author | Juan Quintela <quintela@redhat.com> | 2010-12-01 23:15:41 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-04-22 14:41:40 -0500 |
commit | eecd33a57895a579bd4d2270b1bc758b608ae5a4 (patch) | |
tree | 3a3fbe0ce7d7318d00ce103c690bde236acd11ab /hw/arm_timer.c | |
parent | 81986ac4b66af8005fbe79558c319ba6a38561c2 (diff) | |
download | qemu-eecd33a57895a579bd4d2270b1bc758b608ae5a4.zip qemu-eecd33a57895a579bd4d2270b1bc758b608ae5a4.tar.gz qemu-eecd33a57895a579bd4d2270b1bc758b608ae5a4.tar.bz2 |
vmstate: port arm_timer
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'hw/arm_timer.c')
-rw-r--r-- | hw/arm_timer.c | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/hw/arm_timer.c b/hw/arm_timer.c index cfd1ebe..dac9e70 100644 --- a/hw/arm_timer.c +++ b/hw/arm_timer.c @@ -140,28 +140,19 @@ static void arm_timer_tick(void *opaque) arm_timer_update(s); } -static void arm_timer_save(QEMUFile *f, void *opaque) -{ - arm_timer_state *s = (arm_timer_state *)opaque; - qemu_put_be32(f, s->control); - qemu_put_be32(f, s->limit); - qemu_put_be32(f, s->int_level); - qemu_put_ptimer(f, s->timer); -} - -static int arm_timer_load(QEMUFile *f, void *opaque, int version_id) -{ - arm_timer_state *s = (arm_timer_state *)opaque; - - if (version_id != 1) - return -EINVAL; - - s->control = qemu_get_be32(f); - s->limit = qemu_get_be32(f); - s->int_level = qemu_get_be32(f); - qemu_get_ptimer(f, s->timer); - return 0; -} +static const VMStateDescription vmstate_arm_timer = { + .name = "arm_timer", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT32(control, arm_timer_state), + VMSTATE_UINT32(limit, arm_timer_state), + VMSTATE_INT32(int_level, arm_timer_state), + VMSTATE_PTIMER(timer, arm_timer_state), + VMSTATE_END_OF_LIST() + } +}; static arm_timer_state *arm_timer_init(uint32_t freq) { @@ -174,7 +165,7 @@ static arm_timer_state *arm_timer_init(uint32_t freq) bh = qemu_bh_new(arm_timer_tick, s); s->timer = ptimer_init(bh); - register_savevm(NULL, "arm_timer", -1, 1, arm_timer_save, arm_timer_load, s); + vmstate_register(NULL, -1, &vmstate_arm_timer, s); return s; } |