VirtualBox

Changeset 28455 in vbox


Ignore:
Timestamp:
Apr 19, 2010 12:23:28 PM (15 years ago)
Author:
vboxsync
Message:

DevPS2: Once OBF is set, do not change the type of the reported event.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Input/DevPS2.cpp

    r28079 r28455  
    297297    irq1_level = 0;
    298298    irq12_level = 0;
    299     s->status &= ~(KBD_STAT_OBF | KBD_STAT_MOUSE_OBF);
    300     if (q->count != 0)
    301     {
    302         s->status |= KBD_STAT_OBF;
    303         if ((s->mode & KBD_MODE_KBD_INT) && !(s->mode & KBD_MODE_DISABLE_KBD))
    304             irq1_level = 1;
    305     }
    306     else if (mcq->count != 0 || meq->count != 0)
    307     {
    308         s->status |= KBD_STAT_OBF | KBD_STAT_MOUSE_OBF;
    309         if (s->mode & KBD_MODE_MOUSE_INT)
    310             irq12_level = 1;
     299   
     300    /* Determine new OBF state, but only if OBF is clear. If OBF was already
     301     * set, we cannot risk changing the event type after an ISR potentially
     302     * started executing! Only kbd_read_data() clears the OBF bits.
     303     */
     304    if (!(s->status & KBD_STAT_OBF)) {
     305        s->status &= ~KBD_STAT_MOUSE_OBF;
     306        /* Keyboard data has priority if both kbd and aux data is available. */
     307        if (q->count != 0)
     308        {
     309            s->status |= KBD_STAT_OBF;
     310        }
     311        else if (mcq->count != 0 || meq->count != 0)
     312        {
     313            s->status |= KBD_STAT_OBF | KBD_STAT_MOUSE_OBF;
     314        }
     315    }
     316    /* Determine new IRQ state. */
     317    if (s->status & KBD_STAT_OBF) {
     318        if (s->status & KBD_STAT_MOUSE_OBF)
     319        {
     320            if (s->mode & KBD_MODE_MOUSE_INT)
     321                irq12_level = 1;
     322        }
     323        else
     324        {   /* KBD_STAT_OBF set but KBD_STAT_MOUSE_OBF isn't. */
     325            if ((s->mode & KBD_MODE_KBD_INT) && !(s->mode & KBD_MODE_DISABLE_KBD))
     326                irq1_level = 1;
     327        }
    311328    }
    312329    PDMDevHlpISASetIrq(s->CTX_SUFF(pDevIns), 1, irq1_level);
     
    550567        else
    551568            PDMDevHlpISASetIrq(s->CTX_SUFF(pDevIns), 1, 0);
     569        /* Reading data clears the OBF bits, too. */
     570        s->status &= ~(KBD_STAT_OBF | KBD_STAT_MOUSE_OBF);
    552571    }
    553572    /* reassert IRQs if data left */
Note: See TracChangeset for help on using the changeset viewer.

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