Changeset 70402 in vbox for trunk/src/VBox/Runtime/r3/win
- Timestamp:
- Jan 1, 2018 3:27:56 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/time-win.cpp
r69111 r70402 39 39 #include <iprt/err.h> 40 40 #include "internal/time.h" 41 #include "internal-r3-win.h" 41 42 42 43 /* … … 109 110 110 111 #elif defined USE_INTERRUPT_TIME 111 # if 0 /* ASSUME 0x7ffe0000 is set in stone */ 112 /* 113 * This is exactly what we want, but we have to obtain it by non-official 114 * means. 115 */ 116 static MY_KUSER_SHARED_DATA *s_pUserSharedData = NULL; 117 if (!s_pUserSharedData) 112 /* 113 * Use interrupt time if we can (not possible on NT 3.1). 114 */ 115 /** @todo use RtlGetInterruptTimePrecise if available (W10+). */ 116 117 static int volatile g_fCanUseUserSharedData = -1; 118 int fCanUseUserSharedData = g_fCanUseUserSharedData; 119 if (fCanUseUserSharedData != -1) 120 { /* likely */ } 121 else 118 122 { 119 /** @todo find official way of getting this or some more clever 120 * detection algorithm if necessary. The com debugger class 121 * exports this too, windbg knows it too... */ 122 s_pUserSharedData = (PMY_KUSER_SHARED_DATA)(uintptr_t)0x7ffe0000; 123 /* We may be called before g_enmWinVer has been initialized. */ 124 if (g_enmWinVer != kRTWinOSType_UNKNOWN) 125 fCanUseUserSharedData = g_enmWinVer > kRTWinOSType_NT310; 126 else 127 { 128 DWORD dwVer = GetVersion(); 129 fCanUseUserSharedData = (dwVer & 0xff) != 3 || ((dwVer >> 8) & 0xff) >= 50; 130 } 131 g_fCanUseUserSharedData = fCanUseUserSharedData; 123 132 } 124 # endif 125 PMY_KUSER_SHARED_DATA pUserSharedData = (PMY_KUSER_SHARED_DATA)(uintptr_t)0x7ffe0000; 126 127 /* use interrupt time */ 128 LARGE_INTEGER Time; 129 do 133 134 if (fCanUseUserSharedData != 0) 130 135 { 131 Time.HighPart = pUserSharedData->InterruptTime.High1Time; 132 Time.LowPart = pUserSharedData->InterruptTime.LowPart; 133 } while (pUserSharedData->InterruptTime.High2Time != Time.HighPart); 134 135 return (uint64_t)Time.QuadPart * 100; 136 PMY_KUSER_SHARED_DATA pUserSharedData = (PMY_KUSER_SHARED_DATA)(uintptr_t)0x7ffe0000; 137 LARGE_INTEGER Time; 138 do 139 { 140 Time.HighPart = pUserSharedData->InterruptTime.High1Time; 141 Time.LowPart = pUserSharedData->InterruptTime.LowPart; 142 } while (pUserSharedData->InterruptTime.High2Time != Time.HighPart); 143 144 return (uint64_t)Time.QuadPart * 100; 145 } 146 147 return (uint64_t)GetTickCount() * RT_NS_1MS_64; 136 148 137 149 #else
Note:
See TracChangeset
for help on using the changeset viewer.