VirtualBox

Changeset 15895 in vbox for trunk


Ignore:
Timestamp:
Jan 12, 2009 2:18:43 PM (16 years ago)
Author:
vboxsync
Message:

RTMpIsCpuWorkPending changed; previous code wasn't useful

File:
1 edited

Legend:

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

    r15843 r15895  
    115115
    116116
    117 /** @todo move down after RTMpGetOnlineCount. */
    118 RTDECL(bool) RTMpIsCpuWorkPending(void)
    119 {
    120     RTCPUID idCpuEntry = RTMpCpuId();
    121 
    122     Assert(KeGetCurrentIrql() == DISPATCH_LEVEL);
    123 
    124     /** @todo the best solution is to check for pending DPCs, but there doesn't seem to be any documented way to do this.
    125      *   The KPRCB or KPCR contains an undocumented entry, but it's too risky to make any assumptions about it.
    126 
    127     /* Flush all pending DPCs. Not sure if we can get rescheduling as a direct result. */
    128     KeFlushQueuedDpcs();
    129 
    130     Assert(KeGetCurrentIrql() == DISPATCH_LEVEL);
    131 
    132     if (idCpuEntry != RTMpCpuId())
    133         return true;
    134 
    135     /* We've stayed on the same CPU, so we can continue. */
    136     return false;
    137 }
    138 
    139117
    140118RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet)
     
    172150    return RTCpuSetCount(&Set);
    173151}
     152
     153
     154#if 0
     155/* Experiment with checking the undocumented KPRCB structure
     156 * 'dt nt!_kprcb 0xaddress' shows the layout
     157 */
     158typedef struct
     159{
     160    LIST_ENTRY     DpcListHead;
     161    ULONG_PTR      DpcLock;
     162    volatile ULONG DpcQueueDepth;
     163    ULONG          DpcQueueCount;
     164} KDPC_DATA, *PKDPC_DATA;
     165#endif
     166
     167RTDECL(bool) RTMpIsCpuWorkPending(void)
     168{
     169    uint8_t *pkprcb;
     170    PKDPC_DATA pDpcData;
     171
     172    _asm {
     173        mov eax, fs:0x20
     174        mov pkprcb, eax
     175    }
     176    pDpcData = (PKDPC_DATA)(pkprcb + 0x19e0);
     177    if (pDpcData->DpcQueueDepth)
     178        return true;
     179
     180    pDpcData++;
     181    if (pDpcData->DpcQueueDepth)
     182        return true;
     183    return false;
     184}
     185#else
     186RTDECL(bool) RTMpIsCpuWorkPending(void)
     187{
     188    /** @todo not implemented */
     189    return false;
     190}
     191#endif
    174192
    175193
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