VirtualBox

Changeset 20131 in vbox


Ignore:
Timestamp:
May 28, 2009 6:55:10 PM (15 years ago)
Author:
vboxsync
Message:

DevPit-i8254.cpp: divide by zero workaround/hack. This needs proper fixing.

File:
1 edited

Legend:

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

    r20087 r20131  
    182182            return s->count - (d % s->count); /** @todo check this value. */
    183183        }
     184        uint64_t Interval = s->u64NextTS - s->u64ReloadTS;
     185        if (!Interval)
     186            return s->count - 1; /** @todo This is WRONG! But I'm too tired to fix it properly and just want to shut up a DIV/0 trap now. */
    184187        d = TMTimerGet(pTimer);
    185         d = ASMMultU64ByU32DivByU32(d - s->u64ReloadTS, s->count, s->u64NextTS - s->u64ReloadTS);
     188        d = ASMMultU64ByU32DivByU32(d - s->u64ReloadTS, s->count, Interval);
    186189        if (d >= s->count)
    187190            return 1;
    188         return  s->count - d;
     191        return s->count - d;
    189192    }
    190193    d = ASMMultU64ByU32DivByU32(TMTimerGet(pTimer) - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer));
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