new reset API
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@938 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/hw/i8259.c b/hw/i8259.c
index 622f0bb..c21f0d3 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -231,10 +231,20 @@
return intno;
}
+static void pic_reset(void *opaque)
+{
+ PicState *s = opaque;
+ int tmp;
+
+ tmp = s->elcr_mask;
+ memset(s, 0, sizeof(PicState));
+ s->elcr_mask = tmp;
+}
+
static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val)
{
PicState *s = opaque;
- int priority, cmd, irq, tmp;
+ int priority, cmd, irq;
#ifdef DEBUG_PIC
printf("pic_write: addr=0x%02x val=0x%02x\n", addr, val);
@@ -243,9 +253,7 @@
if (addr == 0) {
if (val & 0x10) {
/* init */
- tmp = s->elcr_mask;
- memset(s, 0, sizeof(PicState));
- s->elcr_mask = tmp;
+ pic_reset(s);
/* deassert a pending interrupt */
cpu_reset_interrupt(cpu_single_env, CPU_INTERRUPT_HARD);
@@ -458,6 +466,7 @@
register_ioport_read(elcr_addr, 1, 1, elcr_ioport_read, s);
}
register_savevm("i8259", io_addr, 1, pic_save, pic_load, s);
+ qemu_register_reset(pic_reset, s);
}
void pic_info(void)