summaryrefslogtreecommitdiffstats
path: root/hw/heathrow_pic.c
diff options
context:
space:
mode:
authorblueswir12008-12-28 19:27:10 +0100
committerblueswir12008-12-28 19:27:10 +0100
commit6e6b73631301d41e8b18de4d35937bc78b0117f3 (patch)
tree486b45bbe8c6cceb18161b7bbec986324fc33492 /hw/heathrow_pic.c
parentSuppress a -Werror=format-security warning (diff)
downloadqemu-6e6b73631301d41e8b18de4d35937bc78b0117f3.tar.gz
qemu-6e6b73631301d41e8b18de4d35937bc78b0117f3.tar.xz
qemu-6e6b73631301d41e8b18de4d35937bc78b0117f3.zip
Register reset handlers
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6136 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/heathrow_pic.c')
-rw-r--r--hw/heathrow_pic.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/hw/heathrow_pic.c b/hw/heathrow_pic.c
index 35bb764e70..c78a4ee638 100644
--- a/hw/heathrow_pic.c
+++ b/hw/heathrow_pic.c
@@ -165,17 +165,33 @@ static void heathrow_pic_set_irq(void *opaque, int num, int level)
heathrow_pic_update(s);
}
+static void heathrow_pic_reset_one(HeathrowPIC *s)
+{
+ memset(s, '\0', sizeof(HeathrowPIC));
+}
+
+static void heathrow_pic_reset(void *opaque)
+{
+ HeathrowPICS *s = opaque;
+
+ heathrow_pic_reset_one(&s->pics[0]);
+ heathrow_pic_reset_one(&s->pics[1]);
+
+ s->pics[0].level_triggered = 0;
+ s->pics[1].level_triggered = 0x1ff00000;
+}
+
qemu_irq *heathrow_pic_init(int *pmem_index,
int nb_cpus, qemu_irq **irqs)
{
HeathrowPICS *s;
s = qemu_mallocz(sizeof(HeathrowPICS));
- s->pics[0].level_triggered = 0;
- s->pics[1].level_triggered = 0x1ff00000;
/* only 1 CPU */
s->irqs = irqs[0];
*pmem_index = cpu_register_io_memory(0, pic_read, pic_write, s);
+ qemu_register_reset(heathrow_pic_reset, s);
+ heathrow_pic_reset(s);
return qemu_allocate_irqs(heathrow_pic_set_irq, s, 64);
}