diff options
author | Juan Quintela <quintela@redhat.com> | 2009-09-10 03:04:35 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-09-11 11:10:06 -0500 |
commit | 77eea83830d8616ad657bb87313953002dfb85f0 (patch) | |
tree | 00d72e8fb6926c05f4764e4294d7fd957a51e25b /hw/i8259.c | |
parent | 7d2edd40fb4981ad8d0809bc8142f1ca59411e59 (diff) | |
download | qemu-77eea83830d8616ad657bb87313953002dfb85f0.zip qemu-77eea83830d8616ad657bb87313953002dfb85f0.tar.gz qemu-77eea83830d8616ad657bb87313953002dfb85f0.tar.bz2 |
vmstate: port i8259 device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/i8259.c')
-rw-r--r-- | hw/i8259.c | 74 |
1 files changed, 26 insertions, 48 deletions
@@ -446,53 +446,31 @@ static uint32_t elcr_ioport_read(void *opaque, uint32_t addr1) return s->elcr; } -static void pic_save(QEMUFile *f, void *opaque) -{ - PicState *s = opaque; - - qemu_put_8s(f, &s->last_irr); - qemu_put_8s(f, &s->irr); - qemu_put_8s(f, &s->imr); - qemu_put_8s(f, &s->isr); - qemu_put_8s(f, &s->priority_add); - qemu_put_8s(f, &s->irq_base); - qemu_put_8s(f, &s->read_reg_select); - qemu_put_8s(f, &s->poll); - qemu_put_8s(f, &s->special_mask); - qemu_put_8s(f, &s->init_state); - qemu_put_8s(f, &s->auto_eoi); - qemu_put_8s(f, &s->rotate_on_auto_eoi); - qemu_put_8s(f, &s->special_fully_nested_mode); - qemu_put_8s(f, &s->init4); - qemu_put_8s(f, &s->single_mode); - qemu_put_8s(f, &s->elcr); -} - -static int pic_load(QEMUFile *f, void *opaque, int version_id) -{ - PicState *s = opaque; - - if (version_id != 1) - return -EINVAL; - - qemu_get_8s(f, &s->last_irr); - qemu_get_8s(f, &s->irr); - qemu_get_8s(f, &s->imr); - qemu_get_8s(f, &s->isr); - qemu_get_8s(f, &s->priority_add); - qemu_get_8s(f, &s->irq_base); - qemu_get_8s(f, &s->read_reg_select); - qemu_get_8s(f, &s->poll); - qemu_get_8s(f, &s->special_mask); - qemu_get_8s(f, &s->init_state); - qemu_get_8s(f, &s->auto_eoi); - qemu_get_8s(f, &s->rotate_on_auto_eoi); - qemu_get_8s(f, &s->special_fully_nested_mode); - qemu_get_8s(f, &s->init4); - qemu_get_8s(f, &s->single_mode); - qemu_get_8s(f, &s->elcr); - return 0; -} +static const VMStateDescription vmstate_pic = { + .name = "i8259", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField []) { + VMSTATE_UINT8(last_irr, PicState), + VMSTATE_UINT8(irr, PicState), + VMSTATE_UINT8(imr, PicState), + VMSTATE_UINT8(isr, PicState), + VMSTATE_UINT8(priority_add, PicState), + VMSTATE_UINT8(irq_base, PicState), + VMSTATE_UINT8(read_reg_select, PicState), + VMSTATE_UINT8(poll, PicState), + VMSTATE_UINT8(special_mask, PicState), + VMSTATE_UINT8(init_state, PicState), + VMSTATE_UINT8(auto_eoi, PicState), + VMSTATE_UINT8(rotate_on_auto_eoi, PicState), + VMSTATE_UINT8(special_fully_nested_mode, PicState), + VMSTATE_UINT8(init4, PicState), + VMSTATE_UINT8(single_mode, PicState), + VMSTATE_UINT8(elcr, PicState), + VMSTATE_END_OF_LIST() + } +}; /* XXX: add generic master/slave system */ static void pic_init1(int io_addr, int elcr_addr, PicState *s) @@ -503,7 +481,7 @@ static void pic_init1(int io_addr, int elcr_addr, PicState *s) register_ioport_write(elcr_addr, 1, 1, elcr_ioport_write, s); register_ioport_read(elcr_addr, 1, 1, elcr_ioport_read, s); } - register_savevm("i8259", io_addr, 1, pic_save, pic_load, s); + vmstate_register(io_addr, &vmstate_pic, s); qemu_register_reset(pic_reset, s); } |