VirtualBox

Changeset 23412 in vbox for trunk/src/VBox/Runtime/r0drv/nt


Ignore:
Timestamp:
Sep 29, 2009 3:24:43 PM (15 years ago)
Author:
vboxsync
Message:

Enabled HalRequestIpi usage again. Hopefully works with Windows 7 too (test pending).

Location:
trunk/src/VBox/Runtime/r0drv/nt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp

    r23065 r23412  
    5757/** KeFlushQueuedDpcs, introduced in XP. */
    5858PFNMYKEFLUSHQUEUEDDPCS      g_pfnrtNtKeFlushQueuedDpcs;
     59/** HalRequestIpi, introduced in ??. */
     60PFNHALREQUESTIPI            g_pfnrtNtHalRequestIpi;
     61/** SendIpi handler based on Windows version */
     62PFNRTSENDIPI                g_pfnrtSendIpi;
    5963
    6064/** Offset of the _KPRCB::QuantumEnd field. 0 if not found. */
     
    8387    g_pfnrtNtExSetTimerResolution = NULL;
    8488    g_pfnrtNtKeFlushQueuedDpcs = NULL;
     89    g_pfnrtNtHalRequestIpi = NULL;
    8590#else
    8691    /*
     
    9398    RtlInitUnicodeString(&RoutineName, L"KeFlushQueuedDpcs");
    9499    g_pfnrtNtKeFlushQueuedDpcs = (PFNMYKEFLUSHQUEUEDDPCS)MmGetSystemRoutineAddress(&RoutineName);
     100
     101    RtlInitUnicodeString(&RoutineName, L"HalRequestIpi");
     102    g_pfnrtNtHalRequestIpi = (PFNHALREQUESTIPI)MmGetSystemRoutineAddress(&RoutineName);
    95103#endif
    96104
     
    103111    BOOLEAN fChecked = PsGetVersion(&MajorVersion, &MinorVersion, &BuildNumber, NULL);
    104112
     113    g_pfnrtSendIpi = rtMpSendIpiDummy;
     114#ifndef IPRT_TARGET_NT4
     115    if (g_pfnrtNtHalRequestIpi)
     116    {
     117        if (    MajorVersion == 6
     118            &&  MinorVersion == 0)
     119        {
     120            /* Vista or Windows Server 2008 */
     121            g_pfnrtSendIpi = rtMpSendIpiVista;
     122        }
     123        else
     124        if (    MajorVersion == 6
     125            &&  MinorVersion == 1)
     126        {
     127            /* Windows 7 or Windows Server 2008 R2 */
     128            g_pfnrtSendIpi = rtMpSendIpiWin7;
     129        }
     130    }
     131#endif
    105132    KIRQL OldIrql;
    106133    KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); /* make sure we stay on the same cpu */
  • trunk/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h

    r20374 r23412  
    4141typedef ULONG (__stdcall *PFNMYEXSETTIMERRESOLUTION)(ULONG, BOOLEAN);
    4242typedef VOID (__stdcall *PFNMYKEFLUSHQUEUEDDPCS)(VOID);
     43typedef VOID (__stdcall *PFNHALREQUESTIPI)(KAFFINITY TargetSet);
     44typedef int (__stdcall *PFNRTSENDIPI)(RTCPUID idCpu);
    4345
    4446
     
    4951extern PFNMYEXSETTIMERRESOLUTION    g_pfnrtNtExSetTimerResolution;
    5052extern PFNMYKEFLUSHQUEUEDDPCS       g_pfnrtNtKeFlushQueuedDpcs;
     53extern PFNHALREQUESTIPI             g_pfnrtNtHalRequestIpi;
     54extern PFNRTSENDIPI                 g_pfnrtSendIpi;
    5155extern uint32_t                     g_offrtNtPbQuantumEnd;
    5256extern uint32_t                     g_cbrtNtPbQuantumEnd;
    5357extern uint32_t                     g_offrtNtPbDpcQueueDepth;
    5458
     59
     60int rtMpSendIpiVista(RTCPUID idCpu);
     61int rtMpSendIpiWin7(RTCPUID idCpu);
     62int rtMpSendIpiDummy(RTCPUID idCpu);
    5563
    5664RT_C_DECLS_END
  • trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp

    r23376 r23412  
    348348}
    349349
    350 
    351 extern "C" void HalRequestIpi(KAFFINITY TargetSet);
     350#ifndef IPRT_TARGET_NT4
     351int rtMpSendIpiVista(RTCPUID idCpu)
     352{
     353    g_pfnrtNtHalRequestIpi(1 << idCpu);
     354    return VINF_SUCCESS;
     355}
     356
     357int rtMpSendIpiWin7(RTCPUID idCpu)
     358{
     359    VOID (__stdcall *pfRequestIpi)(KAFFINITY Zero, KAFFINITY TargetSet) = (VOID (__stdcall *)(KAFFINITY, KAFFINITY))g_pfnrtNtHalRequestIpi;
     360
     361    pfRequestIpi(0, 1 << idCpu);
     362    return VINF_SUCCESS;
     363}
     364#endif /* IPRT_TARGET_NT4 */
     365
     366int rtMpSendIpiDummy(RTCPUID idCpu)
     367{
     368    return VERR_NOT_IMPLEMENTED;
     369}
    352370
    353371RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
     
    358376              : VERR_CPU_OFFLINE;
    359377
    360 #if 0 /* experiment!! */
    361     HalRequestIpi(1 << idCpu);
    362     return VINF_SUCCESS;
    363 #else
     378    int rc = g_pfnrtSendIpi(idCpu);
     379    if (rc == VINF_SUCCESS)
     380        return rc;
     381
     382    /* Fallback. */
    364383    if (!fPokeDPCsInitialized)
    365384    {
     
    383402
    384403    /* Assuming here that high importance DPCs will be delivered immediately; or at least an IPI will be sent immediately.
    385      * Todo: verify!
     404     * @note: not true on at least Vista & Windows 7
    386405     */
    387406    BOOLEAN bRet = KeInsertQueueDpc(&aPokeDpcs[idCpu], 0, 0);
     
    389408    KeLowerIrql(oldIrql);
    390409    return (bRet == TRUE) ? VINF_SUCCESS : VERR_ACCESS_DENIED /* already queued */;
    391 #endif
    392410}
    393411
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