diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-06-20 12:58:36 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-06-20 12:58:36 +0000 |
commit | d7d02e3c3a50782c0fa6b17d16f9957f1cc82a65 (patch) | |
tree | f07209fb39574448a87f576dfaefb655568d1c86 /hw/i8259.c | |
parent | bb0c6722b6606ad34da75d093d95a9bdfe42bc98 (diff) |
new reset API
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@938 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/i8259.c')
-rw-r--r-- | hw/i8259.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/hw/i8259.c b/hw/i8259.c index 622f0bb75a..c21f0d3060 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -231,10 +231,20 @@ int cpu_get_pic_interrupt(CPUState *env) 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 @@ static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val) 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 @@ static void pic_init1(int io_addr, int elcr_addr, PicState *s) 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) |