VirtualBox

Changeset 107192 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Nov 29, 2024 2:42:15 PM (7 weeks ago)
Author:
vboxsync
Message:

IPRT,VMM/TM: Support for GIP time on win.arm64. jiraref:VBP-1266

Location:
trunk/src/VBox/Runtime
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile.kmk

    r107099 r107192  
    29332933        $(if-expr !defined(VBOX_WITH_ALT_HASH_CODE),IPRT_WITHOUT_SHA512T224 IPRT_WITHOUT_SHA512T256,)
    29342934ifn1of ($(KBUILD_TARGET_ARCH), amd64 x86)
    2935  VBoxRT_DEFS                  += RT_NO_GIP
     2935 ifn1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.arm64)
     2936  VBoxRT_DEFS                 += RT_NO_GIP
     2937 endif
    29362938endif
    29372939ifdef VBOX_WITH_LIBCURL
  • trunk/src/VBox/Runtime/common/time/timesup.cpp

    r106061 r107192  
    4848#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
    4949# include <iprt/asm.h>
    50 # include <iprt/asm-amd64-x86.h>
     50# if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     51#  include <iprt/asm-amd64-x86.h>
     52# elif defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32)
     53#  include <iprt/asm-arm.h>
     54# else
     55#  error "port me"
     56# endif
    5157# include <iprt/x86.h>
    5258# include <VBox/sup.h>
     
    5662
    5763/*********************************************************************************************************************************
     64*   Defined Constants And Macros                                                                                                 *
     65*********************************************************************************************************************************/
     66#ifdef IN_RING3
     67# if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     68#  define APPLICABLE_GET_CPU_FLAGS       (  SUPGIPGETCPU_APIC_ID \
     69                                          | SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS \
     70                                          | SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS \
     71                                          | SUPGIPGETCPU_RDTSCP_GROUP_IN_CH_NUMBER_IN_CL \
     72                                          | SUPGIPGETCPU_APIC_ID_EXT_0B \
     73                                          | SUPGIPGETCPU_APIC_ID_EXT_8000001E)
     74# elif defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32)
     75#  define APPLICABLE_GET_CPU_FLAGS       (SUPGIPGETCPU_TPIDRRO_EL0)
     76# else
     77#  error "port me"
     78# endif
     79#endif /* IN_RING3 */
     80
     81
     82/*********************************************************************************************************************************
    5883*   Internal Functions                                                                                                           *
    5984*********************************************************************************************************************************/
    6085#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
    61 static DECLCALLBACK(void)     rtTimeNanoTSInternalBitch(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS);
     86static DECLCALLBACK(void)     rtTimeNanoTSInternalComplain(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev,
     87                                                           uint64_t u64PrevNanoTS);
    6288static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pData, PRTITMENANOTSEXTRA pExtra);
    6389static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalRediscover(PRTTIMENANOTSDATA pData, PRTITMENANOTSEXTRA pExtra);
     
    78104{
    79105    /* .pu64Prev       = */ &g_TimeNanoTSPrev,
    80     /* .pfnBad         = */ rtTimeNanoTSInternalBitch,
     106    /* .pfnBad         = */ rtTimeNanoTSInternalComplain,
    81107    /* .pfnRediscover  = */ rtTimeNanoTSInternalRediscover,
    82108    /* .pfnBadCpuIndex = */ rtTimeNanoTSInternalBadCpuIndex,
     
    95121    rtTimeNanoTSInternalRediscover,
    96122
    97 #  define RTTIMENANO_WORKER_LEGACY_SYNC_INVAR_NO_DELTA                  1
     123#  if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     124#   define RTTIMENANO_WORKER_LEGACY_SYNC_INVAR_NO_DELTA                 1
    98125    RTTimeNanoTSLegacySyncInvarNoDelta,
    99 define RTTIMENANO_WORKER_LEGACY_SYNC_INVAR_WITH_DELTA                2
     126 define RTTIMENANO_WORKER_LEGACY_SYNC_INVAR_WITH_DELTA               2
    100127    RTTimeNanoTSLegacySyncInvarWithDelta,
    101 define RTTIMENANO_WORKER_LEGACY_ASYNC                                3
     128 define RTTIMENANO_WORKER_LEGACY_ASYNC                               3
    102129    RTTimeNanoTSLegacyAsync,
    103130
    104 define RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_NO_DELTA                  4
     131 define RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_NO_DELTA                 4
    105132    RTTimeNanoTSLFenceSyncInvarNoDelta,
    106 define RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_WITH_DELTA                5
     133 define RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_WITH_DELTA               5
    107134    RTTimeNanoTSLFenceSyncInvarWithDelta,
    108 define RTTIMENANO_WORKER_LFENCE_ASYNC                                6
     135 define RTTIMENANO_WORKER_LFENCE_ASYNC                               6
    109136    RTTimeNanoTSLFenceAsync,
     137#  else
     138#   error "port me"
     139#  endif
    110140
    111141#  define RTTIMENANO_WORKER_FALLBACK                                    7
     
    116146 *          code relocation. */
    117147static uint32_t                 g_iWorker   = RTTIMENANO_WORKER_DETECT;
    118 # else
     148# else  /* !IN_RC */
    119149/** Pointer to the worker */
    120150static PFNTIMENANOTSINTERNAL    g_pfnWorker = rtTimeNanoTSInternalRediscover;
    121 # endif /* IN_RC */
     151# endif /* !IN_RC */
    122152
    123153
     
    125155 * @interface_method_impl{RTTIMENANOTSDATA,pfnBad}
    126156 */
    127 static DECLCALLBACK(void) rtTimeNanoTSInternalBitch(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev,
    128                                                     uint64_t u64PrevNanoTS)
     157static DECLCALLBACK(void) rtTimeNanoTSInternalComplain(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev,
     158                                                       uint64_t u64PrevNanoTS)
    129159{
    130160    pData->cBadPrev++;
     
    161191static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pData, PRTITMENANOTSEXTRA pExtra)
    162192{
     193    RT_NOREF(pData);
    163194    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
     195    uint32_t           uMode;
    164196    if (    pGip
    165197        &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC
    166         &&  (   pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC
    167              || pGip->u32Mode == SUPGIPMODE_SYNC_TSC
    168              || pGip->u32Mode == SUPGIPMODE_ASYNC_TSC))
     198        &&  (   (uMode = pGip->u32Mode) == SUPGIPMODE_INVARIANT_TSC
     199             || uMode                   == SUPGIPMODE_SYNC_TSC
     200             || uMode                   == SUPGIPMODE_ASYNC_TSC)
     201# ifdef IN_RING3
     202        &&  (   (pGip->fGetGipCpu & APPLICABLE_GET_CPU_FLAGS) != 0
     203             || (   pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_PRACTICALLY_ZERO
     204                 && uMode != SUPGIPMODE_ASYNC_TSC))
     205# endif
     206       )
    169207        return rtTimeNanoTSInternalRediscover(pData, pExtra);
    170     NOREF(pData);
    171208# ifndef IN_RC
    172209    if (pExtra)
     
    192229    PFNTIMENANOTSINTERNAL   pfnWorker;
    193230# endif
     231    uint32_t                uMode;
    194232    if (    pGip
    195233        &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC
    196         &&  (   pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC
    197              || pGip->u32Mode == SUPGIPMODE_SYNC_TSC
    198              || pGip->u32Mode == SUPGIPMODE_ASYNC_TSC))
     234        &&  (   (uMode = pGip->u32Mode) == SUPGIPMODE_INVARIANT_TSC
     235             || uMode                  == SUPGIPMODE_SYNC_TSC
     236             || uMode                  == SUPGIPMODE_ASYNC_TSC))
    199237    {
     238# if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    200239        if (ASMCpuId_EDX(1) & X86_CPUID_FEATURE_EDX_SSE2)
    201240        {
    202 # ifdef IN_RC
    203             iWorker   = pGip->u32Mode == SUPGIPMODE_ASYNC_TSC
     241#  ifdef IN_RC
     242            iWorker   = uMode == SUPGIPMODE_ASYNC_TSC
    204243                      ? RTTIMENANO_WORKER_LFENCE_ASYNC
    205244                      : pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
    206245                      ? RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_NO_DELTA
    207246                      : RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_WITH_DELTA;
    208 # elif defined(IN_RING0)
    209             pfnWorker = pGip->u32Mode == SUPGIPMODE_ASYNC_TSC
     247#  elif defined(IN_RING0)
     248            pfnWorker = uMode == SUPGIPMODE_ASYNC_TSC
    210249                      ? RTTimeNanoTSLFenceAsync
    211250                      : pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
    212251                      ? RTTimeNanoTSLFenceSyncInvarNoDelta
    213252                      : RTTimeNanoTSLFenceSyncInvarWithDelta;
    214 # else
    215             if (pGip->u32Mode == SUPGIPMODE_ASYNC_TSC)
     253#  else
     254            if (uMode == SUPGIPMODE_ASYNC_TSC)
    216255            {
    217256                if (     pGip->fGetGipCpu & SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS)
     
    247286                    pfnWorker = rtTimeNanoTSInternalFallback;
    248287            }
    249 # endif
     288#  endif
    250289        }
    251290        else
    252291        {
    253 # ifdef IN_RC
    254             iWorker = pGip->u32Mode == SUPGIPMODE_ASYNC_TSC
     292#  ifdef IN_RC
     293            iWorker = uMode == SUPGIPMODE_ASYNC_TSC
    255294                    ? RTTIMENANO_WORKER_LEGACY_ASYNC
    256295                    : pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
    257296                    ? RTTIMENANO_WORKER_LEGACY_SYNC_INVAR_NO_DELTA : RTTIMENANO_WORKER_LEGACY_SYNC_INVAR_WITH_DELTA;
    258 # elif defined(IN_RING0)
    259             pfnWorker = pGip->u32Mode == SUPGIPMODE_ASYNC_TSC
     297#  elif defined(IN_RING0)
     298            pfnWorker = uMode == SUPGIPMODE_ASYNC_TSC
    260299                      ? RTTimeNanoTSLegacyAsync
    261300                      : pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
    262301                      ? RTTimeNanoTSLegacySyncInvarNoDelta
    263302                      : RTTimeNanoTSLegacySyncInvarWithDelta;
    264 # else
    265             if (pGip->u32Mode == SUPGIPMODE_ASYNC_TSC)
     303#  else
     304            if (uMode == SUPGIPMODE_ASYNC_TSC)
    266305                pfnWorker = pGip->fGetGipCpu & SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
    267306                          ? RTTimeNanoTSLegacyAsyncUseRdtscp
     
    299338                           : RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId
    300339                         : rtTimeNanoTSInternalFallback;
    301 # endif
     340#  endif
    302341        }
     342# else  /* !AMD64 && !X86 */
     343#  ifdef IN_RC
     344#   error "port me"
     345        iWorker   = uMode == SUPGIPMODE_ASYNC_TSC
     346                  ? RTTIMENANO_WORKER_LFENCE_ASYNC
     347                  : pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
     348                  ? RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_NO_DELTA
     349                  : RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_WITH_DELTA;
     350#  elif defined(IN_RING0)
     351        pfnWorker = uMode == SUPGIPMODE_ASYNC_TSC
     352                  ? RTTimeNanoTSAsync
     353                  : pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
     354                  ? RTTimeNanoTSSyncInvarNoDelta
     355                  : RTTimeNanoTSSyncInvarWithDelta;
     356#  else
     357        if (uMode == SUPGIPMODE_ASYNC_TSC)
     358        {
     359            if (pGip->fGetGipCpu & SUPGIPGETCPU_TPIDRRO_EL0)
     360                pfnWorker = RTTimeNanoTSAsyncUseTpIdRRo;
     361            else
     362                pfnWorker = rtTimeNanoTSInternalFallback;
     363        }
     364        else
     365        {
     366            if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_PRACTICALLY_ZERO)
     367                pfnWorker = RTTimeNanoTSSyncInvarNoDelta;
     368            else if (pGip->fGetGipCpu & SUPGIPGETCPU_TPIDRRO_EL0)
     369                pfnWorker = RTTimeNanoTSSyncInvarWithDeltaUseTpIdRRo;
     370            else
     371                pfnWorker = rtTimeNanoTSInternalFallback;
     372        }
     373#  endif
     374
     375# endif /* !AMD64 && !X86 */
    303376    }
    304377    else
     
    318391}
    319392
     393
    320394# if defined(IN_RING3) || defined(IN_RING0)
    321395RTDECL(const char *) RTTimeNanoTSWorkerName(void)
     
    324398    {
    325399#  define ENTRY(a_fn) { a_fn, #a_fn }
     400#  if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    326401        ENTRY(RTTimeNanoTSLegacySyncInvarNoDelta),
    327402        ENTRY(RTTimeNanoTSLFenceSyncInvarNoDelta),
    328 ifdef IN_RING3
     403 ifdef IN_RING3
    329404        ENTRY(RTTimeNanoTSLegacyAsyncUseApicId),
    330405        ENTRY(RTTimeNanoTSLegacyAsyncUseApicIdExt0B),
     
    349424        ENTRY(RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp),
    350425        ENTRY(RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim),
    351 else
     426 else
    352427        ENTRY(RTTimeNanoTSLegacyAsync),
    353428        ENTRY(RTTimeNanoTSLegacySyncInvarWithDelta),
    354429        ENTRY(RTTimeNanoTSLFenceAsync),
    355430        ENTRY(RTTimeNanoTSLFenceSyncInvarWithDelta),
    356 #  endif
     431#   endif
     432#  else  /* !AMD64 && !X86 */
     433        ENTRY(RTTimeNanoTSSyncInvarNoDelta),
     434#   ifdef IN_RING3
     435#    ifdef RT_ARCH_ARM64
     436        ENTRY(RTTimeNanoTSSyncInvarWithDeltaUseTpIdRRo),
     437        ENTRY(RTTimeNanoTSAsyncUseTpIdRRo),
     438#    endif
     439#   else
     440        ENTRY(RTTimeNanoTSAsync),
     441        ENTRY(RTTimeNanoTSSyncInvarWithDelta),
     442#   endif
     443#  endif /* !AMD64 && !X86 */
    357444        ENTRY(rtTimeNanoTSInternalFallback),
    358445#  undef ENTRY
  • trunk/src/VBox/Runtime/common/time/timesupref.cpp

    r106061 r107192  
    3535 */
    3636
    37 #if !defined(IN_GUEST) && !defined(RT_NO_GIP)
     37#if !defined(IN_GUEST) && !defined(RT_NO_GIP) /* rest of the file */
    3838
    3939
     
    4646#include <iprt/asm.h>
    4747#include <iprt/asm-math.h>
    48 #include <iprt/asm-amd64-x86.h>
     48#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_x86)
     49# include <iprt/asm-amd64-x86.h>
     50#elif defined(RT_ARCH_ARM64)
     51# include <iprt/asm-arm.h>
     52#else
     53# error "port me"
     54#endif
    4955#include <iprt/param.h>
    5056#include <iprt/string.h>
     
    6268
    6369
     70#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_x86)
     71/*
     72 * AMD64 & x86.
     73 * AMD64 & x86.
     74 * AMD64 & x86.
     75 */
     76
    6477/*
    6578 * Use the XCHG instruction for some kind of serialization.
    6679 */
    67 #define TMPL_READ_FENCE()        ASMReadFence()
    68 
    69 #undef  TMPL_MODE
    70 #define TMPL_MODE                TMPL_MODE_SYNC_INVAR_NO_DELTA
    71 #undef  TMPL_GET_CPU_METHOD
    72 #define TMPL_GET_CPU_METHOD      0
    73 #undef  rtTimeNanoTSInternalRef
    74 #define rtTimeNanoTSInternalRef  RTTimeNanoTSLegacySyncInvarNoDelta
    75 #include "timesupref.h"
     80# define TMPL_READ_FENCE()        ASMReadFence()
     81
     82# undef  TMPL_MODE
     83# define TMPL_MODE                TMPL_MODE_SYNC_INVAR_NO_DELTA
     84# undef  TMPL_GET_CPU_METHOD
     85# define TMPL_GET_CPU_METHOD      0
     86# undef  rtTimeNanoTSInternalRef
     87# define rtTimeNanoTSInternalRef  RTTimeNanoTSLegacySyncInvarNoDelta
     88# include "timesupref.h"
    7689RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarNoDelta);
    7790
    78 #ifdef IN_RING3
     91# ifdef IN_RING3
     92
     93#  undef  TMPL_MODE
     94#  define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     95#  undef  TMPL_GET_CPU_METHOD
     96#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
     97#  undef  rtTimeNanoTSInternalRef
     98#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId
     99#  include "timesupref.h"
     100RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId);
     101
     102#  undef  TMPL_MODE
     103#  define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     104#  undef  TMPL_GET_CPU_METHOD
     105#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_0B
     106#  undef  rtTimeNanoTSInternalRef
     107#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseApicIdExt0B
     108#  include "timesupref.h"
     109RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseApicIdExt0B);
     110
     111#  undef  TMPL_MODE
     112#  define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     113#  undef  TMPL_GET_CPU_METHOD
     114#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_8000001E
     115#  undef  rtTimeNanoTSInternalRef
     116#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseApicIdExt8000001E
     117#  include "timesupref.h"
     118RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseApicIdExt8000001E);
     119
     120#  undef  TMPL_GET_CPU_METHOD
     121#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
     122#  undef  rtTimeNanoTSInternalRef
     123#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp
     124#  include "timesupref.h"
     125RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp);
     126
     127#  undef  TMPL_GET_CPU_METHOD
     128#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
     129#  undef  rtTimeNanoTSInternalRef
     130#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim
     131#  include "timesupref.h"
     132RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim);
     133
     134#  undef  TMPL_MODE
     135#  define TMPL_MODE               TMPL_MODE_ASYNC
     136#  undef  TMPL_GET_CPU_METHOD
     137#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
     138#  undef  rtTimeNanoTSInternalRef
     139#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseApicId
     140#  include "timesupref.h"
     141RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseApicId);
     142
     143#  undef  TMPL_MODE
     144#  define TMPL_MODE               TMPL_MODE_ASYNC
     145#  undef  TMPL_GET_CPU_METHOD
     146#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_0B
     147#  undef  rtTimeNanoTSInternalRef
     148#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseApicIdExt0B
     149#  include "timesupref.h"
     150RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseApicIdExt0B);
     151
     152#  undef  TMPL_MODE
     153#  define TMPL_MODE               TMPL_MODE_ASYNC
     154#  undef  TMPL_GET_CPU_METHOD
     155#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_8000001E
     156#  undef  rtTimeNanoTSInternalRef
     157#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseApicIdExt8000001E
     158#  include "timesupref.h"
     159RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseApicIdExt8000001E);
     160
     161#  undef  TMPL_GET_CPU_METHOD
     162#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
     163#  undef  rtTimeNanoTSInternalRef
     164#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseRdtscp
     165#  include "timesupref.h"
     166RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseRdtscp);
     167
     168#  undef  TMPL_GET_CPU_METHOD
     169#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
     170#  undef  rtTimeNanoTSInternalRef
     171#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseIdtrLim
     172#  include "timesupref.h"
     173RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseIdtrLim);
     174
     175#  undef  TMPL_GET_CPU_METHOD
     176#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_GROUP_IN_CH_NUMBER_IN_CL
     177#  undef  rtTimeNanoTSInternalRef
     178#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseRdtscpGroupChNumCl
     179#  include "timesupref.h"
     180RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseRdtscpGroupChNumCl);
     181
     182# else  /* IN_RC || IN_RING0: Disable interrupts and call getter function. */
     183
     184#  undef  TMPL_MODE
     185#  define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     186#  undef  TMPL_GET_CPU_METHOD
     187#  define TMPL_GET_CPU_METHOD     UINT32_MAX
     188#  undef  rtTimeNanoTSInternalRef
     189#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDelta
     190#  include "timesupref.h"
     191RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDelta);
     192
     193#  undef  TMPL_MODE
     194#  define TMPL_MODE TMPL_MODE_ASYNC
     195#  undef  rtTimeNanoTSInternalRef
     196#  define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsync
     197#  include "timesupref.h"
     198RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsync);
     199
     200# endif
     201
     202
     203/*
     204 * Use LFENCE for load serialization.
     205 */
     206# undef  TMPL_READ_FENCE
     207# define TMPL_READ_FENCE()        ASMReadFenceSSE2()
    79208
    80209# undef  TMPL_MODE
    81 # define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     210# define TMPL_MODE                TMPL_MODE_SYNC_INVAR_NO_DELTA
    82211# undef  TMPL_GET_CPU_METHOD
    83 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
     212# define TMPL_GET_CPU_METHOD      0
    84213# undef  rtTimeNanoTSInternalRef
    85 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId
     214# define rtTimeNanoTSInternalRef  RTTimeNanoTSLFenceSyncInvarNoDelta
    86215# include "timesupref.h"
    87 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId);
     216RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarNoDelta);
     217
     218# ifdef IN_RING3
     219
     220#  undef  TMPL_MODE
     221#  define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     222#  undef  TMPL_GET_CPU_METHOD
     223#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
     224#  undef  rtTimeNanoTSInternalRef
     225#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId
     226#  include "timesupref.h"
     227RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId);
     228
     229#  undef  TMPL_MODE
     230#  define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     231#  undef  TMPL_GET_CPU_METHOD
     232#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_0B
     233#  undef  rtTimeNanoTSInternalRef
     234#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicIdExt0B
     235#  include "timesupref.h"
     236RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicIdExt0B);
     237
     238#  undef  TMPL_MODE
     239#  define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     240#  undef  TMPL_GET_CPU_METHOD
     241#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_8000001E
     242#  undef  rtTimeNanoTSInternalRef
     243#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicIdExt8000001E
     244#  include "timesupref.h"
     245RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicIdExt8000001E);
     246
     247#  undef  TMPL_GET_CPU_METHOD
     248#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
     249#  undef  rtTimeNanoTSInternalRef
     250#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp
     251#  include "timesupref.h"
     252RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp);
     253
     254#  undef  TMPL_GET_CPU_METHOD
     255#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
     256#  undef  rtTimeNanoTSInternalRef
     257#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim
     258#  include "timesupref.h"
     259RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim);
     260
     261#  undef  TMPL_MODE
     262#  define TMPL_MODE               TMPL_MODE_ASYNC
     263#  undef  TMPL_GET_CPU_METHOD
     264#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
     265#  undef  rtTimeNanoTSInternalRef
     266#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseApicId
     267#  include "timesupref.h"
     268RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseApicId);
     269
     270#  undef  TMPL_MODE
     271#  define TMPL_MODE               TMPL_MODE_ASYNC
     272#  undef  TMPL_GET_CPU_METHOD
     273#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_0B
     274#  undef  rtTimeNanoTSInternalRef
     275#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseApicIdExt0B
     276#  include "timesupref.h"
     277RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseApicIdExt0B);
     278
     279#  undef  TMPL_MODE
     280#  define TMPL_MODE               TMPL_MODE_ASYNC
     281#  undef  TMPL_GET_CPU_METHOD
     282#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_8000001E
     283#  undef  rtTimeNanoTSInternalRef
     284#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseApicIdExt8000001E
     285#  include "timesupref.h"
     286RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseApicIdExt8000001E);
     287
     288#  undef  TMPL_GET_CPU_METHOD
     289#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
     290#  undef  rtTimeNanoTSInternalRef
     291#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseRdtscp
     292#  include "timesupref.h"
     293RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseRdtscp);
     294
     295#  undef  TMPL_GET_CPU_METHOD
     296#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
     297#  undef  rtTimeNanoTSInternalRef
     298#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseIdtrLim
     299#  include "timesupref.h"
     300RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseIdtrLim);
     301
     302#  undef  TMPL_GET_CPU_METHOD
     303#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_GROUP_IN_CH_NUMBER_IN_CL
     304#  undef  rtTimeNanoTSInternalRef
     305#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseRdtscpGroupChNumCl
     306#  include "timesupref.h"
     307RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseRdtscpGroupChNumCl);
     308
     309# else  /* IN_RC || IN_RING0: Disable interrupts and call getter function. */
     310
     311#  undef  TMPL_MODE
     312#  define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     313#  undef  TMPL_GET_CPU_METHOD
     314#  define TMPL_GET_CPU_METHOD     UINT32_MAX
     315#  undef  rtTimeNanoTSInternalRef
     316#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDelta
     317#  include "timesupref.h"
     318RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDelta);
     319
     320#  undef  TMPL_MODE
     321#  define TMPL_MODE TMPL_MODE_ASYNC
     322#  undef  rtTimeNanoTSInternalRef
     323#  define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsync
     324#  include "timesupref.h"
     325RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsync);
     326
     327# endif
     328
     329#else  /* !AMD64 && !X86 */
     330/*
     331 * Generic.
     332 */
     333# define TMPL_READ_FENCE()        ASMReadFence()
    88334
    89335# undef  TMPL_MODE
    90 # define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     336# define TMPL_MODE                TMPL_MODE_SYNC_INVAR_NO_DELTA
    91337# undef  TMPL_GET_CPU_METHOD
    92 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_0B
     338# define TMPL_GET_CPU_METHOD      0
    93339# undef  rtTimeNanoTSInternalRef
    94 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseApicIdExt0B
     340# define rtTimeNanoTSInternalRef  RTTimeNanoTSSyncInvarNoDelta
    95341# include "timesupref.h"
    96 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseApicIdExt0B);
    97 
    98 # undef  TMPL_MODE
    99 # define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
    100 # undef  TMPL_GET_CPU_METHOD
    101 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_8000001E
    102 # undef  rtTimeNanoTSInternalRef
    103 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseApicIdExt8000001E
    104 # include "timesupref.h"
    105 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseApicIdExt8000001E);
    106 
    107 # undef  TMPL_GET_CPU_METHOD
    108 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
    109 # undef  rtTimeNanoTSInternalRef
    110 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp
    111 # include "timesupref.h"
    112 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp);
    113 
    114 # undef  TMPL_GET_CPU_METHOD
    115 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
    116 # undef  rtTimeNanoTSInternalRef
    117 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim
    118 # include "timesupref.h"
    119 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim);
    120 
    121 # undef  TMPL_MODE
    122 # define TMPL_MODE               TMPL_MODE_ASYNC
    123 # undef  TMPL_GET_CPU_METHOD
    124 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
    125 # undef  rtTimeNanoTSInternalRef
    126 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseApicId
    127 # include "timesupref.h"
    128 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseApicId);
    129 
    130 # undef  TMPL_MODE
    131 # define TMPL_MODE               TMPL_MODE_ASYNC
    132 # undef  TMPL_GET_CPU_METHOD
    133 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_0B
    134 # undef  rtTimeNanoTSInternalRef
    135 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseApicIdExt0B
    136 # include "timesupref.h"
    137 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseApicIdExt0B);
    138 
    139 # undef  TMPL_MODE
    140 # define TMPL_MODE               TMPL_MODE_ASYNC
    141 # undef  TMPL_GET_CPU_METHOD
    142 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_8000001E
    143 # undef  rtTimeNanoTSInternalRef
    144 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseApicIdExt8000001E
    145 # include "timesupref.h"
    146 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseApicIdExt8000001E);
    147 
    148 # undef  TMPL_GET_CPU_METHOD
    149 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
    150 # undef  rtTimeNanoTSInternalRef
    151 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseRdtscp
    152 # include "timesupref.h"
    153 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseRdtscp);
    154 
    155 # undef  TMPL_GET_CPU_METHOD
    156 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
    157 # undef  rtTimeNanoTSInternalRef
    158 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseIdtrLim
    159 # include "timesupref.h"
    160 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseIdtrLim);
    161 
    162 # undef  TMPL_GET_CPU_METHOD
    163 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_GROUP_IN_CH_NUMBER_IN_CL
    164 # undef  rtTimeNanoTSInternalRef
    165 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseRdtscpGroupChNumCl
    166 # include "timesupref.h"
    167 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseRdtscpGroupChNumCl);
    168 
    169 #else  /* IN_RC || IN_RING0: Disable interrupts and call getter function. */
    170 
    171 # undef  TMPL_MODE
    172 # define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
    173 # undef  TMPL_GET_CPU_METHOD
    174 # define TMPL_GET_CPU_METHOD     UINT32_MAX
    175 # undef  rtTimeNanoTSInternalRef
    176 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDelta
    177 # include "timesupref.h"
    178 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDelta);
    179 
    180 # undef  TMPL_MODE
    181 # define TMPL_MODE TMPL_MODE_ASYNC
    182 # undef  rtTimeNanoTSInternalRef
    183 # define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsync
    184 # include "timesupref.h"
    185 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsync);
    186 
    187 #endif
    188 
    189 
    190 /*
    191  * Use LFENCE for load serialization.
    192  */
    193 #undef  TMPL_READ_FENCE
    194 #define TMPL_READ_FENCE()        ASMReadFenceSSE2()
    195 
    196 #undef  TMPL_MODE
    197 #define TMPL_MODE                TMPL_MODE_SYNC_INVAR_NO_DELTA
    198 #undef  TMPL_GET_CPU_METHOD
    199 #define TMPL_GET_CPU_METHOD      0
    200 #undef  rtTimeNanoTSInternalRef
    201 #define rtTimeNanoTSInternalRef  RTTimeNanoTSLFenceSyncInvarNoDelta
    202 #include "timesupref.h"
    203 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarNoDelta);
    204 
    205 #ifdef IN_RING3
    206 
    207 # undef  TMPL_MODE
    208 # define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
    209 # undef  TMPL_GET_CPU_METHOD
    210 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
    211 # undef  rtTimeNanoTSInternalRef
    212 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId
    213 # include "timesupref.h"
    214 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId);
    215 
    216 # undef  TMPL_MODE
    217 # define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
    218 # undef  TMPL_GET_CPU_METHOD
    219 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_0B
    220 # undef  rtTimeNanoTSInternalRef
    221 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicIdExt0B
    222 # include "timesupref.h"
    223 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicIdExt0B);
    224 
    225 # undef  TMPL_MODE
    226 # define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
    227 # undef  TMPL_GET_CPU_METHOD
    228 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_8000001E
    229 # undef  rtTimeNanoTSInternalRef
    230 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicIdExt8000001E
    231 # include "timesupref.h"
    232 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicIdExt8000001E);
    233 
    234 # undef  TMPL_GET_CPU_METHOD
    235 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
    236 # undef  rtTimeNanoTSInternalRef
    237 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp
    238 # include "timesupref.h"
    239 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp);
    240 
    241 # undef  TMPL_GET_CPU_METHOD
    242 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
    243 # undef  rtTimeNanoTSInternalRef
    244 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim
    245 # include "timesupref.h"
    246 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim);
    247 
    248 # undef  TMPL_MODE
    249 # define TMPL_MODE               TMPL_MODE_ASYNC
    250 # undef  TMPL_GET_CPU_METHOD
    251 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
    252 # undef  rtTimeNanoTSInternalRef
    253 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseApicId
    254 # include "timesupref.h"
    255 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseApicId);
    256 
    257 # undef  TMPL_MODE
    258 # define TMPL_MODE               TMPL_MODE_ASYNC
    259 # undef  TMPL_GET_CPU_METHOD
    260 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_0B
    261 # undef  rtTimeNanoTSInternalRef
    262 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseApicIdExt0B
    263 # include "timesupref.h"
    264 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseApicIdExt0B);
    265 
    266 # undef  TMPL_MODE
    267 # define TMPL_MODE               TMPL_MODE_ASYNC
    268 # undef  TMPL_GET_CPU_METHOD
    269 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID_EXT_8000001E
    270 # undef  rtTimeNanoTSInternalRef
    271 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseApicIdExt8000001E
    272 # include "timesupref.h"
    273 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseApicIdExt8000001E);
    274 
    275 # undef  TMPL_GET_CPU_METHOD
    276 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
    277 # undef  rtTimeNanoTSInternalRef
    278 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseRdtscp
    279 # include "timesupref.h"
    280 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseRdtscp);
    281 
    282 # undef  TMPL_GET_CPU_METHOD
    283 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
    284 # undef  rtTimeNanoTSInternalRef
    285 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseIdtrLim
    286 # include "timesupref.h"
    287 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseIdtrLim);
    288 
    289 # undef  TMPL_GET_CPU_METHOD
    290 # define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_GROUP_IN_CH_NUMBER_IN_CL
    291 # undef  rtTimeNanoTSInternalRef
    292 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseRdtscpGroupChNumCl
    293 # include "timesupref.h"
    294 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseRdtscpGroupChNumCl);
    295 
    296 #else  /* IN_RC || IN_RING0: Disable interrupts and call getter function. */
    297 
    298 # undef  TMPL_MODE
    299 # define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
    300 # undef  TMPL_GET_CPU_METHOD
    301 # define TMPL_GET_CPU_METHOD     UINT32_MAX
    302 # undef  rtTimeNanoTSInternalRef
    303 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDelta
    304 # include "timesupref.h"
    305 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDelta);
    306 
    307 # undef  TMPL_MODE
    308 # define TMPL_MODE TMPL_MODE_ASYNC
    309 # undef  rtTimeNanoTSInternalRef
    310 # define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsync
    311 # include "timesupref.h"
    312 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsync);
    313 
    314 #endif
    315 
     342RT_EXPORT_SYMBOL(RTTimeNanoTSSyncInvarNoDelta);
     343
     344# ifdef IN_RING0
     345
     346#  undef  TMPL_MODE
     347#  define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     348#  undef  TMPL_GET_CPU_METHOD
     349#  define TMPL_GET_CPU_METHOD     UINT32_MAX
     350#  undef  rtTimeNanoTSInternalRef
     351#  define rtTimeNanoTSInternalRef RTTimeNanoTSSyncInvarWithDelta
     352#  include "timesupref.h"
     353RT_EXPORT_SYMBOL(RTTimeNanoTSSyncInvarWithDelta);
     354
     355#  undef  TMPL_MODE
     356#  define TMPL_MODE               TMPL_MODE_ASYNC
     357#  undef  rtTimeNanoTSInternalRef
     358#  define rtTimeNanoTSInternalRef RTTimeNanoTSAsync
     359#  include "timesupref.h"
     360RT_EXPORT_SYMBOL(RTTimeNanoTSAsync);
     361
     362# elif defined(IN_RING3) && defined(RT_ARCH_ARM64)
     363
     364#  undef  TMPL_MODE
     365#  define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
     366#  undef  TMPL_GET_CPU_METHOD
     367#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_TPIDRRO_EL0
     368#  undef  rtTimeNanoTSInternalRef
     369#  define rtTimeNanoTSInternalRef RTTimeNanoTSSyncInvarWithDeltaUseTpIdRRo
     370#  include "timesupref.h"
     371RT_EXPORT_SYMBOL(RTTimeNanoTSSyncInvarWithDeltaUseTpIdRRo);
     372
     373#  undef  TMPL_MODE
     374#  define TMPL_MODE               TMPL_MODE_ASYNC
     375#  undef  TMPL_GET_CPU_METHOD
     376#  define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_TPIDRRO_EL0
     377#  undef  rtTimeNanoTSInternalRef
     378#  define rtTimeNanoTSInternalRef RTTimeNanoTSAsyncUseTpIdRRo
     379#  include "timesupref.h"
     380RT_EXPORT_SYMBOL(RTTimeNanoTSAsyncUseTpIdRRo);
     381
     382# endif
     383
     384#endif /* !AMD64 && !X86 */
    316385
    317386#endif /* !IN_GUEST && !RT_NO_GIP */
  • trunk/src/VBox/Runtime/common/time/timesupref.h

    r106061 r107192  
    139139            uint16_t const  iCpuSet  = (cbLim - 256 * (ARCH_BITS == 64 ? 16 : 8)) & (RTCPUSET_MAX_CPUS - 1);
    140140            uint16_t const  iGipCpu  = pGip->aiCpuFromCpuSetIdx[iCpuSet];
     141# elif TMPL_GET_CPU_METHOD == SUPGIPGETCPU_TPIDRRO_EL0
     142            uint32_t const  iCpuSet  = ASMGetThreadIdRoEL0() & (RTCPUSET_MAX_CPUS - 1);
     143            uint16_t const  iGipCpu  = pGip->aiCpuFromCpuSetIdx[iCpuSet];
    141144# else
    142145#  error "What?"
  • trunk/src/VBox/Runtime/r3/nt/time-nt.cpp

    r106061 r107192  
    5555*********************************************************************************************************************************/
    5656/** Whether we've tried to resolve g_pfnRtlGetSystemTimePrecise or not. */
    57 static bool                         g_fInitialized = false;
     57static bool                             g_fInitialized = false;
    5858/** Pointer to RtlGetSystemTimePrecise, added in 6.2 (windows 8).   */
    59 static PFNRTLGETSYSTEMTIMEPRECISE   g_pfnRtlGetSystemTimePrecise = NULL;
     59static PFNRTLGETSYSTEMTIMEPRECISE       g_pfnRtlGetSystemTimePrecise = NULL;
    6060
    6161
     
    7070    if (ASMAtomicCmpXchgBool(&g_fInitialized, true, false))
    7171    {
     72/** @todo there is a RtlGetInterruptTimePrecise export since W10   */
    7273        void *pvFunc = RTLdrGetSystemSymbol("ntdll.dll", "RtlGetSystemTimePrecise");
    7374        if (pvFunc)
     
    9091     * interrupt time from it.  (Microsoft doesn't expose interrupt time to user
    9192     * application, which is very unfortunate as there are a lot place where
    92      * monotonic time is applicable but developer is "forced" to use wall clock.)
     93     * monotonic time is applicable but developers are "forced" to use the wall
     94     * clock.)
    9395     */
    9496    if (g_pfnRtlGetSystemTimePrecise)
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