From: Jack Lange Date: Fri, 27 Jul 2012 19:06:45 +0000 (-0400) Subject: added error check to 8259 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=a6c6130621519b97fb8f707001ff23595cc8e605;p=palacios.git added error check to 8259 --- diff --git a/palacios/src/devices/8259a.c b/palacios/src/devices/8259a.c index bfe90e5..0521c51 100644 --- a/palacios/src/devices/8259a.c +++ b/palacios/src/devices/8259a.c @@ -493,7 +493,7 @@ static int write_master_port1(struct guest_info * core, ushort_t port, void * sr state->master_isr &= ~(0x01 << i); break; } - } + } PrintDebug("8259 PIC: Post ISR = %x (wr_Master1)\n", state->master_isr); } else if (!(cw2->EOI) && (cw2->R) && (cw2->SL)) { PrintDebug("8259 PIC: Ignoring set-priority, priorities not implemented (level=%d, wr_Master1)\n", cw2->level); @@ -504,6 +504,13 @@ static int write_master_port1(struct guest_info * core, ushort_t port, void * sr return -1; } + if (cw2->EOI) { + if (pic_get_intr_number(core, state) != -1) { + PrintError("Interrupt pending after EOI\n"); + } + } + + state->master_ocw2 = cw; } else if (IS_OCW3(cw)) { PrintDebug("8259 PIC: Handling OCW3 = %x (wr_Master1)\n", cw); @@ -627,6 +634,14 @@ static int write_slave_port1(struct guest_info * core, ushort_t port, void * src return -1; } + if (cw2->EOI) { + if (pic_get_intr_number(core, state) != -1) { + PrintError("Interrupt pending after EOI\n"); + } + } + + + state->slave_ocw2 = cw; } else if (IS_OCW3(cw)) { // Basically sets the IRR/ISR read flag