Author: neel
Date: Sat Aug 23 21:16:26 2014
New Revision: 270434
URL: http://svnweb.freebsd.org/changeset/base/270434

Log:
  Return the spurious interrupt vector (IRQ7 or IRQ15) if the atpic cannot
  find any unmasked pin with an interrupt asserted.
  
  Reviewed by:  tychon
  CR:           https://reviews.freebsd.org/D669
  MFC after:    1 week

Modified:
  head/sys/amd64/vmm/io/vatpic.c

Modified: head/sys/amd64/vmm/io/vatpic.c
==============================================================================
--- head/sys/amd64/vmm/io/vatpic.c      Sat Aug 23 20:45:00 2014        
(r270433)
+++ head/sys/amd64/vmm/io/vatpic.c      Sat Aug 23 21:16:26 2014        
(r270434)
@@ -500,13 +500,19 @@ vatpic_pending_intr(struct vm *vm, int *
        VATPIC_LOCK(vatpic);
 
        pin = vatpic_get_highest_irrpin(atpic);
-       if (pin == -1)
-               pin = 7;
        if (pin == 2) {
                atpic = &vatpic->atpic[1];
                pin = vatpic_get_highest_irrpin(atpic);
        }
 
+       /*
+        * If there are no pins active at this moment then return the spurious
+        * interrupt vector instead.
+        */
+       if (pin == -1)
+               pin = 7;
+
+       KASSERT(pin >= 0 && pin <= 7, ("%s: invalid pin %d", __func__, pin));
        *vecptr = atpic->irq_base + pin;
 
        VATPIC_UNLOCK(vatpic);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to