svn commit: r191730 - in head/sys: amd64/amd64 i386/i386

Alexander Motin mav at FreeBSD.org
Fri May 1 20:53:39 UTC 2009


Author: mav
Date: Fri May  1 20:53:37 2009
New Revision: 191730
URL: http://svn.freebsd.org/changeset/base/191730

Log:
  Small addition to r191720.
  
  Restore previous behaviour for the case of unknown interrupt. Invocation
  of IRQ -1 crashes my system on resume. Returning 0, as it was, is not
  perfect also, but at least not so dangerous.

Modified:
  head/sys/amd64/amd64/local_apic.c
  head/sys/i386/i386/local_apic.c

Modified: head/sys/amd64/amd64/local_apic.c
==============================================================================
--- head/sys/amd64/amd64/local_apic.c	Fri May  1 19:46:42 2009	(r191729)
+++ head/sys/amd64/amd64/local_apic.c	Fri May  1 20:53:37 2009	(r191730)
@@ -950,11 +950,15 @@ apic_free_vector(u_int apic_id, u_int ve
 u_int
 apic_idt_to_irq(u_int apic_id, u_int vector)
 {
+	int irq;
 
 	KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL &&
 	    vector <= APIC_IO_INTS + APIC_NUM_IOINTS,
 	    ("Vector %u does not map to an IRQ line", vector));
-	return (lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS]);
+	irq = lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS];
+	if (irq < 0)
+		irq = 0;
+	return (irq);
 }
 
 #ifdef DDB

Modified: head/sys/i386/i386/local_apic.c
==============================================================================
--- head/sys/i386/i386/local_apic.c	Fri May  1 19:46:42 2009	(r191729)
+++ head/sys/i386/i386/local_apic.c	Fri May  1 20:53:37 2009	(r191730)
@@ -954,11 +954,15 @@ apic_free_vector(u_int apic_id, u_int ve
 u_int
 apic_idt_to_irq(u_int apic_id, u_int vector)
 {
+	int irq;
 
 	KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL &&
 	    vector <= APIC_IO_INTS + APIC_NUM_IOINTS,
 	    ("Vector %u does not map to an IRQ line", vector));
-	return (lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS]);
+	irq = lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS];
+	if (irq < 0)
+		irq = 0;
+	return (irq);
 }
 
 #ifdef DDB


More information about the svn-src-all mailing list