Changeset 24034 in vbox for trunk/src/VBox
- Timestamp:
- Oct 23, 2009 1:04:13 PM (15 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv/nt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp
r24021 r24034 54 54 55 55 /** ExSetTimerResolution, introduced in W2K. */ 56 PFNMYEXSETTIMERRESOLUTION 56 PFNMYEXSETTIMERRESOLUTION g_pfnrtNtExSetTimerResolution; 57 57 /** KeFlushQueuedDpcs, introduced in XP. */ 58 PFNMYKEFLUSHQUEUEDDPCS g_pfnrtNtKeFlushQueuedDpcs; 59 /** KeSetSystemAffinityThread - Windows 2000+ */ 60 PFNRTKESETSYSTEMAFFINITYTHREAD g_pfnrtKeSetSystemAffinityThread; 61 58 PFNMYKEFLUSHQUEUEDDPCS g_pfnrtNtKeFlushQueuedDpcs; 59 /** HalRequestIpi, introduced in ??. */ 60 PFNHALREQUESTIPI g_pfnrtNtHalRequestIpi; 61 /** HalSendSoftwareInterrupt */ 62 PFNHALSENDSOFTWAREINTERRUPT g_pfnrtNtHalSendSoftwareInterrupt; 63 /** SendIpi handler based on Windows version */ 64 PFNRTSENDIPI g_pfnrtSendIpi; 65 /** KeIpiGenericCall - Windows Server 2003+ only */ 66 PFNRTKEIPIGENERICCALL g_pfnrtKeIpiGenericCall; 62 67 63 68 /** Offset of the _KPRCB::QuantumEnd field. 0 if not found. */ … … 86 91 g_pfnrtNtExSetTimerResolution = NULL; 87 92 g_pfnrtNtKeFlushQueuedDpcs = NULL; 88 g_pfnrtKeSetSystemAffinityThread = NULL; 93 g_pfnrtNtHalRequestIpi = NULL; 94 g_pfnrtNtHalSendSoftwareInterrupt = NULL; 95 g_pfnrtKeIpiGenericCall = NULL; 89 96 #else 90 97 /* … … 98 105 g_pfnrtNtKeFlushQueuedDpcs = (PFNMYKEFLUSHQUEUEDDPCS)MmGetSystemRoutineAddress(&RoutineName); 99 106 100 RtlInitUnicodeString(&RoutineName, L"KeSetSystemAffinityThread"); 101 g_pfnrtKeSetSystemAffinityThread = (PFNRTKESETSYSTEMAFFINITYTHREAD)MmGetSystemRoutineAddress(&RoutineName); 107 RtlInitUnicodeString(&RoutineName, L"HalRequestIpi"); 108 g_pfnrtNtHalRequestIpi = (PFNHALREQUESTIPI)MmGetSystemRoutineAddress(&RoutineName); 109 110 RtlInitUnicodeString(&RoutineName, L"HalSendSoftwareInterrupt"); 111 g_pfnrtNtHalSendSoftwareInterrupt = (PFNHALSENDSOFTWAREINTERRUPT)MmGetSystemRoutineAddress(&RoutineName); 112 113 RtlInitUnicodeString(&RoutineName, L"KeIpiGenericCall"); 114 g_pfnrtKeIpiGenericCall = (PFNRTKEIPIGENERICCALL)MmGetSystemRoutineAddress(&RoutineName); 102 115 #endif 103 116 … … 110 123 BOOLEAN fChecked = PsGetVersion(&MajorVersion, &MinorVersion, &BuildNumber, NULL); 111 124 125 g_pfnrtSendIpi = rtMpSendIpiDummy; 126 #ifndef IPRT_TARGET_NT4 127 if ( g_pfnrtNtHalRequestIpi 128 && MajorVersion == 6 129 && MinorVersion == 0) 130 { 131 /* Vista or Windows Server 2008 */ 132 g_pfnrtSendIpi = rtMpSendIpiVista; 133 } 134 else 135 if ( g_pfnrtNtHalSendSoftwareInterrupt 136 && MajorVersion == 6 137 && MinorVersion == 1) 138 { 139 /* Windows 7 or Windows Server 2008 R2 */ 140 g_pfnrtSendIpi = rtMpSendIpiWin7; 141 } 142 /* Windows XP should send always send an IPI -> VERIFY */ 143 #endif 112 144 KIRQL OldIrql; 113 145 KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); /* make sure we stay on the same cpu */ -
trunk/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h
r24021 r24034 41 41 typedef ULONG (__stdcall *PFNMYEXSETTIMERRESOLUTION)(ULONG, BOOLEAN); 42 42 typedef VOID (__stdcall *PFNMYKEFLUSHQUEUEDDPCS)(VOID); 43 typedef VOID (__stdcall *PFNRTKESETSYSTEMAFFINITYTHREAD)(KAFFINITY); 43 typedef VOID (__stdcall *PFNHALREQUESTIPI)(KAFFINITY TargetSet); 44 typedef VOID (__stdcall *PFNHALSENDSOFTWAREINTERRUPT)(ULONG ProcessorNumber, KIRQL Irql); 45 typedef int (__stdcall *PFNRTSENDIPI)(RTCPUID idCpu); 46 typedef ULONG_PTR (__stdcall *PFNRTKEIPIGENERICCALL)(PKIPI_BROADCAST_WORKER BroadcastFunction, ULONG_PTR Context); 44 47 45 48 /******************************************************************************* … … 49 52 extern PFNMYEXSETTIMERRESOLUTION g_pfnrtNtExSetTimerResolution; 50 53 extern PFNMYKEFLUSHQUEUEDDPCS g_pfnrtNtKeFlushQueuedDpcs; 51 extern PFNRTKESETSYSTEMAFFINITYTHREAD g_pfnrtKeSetSystemAffinityThread; 54 extern PFNHALREQUESTIPI g_pfnrtNtHalRequestIpi; 55 extern PFNHALSENDSOFTWAREINTERRUPT g_pfnrtNtHalSendSoftwareInterrupt; 56 extern PFNRTSENDIPI g_pfnrtSendIpi; 57 extern PFNRTKEIPIGENERICCALL g_pfnrtKeIpiGenericCall; 52 58 extern uint32_t g_offrtNtPbQuantumEnd; 53 59 extern uint32_t g_cbrtNtPbQuantumEnd; 54 60 extern uint32_t g_offrtNtPbDpcQueueDepth; 61 62 63 int rtMpSendIpiVista(RTCPUID idCpu); 64 int rtMpSendIpiWin7(RTCPUID idCpu); 65 int rtMpSendIpiDummy(RTCPUID idCpu); 55 66 56 67 RT_C_DECLS_END -
trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
r24021 r24034 347 347 } 348 348 349 #ifndef IPRT_TARGET_NT4 350 351 ULONG_PTR rtMpIpiGenericCall(ULONG_PTR Argument) 352 { 353 return 0; 354 } 355 356 int rtMpSendIpiVista(RTCPUID idCpu) 357 { 358 g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0); 359 //// g_pfnrtNtHalRequestIpi(1 << idCpu); 360 return VINF_SUCCESS; 361 } 362 363 int rtMpSendIpiWin7(RTCPUID idCpu) 364 { 365 g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0); 366 //// g_pfnrtNtHalSendSoftwareInterrupt(idCpu, DISPATCH_LEVEL); 367 return VINF_SUCCESS; 368 } 369 #endif /* IPRT_TARGET_NT4 */ 370 371 int rtMpSendIpiDummy(RTCPUID idCpu) 372 { 373 return VERR_NOT_IMPLEMENTED; 374 } 375 349 376 RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) 350 377 { … … 353 380 ? VERR_CPU_NOT_FOUND 354 381 : VERR_CPU_OFFLINE; 382 383 int rc = g_pfnrtSendIpi(idCpu); 384 if (rc == VINF_SUCCESS) 385 return rc; 355 386 356 387 /* Fallback. */ … … 376 407 377 408 /* Assuming here that high importance DPCs will be delivered immediately; or at least an IPI will be sent immediately. 378 * @note: seems to be true on Vista409 * @note: not true on at least Vista & Windows 7 379 410 */ 380 411 BOOLEAN bRet = KeInsertQueueDpc(&aPokeDpcs[idCpu], 0, 0); -
trunk/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp
r24021 r24034 170 170 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 171 171 172 #ifndef IPRT_TARGET_NT4173 Assert(g_pfnrtKeSetSystemAffinityThread);174 g_pfnrtKeSetSystemAffinityThread((KAFFINITY)1 << KeGetCurrentProcessorNumber());175 #else176 172 KeRaiseIrql(DISPATCH_LEVEL, &pState->uchOldIrql); 177 #endif178 173 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState); 179 174 } … … 185 180 186 181 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState); 187 #ifndef IPRT_TARGET_NT4188 Assert(g_pfnrtKeSetSystemAffinityThread);189 g_pfnrtKeSetSystemAffinityThread(KeQueryActiveProcessors());190 #else191 182 KeLowerIrql(pState->uchOldIrql); 192 #endif193 183 pState->uchOldIrql = 255; 194 184 }
Note:
See TracChangeset
for help on using the changeset viewer.