VirtualBox

Changeset 34896 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 9, 2010 3:05:54 PM (14 years ago)
Author:
vboxsync
Message:

PIT: Avoid double calls of timer handler caused by integer truncation.

File:
1 edited

Legend:

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

    r34692 r34896  
    356356    uint32_t period2;
    357357
    358     d = ASMMultU64ByU32DivByU32(current_time - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer));
     358    /* Add one to current_time; if we don't, integer truncation will cause
     359     * the algorithm to think that at the end of each period, it's still
     360     * within the first one instead of at the beginning of the next one.
     361     */
     362    d = ASMMultU64ByU32DivByU32(current_time + 1 - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer));
    359363    switch(s->mode) {
    360364    default:
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