aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-12-02 11:49:38 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:26 -0600
commit709ae102bcc68a40c333f9baff308b9a48380986 (patch)
treedfc09559cd0d33b3a85ba4abb586a22b35a895bd
parent1d190d5ce79b97138a03fc799df2c9397e34231c (diff)
gus: port to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/gus.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/hw/gus.c b/hw/gus.c
index c6b98b3ce4..d35da0a0c6 100644
--- a/hw/gus.c
+++ b/hw/gus.c
@@ -215,35 +215,22 @@ static int GUS_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len)
return dma_len;
}
-static void GUS_save (QEMUFile *f, void *opaque)
-{
- GUSState *s = opaque;
-
- qemu_put_be32 (f, s->pos);
- qemu_put_be32 (f, s->left);
- qemu_put_be32 (f, s->shift);
- qemu_put_be32 (f, s->irqs);
- qemu_put_be32 (f, s->samples);
- qemu_put_be64 (f, s->last_ticks);
- qemu_put_buffer (f, s->himem, sizeof (s->himem));
-}
-
-static int GUS_load (QEMUFile *f, void *opaque, int version_id)
-{
- GUSState *s = opaque;
-
- if (version_id != 2)
- return -EINVAL;
-
- s->pos = qemu_get_be32 (f);
- s->left = qemu_get_be32 (f);
- s->shift = qemu_get_be32 (f);
- s->irqs = qemu_get_be32 (f);
- s->samples = qemu_get_be32 (f);
- s->last_ticks = qemu_get_be64 (f);
- qemu_get_buffer (f, s->himem, sizeof (s->himem));
- return 0;
-}
+static const VMStateDescription vmstate_gus = {
+ .name = "gus",
+ .version_id = 2,
+ .minimum_version_id = 2,
+ .minimum_version_id_old = 2,
+ .fields = (VMStateField []) {
+ VMSTATE_INT32(pos, GUSState),
+ VMSTATE_INT32(left, GUSState),
+ VMSTATE_INT32(shift, GUSState),
+ VMSTATE_INT32(irqs, GUSState),
+ VMSTATE_INT32(samples, GUSState),
+ VMSTATE_INT64(last_ticks, GUSState),
+ VMSTATE_BUFFER(himem, GUSState),
+ VMSTATE_END_OF_LIST()
+ }
+};
static int gus_initfn (ISADevice *dev)
{
@@ -300,7 +287,7 @@ static int gus_initfn (ISADevice *dev)
AUD_set_active_out (s->voice, 1);
- register_savevm ("gus", 0, 2, GUS_save, GUS_load, s);
+ vmstate_register (0, &vmstate_gus, s);
return 0;
}