struct guest_info * core;
+ struct {
+ int (*ack)(struct guest_info * core, uint32_t irq, void * private_data);
+ void * private_data;
+ } irq_ack_cbs[15];
+
void * router_handle;
void * controller_handle;
return -1;
}
+ state->irq_ack_cbs[irq_num].ack = irq->ack;
+ state->irq_ack_cbs[irq_num].private_data = irq->private_data;
+
if (V3_Get_CPU() != vm->cores[0].pcpu_id) {
// guest is running on another core, interrupt it to deliver irq
v3_interrupt_cpu(vm, 0, 0);
state->master_irr &= ~(0x1 << irq);
}
} else {
- PrintDebug("8259 PIC: (master) Ignoring begin_irq for %d since I don't own it\n",irq);
+ PrintDebug("8259 PIC: (master) Ignoring begin_irq for %d since I don't own it\n", irq);
}
} else {
state->slave_irr &= ~(0x1 << (irq - 8));
}
} else {
- PrintDebug("8259 PIC: (slave) Ignoring begin_irq for %d since I don't own it\n",irq);
+ PrintDebug("8259 PIC: (slave) Ignoring begin_irq for %d since I don't own it\n", irq);
}
-
}
+
+
return 0;
}
if ((cw2->EOI) && (!cw2->R) && (cw2->SL)) {
// specific EOI;
state->master_isr &= ~(0x01 << cw2->level);
+
+
+ /*
+ // ack the irq if requested
+ if (state->irq_ack_cbs[irq].ack) {
+ state->irq_ack_cbs[irq].ack(info, irq, state->irq_ack_cbs[irq].private_data);
+ }
+ */
+
} else if ((cw2->EOI) & (!cw2->R) && (!cw2->SL)) {
int i;
// Non-specific EOI
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);
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);
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
state = (struct pic_internal *)V3_Malloc(sizeof(struct pic_internal));
- V3_ASSERT(state != NULL);
+ if (!state) {
+ PrintError("Cannot allocate in init\n");
+ return -1;
+ }
struct vm_device * dev = v3_add_device(vm, dev_id, &dev_ops, state);