From 2028834574e75de9d34995fbaf09a8b35cb9daa0 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 28 Mar 2012 15:42:03 +0200 Subject: qtest: IRQ interception infrastructure Since /i440fx/piix3 is being removed from the composition tree, the IO-APIC is placed under /i440fx. This is wrong and should be changed as soon as the /i440fx/piix3 path is put back. Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- hw/irq.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'hw/irq.c') diff --git a/hw/irq.c b/hw/irq.c index 62f766eb6f..d413a0b235 100644 --- a/hw/irq.c +++ b/hw/irq.c @@ -104,3 +104,20 @@ qemu_irq *qemu_irq_proxy(qemu_irq **target, int n) { return qemu_allocate_irqs(proxy_irq_handler, target, n); } + +void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n) +{ + int i; + qemu_irq *old_irqs = qemu_allocate_irqs(NULL, NULL, n); + for (i = 0; i < n; i++) { + *old_irqs[i] = *gpio_in[i]; + gpio_in[i]->handler = handler; + gpio_in[i]->opaque = old_irqs; + } +} + +void qemu_irq_intercept_out(qemu_irq **gpio_out, qemu_irq_handler handler, int n) +{ + qemu_irq *old_irqs = *gpio_out; + *gpio_out = qemu_allocate_irqs(handler, old_irqs, n); +} -- cgit v1.2.3-55-g7522