VirtualBox

Changeset 24034 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 23, 2009 1:04:13 PM (15 years ago)
Author:
vboxsync
Message:

Backed out r53864; will cause too many problems unfortunately.

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  
    5454
    5555/** ExSetTimerResolution, introduced in W2K. */
    56 PFNMYEXSETTIMERRESOLUTION       g_pfnrtNtExSetTimerResolution;
     56PFNMYEXSETTIMERRESOLUTION   g_pfnrtNtExSetTimerResolution;
    5757/** KeFlushQueuedDpcs, introduced in XP. */
    58 PFNMYKEFLUSHQUEUEDDPCS          g_pfnrtNtKeFlushQueuedDpcs;
    59 /** KeSetSystemAffinityThread - Windows 2000+ */
    60 PFNRTKESETSYSTEMAFFINITYTHREAD  g_pfnrtKeSetSystemAffinityThread;
    61 
     58PFNMYKEFLUSHQUEUEDDPCS      g_pfnrtNtKeFlushQueuedDpcs;
     59/** HalRequestIpi, introduced in ??. */
     60PFNHALREQUESTIPI            g_pfnrtNtHalRequestIpi;
     61/** HalSendSoftwareInterrupt */
     62PFNHALSENDSOFTWAREINTERRUPT g_pfnrtNtHalSendSoftwareInterrupt;
     63/** SendIpi handler based on Windows version */
     64PFNRTSENDIPI                g_pfnrtSendIpi;
     65/** KeIpiGenericCall - Windows Server 2003+ only */
     66PFNRTKEIPIGENERICCALL       g_pfnrtKeIpiGenericCall;
    6267
    6368/** Offset of the _KPRCB::QuantumEnd field. 0 if not found. */
     
    8691    g_pfnrtNtExSetTimerResolution = NULL;
    8792    g_pfnrtNtKeFlushQueuedDpcs = NULL;
    88         g_pfnrtKeSetSystemAffinityThread = NULL;
     93    g_pfnrtNtHalRequestIpi = NULL;
     94    g_pfnrtNtHalSendSoftwareInterrupt = NULL;
     95    g_pfnrtKeIpiGenericCall = NULL;
    8996#else
    9097    /*
     
    98105    g_pfnrtNtKeFlushQueuedDpcs = (PFNMYKEFLUSHQUEUEDDPCS)MmGetSystemRoutineAddress(&RoutineName);
    99106
    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);
    102115#endif
    103116
     
    110123    BOOLEAN fChecked = PsGetVersion(&MajorVersion, &MinorVersion, &BuildNumber, NULL);
    111124
     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
    112144    KIRQL OldIrql;
    113145    KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); /* make sure we stay on the same cpu */
  • trunk/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h

    r24021 r24034  
    4141typedef ULONG (__stdcall *PFNMYEXSETTIMERRESOLUTION)(ULONG, BOOLEAN);
    4242typedef VOID (__stdcall *PFNMYKEFLUSHQUEUEDDPCS)(VOID);
    43 typedef VOID (__stdcall *PFNRTKESETSYSTEMAFFINITYTHREAD)(KAFFINITY);
     43typedef VOID (__stdcall *PFNHALREQUESTIPI)(KAFFINITY TargetSet);
     44typedef VOID (__stdcall *PFNHALSENDSOFTWAREINTERRUPT)(ULONG ProcessorNumber, KIRQL Irql);
     45typedef int (__stdcall *PFNRTSENDIPI)(RTCPUID idCpu);
     46typedef ULONG_PTR (__stdcall *PFNRTKEIPIGENERICCALL)(PKIPI_BROADCAST_WORKER BroadcastFunction, ULONG_PTR  Context);
    4447
    4548/*******************************************************************************
     
    4952extern PFNMYEXSETTIMERRESOLUTION    g_pfnrtNtExSetTimerResolution;
    5053extern PFNMYKEFLUSHQUEUEDDPCS       g_pfnrtNtKeFlushQueuedDpcs;
    51 extern PFNRTKESETSYSTEMAFFINITYTHREAD g_pfnrtKeSetSystemAffinityThread;
     54extern PFNHALREQUESTIPI             g_pfnrtNtHalRequestIpi;
     55extern PFNHALSENDSOFTWAREINTERRUPT  g_pfnrtNtHalSendSoftwareInterrupt;
     56extern PFNRTSENDIPI                 g_pfnrtSendIpi;
     57extern PFNRTKEIPIGENERICCALL        g_pfnrtKeIpiGenericCall;
    5258extern uint32_t                     g_offrtNtPbQuantumEnd;
    5359extern uint32_t                     g_cbrtNtPbQuantumEnd;
    5460extern uint32_t                     g_offrtNtPbDpcQueueDepth;
     61
     62
     63int rtMpSendIpiVista(RTCPUID idCpu);
     64int rtMpSendIpiWin7(RTCPUID idCpu);
     65int rtMpSendIpiDummy(RTCPUID idCpu);
    5566
    5667RT_C_DECLS_END
  • trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp

    r24021 r24034  
    347347}
    348348
     349#ifndef IPRT_TARGET_NT4
     350
     351ULONG_PTR rtMpIpiGenericCall(ULONG_PTR  Argument)
     352{
     353    return 0;
     354}
     355
     356int rtMpSendIpiVista(RTCPUID idCpu)
     357{
     358    g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0);
     359////    g_pfnrtNtHalRequestIpi(1 << idCpu);
     360    return VINF_SUCCESS;
     361}
     362
     363int 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
     371int rtMpSendIpiDummy(RTCPUID idCpu)
     372{
     373    return VERR_NOT_IMPLEMENTED;
     374}
     375
    349376RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
    350377{
     
    353380              ? VERR_CPU_NOT_FOUND
    354381              : VERR_CPU_OFFLINE;
     382
     383    int rc = g_pfnrtSendIpi(idCpu);
     384    if (rc == VINF_SUCCESS)
     385        return rc;
    355386
    356387    /* Fallback. */
     
    376407
    377408    /* 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 Vista
     409     * @note: not true on at least Vista & Windows 7
    379410     */
    380411    BOOLEAN bRet = KeInsertQueueDpc(&aPokeDpcs[idCpu], 0, 0);
  • trunk/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp

    r24021 r24034  
    170170    Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL);
    171171
    172 #ifndef IPRT_TARGET_NT4
    173     Assert(g_pfnrtKeSetSystemAffinityThread);
    174     g_pfnrtKeSetSystemAffinityThread((KAFFINITY)1 << KeGetCurrentProcessorNumber());
    175 #else
    176172    KeRaiseIrql(DISPATCH_LEVEL, &pState->uchOldIrql);
    177 #endif
    178173    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    179174}
     
    185180
    186181    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
    187 #ifndef IPRT_TARGET_NT4
    188     Assert(g_pfnrtKeSetSystemAffinityThread);
    189     g_pfnrtKeSetSystemAffinityThread(KeQueryActiveProcessors());
    190 #else
    191182    KeLowerIrql(pState->uchOldIrql);
    192 #endif
    193183    pState->uchOldIrql = 255;
    194184}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette