Changeset 72639 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jun 21, 2018 1:51:44 PM (6 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv/nt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp
r70341 r72639 95 95 /** KeInitializeTimerEx - Introduced in NT 4. */ 96 96 decltype(KeInitializeTimerEx) *g_pfnrtKeInitializeTimerEx; 97 /** KeShouldYieldProcessor - Introduced in Windows 10. */ 98 PFNKESHOULDYIELDPROCESSOR g_pfnrtKeShouldYieldProcessor; 97 99 /** Pointer to the MmProtectMdlSystemAddress kernel function if it's available. 98 100 * This API was introduced in XP. */ … … 306 308 GET_SYSTEM_ROUTINE(KeSetTargetProcessorDpc); 307 309 GET_SYSTEM_ROUTINE(KeInitializeTimerEx); 310 GET_SYSTEM_ROUTINE_TYPE(KeShouldYieldProcessor, PFNKESHOULDYIELDPROCESSOR); 308 311 GET_SYSTEM_ROUTINE(MmProtectMdlSystemAddress); 309 312 GET_SYSTEM_ROUTINE(MmAllocatePagesForMdl); -
trunk/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h
r70341 r72639 85 85 extern decltype(KeSetTargetProcessorDpc) *g_pfnrtKeSetTargetProcessorDpc; 86 86 extern decltype(KeInitializeTimerEx) *g_pfnrtKeInitializeTimerEx; 87 extern PFNKESHOULDYIELDPROCESSOR g_pfnrtKeShouldYieldProcessor; 87 88 extern decltype(MmProtectMdlSystemAddress) *g_pfnrtMmProtectMdlSystemAddress; 88 89 extern decltype(MmAllocatePagesForMdl) *g_pfnrtMmAllocatePagesForMdl; -
trunk/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp
r70334 r72639 96 96 97 97 /* 98 * The KeShouldYieldProcessor API introduced in Windows 10 looks like exactly 99 * what we want. But of course there is a snag. It may return with interrupts 100 * enabled when called with them disabled. Let's just hope it doesn't get upset 101 * by disabled interrupts in other ways... 102 */ 103 if (g_pfnrtKeShouldYieldProcessor) 104 { 105 RTCCUINTREG fSavedFlags = ASMGetFlags(); 106 bool fReturn = g_pfnrtKeShouldYieldProcessor() != FALSE; 107 ASMSetFlags(fSavedFlags); 108 return fReturn; 109 } 110 111 /* 112 * Fallback approach for pre W10 kernels. 113 * 114 * If W10 is anything to go by, we should also check and yield when: 115 * - pPrcb->NextThread != NULL && pPrcb->NextThread != pPrcb->CurrentThread 116 * when QuantumEnd is zero. 117 * - pPrcb->DpcRequestSummary & 1 118 * - pPrcb->DpcRequestSummary & 0x1e 119 */ 120 121 /* 98 122 * Read the globals and check if they are useful. 99 123 */ … … 154 178 RTDECL(bool) RTThreadPreemptIsPendingTrusty(void) 155 179 { 180 if (g_pfnrtKeShouldYieldProcessor) 181 return true; 156 182 #if 0 /** @todo RTThreadPreemptIsPending isn't good enough on w7 and possibly elsewhere. */ 157 183 /* RTThreadPreemptIsPending is only reliable if we've got both offsets and size. */
Note:
See TracChangeset
for help on using the changeset viewer.