aboutsummaryrefslogtreecommitdiff
path: root/hw/slavio_intctl.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2009-08-28 20:22:52 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-08-28 20:22:52 +0000
commitc9e95029504d872ce5699d946b769c1f9544ba44 (patch)
treef5c9b9ad08fa081fce50ac725ef0af2af3dcdc89 /hw/slavio_intctl.c
parent7130a4224765ad853fc81822bac8adb112bb3c7f (diff)
downloadqemu-c9e95029504d872ce5699d946b769c1f9544ba44.zip
qemu-c9e95029504d872ce5699d946b769c1f9544ba44.tar.gz
qemu-c9e95029504d872ce5699d946b769c1f9544ba44.tar.bz2
Sparc32: port interrupt controller to VMState design
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/slavio_intctl.c')
-rw-r--r--hw/slavio_intctl.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c
index b81ad57..259e45e 100644
--- a/hw/slavio_intctl.c
+++ b/hw/slavio_intctl.c
@@ -374,36 +374,40 @@ static void slavio_set_irq_all(void *opaque, int irq, int level)
}
}
-static void slavio_intctl_save(QEMUFile *f, void *opaque)
+static int vmstate_intctl_after_load(void *opaque)
{
SLAVIO_INTCTLState *s = opaque;
- int i;
- for (i = 0; i < MAX_CPUS; i++) {
- qemu_put_be32s(f, &s->slaves[i].intreg_pending);
- }
- qemu_put_be32s(f, &s->intregm_pending);
- qemu_put_be32s(f, &s->intregm_disabled);
- qemu_put_be32s(f, &s->target_cpu);
+ slavio_check_interrupts(s, 0);
+ return 0;
}
-static int slavio_intctl_load(QEMUFile *f, void *opaque, int version_id)
-{
- SLAVIO_INTCTLState *s = opaque;
- int i;
-
- if (version_id != 1)
- return -EINVAL;
+static const VMStateDescription vmstate_intctl_cpu = {
+ .name ="slavio_intctl_cpu",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .fields = (VMStateField []) {
+ VMSTATE_UINT32(intreg_pending, SLAVIO_CPUINTCTLState),
+ VMSTATE_END_OF_LIST()
+ }
+};
- for (i = 0; i < MAX_CPUS; i++) {
- qemu_get_be32s(f, &s->slaves[i].intreg_pending);
+static const VMStateDescription vmstate_intctl = {
+ .name ="slavio_intctl",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .run_after_load = vmstate_intctl_after_load,
+ .fields = (VMStateField []) {
+ VMSTATE_STRUCT_ARRAY(slaves, SLAVIO_INTCTLState, MAX_CPUS, 1,
+ vmstate_intctl_cpu, SLAVIO_CPUINTCTLState),
+ VMSTATE_UINT32(intregm_pending, SLAVIO_INTCTLState),
+ VMSTATE_UINT32(intregm_disabled, SLAVIO_INTCTLState),
+ VMSTATE_UINT32(target_cpu, SLAVIO_INTCTLState),
+ VMSTATE_END_OF_LIST()
}
- qemu_get_be32s(f, &s->intregm_pending);
- qemu_get_be32s(f, &s->intregm_disabled);
- qemu_get_be32s(f, &s->target_cpu);
- slavio_check_interrupts(s, 0);
- return 0;
-}
+};
static void slavio_intctl_reset(void *opaque)
{
@@ -442,8 +446,7 @@ static int slavio_intctl_init1(SysBusDevice *dev)
s->slaves[i].cpu = i;
s->slaves[i].master = s;
}
- register_savevm("slavio_intctl", -1, 1, slavio_intctl_save,
- slavio_intctl_load, s);
+ vmstate_register(-1, &vmstate_intctl, s);
qemu_register_reset(slavio_intctl_reset, s);
slavio_intctl_reset(s);
return 0;