Changeset 53720 in vbox for trunk/src/VBox/Runtime/r0drv/nt
- Timestamp:
- Jan 3, 2015 5:57:05 AM (10 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
r53718 r53720 56 56 /** KeFlushQueuedDpcs, introduced in XP. */ 57 57 PFNMYKEFLUSHQUEUEDDPCS g_pfnrtNtKeFlushQueuedDpcs; 58 /** HalRequestIpi, introduced in ??. */ 59 PFNHALREQUESTIPI g_pfnrtNtHalRequestIpi; 58 /** HalRequestIpi, version introduced with windows 7. */ 59 PFNHALREQUESTIPI_W7PLUS g_pfnrtHalRequestIpiW7Plus; 60 /** HalRequestIpi, version valid up to windows vista?? */ 61 PFNHALREQUESTIPI_PRE_W7 g_pfnrtHalRequestIpiPreW7; 60 62 /** HalSendSoftwareInterrupt, introduced in AMD64 version of W2K3. */ 61 63 PFNHALSENDSOFTWAREINTERRUPT g_pfnrtNtHalSendSoftwareInterrupt; … … 64 66 /** KeIpiGenericCall - Introduced in Windows Server 2003. */ 65 67 PFNRTKEIPIGENERICCALL g_pfnrtKeIpiGenericCall; 68 /** KeInitializeAffinityEx - Introducted in Windows 7. */ 69 PFNKEINITIALIZEAFFINITYEX g_pfnrtKeInitializeAffinityEx; 70 /** KeAddProcessorAffinityEx - Introducted in Windows 7. */ 71 PFNKEADDPROCESSORAFFINITYEX g_pfnrtKeAddProcessorAffinityEx; 72 /** KeGetProcessorIndexFromNumber - Introducted in Windows 7. */ 73 PFNKEGETPROCESSORINDEXFROMNUMBER g_pfnrtKeGetProcessorIndexFromNumber; 66 74 /** RtlGetVersion, introduced in ??. */ 67 75 PFNRTRTLGETVERSION g_pfnrtRtlGetVersion; … … 216 224 g_pfnrtNtExSetTimerResolution = NULL; 217 225 g_pfnrtNtKeFlushQueuedDpcs = NULL; 218 g_pfnrtNtHalRequestIpi = NULL; 226 g_pfnrtHalRequestIpiW7Plus = NULL; 227 g_pfnrtHalRequestIpiPreW7 = NULL; 219 228 g_pfnrtNtHalSendSoftwareInterrupt = NULL; 220 229 g_pfnrtKeIpiGenericCall = NULL; 230 g_pfnrtKeInitializeAffinityEx = NULL; 231 g_pfnrtKeAddProcessorAffinityEx = NULL; 232 g_pfnrtKeGetProcessorIndexFromNumber = NULL; 221 233 g_pfnrtRtlGetVersion = NULL; 222 234 g_pfnrtKeQueryInterruptTime = NULL; … … 233 245 234 246 RtlInitUnicodeString(&RoutineName, L"HalRequestIpi"); 235 g_pfnrtNtHalRequestIpi = (PFNHALREQUESTIPI)MmGetSystemRoutineAddress(&RoutineName); 247 g_pfnrtHalRequestIpiW7Plus = (PFNHALREQUESTIPI_W7PLUS)MmGetSystemRoutineAddress(&RoutineName); 248 g_pfnrtHalRequestIpiPreW7 = (PFNHALREQUESTIPI_PRE_W7)g_pfnrtHalRequestIpiW7Plus; 236 249 237 250 RtlInitUnicodeString(&RoutineName, L"HalSendSoftwareInterrupt"); … … 240 253 RtlInitUnicodeString(&RoutineName, L"KeIpiGenericCall"); 241 254 g_pfnrtKeIpiGenericCall = (PFNRTKEIPIGENERICCALL)MmGetSystemRoutineAddress(&RoutineName); 255 256 RtlInitUnicodeString(&RoutineName, L"KeInitializeAffinityEx"); 257 g_pfnrtKeInitializeAffinityEx = (PFNKEINITIALIZEAFFINITYEX)MmGetSystemRoutineAddress(&RoutineName); 258 259 RtlInitUnicodeString(&RoutineName, L"KeAddProcessorAffinityEx"); 260 g_pfnrtKeAddProcessorAffinityEx = (PFNKEADDPROCESSORAFFINITYEX)MmGetSystemRoutineAddress(&RoutineName); 261 262 RtlInitUnicodeString(&RoutineName, L"KeGetProcessorIndexFromNumber"); 263 g_pfnrtKeGetProcessorIndexFromNumber = (PFNKEGETPROCESSORINDEXFROMNUMBER)MmGetSystemRoutineAddress(&RoutineName); 242 264 243 265 RtlInitUnicodeString(&RoutineName, L"RtlGetVersion"); … … 388 410 * Special IPI fun for RTMpPokeCpu. 389 411 * 390 * On Vista and later the DPC fallbackdoesn't seem to reliably send IPIs,412 * On Vista and later the DPC method doesn't seem to reliably send IPIs, 391 413 * so we have to use alternative methods. The NtHalSendSoftwareInterrupt 392 * is preferrable, but if that's not available we'll settle for broadcast 393 * IPIs. 394 */ 414 * is preferrable, but it's AMD64 only. The NalRequestIpip method changed 415 * in Windows 7 with the lots-of-processors-support, but it's the only 416 * targeted IPI game in town if we cannot use KeInsertQueueDpc. Worst case 417 * we use broadcast IPIs. 418 */ 419 if ( OsVerInfo.uMajorVer > 6 420 || (OsVerInfo.uMajorVer == 6 && OsVerInfo.uMinorVer > 0)) 421 g_pfnrtHalRequestIpiPreW7 = NULL; 422 else 423 g_pfnrtHalRequestIpiW7Plus = NULL; 424 395 425 g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingDpc; 396 426 #ifndef IPRT_TARGET_NT4 397 427 if (g_pfnrtNtHalSendSoftwareInterrupt) 398 428 g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingHalSendSoftwareInterrupt; 429 else if ( g_pfnrtHalRequestIpiW7Plus 430 && g_pfnrtKeInitializeAffinityEx 431 && g_pfnrtKeAddProcessorAffinityEx 432 && g_pfnrtKeGetProcessorIndexFromNumber) 433 g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingHalReqestIpiW7Plus; 399 434 else if (OsVerInfo.uMajorVer >= 6 && g_pfnrtKeIpiGenericCall) 400 435 g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingBroadcastIpi; -
trunk/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h
r53718 r53720 29 29 30 30 #include <iprt/cpuset.h> 31 #include <iprt/nt/nt.h> 31 32 32 33 RT_C_DECLS_BEGIN … … 37 38 typedef ULONG (__stdcall *PFNMYEXSETTIMERRESOLUTION)(ULONG, BOOLEAN); 38 39 typedef VOID (__stdcall *PFNMYKEFLUSHQUEUEDDPCS)(VOID); 39 typedef VOID (__stdcall *PFNHALREQUESTIPI)(KAFFINITY TargetSet);40 40 typedef VOID (__stdcall *PFNHALSENDSOFTWAREINTERRUPT)(ULONG ProcessorNumber, KIRQL Irql); 41 41 typedef int (__stdcall *PFNRTSENDIPI)(RTCPUID idCpu); … … 56 56 extern PFNMYEXSETTIMERRESOLUTION g_pfnrtNtExSetTimerResolution; 57 57 extern PFNMYKEFLUSHQUEUEDDPCS g_pfnrtNtKeFlushQueuedDpcs; 58 extern PFNHALREQUESTIPI g_pfnrtNtHalRequestIpi; 58 extern PFNHALREQUESTIPI_W7PLUS g_pfnrtHalRequestIpiW7Plus; 59 extern PFNHALREQUESTIPI_PRE_W7 g_pfnrtHalRequestIpiPreW7; 59 60 extern PFNHALSENDSOFTWAREINTERRUPT g_pfnrtNtHalSendSoftwareInterrupt; 60 61 extern PFNRTSENDIPI g_pfnrtMpPokeCpuWorker; 61 62 extern PFNRTKEIPIGENERICCALL g_pfnrtKeIpiGenericCall; 63 extern PFNKEINITIALIZEAFFINITYEX g_pfnrtKeInitializeAffinityEx; 64 extern PFNKEADDPROCESSORAFFINITYEX g_pfnrtKeAddProcessorAffinityEx; 65 extern PFNKEGETPROCESSORINDEXFROMNUMBER g_pfnrtKeGetProcessorIndexFromNumber; 66 62 67 extern PFNRTRTLGETVERSION g_pfnrtRtlGetVersion; 63 68 #ifndef RT_ARCH_AMD64 … … 75 80 int rtMpPokeCpuUsingBroadcastIpi(RTCPUID idCpu); 76 81 int rtMpPokeCpuUsingHalSendSoftwareInterrupt(RTCPUID idCpu); 82 int rtMpPokeCpuUsingHalReqestIpiW7Plus(RTCPUID idCpu); 83 int rtMpPokeCpuUsingHalReqestIpiPreW7(RTCPUID idCpu); 77 84 78 85 RT_C_DECLS_END -
trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
r53718 r53720 454 454 #ifndef IPRT_TARGET_NT4 455 455 456 /** Callback used by rtMpPokeCpuUsingBroadcastIpi. */ 456 457 static ULONG_PTR __stdcall rtMpIpiGenericCall(ULONG_PTR Argument) 457 458 { … … 461 462 462 463 464 /** 465 * RTMpPokeCpu worker that uses broadcast IPIs for doing the work. 466 * 467 * @returns VINF_SUCCESS 468 * @param idCpu The CPU identifier. 469 */ 463 470 int rtMpPokeCpuUsingBroadcastIpi(RTCPUID idCpu) 464 471 { … … 467 474 } 468 475 469 # if 0 470 int rtMpSendIpiVista(RTCPUID idCpu) 471 { 472 /* If we start care about Vista, we should investigate a non-broadcast API. */ 473 g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0); 474 //// g_pfnrtNtHalRequestIpi(1 << idCpu); 475 return VINF_SUCCESS; 476 } 477 # endif 478 479 476 477 /** 478 * RTMpPokeCpu worker that uses HalSendSoftwareInterrupt to get the job done. 479 * 480 * This is only really available on AMD64, at least at the time of writing. 481 * 482 * @returns VINF_SUCCESS 483 * @param idCpu The CPU identifier. 484 */ 480 485 int rtMpPokeCpuUsingHalSendSoftwareInterrupt(RTCPUID idCpu) 481 486 { … … 484 489 } 485 490 486 #endif /* IPRT_TARGET_NT4 */ 491 492 /** 493 * RTMpPokeCpu worker that uses the Windows 7 and later version of 494 * HalRequestIpip to get the job done. 495 * 496 * @returns VINF_SUCCESS 497 * @param idCpu The CPU identifier. 498 */ 499 int rtMpPokeCpuUsingHalReqestIpiW7Plus(RTCPUID idCpu) 500 { 501 /* 502 * I think we'll let idCpu be an NT processor number and not a HAL processor 503 * index. KeAddProcessorAffinityEx is for HAL and uses HAL processor 504 * indexes as input from what I can tell. 505 */ 506 PROCESSOR_NUMBER ProcNumber = { /*Group=*/ idCpu / 64, /*Number=*/ idCpu % 64, /* Reserved=*/ 0}; 507 KAFFINITY_EX Target; 508 g_pfnrtKeInitializeAffinityEx(&Target); 509 g_pfnrtKeAddProcessorAffinityEx(&Target, g_pfnrtKeGetProcessorIndexFromNumber(&ProcNumber)); 510 511 g_pfnrtHalRequestIpiW7Plus(0, &Target); 512 return VINF_SUCCESS; 513 } 514 515 516 /** 517 * RTMpPokeCpu worker that uses the Vista and earlier version of HalRequestIpip 518 * to get the job done. 519 * 520 * @returns VINF_SUCCESS 521 * @param idCpu The CPU identifier. 522 */ 523 int rtMpPokeCpuUsingHalReqestIpiPreW7(RTCPUID idCpu) 524 { 525 __debugbreak(); /** @todo this code needs testing!! */ 526 KAFFINITY Target = 1; 527 Target <<= idCpu; 528 g_pfnrtHalRequestIpiPreW7(Target); 529 return VINF_SUCCESS; 530 } 531 532 #endif /* !IPRT_TARGET_NT4 */ 487 533 488 534 -
trunk/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h
r44528 r53720 41 41 # pragma warning(disable : 4163) 42 42 RT_C_DECLS_BEGIN 43 # include < ntddk.h>43 # include <iprt/nt/nt.h> 44 44 RT_C_DECLS_END 45 45 # pragma warning(default : 4163) … … 50 50 #else 51 51 RT_C_DECLS_BEGIN 52 # include < ntddk.h>52 # include <iprt/nt/nt.h> 53 53 RT_C_DECLS_END 54 54 #endif
Note:
See TracChangeset
for help on using the changeset viewer.