aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'xen/arch/x86/irq.c')
-rw-r--r--xen/arch/x86/irq.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index ab5fd15556..2e150bc05b 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -772,6 +772,21 @@ void set_direct_apic_vector(
direct_apic_vector[vector] = handler;
}
+void alloc_direct_apic_vector(
+ uint8_t *vector, void (*handler)(struct cpu_user_regs *))
+{
+ static uint8_t next = LAST_HIPRIORITY_VECTOR;
+ static DEFINE_SPINLOCK(lock);
+
+ spin_lock(&lock);
+ if (*vector == 0) {
+ BUG_ON(next == FIRST_HIPRIORITY_VECTOR);
+ set_direct_apic_vector(next, handler);
+ *vector = next--;
+ }
+ spin_unlock(&lock);
+}
+
void do_IRQ(struct cpu_user_regs *regs)
{
struct irqaction *action;