VirtualBox

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


Ignore:
Timestamp:
Sep 27, 2010 1:11:27 PM (14 years ago)
Author:
vboxsync
Message:

apicDoFrequencyHinting: don't div/0.

File:
1 edited

Legend:

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

    r32505 r32775  
    15031503 * @param   pThis               The device state.
    15041504 */
    1505 DECLINLINE(void) apciDoFrequencyHinting(APICState *pThis)
     1505DECLINLINE(void) apicDoFrequencyHinting(APICState *pThis)
    15061506{
    15071507    if (   pThis->uHintedInitialCount != pThis->initial_count
    15081508        || pThis->uHintedCountShift   != (uint32_t)pThis->count_shift)
    15091509    {
    1510         pThis->uHintedInitialCount = pThis->initial_count;
    1511         pThis->uHintedCountShift   = pThis->count_shift;
     1510        pThis->uHintedInitialCount  = pThis->initial_count;
     1511        pThis->uHintedCountShift    = pThis->count_shift;
    15121512
    15131513        uint64_t cTickPerPeriod = (uint64_t)pThis->initial_count << pThis->count_shift;
    1514         uint32_t uHz            = TMTimerGetFreq(pThis->CTX_SUFF(pTimer)) / cTickPerPeriod;
     1514        uint32_t uHz = cTickPerPeriod > 0
     1515                     ? TMTimerGetFreq(pThis->CTX_SUFF(pTimer)) / cTickPerPeriod
     1516                     : 100 /*whatever*/;
    15151517        TMTimerSetFrequencyHint(pThis->CTX_SUFF(pTimer), uHz);
    15161518        Log(("apic: %u Hz\n", uHz));
     
    15501552        pThis->next_time = pThis->initial_count_load_time + cTicksNext;
    15511553        pThis->fTimerArmed = true;
    1552         apciDoFrequencyHinting(pThis);
     1554        apicDoFrequencyHinting(pThis);
    15531555        STAM_COUNTER_INC(&pThis->StatTimerSetInitialCountArm);
    15541556    }
     
    16501652                    pThis->next_time = NextTS;
    16511653                    pThis->fTimerArmed = true;
    1652                     apciDoFrequencyHinting(pThis);
     1654                    apicDoFrequencyHinting(pThis);
    16531655                    break;
    16541656                }
     
    16851687            TMTimerSet(pThis->CTX_SUFF(pTimer), pThis->next_time);
    16861688            pThis->fTimerArmed = true;
    1687             apciDoFrequencyHinting(pThis);
     1689            apicDoFrequencyHinting(pThis);
    16881690        } else {
    16891691            /* single shot. */
     
    20742076    s->fTimerArmed = TMTimerIsActive(s->CTX_SUFF(pTimer));
    20752077    if (s->fTimerArmed)
    2076         apciDoFrequencyHinting(s);
     2078        apicDoFrequencyHinting(s);
    20772079#endif
    20782080
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