VirtualBox

Changeset 33799 in vbox for trunk/src


Ignore:
Timestamp:
Nov 5, 2010 4:14:07 PM (14 years ago)
Author:
vboxsync
Message:

PDM: Added DevHelps to query virtual time without requiring a timer.

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

Legend:

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

    r33236 r33799  
    595595    LogFlow(("pdmR3DevHlp_TMUtcNow: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, RTTimeSpecGetNano(pTime)));
    596596    return pTime;
     597}
     598
     599
     600/** @interface_method_impl{PDMDEVHLPR3,pfnTMTimeVirtGet} */
     601static DECLCALLBACK(uint64_t) pdmR3DevHlp_TMTimeVirtGet(PPDMDEVINS pDevIns)
     602{
     603    PDMDEV_ASSERT_DEVINS(pDevIns);
     604    LogFlow(("pdmR3DevHlp_TMTimeVirtGet: caller='%s'\n",
     605             pDevIns->pReg->szName, pDevIns->iInstance));
     606
     607    uint64_t u64Time = TMVirtualSyncGet(pDevIns->Internal.s.pVMR3);
     608
     609    LogFlow(("pdmR3DevHlp_TMTimeVirtGet: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Time));
     610    return u64Time;
     611}
     612
     613
     614/** @interface_method_impl{PDMDEVHLPR3,pfnTMTimeVirtGetFreq} */
     615static DECLCALLBACK(uint64_t) pdmR3DevHlp_TMTimeVirtGetFreq(PPDMDEVINS pDevIns)
     616{
     617    PDMDEV_ASSERT_DEVINS(pDevIns);
     618    LogFlow(("pdmR3DevHlp_TMTimeVirtGetFreq: caller='%s'\n",
     619             pDevIns->pReg->szName, pDevIns->iInstance));
     620
     621    uint64_t u64Freq = TMVirtualGetFreq(pDevIns->Internal.s.pVMR3);
     622
     623    LogFlow(("pdmR3DevHlp_TMTimeVirtGetFreq: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Freq));
     624    return u64Freq;
     625}
     626
     627
     628/** @interface_method_impl{PDMDEVHLPR3,pfnTMTimeVirtGetNano} */
     629static DECLCALLBACK(uint64_t) pdmR3DevHlp_TMTimeVirtGetNano(PPDMDEVINS pDevIns)
     630{
     631    PDMDEV_ASSERT_DEVINS(pDevIns);
     632    LogFlow(("pdmR3DevHlp_TMTimeVirtGetNano: caller='%s'\n",
     633             pDevIns->pReg->szName, pDevIns->iInstance));
     634
     635    uint64_t u64Time = TMVirtualSyncGet(pDevIns->Internal.s.pVMR3);
     636    uint64_t u64Nano = TMVirtualToNano(pDevIns->Internal.s.pVMR3, u64Time);
     637
     638    LogFlow(("pdmR3DevHlp_TMTimeVirtGetNano: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Nano));
     639    return u64Nano;
    597640}
    598641
     
    31473190    pdmR3DevHlp_A20Set,
    31483191    pdmR3DevHlp_GetCpuId,
     3192    pdmR3DevHlp_TMTimeVirtGet,
     3193    pdmR3DevHlp_TMTimeVirtGetFreq,
     3194    pdmR3DevHlp_TMTimeVirtGetNano,
    31493195    PDM_DEVHLPR3_VERSION /* the end */
    31503196};
     
    33543400    pdmR3DevHlp_Untrusted_A20Set,
    33553401    pdmR3DevHlp_Untrusted_GetCpuId,
     3402    pdmR3DevHlp_TMTimeVirtGet,
     3403    pdmR3DevHlp_TMTimeVirtGetFreq,
     3404    pdmR3DevHlp_TMTimeVirtGetNano,
    33563405    PDM_DEVHLPR3_VERSION /* the end */
    33573406};
  • trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp

    r32935 r33799  
    233233    LogFlow(("pdmRCDevHlp_GetVMCPU: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
    234234    return VMMGetCpu(pDevIns->Internal.s.pVMRC);
     235}
     236
     237
     238/** @interface_method_impl{PDMDEVHLPRC,pfnTMTimeVirtGet} */
     239static DECLCALLBACK(uint64_t) pdmRCDevHlp_TMTimeVirtGet(PPDMDEVINS pDevIns)
     240{
     241    PDMDEV_ASSERT_DEVINS(pDevIns);
     242    LogFlow(("pdmRCDevHlp_TMTimeVirtGet: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
     243    return TMVirtualGet(pDevIns->Internal.s.pVMRC);
     244}
     245
     246
     247/** @interface_method_impl{PDMDEVHLPRC,pfnTMTimeVirtGetFreq} */
     248static DECLCALLBACK(uint64_t) pdmRCDevHlp_TMTimeVirtGetFreq(PPDMDEVINS pDevIns)
     249{
     250    PDMDEV_ASSERT_DEVINS(pDevIns);
     251    LogFlow(("pdmRCDevHlp_TMTimeVirtGetFreq: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
     252    return TMVirtualGetFreq(pDevIns->Internal.s.pVMRC);
     253}
     254
     255
     256/** @interface_method_impl{PDMDEVHLPRC,pfnTMTimeVirtGetNano} */
     257static DECLCALLBACK(uint64_t) pdmRCDevHlp_TMTimeVirtGetNano(PPDMDEVINS pDevIns)
     258{
     259    PDMDEV_ASSERT_DEVINS(pDevIns);
     260    LogFlow(("pdmRCDevHlp_TMTimeVirtGetNano: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
     261    return TMVirtualToNano(pDevIns->Internal.s.pVMRC, TMVirtualGet(pDevIns->Internal.s.pVMRC));
    235262}
    236263
     
    255282    pdmRCDevHlp_GetVM,
    256283    pdmRCDevHlp_GetVMCPU,
     284    pdmRCDevHlp_TMTimeVirtGet,
     285    pdmRCDevHlp_TMTimeVirtGetFreq,
     286    pdmRCDevHlp_TMTimeVirtGetNano,
    257287    PDM_DEVHLPRC_VERSION
    258288};
  • trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp

    r32935 r33799  
    249249    LogFlow(("pdmR0DevHlp_GetVMCPU: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
    250250    return VMMGetCpu(pDevIns->Internal.s.pVMR0);
     251}
     252
     253
     254/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGet} */
     255static DECLCALLBACK(uint64_t) pdmR0DevHlp_TMTimeVirtGet(PPDMDEVINS pDevIns)
     256{
     257    PDMDEV_ASSERT_DEVINS(pDevIns);
     258    LogFlow(("pdmR0DevHlp_TMTimeVirtGet: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
     259    return TMVirtualGet(pDevIns->Internal.s.pVMR0);
     260}
     261
     262
     263/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGetFreq} */
     264static DECLCALLBACK(uint64_t) pdmR0DevHlp_TMTimeVirtGetFreq(PPDMDEVINS pDevIns)
     265{
     266    PDMDEV_ASSERT_DEVINS(pDevIns);
     267    LogFlow(("pdmR0DevHlp_TMTimeVirtGetFreq: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
     268    return TMVirtualGetFreq(pDevIns->Internal.s.pVMR0);
     269}
     270
     271
     272/** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGetNano} */
     273static DECLCALLBACK(uint64_t) pdmR0DevHlp_TMTimeVirtGetNano(PPDMDEVINS pDevIns)
     274{
     275    PDMDEV_ASSERT_DEVINS(pDevIns);
     276    LogFlow(("pdmR0DevHlp_TMTimeVirtGetNano: caller='%p'/%d\n", pDevIns, pDevIns->iInstance));
     277    return TMVirtualToNano(pDevIns->Internal.s.pVMR0, TMVirtualGet(pDevIns->Internal.s.pVMR0));
    251278}
    252279
     
    272299    pdmR0DevHlp_CanEmulateIoBlock,
    273300    pdmR0DevHlp_GetVMCPU,
     301    pdmR0DevHlp_TMTimeVirtGet,
     302    pdmR0DevHlp_TMTimeVirtGetFreq,
     303    pdmR0DevHlp_TMTimeVirtGetNano,
    274304    PDM_DEVHLPR0_VERSION
    275305};
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