VirtualBox

Changeset 67891 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
Jul 10, 2017 6:37:59 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116857
Message:

PIC: Simplified implementation. Seems to work just as well as the previous code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevPIC.cpp

    r64369 r67891  
    243243       for the priority computation. */
    244244    mask = pPic->isr;
     245    if (pPic->special_mask)
     246        mask &= ~pPic->imr;
    245247    if (pPic->special_fully_nested_mode && pPic->idxPic == 0)
    246248        mask &= ~(1 << 2);
     
    316318    return VINF_SUCCESS;
    317319}
    318 
    319 /** @note if an interrupt line state changes from unmasked to masked, then it must be deactivated when currently pending! */
    320 static void pic_update_imr(PDEVPIC pThis, PPICSTATE pPic, uint8_t val)
    321 {
    322     int       irq, intno;
    323     PPICSTATE pActivePIC;
    324 
    325     /* Query the current pending irq, if any. */
    326     pActivePIC = &pThis->aPics[0];
    327     intno = irq = pic_get_irq(pActivePIC);
    328     if (irq == 2)
    329     {
    330         pActivePIC = &pThis->aPics[1];
    331         irq = pic_get_irq(pActivePIC);
    332         intno = irq + 8;
    333     }
    334 
    335     /* Update IMR */
    336     Log(("pic_update_imr: pic%u %#x -> %#x\n", pPic->idxPic, pPic->imr, val));
    337     pPic->imr = val;
    338 
    339     /* If an interrupt is pending and now masked, then clear the FF flag. */
    340     if (    irq >= 0
    341         &&  ((1 << irq) & ~pActivePIC->imr) == 0)
    342     {
    343         Log(("pic_update_imr: pic0: elcr=%x last_irr=%x irr=%x imr=%x isr=%x irq_base=%x\n",
    344             pThis->aPics[0].elcr, pThis->aPics[0].last_irr, pThis->aPics[0].irr, pThis->aPics[0].imr, pThis->aPics[0].isr, pThis->aPics[0].irq_base));
    345         Log(("pic_update_imr: pic1: elcr=%x last_irr=%x irr=%x imr=%x isr=%x irq_base=%x\n",
    346             pThis->aPics[1].elcr, pThis->aPics[1].last_irr, pThis->aPics[1].irr, pThis->aPics[1].imr, pThis->aPics[1].isr, pThis->aPics[1].irq_base));
    347 
    348         /* Clear pending IRQ 2 on master controller in case of slave interrupt. */
    349         /** @todo Is this correct? */
    350         if (intno > 7)
    351         {
    352             pThis->aPics[0].irr &= ~(1 << 2);
    353             STAM_COUNTER_INC(&pThis->StatClearedActiveSlaveIRQ);
    354         }
    355         else
    356             STAM_COUNTER_INC(&pThis->StatClearedActiveMasterIRQ);
    357 
    358         Log(("pic_update_imr: clear pending interrupt %d\n", intno));
    359         pThis->CTX_SUFF(pPicHlp)->pfnClearInterruptFF(pThis->CTX_SUFF(pDevIns));
    360     }
    361 }
    362 
    363320
    364321/**
     
    595552            case 0:
    596553                /* normal mode */
    597                 pic_update_imr(pThis, pPic, val);
    598 
     554                pPic->imr = val;
    599555                rc = pic_update_irq(pThis);
    600556                Assert(rc == VINF_SUCCESS);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette