VirtualBox

Changeset 35178 in vbox


Ignore:
Timestamp:
Dec 16, 2010 1:06:34 PM (14 years ago)
Author:
vboxsync
Message:

PIT: Modes 2/6 and 3/7 are identical.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevPit-i8254.cpp

    r34900 r35178  
    8888#endif
    8989
     90/** The effective counter mode - if bit 1 is set, bit 2 is ignored. */
     91#define EFFECTIVE_MODE(x)   ((x) & ~(((x) & 2) << 1))
    9092
    9193/*******************************************************************************
     
    188190    PTMTIMER pTimer = s->CTX_SUFF(pPit)->channels[0].CTX_SUFF(pTimer);
    189191
    190     if (s->mode == 2)
     192    if (EFFECTIVE_MODE(s->mode) == 2)
    191193    {
    192194        if (s->u64NextTS == UINT64_MAX)
     
    205207    }
    206208    d = ASMMultU64ByU32DivByU32(TMTimerGet(pTimer) - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer));
    207     switch(s->mode) {
     209    switch(EFFECTIVE_MODE(s->mode)) {
    208210    case 0:
    209211    case 1:
     
    232234
    233235    d = ASMMultU64ByU32DivByU32(current_time - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer));
    234     switch(s->mode) {
     236    switch(EFFECTIVE_MODE(s->mode)) {
    235237    default:
    236238    case 0:
     
    293295    Assert((val & 1) == val);
    294296
    295     switch(s->mode) {
     297    switch(EFFECTIVE_MODE(s->mode)) {
    296298    default:
    297299    case 0:
     
    357359
    358360    d = ASMMultU64ByU32DivByU32(current_time - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer));
    359     switch(s->mode) {
     361    switch(EFFECTIVE_MODE(s->mode)) {
    360362    default:
    361363    case 0:
     
    436438        pDevIns = s->CTX_SUFF(pPit)->pDevIns;
    437439
    438         if (s->mode == 2)
     440        if (EFFECTIVE_MODE(s->mode) == 2)
    439441        {
    440442            /* We just flip-flop the irq level to save that extra timer call, which isn't generally required (we haven't served it for years). */
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