diff options
Diffstat (limited to 'src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp')
-rw-r--r-- | src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp index d05b4c7a7..15fa72d45 100644 --- a/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp @@ -40,7 +40,6 @@ #include <iprt/asm.h> #include "r0drv/mp-r0drv.h" #include "internal-r0drv-nt.h" -#include "internal/mp.h" /******************************************************************************* @@ -347,6 +346,32 @@ static VOID rtMpNtPokeCpuDummy(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID NOREF(SystemArgument2); } +#ifndef IPRT_TARGET_NT4 + +ULONG_PTR rtMpIpiGenericCall(ULONG_PTR Argument) +{ + return 0; +} + +int rtMpSendIpiVista(RTCPUID idCpu) +{ + g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0); +//// g_pfnrtNtHalRequestIpi(1 << idCpu); + return VINF_SUCCESS; +} + +int rtMpSendIpiWin7(RTCPUID idCpu) +{ + g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0); +//// g_pfnrtNtHalSendSoftwareInterrupt(idCpu, DISPATCH_LEVEL); + return VINF_SUCCESS; +} +#endif /* IPRT_TARGET_NT4 */ + +int rtMpSendIpiDummy(RTCPUID idCpu) +{ + return VERR_NOT_IMPLEMENTED; +} RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) { @@ -355,6 +380,11 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) ? VERR_CPU_NOT_FOUND : VERR_CPU_OFFLINE; + int rc = g_pfnrtSendIpi(idCpu); + if (rc == VINF_SUCCESS) + return rc; + + /* Fallback. */ if (!fPokeDPCsInitialized) { for (unsigned i = 0; i < RT_ELEMENTS(aPokeDpcs); i++) @@ -372,20 +402,14 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) KIRQL oldIrql; KeRaiseIrql(DISPATCH_LEVEL, &oldIrql); + KeSetImportanceDpc(&aPokeDpcs[idCpu], HighImportance); + KeSetTargetProcessorDpc(&aPokeDpcs[idCpu], (int)idCpu); + /* Assuming here that high importance DPCs will be delivered immediately; or at least an IPI will be sent immediately. - * Todo: verify! + * @note: not true on at least Vista & Windows 7 */ BOOLEAN bRet = KeInsertQueueDpc(&aPokeDpcs[idCpu], 0, 0); KeLowerIrql(oldIrql); return (bRet == TRUE) ? VINF_SUCCESS : VERR_ACCESS_DENIED /* already queued */; } - -void rtMpPokeCpuClear() -{ - RTCPUID idCpu = RTMpCpuId(); - - /* Remove any pending poke DPC from the queue, so another call to RTMpPokeCpu will send an IPI */ - /* Note: assuming this is a cheap operation. */ - KeRemoveQueueDpc(&aPokeDpcs[idCpu]); -} |