VirtualBox

Changeset 2464 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
May 3, 2007 3:09:01 PM (18 years ago)
Author:
vboxsync
Message:

Added TMR3UCTNow, exported it as a DevHlp and made VMMDev use it as time source. TMR3UCTNow adjust for lag we intend to catchup so the guest time wont run ahead of real-world time.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PDMDevice.cpp

    r2452 r2464  
    126126static DECLCALLBACK(void) pdmR3DevHlp_STAMRegisterV(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args);
    127127static DECLCALLBACK(int) pdmR3DevHlp_CritSectInit(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, const char *pszName);
     128static DECLCALLBACK(PRTTIMESPEC) pdmR3DevHlp_UCTNow(PPDMDEVINS pDevIns, PRTTIMESPEC pTime);
    128129
    129130static DECLCALLBACK(PVM) pdmR3DevHlp_GetVM(PPDMDEVINS pDevIns);
     
    307308    pdmR3DevHlp_PDMQueueCreate,
    308309    pdmR3DevHlp_CritSectInit,
     310    pdmR3DevHlp_UCTNow,
     311    0,
     312    0,
     313    0,
     314    0,
     315    0,
     316    0,
     317    0,
     318    0,
     319    0,
     320    0,
    309321    pdmR3DevHlp_GetVM,
    310322    pdmR3DevHlp_PCIBusRegister,
     
    380392    pdmR3DevHlp_PDMQueueCreate,
    381393    pdmR3DevHlp_CritSectInit,
     394    pdmR3DevHlp_UCTNow,
     395    0,
     396    0,
     397    0,
     398    0,
     399    0,
     400    0,
     401    0,
     402    0,
     403    0,
     404    0,
    382405    pdmR3DevHlp_Untrusted_GetVM,
    383406    pdmR3DevHlp_Untrusted_PCIBusRegister,
     
    22712294
    22722295
     2296/** @copydoc PDMDEVHLP::pfnUCTNow */
     2297static DECLCALLBACK(PRTTIMESPEC) pdmR3DevHlp_UCTNow(PPDMDEVINS pDevIns, PRTTIMESPEC pTime)
     2298{
     2299    PDMDEV_ASSERT_DEVINS(pDevIns);
     2300    LogFlow(("pdmR3DevHlp_UCTNow: caller='%s'/%d: pTime=%p\n",
     2301             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pTime));
     2302
     2303    pTime = TMR3UCTNow(pDevIns->Internal.s.pVMHC, pTime);
     2304
     2305    LogFlow(("pdmR3DevHlp_UCTNow: caller='%s'/%d: returns %RU64\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, RTTimeSpecGetNano(pTime)));
     2306    return pTime;
     2307}
     2308
     2309
    22732310/** @copydoc PDMDEVHLP::pfnGetVM */
    22742311static DECLCALLBACK(PVM) pdmR3DevHlp_GetVM(PPDMDEVINS pDevIns)
  • trunk/src/VBox/VMM/TM.cpp

    r2283 r2464  
    16151615
    16161616/**
     1617 * Get the real world UCT time adjusted for VM lag.
     1618 *
     1619 * @returns pTime.
     1620 * @param   pVM             The VM instance.
     1621 * @param   pTime           Where to store the time.
     1622 */
     1623TMR3DECL(PRTTIMESPEC) TMR3UCTNow(PVM pVM, PRTTIMESPEC pTime)
     1624{
     1625    RTTimeNow(pTime);
     1626    RTTimeSpecSubNano(pTime, pVM->tm.s.offVirtualSync - pVM->tm.s.offVirtualSyncGivenUp);
     1627    return pTime;
     1628}
     1629
     1630
     1631/**
    16171632 * Display all timers.
    16181633 *
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