// This will overwrite the bar registers.. but that should be ok.
memcpy(pci_dev->config_space, (uint8_t *)&(state->real_hdr), sizeof(struct pci_config_header));
+ state->pci_dev = pci_dev;
+
return 0;
}
+static int irq_handler(struct guest_info * info, struct v3_interrupt * intr, void * private_data) {
+ struct vm_device * dev = (struct vm_device *)private_data;
+ struct pt_dev_state * state = (struct pt_dev_state *)dev->private_data;
+
+ PrintDebug("Handling E1000 IRQ %d\n", intr->irq);
+
+ v3_pci_raise_irq(state->pci_bus, 0, state->pci_dev);
+
+ V3_ACK_IRQ(intr->irq);
+
+ return 0;
+}
+
+
+
+
static int passthrough_init(struct guest_info * info, void * cfg_data) {
struct pci_passthrough_cfg * cfg = (struct pci_passthrough_cfg *)cfg_data;
struct pt_dev_state * state = V3_Malloc(sizeof(struct pt_dev_state));
+
dev = v3_allocate_device("PCI_PASSTHROUGH", &dev_ops, state);
if (v3_attach_device(info, dev) == -1) {
setup_virt_pci_dev(info, dev);
+ v3_hook_irq(info, 59, irq_handler, dev);
+
return 0;
}