VirtualBox

Changeset 54333 in vbox


Ignore:
Timestamp:
Feb 20, 2015 2:58:54 PM (10 years ago)
Author:
vboxsync
Message:

sup.h: whether TSC-delta is available for given CPU.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/sup.h

    r54310 r54333  
    648648
    649649/**
     650 * Checks if the TSC delta is available for a given CPU (if TSC-deltas are
     651 * relevant).
     652 *
     653 * @returns true if it's okay to read the TSC, false otherwise.
     654 *
     655 * @param   iCpuSet   The CPU set index of the CPU which TSC delta we check.
     656 * @remarks Requires GIP to be initialized and valid.
     657 */
     658DECLINLINE(bool) SUPIsTscDeltaAvailableForCpuSetIndex(uint32_t iCpuSet)
     659{
     660    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
     661    if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
     662        return true;
     663    if (RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
     664    {
     665        uint16_t iCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
     666        if (RT_LIKELY(iCpu < pGip->cCpus))
     667        {
     668            int64_t iTscDelta = pGip->aCPUs[iCpu].i64TSCDelta;
     669            if (iTscDelta != INT64_MAX)
     670                return true;
     671        }
     672    }
     673    return false;
     674}
     675
     676
     677/**
    650678 * Gets the descriptive GIP mode name.
    651679 *
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