Changeset 52780 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Sep 17, 2014 5:35:42 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 96159
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r52725 r52780 159 159 static DECLCALLBACK(void) supdrvGipAsyncTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick); 160 160 static DECLCALLBACK(void) supdrvGipMpEvent(RTMPEVENT enmEvent, RTCPUID idCpu, void *pvUser); 161 static bool supdrvIsInvariantTsc(void); 161 162 static void supdrvGipInit(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, RTHCPHYS HCPhys, 162 163 uint64_t u64NanoTS, unsigned uUpdateHz, unsigned cCpus); … … 6038 6039 6039 6040 /** 6041 * Returns whether the host CPU sports an invariant TSC or not. 6042 * 6043 * @returns true if invariant TSC is supported, false otherwise. 6044 */ 6045 static bool supdrvIsInvariantTsc(void) 6046 { 6047 static bool s_fQueried = false; 6048 static bool s_fIsInvariantTsc = false; 6049 if (!s_fQueried) 6050 { 6051 uint32_t uEax, uEbx, uEcx, uEdx; 6052 ASMCpuId(0x80000000, &uEax, &uEbx, &uEcx, &uEdx); 6053 if (uEax >= 0x80000007) 6054 { 6055 ASMCpuId(0x80000007, &uEax, &uEbx, &uEcx, &uEdx); 6056 if (uEdx & X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR) 6057 s_fIsInvariantTsc = true; 6058 } 6059 s_fQueried = true; 6060 } 6061 6062 return s_fIsInvariantTsc; 6063 } 6064 6065 6066 /** 6040 6067 * Callback used by supdrvMeasureTscDeltas() to read the TSC on two CPUs and 6041 6068 * compute the delta between them. … … 6058 6085 * minimum as an arbibtrary acceptable threshold. Therefore, it is still 6059 6086 * possible to get negative deltas where there are none when the worker is 6060 * earlier. 6087 * earlier. As long as these occasional negative deltas are lower than the 6088 * time it takes to exit guest-context and the OS to reschedule EMT on a 6089 * different CPU we won't expose a TSC that jumped backwards. 6061 6090 */ 6062 6091 static DECLCALLBACK(void) supdrvMeasureTscDeltaCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
Note:
See TracChangeset
for help on using the changeset viewer.