From b41a2cd1e4228c765e3b82ec6c89096528b4d7d9 Mon Sep 17 00:00:00 2001 From: bellard Date: Sun, 14 Mar 2004 21:46:48 +0000 Subject: io port API change git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@664 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/i8259.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'hw/i8259.c') diff --git a/hw/i8259.c b/hw/i8259.c index 08c7be394..5ef1fa070 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -46,6 +46,8 @@ /* debug PIC */ //#define DEBUG_PIC +//#define DEBUG_IRQ_LATENCY + typedef struct PicState { uint8_t last_irr; /* edge detection */ uint8_t irr; /* interrupt request register */ @@ -220,15 +222,14 @@ int cpu_x86_get_pic_interrupt(CPUState *env) return intno; } -void pic_ioport_write(CPUState *env, uint32_t addr, uint32_t val) +static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val) { - PicState *s; + PicState *s = opaque; int priority, cmd, irq; #ifdef DEBUG_PIC printf("pic_write: addr=0x%02x val=0x%02x\n", addr, val); #endif - s = &pics[addr >> 7]; addr &= 1; if (addr == 0) { if (val & 0x10) { @@ -334,14 +335,13 @@ static uint32_t pic_poll_read (PicState *s, uint32_t addr1) return ret; } -uint32_t pic_ioport_read(CPUState *env, uint32_t addr1) +static uint32_t pic_ioport_read(void *opaque, uint32_t addr1) { - PicState *s; + PicState *s = opaque; unsigned int addr; int ret; addr = addr1; - s = &pics[addr >> 7]; addr &= 1; if (s->poll) { ret = pic_poll_read(s, addr1); @@ -378,11 +378,9 @@ uint32_t pic_intack_read(CPUState *env) void pic_init(void) { -#if defined (TARGET_I386) || defined (TARGET_PPC) - register_ioport_write(0x20, 2, pic_ioport_write, 1); - register_ioport_read(0x20, 2, pic_ioport_read, 1); - register_ioport_write(0xa0, 2, pic_ioport_write, 1); - register_ioport_read(0xa0, 2, pic_ioport_read, 1); -#endif + 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]); } -- cgit v1.2.3