diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2011-05-03 20:16:18 -0300 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2011-05-03 20:16:18 -0300 |
commit | 28262112181f27f302b5186f0df6428df6b513e7 (patch) | |
tree | c1a12fd82d869eb8c57da3e3314abb3437f3a8a1 /hw/heathrow_pic.c | |
parent | 70757dcaa40e14978bf287084d8fab9efb815a2d (diff) | |
parent | 4eb1a092e5810298b2baf4b12d9f52ea0d52322f (diff) |
* upstream-merge: (197 commits)
NBD: Avoid leaking a couple of strings when the NBD device is closed
qemu-progress.c: printf isn't signal safe
ide/atapi: fix set but unused
atapi: Explain why we need a 'media not present' state
atapi: Move comment to proper place
qemu-img resize: Fix option parsing
lm32: add Milkymist Minimac2 support
milkymist-sysctl: fix timers
milkymist-vgafb: fix console resizing
lm32: fix exception handling
kvm: use qemu_free consistently
kvm: Install specialized interrupt handler
fix crash in migration, 32-bit userspace on 64-bit host
Redirect cpu_interrupt to callback handler
Break up user and system cpu_interrupt implementations
kvm: create kvmclock when one of the flags are present
kvm: add kvmclock to its second bit
x86: Allow multiple cpu feature matches of lookup_feature
kvm: use kernel-provided para_features instead of statically coming up with new capabilities
Don't zero out buffer in sched_getaffinity
...
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'hw/heathrow_pic.c')
-rw-r--r-- | hw/heathrow_pic.c | 62 |
1 files changed, 25 insertions, 37 deletions
diff --git a/hw/heathrow_pic.c b/hw/heathrow_pic.c index b19b754b3..5fd71a0f7 100644 --- a/hw/heathrow_pic.c +++ b/hw/heathrow_pic.c @@ -159,42 +159,31 @@ static void heathrow_pic_set_irq(void *opaque, int num, int level) heathrow_pic_update(s); } -static void heathrow_pic_save_one(QEMUFile *f, HeathrowPIC *s) -{ - qemu_put_be32s(f, &s->events); - qemu_put_be32s(f, &s->mask); - qemu_put_be32s(f, &s->levels); - qemu_put_be32s(f, &s->level_triggered); -} - -static void heathrow_pic_save(QEMUFile *f, void *opaque) -{ - HeathrowPICS *s = (HeathrowPICS *)opaque; - - heathrow_pic_save_one(f, &s->pics[0]); - heathrow_pic_save_one(f, &s->pics[1]); -} - -static void heathrow_pic_load_one(QEMUFile *f, HeathrowPIC *s) -{ - qemu_get_be32s(f, &s->events); - qemu_get_be32s(f, &s->mask); - qemu_get_be32s(f, &s->levels); - qemu_get_be32s(f, &s->level_triggered); -} - -static int heathrow_pic_load(QEMUFile *f, void *opaque, int version_id) -{ - HeathrowPICS *s = (HeathrowPICS *)opaque; - - if (version_id != 1) - return -EINVAL; - - heathrow_pic_load_one(f, &s->pics[0]); - heathrow_pic_load_one(f, &s->pics[1]); +static const VMStateDescription vmstate_heathrow_pic_one = { + .name = "heathrow_pic_one", + .version_id = 0, + .minimum_version_id = 0, + .minimum_version_id_old = 0, + .fields = (VMStateField[]) { + VMSTATE_UINT32(events, HeathrowPIC), + VMSTATE_UINT32(mask, HeathrowPIC), + VMSTATE_UINT32(levels, HeathrowPIC), + VMSTATE_UINT32(level_triggered, HeathrowPIC), + VMSTATE_END_OF_LIST() + } +}; - return 0; -} +static const VMStateDescription vmstate_heathrow_pic = { + .name = "heathrow_pic", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField[]) { + VMSTATE_STRUCT_ARRAY(pics, HeathrowPICS, 2, 1, + vmstate_heathrow_pic_one, HeathrowPIC), + VMSTATE_END_OF_LIST() + } +}; static void heathrow_pic_reset_one(HeathrowPIC *s) { @@ -223,8 +212,7 @@ qemu_irq *heathrow_pic_init(int *pmem_index, *pmem_index = cpu_register_io_memory(pic_read, pic_write, s, DEVICE_LITTLE_ENDIAN); - register_savevm(NULL, "heathrow_pic", -1, 1, heathrow_pic_save, - heathrow_pic_load, s); + vmstate_register(NULL, -1, &vmstate_heathrow_pic, s); qemu_register_reset(heathrow_pic_reset, s); return qemu_allocate_irqs(heathrow_pic_set_irq, s, 64); } |