i386/ioapic_abi: Mark the unused IOAPIC irqmap as reserved
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 20 Dec 2011 11:47:23 +0000 (19:47 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 20 Dec 2011 11:51:24 +0000 (19:51 +0800)
Since IDT on i386 is shared, we need to guard against reuse
an already used IDT entry

sys/platform/pc32/apic/ioapic_abi.c

index 2923186..7441c74 100644 (file)
@@ -799,10 +799,14 @@ ioapic_abi_fixup_irqmap(void)
 {
        int cpu;
 
+       ioapic_abi_line_irq_max += 1;
+       if (bootverbose)
+               kprintf("IOAPIC: line irq max %d\n", ioapic_abi_line_irq_max);
+
        for (cpu = 0; cpu < ncpus; ++cpu) {
                int i;
 
-               for (i = 0; i < ISA_IRQ_CNT; ++i) {
+               for (i = 0; i < ioapic_abi_line_irq_max; ++i) {
                        struct ioapic_irqmap *map = &ioapic_irqmaps[cpu][i];
 
                        if (map->im_type == IOAPIC_IMT_UNUSED) {
@@ -814,10 +818,6 @@ ioapic_abi_fixup_irqmap(void)
                        }
                }
        }
-
-       ioapic_abi_line_irq_max += 1;
-       if (bootverbose)
-               kprintf("IOAPIC: line irq max %d\n", ioapic_abi_line_irq_max);
 }
 
 int