VirtualBox

Changeset 87626 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Feb 5, 2021 12:58:54 PM (4 years ago)
Author:
vboxsync
Message:

IPRT/time,VMM/TM: Added extra parameter to the RTTimeNanoTS GIP workers for returning the TSC value.

Location:
trunk/src/VBox/Runtime/common/time
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/time/timesup.cpp

    r82968 r87626  
    5050#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
    5151static DECLCALLBACK(void)     rtTimeNanoTSInternalBitch(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS);
    52 static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pData);
    53 static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalRediscover(PRTTIMENANOTSDATA pData);
    54 static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalBadCpuIndex(PRTTIMENANOTSDATA pData, uint16_t idApic, uint16_t iCpuSet, uint16_t iGipCpu);
     52static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pData, PRTITMENANOTSEXTRA pExtra);
     53static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalRediscover(PRTTIMENANOTSDATA pData, PRTITMENANOTSEXTRA pExtra);
     54static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalBadCpuIndex(PRTTIMENANOTSDATA pData, PRTITMENANOTSEXTRA pExtra,
     55                                                              uint16_t idApic, uint16_t iCpuSet, uint16_t iGipCpu);
    5556#endif
    5657
     
    129130 * @interface_method_impl{RTTIMENANOTSDATA,pfnBadCpuIndex}
    130131 */
    131 static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalBadCpuIndex(PRTTIMENANOTSDATA pData, uint16_t idApic,
    132                                                               uint16_t iCpuSet, uint16_t iGipCpu)
     132static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalBadCpuIndex(PRTTIMENANOTSDATA pData, PRTITMENANOTSEXTRA pExtra,
     133                                                              uint16_t idApic, uint16_t iCpuSet, uint16_t iGipCpu)
    133134{
    134135    RT_NOREF_PV(pData); RT_NOREF_PV(idApic); RT_NOREF_PV(iCpuSet); RT_NOREF_PV(iGipCpu);
    135136# ifndef IN_RC
    136137    AssertMsgFailed(("idApic=%#x iCpuSet=%#x iGipCpu=%#x\n", idApic, iCpuSet, iGipCpu));
     138    if (pExtra)
     139        pExtra->uTSCValue = ASMReadTSC();
    137140    return RTTimeSystemNanoTS();
    138141# else
     
    146149 * Fallback function.
    147150 */
    148 static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pData)
     151static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pData, PRTITMENANOTSEXTRA pExtra)
    149152{
    150153    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
     
    154157             || pGip->u32Mode == SUPGIPMODE_SYNC_TSC
    155158             || pGip->u32Mode == SUPGIPMODE_ASYNC_TSC))
    156         return rtTimeNanoTSInternalRediscover(pData);
     159        return rtTimeNanoTSInternalRediscover(pData, pExtra);
    157160    NOREF(pData);
    158161# ifndef IN_RC
     162    if (pExtra)
     163        pExtra->uTSCValue = ASMReadTSC();
    159164    return RTTimeSystemNanoTS();
    160165# else
     
    169174 * is mapped/unmapped.
    170175 */
    171 static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalRediscover(PRTTIMENANOTSDATA pData)
     176static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalRediscover(PRTTIMENANOTSDATA pData, PRTITMENANOTSEXTRA pExtra)
    172177{
    173178    PSUPGLOBALINFOPAGE      pGip = g_pSUPGlobalInfoPage;
     
    298303# ifdef IN_RC
    299304    ASMAtomicWriteU32((uint32_t volatile *)&g_iWorker, iWorker);
    300     return g_apfnWorkers[iWorker](pData);
     305    return g_apfnWorkers[iWorker](pData, pExtra);
    301306# else
    302307    ASMAtomicWritePtr((void * volatile *)&g_pfnWorker, (void *)(uintptr_t)pfnWorker);
    303     return pfnWorker(pData);
     308    return pfnWorker(pData, pExtra);
    304309# endif
    305310}
     
    315320#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
    316321# ifdef IN_RC
    317     return g_apfnWorkers[g_iWorker](&g_TimeNanoTSData);
    318 # else
    319     return g_pfnWorker(&g_TimeNanoTSData);
     322    return g_apfnWorkers[g_iWorker](&g_TimeNanoTSData, NULL /*pExtra*/);
     323# else
     324    return g_pfnWorker(&g_TimeNanoTSData, NULL /*pExtra*/);
    320325# endif
    321326#else
  • trunk/src/VBox/Runtime/common/time/timesupref.h

    r82968 r87626  
    4141 * @returns Nanosecond timestamp.
    4242 * @param   pData       Pointer to the data structure.
     43 * @param   pExtra      Where to return extra time info. Optional.
    4344 */
    44 RTDECL(uint64_t) rtTimeNanoTSInternalRef(PRTTIMENANOTSDATA pData)
     45RTDECL(uint64_t) rtTimeNanoTSInternalRef(PRTTIMENANOTSDATA pData, PRTITMENANOTSEXTRA pExtra)
    4546{
    4647#if TMPL_MODE == TMPL_MODE_SYNC_INVAR_WITH_DELTA && defined(IN_RING3)
     
    246247#endif
    247248
     249                            if (pExtra)
     250                                pExtra->uTSCValue = u64Delta;
     251
    248252                            /*
    249253                             * Calc NanoTS delta.
     
    374378      && TMPL_GET_CPU_METHOD != SUPGIPGETCPU_APIC_ID_EXT_0B /*?*/ \
    375379      && TMPL_GET_CPU_METHOD != SUPGIPGETCPU_APIC_ID_EXT_8000001E /*?*/)
    376                 return pData->pfnBadCpuIndex(pData, UINT16_MAX-1, iCpuSet, iGipCpu);
     380                return pData->pfnBadCpuIndex(pData, pExtra, UINT16_MAX-1, iCpuSet, iGipCpu);
    377381# else
    378                 return pData->pfnBadCpuIndex(pData, idApic, UINT16_MAX-1, iGipCpu);
     382                return pData->pfnBadCpuIndex(pData, pExtra, idApic, UINT16_MAX-1, iGipCpu);
    379383# endif
    380384            }
     
    389393        ASMSetFlags(uFlags);
    390394#endif
    391         return pData->pfnRediscover(pData);
     395        return pData->pfnRediscover(pData, pExtra);
    392396    }
    393397}
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