- Timestamp:
- Sep 19, 2020 4:06:57 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
r86176 r86177 37 37 #include <iprt/log.h> 38 38 #include <iprt/mem.h> 39 #include <iprt/string.h>40 39 #include <iprt/time.h> 41 40 #include "r0drv/mp-r0drv.h" … … 123 122 /** The handle of the rtR0NtMpProcessorChangeCallback registration. */ 124 123 static PVOID g_pvMpCpuChangeCallback = NULL; 125 /** Size of the KAFFINITY_EX structure.126 * This increased from 20 to 32 bitmap words in the 2020 H2 windows 10 release127 * (i.e. 1280 to 2048 CPUs). We expect this to increase in the future. */128 static size_t g_cbRtMpNtKaffinityEx = RT_UOFFSETOF(KAFFINITY_EX, Bitmap)129 + RT_SIZEOFMEMB(KAFFINITY_EX, Bitmap[0]) * 256;130 /** The size value of the KAFFINITY_EX structure. */131 static uint16_t g_cRtMpNtKaffinityExEntries = 256;132 124 133 125 … … 606 598 && g_pfnrtKeGetProcessorIndexFromNumber) 607 599 { 608 /* Determine the real size of the KAFFINITY_EX structure. */ 609 union 610 { 611 KAFFINITY_EX Struct; 612 uint8_t ab[_4K + 8]; /* This should suffice for determining the real size. */ 613 } u; 614 RT_ZERO(u); 615 size_t const cMaxEntries = (sizeof(u) - RT_UOFFSETOF(KAFFINITY_EX, Bitmap[0])) / sizeof(u.Struct.Bitmap[0]); 616 g_pfnrtKeInitializeAffinityEx(&u.Struct); 617 if (u.Struct.Size > 1 && u.Struct.Size <= cMaxEntries) 618 { 619 g_cRtMpNtKaffinityExEntries = u.Struct.Size; 620 g_cbRtMpNtKaffinityEx = u.Struct.Size * sizeof(u.Struct.Bitmap[0]) + RT_UOFFSETOF(KAFFINITY_EX, Bitmap[0]); 621 g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingHalRequestIpiW7Plus; 622 DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingHalRequestIpiW7Plus\n"); 623 return VINF_SUCCESS; 624 } 625 DbgPrint("IPRT: RTMpPoke can't use rtMpPokeCpuUsingHalRequestIpiW7Plus! u.Struct.Size=%u\n", u.Struct.Size); 626 AssertReleaseMsg(u.Struct.Size <= cMaxEntries, ("%#x\n", u.Struct.Size)); /* stack is toast if larger (32768 CPUs). */ 627 } 628 629 if (pOsVerInfo->uMajorVer >= 6 && g_pfnrtKeIpiGenericCall) 600 g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingHalRequestIpiW7Plus; 601 DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingHalRequestIpiW7Plus\n"); 602 } 603 else if (pOsVerInfo->uMajorVer >= 6 && g_pfnrtKeIpiGenericCall) 630 604 { 631 605 DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingBroadcastIpi\n"); … … 1887 1861 { 1888 1862 /* idCpu is an HAL processor index, so we can use it directly. */ 1889 PKAFFINITY_EX pTarget = (PKAFFINITY_EX)alloca(g_cbRtMpNtKaffinityEx); 1890 pTarget->Size = g_cRtMpNtKaffinityExEntries; /* (just in case KeInitializeAffinityEx starts using it) */ 1891 g_pfnrtKeInitializeAffinityEx(pTarget); 1892 g_pfnrtKeAddProcessorAffinityEx(pTarget, idCpu); 1893 1894 g_pfnrtHalRequestIpiW7Plus(0, pTarget); 1863 KAFFINITY_EX Target; 1864 g_pfnrtKeInitializeAffinityEx(&Target); 1865 g_pfnrtKeAddProcessorAffinityEx(&Target, idCpu); 1866 1867 g_pfnrtHalRequestIpiW7Plus(0, &Target); 1895 1868 return VINF_SUCCESS; 1896 1869 }
Note:
See TracChangeset
for help on using the changeset viewer.