vmstate: port arm sp804

Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
Juan Quintela 2010-12-01 23:12:32 +01:00 committed by Anthony Liguori
parent c7298ab251
commit 81986ac4b6

View File

@ -235,24 +235,17 @@ static CPUWriteMemoryFunc * const sp804_writefn[] = {
sp804_write
};
static void sp804_save(QEMUFile *f, void *opaque)
{
sp804_state *s = (sp804_state *)opaque;
qemu_put_be32(f, s->level[0]);
qemu_put_be32(f, s->level[1]);
}
static int sp804_load(QEMUFile *f, void *opaque, int version_id)
{
sp804_state *s = (sp804_state *)opaque;
if (version_id != 1)
return -EINVAL;
s->level[0] = qemu_get_be32(f);
s->level[1] = qemu_get_be32(f);
return 0;
}
static const VMStateDescription vmstate_sp804 = {
.name = "sp804",
.version_id = 1,
.minimum_version_id = 1,
.minimum_version_id_old = 1,
.fields = (VMStateField[]) {
VMSTATE_INT32_ARRAY(level, sp804_state, 2),
VMSTATE_END_OF_LIST()
}
};
static int sp804_init(SysBusDevice *dev)
{
@ -271,7 +264,7 @@ static int sp804_init(SysBusDevice *dev)
iomemtype = cpu_register_io_memory(sp804_readfn,
sp804_writefn, s, DEVICE_NATIVE_ENDIAN);
sysbus_init_mmio(dev, 0x1000, iomemtype);
register_savevm(&dev->qdev, "sp804", -1, 1, sp804_save, sp804_load, s);
vmstate_register(&dev->qdev, -1, &vmstate_sp804, s);
return 0;
}