aboutsummaryrefslogtreecommitdiff
path: root/hw/i8259.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-03-31 18:58:38 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-03-31 18:58:38 +0000
commitb0a21b5334fb31042d555bfb66de864291c53140 (patch)
treed9a0fd630071798b7a87b32c03a1e61fe87e2a9d /hw/i8259.c
parentdff38e7b40b398dd713643d57d89f280c6d09ff1 (diff)
downloadqemu-b0a21b5334fb31042d555bfb66de864291c53140.zip
qemu-b0a21b5334fb31042d555bfb66de864291c53140.tar.gz
qemu-b0a21b5334fb31042d555bfb66de864291c53140.tar.bz2
use new timer API
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@689 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/i8259.c')
-rw-r--r--hw/i8259.c62
1 files changed, 56 insertions, 6 deletions
diff --git a/hw/i8259.c b/hw/i8259.c
index 5ef1fa0..55488c6 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -122,7 +122,7 @@ static int pic_get_irq(PicState *s)
/* raise irq to CPU if necessary. must be called every time the active
irq may change */
-void pic_update_irq(void)
+static void pic_update_irq(void)
{
int irq2, irq;
@@ -160,7 +160,6 @@ void pic_update_irq(void)
#ifdef DEBUG_IRQ_LATENCY
int64_t irq_time[16];
-int64_t cpu_get_ticks(void);
#endif
#if defined(DEBUG_PIC)
int irq_level[16];
@@ -376,11 +375,62 @@ uint32_t pic_intack_read(CPUState *env)
return ret;
}
+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);
+}
+
+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);
+ return 0;
+}
+
+/* XXX: add generic master/slave system */
+static void pic_init1(int io_addr, PicState *s)
+{
+ register_ioport_write(io_addr, 2, 1, pic_ioport_write, s);
+ register_ioport_read(io_addr, 2, 1, pic_ioport_read, s);
+
+ register_savevm("i8259", io_addr, 1, pic_save, pic_load, s);
+}
+
void pic_init(void)
{
- register_ioport_write(0x20, 2, 1, pic_ioport_write, &pics[0]);
- register_ioport_read(0x20, 2, 1, pic_ioport_read, &pics[0]);
- register_ioport_write(0xa0, 2, 1, pic_ioport_write, &pics[1]);
- register_ioport_read(0xa0, 2, 1, pic_ioport_read, &pics[1]);
+ pic_init1(0x20, &pics[0]);
+ pic_init1(0xa0, &pics[1]);
}