VirtualBox

Changeset 40806 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Apr 6, 2012 9:05:19 PM (13 years ago)
Author:
vboxsync
Message:

RTSpinlock: Redid the interface, eliminating NoInts and Tmp. Whether a spinlock is interrupt safe or not is now defined at creation time, preventing stupid bugs arrising from calling the wrong acquire and/or release methods somewhere. The saved flags are stored in the spinlock strucutre, eliminating the annoying Tmp variable. Needs testing on each platform before fixing the build burn.

Location:
trunk/src/VBox/HostDrivers
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r40804 r40806  
    342342    { "RTSemMutexRequestNoResumeDebug",         (void *)RTSemMutexRequestNoResumeDebug },
    343343    { "RTSpinlockAcquire",                      (void *)RTSpinlockAcquire },
    344     { "RTSpinlockAcquireNoInts",                (void *)RTSpinlockAcquireNoInts },
    345344    { "RTSpinlockCreate",                       (void *)RTSpinlockCreate },
    346345    { "RTSpinlockDestroy",                      (void *)RTSpinlockDestroy },
     
    452451     */
    453452    memset(pDevExt, 0, sizeof(*pDevExt));
    454     rc = RTSpinlockCreate(&pDevExt->Spinlock);
     453    rc = RTSpinlockCreate(&pDevExt->Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, "SUPDrvDevExt");
    455454    if (RT_SUCCESS(rc))
    456455    {
    457         rc = RTSpinlockCreate(&pDevExt->spinGip);
     456        rc = RTSpinlockCreate(&pDevExt->hGipSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "SUPDrvGip");
    458457        if (RT_SUCCESS(rc))
    459458        {
     
    563562#endif
    564563            }
    565             RTSpinlockDestroy(pDevExt->spinGip);
    566             pDevExt->spinGip = NIL_RTSPINLOCK;
     564            RTSpinlockDestroy(pDevExt->hGipSpinlock);
     565            pDevExt->hGipSpinlock = NIL_RTSPINLOCK;
    567566        }
    568567        RTSpinlockDestroy(pDevExt->Spinlock);
     
    636635    /* kill the GIP. */
    637636    supdrvGipDestroy(pDevExt);
    638     RTSpinlockDestroy(pDevExt->spinGip);
    639     pDevExt->spinGip = NIL_RTSPINLOCK;
     637    RTSpinlockDestroy(pDevExt->hGipSpinlock);
     638    pDevExt->hGipSpinlock = NIL_RTSPINLOCK;
    640639
    641640    supdrvTracerTerm(pDevExt);
     
    667666    {
    668667        /* Initialize session data. */
    669         rc = RTSpinlockCreate(&pSession->Spinlock);
     668        rc = RTSpinlockCreate(&pSession->Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, "SUPDrvSession");
    670669        if (!rc)
    671670        {
     
    777776    if (pSession->pUsage)
    778777    {
    779         RTSPINLOCKTMP   SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    780778        PSUPDRVUSAGE    pUsage;
    781         RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp);
     779        RTSpinlockAcquire(pDevExt->Spinlock);
    782780
    783781        while ((pUsage = pSession->pUsage) != NULL)
     
    790788            {
    791789                pObj->cUsage -= pUsage->cUsage;
    792                 RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     790                RTSpinlockRelease(pDevExt->Spinlock);
    793791            }
    794792            else
     
    808806                    Assert(pObjPrev);
    809807                }
    810                 RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     808                RTSpinlockRelease(pDevExt->Spinlock);
    811809
    812810                Log(("supdrvCleanupSession: destroying %p/%d (%p/%p) cpid=%RTproc pid=%RTproc dtor=%p\n",
     
    820818            RTMemFree(pUsage);
    821819
    822             RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp);
    823         }
    824 
    825         RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     820            RTSpinlockAcquire(pDevExt->Spinlock);
     821        }
     822
     823        RTSpinlockRelease(pDevExt->Spinlock);
    826824        AssertMsg(!pSession->pUsage, ("Some buster reregistered an object during desturction!\n"));
    827825    }
     
    20022000SUPR0DECL(void *) SUPR0ObjRegister(PSUPDRVSESSION pSession, SUPDRVOBJTYPE enmType, PFNSUPDRVDESTRUCTOR pfnDestructor, void *pvUser1, void *pvUser2)
    20032001{
    2004     RTSPINLOCKTMP   SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    20052002    PSUPDRVDEVEXT   pDevExt     = pSession->pDevExt;
    20062003    PSUPDRVOBJ      pObj;
     
    20362033     * (We keep freed usage records around to simplify SUPR0ObjAddRefEx().)
    20372034     */
    2038     RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp);
     2035    RTSpinlockAcquire(pDevExt->Spinlock);
    20392036
    20402037    pUsage = pDevExt->pUsageFree;
     
    20432040    else
    20442041    {
    2045         RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     2042        RTSpinlockRelease(pDevExt->Spinlock);
    20462043        pUsage = (PSUPDRVUSAGE)RTMemAlloc(sizeof(*pUsage));
    20472044        if (!pUsage)
     
    20502047            return NULL;
    20512048        }
    2052         RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp);
     2049        RTSpinlockAcquire(pDevExt->Spinlock);
    20532050    }
    20542051
     
    20672064    pSession->pUsage    = pUsage;
    20682065
    2069     RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     2066    RTSpinlockRelease(pDevExt->Spinlock);
    20702067
    20712068    Log(("SUPR0ObjRegister: returns %p (pvUser1=%p, pvUser=%p)\n", pObj, pvUser1, pvUser2));
     
    21132110SUPR0DECL(int) SUPR0ObjAddRefEx(void *pvObj, PSUPDRVSESSION pSession, bool fNoBlocking)
    21142111{
    2115     RTSPINLOCKTMP   SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    21162112    PSUPDRVDEVEXT   pDevExt     = pSession->pDevExt;
    21172113    PSUPDRVOBJ      pObj        = (PSUPDRVOBJ)pvObj;
     
    21312127                    VERR_INVALID_PARAMETER);
    21322128
    2133     RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp);
     2129    RTSpinlockAcquire(pDevExt->Spinlock);
    21342130
    21352131    if (RT_UNLIKELY(pObj->u32Magic != SUPDRVOBJ_MAGIC))
    21362132    {
    2137         RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     2133        RTSpinlockRelease(pDevExt->Spinlock);
    21382134
    21392135        AssertMsgFailed(("pvObj=%p magic=%#x\n", pvObj, pObj->u32Magic));
     
    21492145    else if (!fNoBlocking)
    21502146    {
    2151         RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     2147        RTSpinlockRelease(pDevExt->Spinlock);
    21522148        pUsagePre = (PSUPDRVUSAGE)RTMemAlloc(sizeof(*pUsagePre));
    21532149        if (!pUsagePre)
    21542150            return VERR_NO_MEMORY;
    21552151
    2156         RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp);
     2152        RTSpinlockAcquire(pDevExt->Spinlock);
    21572153        if (RT_UNLIKELY(pObj->u32Magic != SUPDRVOBJ_MAGIC))
    21582154        {
    2159             RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     2155            RTSpinlockRelease(pDevExt->Spinlock);
    21602156
    21612157            AssertMsgFailed(("pvObj=%p magic=%#x\n", pvObj, pObj->u32Magic));
     
    22062202    }
    22072203
    2208     RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     2204    RTSpinlockRelease(pDevExt->Spinlock);
    22092205
    22102206    return rc;
     
    22282224SUPR0DECL(int) SUPR0ObjRelease(void *pvObj, PSUPDRVSESSION pSession)
    22292225{
    2230     RTSPINLOCKTMP       SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    22312226    PSUPDRVDEVEXT       pDevExt     = pSession->pDevExt;
    22322227    PSUPDRVOBJ          pObj        = (PSUPDRVOBJ)pvObj;
     
    22462241     * Acquire the spinlock and look for the usage record.
    22472242     */
    2248     RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp);
     2243    RTSpinlockAcquire(pDevExt->Spinlock);
    22492244
    22502245    for (pUsagePrev = NULL, pUsage = pSession->pUsage;
     
    23032298    }
    23042299
    2305     RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     2300    RTSpinlockRelease(pDevExt->Spinlock);
    23062301
    23072302    /*
     
    26862681{
    26872682    PSUPDRVBUNDLE pBundle;
    2688     RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    26892683    LogFlow(("SUPR0MemGetPhys: pSession=%p uPtr=%p paPages=%p\n", pSession, (void *)uPtr, paPages));
    26902684
     
    26992693     * Search for the address.
    27002694     */
    2701     RTSpinlockAcquire(pSession->Spinlock, &SpinlockTmp);
     2695    RTSpinlockAcquire(pSession->Spinlock);
    27022696    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
    27032697    {
     
    27222716                        paPages[iPage].uReserved = 0;
    27232717                    }
    2724                     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
     2718                    RTSpinlockRelease(pSession->Spinlock);
    27252719                    return VINF_SUCCESS;
    27262720                }
     
    27282722        }
    27292723    }
    2730     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
     2724    RTSpinlockRelease(pSession->Spinlock);
    27312725    Log(("Failed to find %p!!!\n", (void *)uPtr));
    27322726    return VERR_INVALID_PARAMETER;
     
    28512845    int             rc;
    28522846    PSUPDRVBUNDLE   pBundle;
    2853     RTSPINLOCKTMP   SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    28542847    RTR0MEMOBJ      hMemObj = NIL_RTR0MEMOBJ;
    28552848    LogFlow(("SUPR0PageMapKernel: pSession=%p pvR3=%p offSub=%#x cbSub=%#x\n", pSession, pvR3, offSub, cbSub));
     
    28682861     * Find the memory object.
    28692862     */
    2870     RTSpinlockAcquire(pSession->Spinlock, &SpinlockTmp);
     2863    RTSpinlockAcquire(pSession->Spinlock);
    28712864    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
    28722865    {
     
    28912884        }
    28922885    }
    2893     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
     2886    RTSpinlockRelease(pSession->Spinlock);
    28942887
    28952888    rc = VERR_INVALID_PARAMETER;
     
    29372930    int             rc;
    29382931    PSUPDRVBUNDLE   pBundle;
    2939     RTSPINLOCKTMP   SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    29402932    RTR0MEMOBJ      hMemObjR0 = NIL_RTR0MEMOBJ;
    29412933    RTR0MEMOBJ      hMemObjR3 = NIL_RTR0MEMOBJ;
     
    29542946     * Find the memory object.
    29552947     */
    2956     RTSpinlockAcquire(pSession->Spinlock, &SpinlockTmp);
     2948    RTSpinlockAcquire(pSession->Spinlock);
    29572949    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
    29582950    {
     
    29802972        }
    29812973    }
    2982     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
     2974    RTSpinlockRelease(pSession->Spinlock);
    29832975
    29842976    rc = VERR_INVALID_PARAMETER;
     
    36963688{
    36973689    PSUPDRVBUNDLE pBundle;
    3698     RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    36993690
    37003691    /*
    37013692     * Find free entry and record the allocation.
    37023693     */
    3703     RTSpinlockAcquire(pSession->Spinlock, &SpinlockTmp);
     3694    RTSpinlockAcquire(pSession->Spinlock);
    37043695    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
    37053696    {
     
    37133704                    pBundle->cUsed++;
    37143705                    pBundle->aMem[i] = *pMem;
    3715                     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
     3706                    RTSpinlockRelease(pSession->Spinlock);
    37163707                    return VINF_SUCCESS;
    37173708                }
     
    37203711        }
    37213712    }
    3722     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
     3713    RTSpinlockRelease(pSession->Spinlock);
    37233714
    37243715    /*
     
    37353726
    37363727    /* insert into list. */
    3737     RTSpinlockAcquire(pSession->Spinlock, &SpinlockTmp);
     3728    RTSpinlockAcquire(pSession->Spinlock);
    37383729    pBundle->pNext = pSession->Bundle.pNext;
    37393730    pSession->Bundle.pNext = pBundle;
    3740     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
     3731    RTSpinlockRelease(pSession->Spinlock);
    37413732
    37423733    return VINF_SUCCESS;
     
    37553746{
    37563747    PSUPDRVBUNDLE pBundle;
    3757     RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    37583748
    37593749    /*
     
    37693759     * Search for the address.
    37703760     */
    3771     RTSpinlockAcquire(pSession->Spinlock, &SpinlockTmp);
     3761    RTSpinlockAcquire(pSession->Spinlock);
    37723762    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
    37733763    {
     
    37893779                    pBundle->aMem[i].MemObj = NIL_RTR0MEMOBJ;
    37903780                    pBundle->aMem[i].MapObjR3 = NIL_RTR0MEMOBJ;
    3791                     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
     3781                    RTSpinlockRelease(pSession->Spinlock);
    37923782
    37933783                    if (Mem.MapObjR3 != NIL_RTR0MEMOBJ)
     
    38063796        }
    38073797    }
    3808     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
     3798    RTSpinlockRelease(pSession->Spinlock);
    38093799    Log(("Failed to find %p!!! (eType=%d)\n", (void *)uPtr, eType));
    38103800    return VERR_INVALID_PARAMETER;
     
    42124202         * clean things up in the right order and not leave them all dangling.
    42134203         */
    4214         RTSPINLOCKTMP   SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    4215         RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp);
     4204        RTSpinlockAcquire(pDevExt->Spinlock);
    42164205        if (pImage->cUsage <= 1)
    42174206        {
     
    42344223                }
    42354224        }
    4236         RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     4225        RTSpinlockRelease(pDevExt->Spinlock);
    42374226        if (rc == VINF_SUCCESS)
    42384227        {
     
    45724561        unsigned        cObjs = 0;
    45734562        PSUPDRVOBJ      pObj;
    4574         RTSPINLOCKTMP   SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    4575         RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp);
     4563        RTSpinlockAcquire(pDevExt->Spinlock);
    45764564        for (pObj = pDevExt->pObjs; pObj; pObj = pObj->pNext)
    45774565            if (RT_UNLIKELY((uintptr_t)pObj->pfnDestructor - (uintptr_t)pImage->pvImage < pImage->cbImageBits))
     
    45804568                cObjs++;
    45814569            }
    4582         RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp);
     4570        RTSpinlockRelease(pDevExt->Spinlock);
    45834571        if (cObjs)
    45844572            OSDBGPRINT(("supdrvLdrFree: Image '%s' has %d dangling objects!\n", pImage->szName, cObjs));
     
    50875075    uint32_t    i = 0;
    50885076    uint64_t    u64NanoTS = 0;
    5089     RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    50905077    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
    50915078
     
    50985085     * on all CPUs simultaneously, see #6110.
    50995086     */
    5100     RTSpinlockAcquireNoInts(pDevExt->spinGip, &SpinlockTmp);
     5087    RTSpinlockAcquire(pDevExt->hGipSpinlock);
    51015088
    51025089    /*
     
    51335120    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_ONLINE);
    51345121
    5135     RTSpinlockReleaseNoInts(pDevExt->spinGip, &SpinlockTmp);
     5122    RTSpinlockReleaseNoInts(pDevExt->hGipSpinlock);
    51365123}
    51375124
     
    51515138
    51525139    PSUPGLOBALINFOPAGE pGip   = pDevExt->pGip;
    5153     RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    51545140
    51555141    AssertPtrReturnVoid(pGip);
    5156     RTSpinlockAcquireNoInts(pDevExt->spinGip, &SpinlockTmp);
     5142    RTSpinlockAcquire(pDevExt->hGipSpinlock);
    51575143
    51585144    iCpuSet = RTMpCpuIdToSetIndex(idCpu);
     
    51695155    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_OFFLINE);
    51705156
    5171     RTSpinlockReleaseNoInts(pDevExt->spinGip, &SpinlockTmp);
     5157    RTSpinlockReleaseNoInts(pDevExt->hGipSpinlock);
    51725158}
    51735159
  • trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h

    r40763 r40806  
    191191 *
    192192 * @todo Pending work on next major version change:
    193  *          - None.
    194  */
    195 #define SUPDRV_IOC_VERSION                              0x00190002
     193 *          - Remove RTSpinlockReleaseNoInts.
     194 */
     195#define SUPDRV_IOC_VERSION                              0x001a0000
    196196
    197197/** SUP_IOCTL_COOKIE. */
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r40777 r40806  
    517517#endif
    518518    /** GIP spinlock protecting GIP members during Mp events. */
    519     RTSPINLOCK                      spinGip;
     519    RTSPINLOCK                      hGipSpinlock;
    520520    /** Pointer to the Global Info Page (GIP). */
    521521    PSUPGLOBALINFOPAGE              pGip;
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

    r37970 r40806  
    239239             */
    240240            memset(g_apSessionHashTab, 0, sizeof(g_apSessionHashTab)); /* paranoia */
    241             rc = RTSpinlockCreate(&g_Spinlock);
     241            rc = RTSpinlockCreate(&g_Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxDrvDarwin");
    242242            if (RT_SUCCESS(rc))
    243243            {
     
    370370        RTPROCESS       Process = RTProcSelf();
    371371        unsigned        iHash = SESSION_HASH(Process);
    372         RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
    373         RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     372        RTSpinlockAcquire(g_Spinlock);
    374373
    375374        pSession = g_apSessionHashTab[iHash];
     
    393392            rc = VERR_GENERAL_FAILURE;
    394393
    395         RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     394        RTSpinlockReleaseNoInts(g_Spinlock);
    396395#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
    397396        kauth_cred_unref(&pCred);
     
    442441static int VBoxDrvDarwinIOCtl(dev_t Dev, u_long iCmd, caddr_t pData, int fFlags, struct proc *pProcess)
    443442{
    444     RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    445443    const RTPROCESS     Process = proc_pid(pProcess);
    446444    const unsigned      iHash = SESSION_HASH(Process);
     
    450448     * Find the session.
    451449     */
    452     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     450    RTSpinlockAcquire(g_Spinlock);
    453451    pSession = g_apSessionHashTab[iHash];
    454452    if (pSession && pSession->Process != Process)
     
    457455        while (pSession && pSession->Process != Process);
    458456    }
    459     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     457    RTSpinlockReleaseNoInts(g_Spinlock);
    460458    if (!pSession)
    461459    {
     
    982980                 */
    983981                unsigned iHash = SESSION_HASH(m_pSession->Process);
    984                 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    985                 RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     982                RTSpinlockAcquire(g_Spinlock);
    986983
    987984                PSUPDRVSESSION pCur = g_apSessionHashTab[iHash];
     
    1002999                    rc = VERR_ALREADY_LOADED;
    10031000
    1004                 RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     1001                RTSpinlockReleaseNoInts(g_Spinlock);
    10051002                if (RT_SUCCESS(rc))
    10061003                {
     
    10341031     */
    10351032    const unsigned  iHash = SESSION_HASH(Process);
    1036     RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
    1037     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     1033    RTSpinlockAcquire(g_Spinlock);
    10381034    PSUPDRVSESSION  pSession = g_apSessionHashTab[iHash];
    10391035    if (pSession)
     
    10651061        }
    10661062    }
    1067     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     1063    RTSpinlockReleaseNoInts(g_Spinlock);
    10681064    if (!pSession)
    10691065    {
  • trunk/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp

    r37249 r40806  
    108108             * Initialize the session hash table.
    109109             */
    110             rc = RTSpinlockCreate(&g_Spinlock);
     110            rc = RTSpinlockCreate(&g_Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxDrvOS2");
    111111            if (RT_SUCCESS(rc))
    112112            {
     
    160160         */
    161161        unsigned iHash = SESSION_HASH(sfn);
    162         RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    163         RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     162        RTSpinlockAcquire(g_Spinlock);
    164163        pSession->pNextHash = g_apSessionHashTab[iHash];
    165164        g_apSessionHashTab[iHash] = pSession;
    166         RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     165        RTSpinlockReleaseNoInts(g_Spinlock);
    167166    }
    168167
     
    182181    const RTPROCESS Process = RTProcSelf();
    183182    const unsigned  iHash = SESSION_HASH(sfn);
    184     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    185     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     183    RTSpinlockAcquire(g_Spinlock);
    186184
    187185    pSession = g_apSessionHashTab[iHash];
     
    214212        }
    215213    }
    216     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     214    RTSpinlockReleaseNoInts(g_Spinlock);
    217215    if (!pSession)
    218216    {
     
    234232     * Find the session.
    235233     */
    236     RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    237234    const RTPROCESS     Process = RTProcSelf();
    238235    const unsigned      iHash = SESSION_HASH(sfn);
    239236    PSUPDRVSESSION      pSession;
    240237
    241     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     238    RTSpinlockAcquire(g_Spinlock);
    242239    pSession = g_apSessionHashTab[iHash];
    243240    if (pSession && pSession->Process != Process)
     
    248245                     || pSession->Process != Process));
    249246    }
    250     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     247    RTSpinlockReleaseNoInts(g_Spinlock);
    251248    if (RT_UNLIKELY(!pSession))
    252249    {
     
    268265     * Find the session.
    269266     */
    270     RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    271267    const RTPROCESS     Process = RTProcSelf();
    272268    const unsigned      iHash = SESSION_HASH(sfn);
    273269    PSUPDRVSESSION      pSession;
    274270
    275     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     271    RTSpinlockAcquire(g_Spinlock);
    276272    pSession = g_apSessionHashTab[iHash];
    277273    if (pSession && pSession->Process != Process)
     
    282278                     || pSession->Process != Process));
    283279    }
    284     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     280    RTSpinlockReleaseNoInts(g_Spinlock);
    285281    if (!pSession)
    286282    {
  • trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c

    r40616 r40806  
    224224             */
    225225            memset(g_apSessionHashTab, 0, sizeof(g_apSessionHashTab));
    226             rc = RTSpinlockCreate(&g_Spinlock);
     226            rc = RTSpinlockCreate(&g_Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxDrvSol");
    227227            if (RT_SUCCESS(rc))
    228228            {
     
    494494    if (RT_SUCCESS(rc))
    495495    {
    496         RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
    497496        unsigned        iHash;
    498497
     
    504503         */
    505504        iHash = SESSION_HASH(pSession->Process);
    506         RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     505        RTSpinlockAcquire(g_Spinlock);
    507506        pSession->pNextHash = g_apSessionHashTab[iHash];
    508507        g_apSessionHashTab[iHash] = pSession;
    509         RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     508        RTSpinlockReleaseNoInts(g_Spinlock);
    510509        LogFlow((DEVICE_NAME ":VBoxDrvSolarisOpen success\n"));
    511510    }
     
    560559
    561560#else
    562     RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
    563561    const RTPROCESS Process = RTProcSelf();
    564562    const unsigned  iHash = SESSION_HASH(Process);
     
    568566     * Remove from the hash table.
    569567     */
    570     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     568    RTSpinlockAcquire(g_Spinlock);
    571569    pSession = g_apSessionHashTab[iHash];
    572570    if (pSession)
     
    596594        }
    597595    }
    598     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     596    RTSpinlockReleaseNoInts(g_Spinlock);
    599597    if (!pSession)
    600598    {
     
    659657    }
    660658#else
    661     RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    662659    const RTPROCESS     Process = RTProcSelf();
    663660    const unsigned      iHash = SESSION_HASH(Process);
     
    667664     * Find the session.
    668665     */
    669     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     666    RTSpinlockAcquire(g_Spinlock);
    670667    pSession = g_apSessionHashTab[iHash];
    671668    if (pSession && pSession->Process != Process)
     
    674671        while (pSession && pSession->Process != Process);
    675672    }
    676     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     673    RTSpinlockReleaseNoInts(g_Spinlock);
    677674    if (!pSession)
    678675    {
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c

    r38408 r40806  
    106106DECLINLINE(void) vboxNetAdpSetStateWithLock(PVBOXNETADP pThis, VBOXNETADPSTATE enmNewState)
    107107{
    108     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    109108    Log(("vboxNetAdpSetStateWithLock: pThis=%p, state=%d.\n", pThis, enmNewState));
    110     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     109    RTSpinlockAcquire(pThis->hSpinlock);
    111110    vboxNetAdpSetState(pThis, enmNewState);
    112     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     111    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    113112}
    114113
     
    125124{
    126125    VBOXNETADPSTATE enmState;
    127     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    128     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     126    RTSpinlockAcquire(pThis->hSpinlock);
    129127    enmState = vboxNetAdpGetState(pThis);
    130     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     128    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    131129    Log(("vboxNetAdpGetStateWithLock: pThis=%p, state=%d.\n", pThis, enmState));
    132130    return enmState;
     
    147145    VBOXNETADPSTATE enmActualState;
    148146    bool fRc = true; /* be optimistic */
    149     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    150 
    151     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     147
     148    RTSpinlockAcquire(pThis->hSpinlock);
    152149    enmActualState = vboxNetAdpGetState(pThis); /** @todo r=bird: ASMAtomicCmpXchgU32()*/
    153150    if (enmActualState == enmOldState)
     
    155152    else
    156153        fRc = false;
    157     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     154    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    158155
    159156    if (fRc)
     
    178175    for (i = 0; i < RT_ELEMENTS(pGlobals->aAdapters); i++)
    179176    {
    180         RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    181177        PVBOXNETADP pThis = &pGlobals->aAdapters[i];
    182         RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     178        RTSpinlockAcquire(pThis->hSpinlock);
    183179        if (    vboxNetAdpGetState(pThis)
    184180            &&  !strcmp(pThis->szName, pszName))
    185181        {
    186             RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     182            RTSpinlockReleaseNoInts(pThis->hSpinlock);
    187183            return pThis;
    188184        }
    189         RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     185        RTSpinlockReleaseNoInts(pThis->hSpinlock);
    190186    }
    191187    return NULL;
     
    340336DECLHIDDEN(bool) vboxNetAdpPrepareToReceive(PVBOXNETADP pThis)
    341337{
    342     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    343338    bool fCanReceive  = false;
    344339    /*
     
    347342    AssertPtr(pThis);
    348343    Assert(pThis->MyPort.u32Version == INTNETTRUNKIFPORT_VERSION);
    349     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     344    RTSpinlockAcquire(pThis->hSpinlock);
    350345    if (vboxNetAdpGetState(pThis) == kVBoxNetAdpState_Active)
    351346    {
     
    354349        vboxNetAdpBusy(pThis);
    355350    }
    356     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     351    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    357352    Log(("vboxNetAdpPrepareToReceive: fCanReceive=%d.\n", fCanReceive));
    358353
     
    368363DECLHIDDEN(void) vboxNetAdpReceive(PVBOXNETADP pThis, PINTNETSG pSG)
    369364{
    370     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    371365    /*
    372366     * Input validation.
     
    401395static DECLCALLBACK(int) vboxNetAdpPortXmit(PINTNETTRUNKIFPORT pIfPort, PINTNETSG pSG, uint32_t fDst)
    402396{
    403     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    404397    PVBOXNETADP pThis = IFPORT_2_VBOXNETADP(pIfPort);
    405398    int rc = VINF_SUCCESS;
     
    417410     * Do a retain/busy, invoke the OS specific code.
    418411     */
    419     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     412    RTSpinlockAcquire(pThis->hSpinlock);
    420413    if (vboxNetAdpGetState(pThis) != kVBoxNetAdpState_Active)
    421414    {
    422         RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     415        RTSpinlockReleaseNoInts(pThis->hSpinlock);
    423416        Log(("vboxNetAdpReceive: Dropping incoming packet for inactive interface %s.\n",
    424417             pThis->szName));
     
    427420    vboxNetAdpRetain(pThis);
    428421    vboxNetAdpBusy(pThis);
    429     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     422    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    430423
    431424    rc = vboxNetAdpPortOsXmit(pThis, pSG, fDst);
     
    494487{
    495488    bool fPreviouslyActive;
    496     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    497489    PVBOXNETADP pThis = IFPORT_2_VBOXNETADP(pIfPort);
    498490
     
    505497
    506498    Log(("vboxNetAdpPortSetActive: pThis=%p, fActive=%d, state before: %d.\n", pThis, fActive, vboxNetAdpGetState(pThis)));
    507     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     499    RTSpinlockAcquire(pThis->hSpinlock);
    508500
    509501    fPreviouslyActive = vboxNetAdpGetState(pThis) == kVBoxNetAdpState_Active;
     
    523515    }
    524516
    525     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     517    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    526518    Log(("vboxNetAdpPortSetActive: state after: %RTbool.\n", vboxNetAdpGetState(pThis)));
    527519    return fPreviouslyActive;
     
    535527{
    536528    PVBOXNETADP pThis = IFPORT_2_VBOXNETADP(pIfPort);
    537     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    538529
    539530    /*
     
    551542     * Disconnect and release it.
    552543     */
    553     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     544    RTSpinlockAcquire(pThis->hSpinlock);
    554545    //Assert(vboxNetAdpGetState(pThis) == kVBoxNetAdpState_Connected);
    555546    Assert(!pThis->cBusy);
    556547    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Transitional);
    557     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     548    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    558549
    559550    vboxNetAdpOsDisconnectIt(pThis);
    560551    pThis->pSwitchPort = NULL;
    561552
    562     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     553    RTSpinlockAcquire(pThis->hSpinlock);
    563554    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Available);
    564     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     555    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    565556
    566557    vboxNetAdpRelease(pThis);
     
    590581int vboxNetAdpCreate(PINTNETTRUNKFACTORY pIfFactory, PVBOXNETADP *ppNew)
    591582{
     583    PVBOXNETADPGLOBALS pGlobals = (PVBOXNETADPGLOBALS)((uint8_t *)pIfFactory - RT_OFFSETOF(VBOXNETADPGLOBALS, TrunkFactory));
     584    unsigned i;
    592585    int rc;
    593     unsigned i;
    594     PVBOXNETADPGLOBALS pGlobals = (PVBOXNETADPGLOBALS)((uint8_t *)pIfFactory - RT_OFFSETOF(VBOXNETADPGLOBALS, TrunkFactory));
    595586
    596587    for (i = 0; i < RT_ELEMENTS(pGlobals->aAdapters); i++)
    597588    {
    598         RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    599589        PVBOXNETADP pThis = &pGlobals->aAdapters[i];
    600590
     
    608598            rc = vboxNetAdpOsCreate(pThis, &Mac);
    609599            *ppNew = pThis;
    610             RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     600
     601            RTSpinlockAcquire(pThis->hSpinlock);
    611602            vboxNetAdpSetState(pThis, kVBoxNetAdpState_Available);
    612             RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     603            RTSpinlockReleaseNoInts(pThis->hSpinlock);
    613604            return rc;
    614605        }
     
    622613{
    623614    int rc = VINF_SUCCESS;
    624     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    625 
    626     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     615
     616    RTSpinlockAcquire(pThis->hSpinlock);
    627617    if (vboxNetAdpGetState(pThis) != kVBoxNetAdpState_Available || pThis->cBusy)
    628618    {
    629         RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     619        RTSpinlockReleaseNoInts(pThis->hSpinlock);
    630620        return VERR_INTNET_FLT_IF_BUSY;
    631621    }
    632622    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Transitional);
    633     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     623    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    634624    vboxNetAdpRelease(pThis);
    635625
    636626    vboxNetAdpOsDestroy(pThis);
    637627
    638     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     628    RTSpinlockAcquire(pThis->hSpinlock);
    639629    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Invalid);
    640     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     630    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    641631
    642632    return rc;
     
    856846    pNew->hEventIdle                    = NIL_RTSEMEVENT;
    857847
    858     rc = RTSpinlockCreate(&pNew->hSpinlock);
     848    rc = RTSpinlockCreate(&pNew->hSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxNetAdptSlotCreate");
    859849    if (RT_SUCCESS(rc))
    860850    {
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c

    r33540 r40806  
    375375static bool vboxNetFltMaybeRediscovered(PVBOXNETFLTINS pThis)
    376376{
    377     RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
    378377    uint64_t        Now;
    379378    bool            fRediscovered;
     
    396395     */
    397396    Now = RTTimeNanoTS();
    398     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     397    RTSpinlockAcquire(pThis->hSpinlock);
    399398
    400399    fRediscovered = !ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost);
     
    405404        ASMAtomicWriteBool(&pThis->fRediscoveryPending, true);
    406405
    407     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     406    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    408407
    409408    /*
     
    499498{
    500499    PVBOXNETFLTINS      pThis = IFPORT_2_VBOXNETFLTINS(pIfPort);
    501     RTSPINLOCKTMP       Tmp   = RTSPINLOCKTMP_INITIALIZER;
    502500    INTNETTRUNKIFSTATE  enmOldTrunkState;
    503501
     
    515513     * Take the lock and change the state.
    516514     */
    517     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     515    RTSpinlockAcquire(pThis->hSpinlock);
    518516    enmOldTrunkState = pThis->enmTrunkState;
    519517    if (enmOldTrunkState != enmState)
    520518        ASMAtomicWriteU32((uint32_t volatile *)&pThis->enmTrunkState, enmState);
    521     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     519    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    522520
    523521    /*
     
    602600{
    603601    PVBOXNETFLTINS pThis = IFPORT_2_VBOXNETFLTINS(pIfPort);
    604     RTSPINLOCKTMP  Tmp   = RTSPINLOCKTMP_INITIALIZER;
    605602
    606603    /*
     
    623620     * Disconnect and release it.
    624621     */
    625     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     622    RTSpinlockAcquire(pThis->hSpinlock);
    626623    vboxNetFltSetState(pThis, kVBoxNetFltInsState_Disconnecting);
    627     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     624    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    628625
    629626    vboxNetFltOsDisconnectIt(pThis);
     
    631628
    632629#ifdef VBOXNETFLT_STATIC_CONFIG
    633     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     630    RTSpinlockAcquire(pThis->hSpinlock);
    634631    vboxNetFltSetState(pThis, kVBoxNetFltInsState_Unconnected);
    635     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     632    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    636633#endif
    637634
     
    814811DECLHIDDEN(bool) vboxNetFltTryRetainBusyActive(PVBOXNETFLTINS pThis)
    815812{
    816     RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
    817813    uint32_t        cRefs;
    818814    bool            fRc;
     
    834830     * Do the retaining and checking behind the spinlock.
    835831     */
    836     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     832    RTSpinlockAcquire(pThis->hSpinlock);
    837833    fRc = pThis->enmTrunkState == INTNETTRUNKIFSTATE_ACTIVE;
    838834    if (fRc)
     
    844840        AssertMsg(cRefs >= 1 && cRefs < UINT32_MAX / 2, ("%d\n", cRefs)); NOREF(cRefs);
    845841    }
    846     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     842    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    847843
    848844    return fRc;
     
    861857DECLHIDDEN(bool) vboxNetFltTryRetainBusyNotDisconnected(PVBOXNETFLTINS pThis)
    862858{
    863     RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
    864859    uint32_t        cRefs;
    865860    bool            fRc;
     
    881876     * Do the retaining and checking behind the spinlock.
    882877     */
    883     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     878    RTSpinlockAcquire(pThis->hSpinlock);
    884879    fRc =  pThis->enmTrunkState == INTNETTRUNKIFSTATE_ACTIVE
    885880        || pThis->enmTrunkState == INTNETTRUNKIFSTATE_INACTIVE;
     
    892887        AssertMsg(cRefs >= 1 && cRefs < UINT32_MAX / 2, ("%d\n", cRefs)); NOREF(cRefs);
    893888    }
    894     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     889    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    895890
    896891    return fRc;
     
    10171012    memcpy(pNew->szName, pszName, cchName + 1);
    10181013
    1019     rc = RTSpinlockCreate(&pNew->hSpinlock);
     1014    rc = RTSpinlockCreate(&pNew->hSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxNetFltNewInstance");
    10201015    if (RT_SUCCESS(rc))
    10211016    {
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp

    r38485 r40806  
    227227DECLINLINE(ifnet_t) vboxNetFltDarwinRetainIfNet(PVBOXNETFLTINS pThis)
    228228{
    229     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    230229    ifnet_t pIfNet = NULL;
    231230
     
    233232     * Be careful here to avoid problems racing the detached callback.
    234233     */
    235     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     234    RTSpinlockAcquire(pThis->hSpinlock);
    236235    if (!ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost))
    237236    {
     
    240239            ifnet_reference(pIfNet);
    241240    }
    242     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     241    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    243242
    244243    return pIfNet;
     
    639638{
    640639    PVBOXNETFLTINS pThis = (PVBOXNETFLTINS)pvThis;
    641     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    642640    uint64_t NanoTS = RTTimeSystemNanoTS();
    643641    LogFlow(("vboxNetFltDarwinIffDetached: pThis=%p NanoTS=%RU64 (%d)\n",
     
    658656     * behind it in order to avoid problematic races with the detached callback.
    659657     */
    660     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     658    RTSpinlockAcquire(pThis->hSpinlock);
    661659
    662660    pIfNet = ASMAtomicUoReadPtrT(&pThis->u.s.pIfNet, ifnet_t);
     
    671669    ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true);
    672670
    673     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     671    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    674672
    675673    if (pIfNet)
     
    916914    }
    917915
    918     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    919     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     916    RTSpinlockAcquire(pThis->hSpinlock);
    920917    ASMAtomicUoWritePtr(&pThis->u.s.pIfNet, pIfNet);
    921     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     918    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    922919
    923920    /*
     
    943940        Assert(err || pIfFilter);
    944941
    945         RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     942        RTSpinlockAcquire(pThis->hSpinlock);
    946943        pIfNet = ASMAtomicUoReadPtrT(&pThis->u.s.pIfNet, ifnet_t);
    947944        if (pIfNet && !err)
     
    951948            pIfNet = NULL; /* don't dereference it */
    952949        }
    953         RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     950        RTSpinlockReleaseNoInts(pThis->hSpinlock);
    954951
    955952        /* Report capabilities. */
     
    11631160void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis)
    11641161{
    1165     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    11661162    interface_filter_t pIfFilter;
    11671163
     
    11691165     * Carefully obtain the interface filter reference and detach it.
    11701166     */
    1171     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     1167    RTSpinlockAcquire(pThis->hSpinlock);
    11721168    pIfFilter = ASMAtomicUoReadPtrT(&pThis->u.s.pIfFilter, interface_filter_t);
    11731169    if (pIfFilter)
    11741170        ASMAtomicUoWriteNullPtr(&pThis->u.s.pIfFilter);
    1175     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     1171    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    11761172
    11771173    if (pIfFilter)
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c

    r37423 r40806  
    581581    struct ifnet *ifp;
    582582    node_p node;
    583     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    584583
    585584    VBOXCURVNET_SET_FROM_UCRED();
     
    593592        return VERR_INTERNAL_ERROR;
    594593
    595     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     594    RTSpinlockAcquire(pThis->hSpinlock);
    596595
    597596    ASMAtomicUoWritePtr(&pThis->u.s.ifp, ifp);
     
    610609    TASK_INIT(&pThis->u.s.tskout, 0, vboxNetFltFreeBSDoutput, pThis);
    611610
    612     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     611    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    613612
    614613    NG_NODE_SET_PRIVATE(node, pThis);
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c

    r40733 r40806  
    382382{
    383383    PVBOXNETDEVICEOPSOVERRIDE   pOverride;
    384     RTSPINLOCKTMP               Tmp = RTSPINLOCKTMP_INITIALIZER;
    385384
    386385    /* Cancel override if ethtool_ops is missing (host-only case, #5712) */
     
    402401    pOverride->pVBoxNetFlt          = pThis;
    403402
    404     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp); /* (this isn't necessary, but so what) */
     403    RTSpinlockAcquire(pThis->hSpinlock); /* (this isn't necessary, but so what) */
    405404    ASMAtomicWritePtr((void * volatile *)&pDev->OVR_OPS, pOverride);
    406405# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
    407406    ASMAtomicXchgPtr((void * volatile *)&pDev->hard_start_xmit, vboxNetFltLinuxStartXmitFilter);
    408407# endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) */
    409     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     408    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    410409}
    411410
     
    420419{
    421420    PVBOXNETDEVICEOPSOVERRIDE   pOverride;
    422     RTSPINLOCKTMP               Tmp = RTSPINLOCKTMP_INITIALIZER;
    423 
    424     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     421
     422    RTSpinlockAcquire(pThis->hSpinlock);
    425423    if (!pDev)
    426424        pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
     
    444442    else
    445443        pOverride = NULL;
    446     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     444    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    447445
    448446    if (pOverride)
     
    465463{
    466464#if 0
    467     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    468465    struct net_device *pDev = NULL;
    469466
     
    472469     * Be careful here to avoid problems racing the detached callback.
    473470     */
    474     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     471    RTSpinlockAcquire(pThis->hSpinlock);
    475472    if (!ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost))
    476473    {
     
    489486        }
    490487    }
    491     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
     488    RTSpinlockRelease(pThis->hSpinlock);
    492489
    493490    Log(("vboxNetFltLinuxRetainNetDev - done\n"));
     
    13821379        PINTNETTRUNKSWPORT  pSwitchPort;
    13831380        unsigned int        fFeatures;
    1384         RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    1385 
    1386         RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     1381
     1382        RTSpinlockAcquire(pThis->hSpinlock);
    13871383
    13881384        pSwitchPort = pThis->pSwitchPort; /* this doesn't need to be here, but it doesn't harm. */
     
    13931389            fFeatures = 0;
    13941390
    1395         RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     1391        RTSpinlockReleaseNoInts(pThis->hSpinlock);
    13961392
    13971393        if (pThis->pSwitchPort)
     
    14981494static int vboxNetFltLinuxAttachToInterface(PVBOXNETFLTINS pThis, struct net_device *pDev)
    14991495{
    1500     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    15011496    LogFlow(("vboxNetFltLinuxAttachToInterface: pThis=%p (%s)\n", pThis, pThis->szName));
    15021497
     
    15061501    dev_hold(pDev);
    15071502
    1508     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     1503    RTSpinlockAcquire(pThis->hSpinlock);
    15091504    ASMAtomicUoWritePtr(&pThis->u.s.pDev, pDev);
    1510     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     1505    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    15111506
    15121507    Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) retained. ref=%d\n",
     
    15461541     * the device notification handle.
    15471542     */
    1548     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     1543    RTSpinlockAcquire(pThis->hSpinlock);
    15491544    pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
    15501545    if (pDev)
     
    15541549        pDev = NULL; /* don't dereference it */
    15551550    }
    1556     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     1551    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    15571552    Log(("vboxNetFltLinuxAttachToInterface: this=%p: Packet handler installed.\n", pThis));
    15581553
     
    15781573        vboxNetFltLinuxUnhookDev(pThis, pDev);
    15791574#endif
    1580         RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     1575        RTSpinlockAcquire(pThis->hSpinlock);
    15811576        ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev);
    1582         RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     1577        RTSpinlockReleaseNoInts(pThis->hSpinlock);
    15831578        dev_put(pDev);
    15841579        Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) released. ref=%d\n",
     
    15991594static int vboxNetFltLinuxUnregisterDevice(PVBOXNETFLTINS pThis, struct net_device *pDev)
    16001595{
    1601     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    1602 
    16031596    Assert(!pThis->fDisconnectedFromHost);
    16041597
     
    16071600#endif
    16081601
    1609     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     1602    RTSpinlockAcquire(pThis->hSpinlock);
    16101603    ASMAtomicWriteBool(&pThis->u.s.fRegistered, false);
    16111604    ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true);
    16121605    ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev);
    1613     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     1606    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    16141607
    16151608    dev_remove_pack(&pThis->u.s.PacketType);
     
    19021895    struct net_device  *pDev;
    19031896    bool                fRegistered;
    1904     RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    19051897
    19061898#ifdef VBOXNETFLT_WITH_HOST2WIRE_FILTER
     
    19131905     *        ways. */
    19141906
    1915     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     1907    RTSpinlockAcquire(pThis->hSpinlock);
    19161908    pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
    19171909    fRegistered = ASMAtomicUoReadBool(&pThis->u.s.fRegistered);
    1918     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     1910    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    19191911
    19201912    if (fRegistered)
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c

    r40231 r40806  
    10811081             * the promiscuous OFF acknowledgement case).
    10821082             */
    1083             RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    1084             RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     1083            RTSpinlockAcquire(pThis->hSpinlock);
    10851084            const bool fActive = pThis->enmTrunkState == INTNETTRUNKIFSTATE_ACTIVE;
    10861085            vboxNetFltRetain(pThis, true /* fBusy */);
    1087             RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     1086            RTSpinlockReleaseNoInts(pThis->hSpinlock);
    10881087
    10891088            vboxnetflt_promisc_stream_t *pPromiscStream = (vboxnetflt_promisc_stream_t *)pStream;
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltM-win.cpp

    r36184 r40806  
    132132DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDoDeinitialization(PVBOXNETFLTINS pNetFlt)
    133133{
    134     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    135134    uint64_t NanoTS = RTTimeSystemNanoTS();
    136135
    137136    Assert(vboxNetFltWinGetOpState(&pNetFlt->u.s.WinIf.MpState) == kVBoxNetDevOpState_Initialized);
    138137
    139     RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
     138    RTSpinlockAcquire(pNetFlt->hSpinlock);
    140139    ASMAtomicUoWriteBool(&pNetFlt->fDisconnectedFromHost, true);
    141140    ASMAtomicUoWriteBool(&pNetFlt->fRediscoveryPending, false);
     
    144143    vboxNetFltWinSetOpState(&pNetFlt->u.s.WinIf.MpState, kVBoxNetDevOpState_Deinitializing);
    145144
    146     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     145    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    147146
    148147    vboxNetFltWinWaitDereference(&pNetFlt->u.s.WinIf.MpState);
     
    505504static UINT vboxNetFltWinMpRequestStatePrep(PVBOXNETFLTINS pNetFlt, NDIS_STATUS *pStatus)
    506505{
    507     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    508 
    509506    Assert(!pNetFlt->u.s.WinIf.StateFlags.fRequestInfo);
    510507
     
    516513    }
    517514
    518     RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
     515    RTSpinlockAcquire(pNetFlt->hSpinlock);
    519516    Assert(!pNetFlt->u.s.WinIf.StateFlags.fRequestInfo);
    520517    if (vboxNetFltWinGetOpState(&pNetFlt->u.s.WinIf.PtState) > kVBoxNetDevOpState_Initialized /* protocol unbind in progress */
    521518            || vboxNetFltWinGetPowerState(&pNetFlt->u.s.WinIf.MpState) > NdisDeviceStateD0)
    522519    {
    523         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     520        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    524521        *pStatus = NDIS_STATUS_FAILURE;
    525522        return 0;
     
    530527    {
    531528        pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS | VBOXNDISREQUEST_QUEUED;
    532         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     529        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    533530        *pStatus = NDIS_STATUS_PENDING;
    534531        return VBOXNDISREQUEST_INPROGRESS | VBOXNDISREQUEST_QUEUED;
     
    537534    if (pNetFlt->u.s.WinIf.StateFlags.fStandBy)
    538535    {
    539         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     536        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    540537        *pStatus = NDIS_STATUS_FAILURE;
    541538        return 0;
     
    544541    pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS;
    545542
    546     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     543    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    547544
    548545    *pStatus = NDIS_STATUS_SUCCESS;
     
    776773{
    777774    PVBOXNETFLTINS pNetFlt = (PVBOXNETFLTINS)MiniportAdapterContext;
    778     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    779775    NDIS_STATUS Status = NDIS_STATUS_FAILURE;
    780776
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltM-win.h

    r36207 r40806  
    2626DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDoInitialization(PVBOXNETFLTINS pThis, NDIS_HANDLE hMiniportAdapter, NDIS_HANDLE hWrapperConfigurationContext);
    2727DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDoDeinitialization(PVBOXNETFLTINS pThis);
     28
    2829#else
     30
    2931DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpInitializeDevideInstance(PVBOXNETFLTINS pThis);
    3032DECLHIDDEN(bool) vboxNetFltWinMpDeInitializeDeviceInstance(PVBOXNETFLTINS pThis, PNDIS_STATUS pStatus);
     33
    3134DECLINLINE(VOID) vboxNetFltWinMpRequestStateComplete(PVBOXNETFLTINS pNetFlt)
    3235{
    33     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    34     RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
     36    RTSpinlockAcquire(pNetFlt->hSpinlock);
    3537    pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = 0;
    36     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     38    RTSpinlockRelease(pNetFlt->hSpinlock);
    3739}
     40
    3841DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpRequestPost(PVBOXNETFLTINS pNetFlt);
    3942#endif
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltP-win.cpp

    r36184 r40806  
    162162static void vboxNetFltWinPtRequestsWaitComplete(PVBOXNETFLTINS pNetFlt)
    163163{
    164     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    165 
    166164    /* wait for request to complete */
    167165    while (vboxNetFltWinAtomicUoReadWinState(pNetFlt->u.s.WinIf.StateFlags).fRequestInfo == VBOXNDISREQUEST_INPROGRESS)
     
    173171     * If the below miniport is going to low power state, complete the queued request
    174172     */
    175     RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
     173    RTSpinlockAcquire(pNetFlt->hSpinlock);
    176174    if (pNetFlt->u.s.WinIf.StateFlags.fRequestInfo & VBOXNDISREQUEST_QUEUED)
    177175    {
    178176        /* mark the request as InProgress before posting it to RequestComplete */
    179177        pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS;
    180         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     178        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    181179        vboxNetFltWinPtRequestComplete(pNetFlt, &pNetFlt->u.s.WinIf.PassDownRequest, NDIS_STATUS_FAILURE);
    182180    }
    183181    else
    184182    {
    185         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     183        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    186184    }
    187185}
     
    190188{
    191189    NDIS_STATUS Status;
    192     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    193190    uint64_t NanoTS = RTTimeSystemNanoTS();
    194191    int cPPUsage;
     
    200197    Assert(vboxNetFltWinGetOpState(&pNetFlt->u.s.WinIf.PtState) == kVBoxNetDevOpState_Initialized);
    201198
    202     RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
     199    RTSpinlockAcquire(pNetFlt->hSpinlock);
    203200
    204201    ASMAtomicUoWriteBool(&pNetFlt->fDisconnectedFromHost, true);
     
    212209    }
    213210
    214     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     211    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    215212
    216213    vboxNetFltWinPtRequestsWaitComplete(pNetFlt);
     
    14001397DECLHIDDEN(bool) vboxNetFltWinPtCloseInterface(PVBOXNETFLTINS pNetFlt, PNDIS_STATUS pStatus)
    14011398{
    1402     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    1403 
    1404     RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
     1399    RTSpinlockAcquire(pNetFlt->hSpinlock);
    14051400
    14061401    if (pNetFlt->u.s.WinIf.StateFlags.fInterfaceClosing)
    14071402    {
    1408         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     1403        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    14091404        Assert(0);
    14101405        return false;
     
    14121407    if (pNetFlt->u.s.WinIf.hBinding == NULL)
    14131408    {
    1414         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     1409        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    14151410        Assert(0);
    14161411        return false;
     
    14181413
    14191414    pNetFlt->u.s.WinIf.StateFlags.fInterfaceClosing = TRUE;
    1420     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     1415    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    14211416
    14221417    NdisResetEvent(&pNetFlt->u.s.WinIf.OpenCloseEvent);
     
    14381433{
    14391434    NDIS_DEVICE_POWER_STATE enmPrevPowerState = vboxNetFltWinGetPowerState(&pNetFlt->u.s.WinIf.PtState);
    1440     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    1441 
    1442     RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
     1435
     1436    RTSpinlockAcquire(pNetFlt->hSpinlock);
    14431437
    14441438    vboxNetFltWinSetPowerState(&pNetFlt->u.s.WinIf.PtState, enmPowerState);
     
    14501444            pNetFlt->u.s.WinIf.StateFlags.fStandBy = TRUE;
    14511445        }
    1452         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     1446        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    14531447        vboxNetFltWinPtRequestsWaitComplete(pNetFlt);
    14541448        vboxNetFltWinWaitDereference(&pNetFlt->u.s.WinIf.MpState);
     
    14751469        {
    14761470            pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS;
    1477             RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     1471            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    14781472
    14791473            vboxNetFltWinMpRequestPost(pNetFlt);
     
    14811475        else
    14821476        {
    1483             RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     1477            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    14841478        }
    14851479    }
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp

    r37161 r40806  
    10591059DECLHIDDEN(void) vboxNetFltWinQuFiniPacketQueue(PVBOXNETFLTINS pInstance)
    10601060{
    1061     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    10621061    PINTNETSG pSG;
    10631062    PPACKET_QUEUE_WORKER pWorker = &pInstance->u.s.PacketQueueWorker;
     
    10651064
    10661065    /* using the pPacketQueueSG as an indicator that the packet queue is initialized */
    1067     RTSpinlockAcquireNoInts((pInstance)->hSpinlock, &Tmp);
     1066    RTSpinlockAcquire((pInstance)->hSpinlock);
    10681067    if (pWorker->pSG)
    10691068    {
    10701069        pSG = pWorker->pSG;
    10711070        pWorker->pSG = NULL;
    1072         RTSpinlockReleaseNoInts((pInstance)->hSpinlock, &Tmp);
     1071        RTSpinlockReleaseNoInts((pInstance)->hSpinlock);
    10731072        KeSetEvent(&pWorker->KillEvent, 0, FALSE);
    10741073
     
    10841083    else
    10851084    {
    1086         RTSpinlockReleaseNoInts((pInstance)->hSpinlock, &Tmp);
     1085        RTSpinlockReleaseNoInts((pInstance)->hSpinlock);
    10871086    }
    10881087}
     
    18451844        USHORT cbAnsiName = pBindToMiniportName->Length;/* the length is is bytes ; *2 ;RtlUnicodeStringToAnsiSize(pBindToMiniportName)*/
    18461845        CREATE_INSTANCE_CONTEXT Context;
    1847         RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    18481846
    18491847# ifndef VBOXNETADP
     
    26112609static int vboxNetFltWinDeleteInstance(PVBOXNETFLTINS pThis)
    26122610{
    2613     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    26142611    LogFlow(("vboxNetFltWinDeleteInstance: pThis=0x%p \n", pThis));
    26152612
     
    26462643DECLHIDDEN(NDIS_STATUS) vboxNetFltWinDetachFromInterface(PVBOXNETFLTINS pNetFlt, bool bOnUnbind)
    26472644{
    2648     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    26492645    NDIS_STATUS Status;
    26502646    int rc;
     
    27872783    if (RT_SUCCESS(rc))
    27882784    {
    2789         RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    27902785        Assert(vboxNetFltWinGetWinIfState(pThis) == kVBoxWinIfState_Disconnected);
    27912786        Assert(vboxNetFltWinGetOpState(&pThis->u.s.WinIf.MpState) == kVBoxNetDevOpState_Deinitialized);
     
    28302825#endif
    28312826                        /* 4. mark as connected */
    2832                         RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     2827                        RTSpinlockAcquire(pThis->hSpinlock);
    28332828                        ASMAtomicUoWriteBool(&pThis->fDisconnectedFromHost, false);
    2834                         RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
     2829                        RTSpinlockRelease(pThis->hSpinlock);
    28352830
    28362831                        pAttachInfo->Status = VINF_SUCCESS;
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.h

    r36184 r40806  
    587587DECLINLINE(bool) vboxNetFltWinReferenceWinIfNetFlt(PVBOXNETFLTINS pNetFlt, bool * pbNetFltActive)
    588588{
    589     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    590 
    591     RTSpinlockAcquireNoInts((pNetFlt)->hSpinlock, &Tmp);
     589    RTSpinlockAcquire((pNetFlt)->hSpinlock);
    592590#ifndef VBOXNETADP
    593591    if(!vboxNetFltWinDoReferenceDevices(&pNetFlt->u.s.WinIf.MpState, &pNetFlt->u.s.WinIf.PtState))
     
    596594#endif
    597595    {
    598         RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
     596        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
    599597        *pbNetFltActive = false;
    600598        return false;
     
    604602    {
    605603        vboxNetFltWinReferenceModePassThru(pNetFlt);
    606         RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
     604        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
    607605        *pbNetFltActive = false;
    608606        return true;
     
    611609    vboxNetFltRetain((pNetFlt), true /* fBusy */);
    612610    vboxNetFltWinReferenceModeNetFlt(pNetFlt);
    613     RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
     611    RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
    614612
    615613    *pbNetFltActive = true;
     
    619617DECLINLINE(bool) vboxNetFltWinIncReferenceWinIfNetFlt(PVBOXNETFLTINS pNetFlt, uint32_t v, bool *pbNetFltActive)
    620618{
    621     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    622619    uint32_t i;
    623620
     
    629626    }
    630627
    631     RTSpinlockAcquireNoInts((pNetFlt)->hSpinlock, &Tmp);
     628    RTSpinlockAcquire((pNetFlt)->hSpinlock);
    632629#ifndef VBOXNETADP
    633630    if(!vboxNetFltWinDoIncReferenceDevices(&pNetFlt->u.s.WinIf.MpState, &pNetFlt->u.s.WinIf.PtState, v))
     
    636633#endif
    637634    {
    638         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     635        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    639636        *pbNetFltActive = false;
    640637        return false;
     
    645642        vboxNetFltWinIncReferenceModePassThru(pNetFlt, v);
    646643
    647         RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock, &Tmp);
     644        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
    648645        *pbNetFltActive = false;
    649646        return true;
     
    654651    vboxNetFltWinIncReferenceModeNetFlt(pNetFlt, v);
    655652
    656     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     653    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    657654
    658655    /* we have marked it as busy, so can do the res references outside the lock */
     
    705702DECLINLINE(bool) vboxNetFltWinIncReferenceWinIf(PVBOXNETFLTINS pNetFlt, uint32_t v)
    706703{
    707     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    708 
    709704    Assert(v);
    710705    if(!v)
     
    713708    }
    714709
    715     RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
     710    RTSpinlockAcquire(pNetFlt->hSpinlock);
    716711#ifdef VBOXNETADP
    717712    if(vboxNetFltWinDoIncReferenceDevice(&pNetFlt->u.s.WinIf.MpState, v))
     
    720715#endif
    721716    {
    722         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     717        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    723718        return true;
    724719    }
    725720
    726     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     721    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    727722    return false;
    728723}
     
    730725DECLINLINE(bool) vboxNetFltWinReferenceWinIf(PVBOXNETFLTINS pNetFlt)
    731726{
    732     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    733     RTSpinlockAcquireNoInts(pNetFlt->hSpinlock, &Tmp);
     727    RTSpinlockAcquire(pNetFlt->hSpinlock);
    734728#ifdef VBOXNETADP
    735729    if(vboxNetFltWinDoReferenceDevice(&pNetFlt->u.s.WinIf.MpState))
     
    738732#endif
    739733    {
    740         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     734        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    741735        return true;
    742736    }
    743737
    744     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock, &Tmp);
     738    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
    745739    return false;
    746740}
  • trunk/src/VBox/HostDrivers/VBoxPci/VBoxPci.c

    r37423 r40806  
    7474    return NULL;
    7575}
    76 DECLINLINE(int) vboxPciDevLock(PVBOXRAWPCIINS pThis,
    77                                PRTSPINLOCKTMP pTmp)
     76DECLINLINE(int) vboxPciDevLock(PVBOXRAWPCIINS pThis)
    7877{
    7978#ifdef VBOX_WITH_SHARED_PCI_INTERRUPTS
    80     RTSpinlockAcquireNoInts(pThis->hSpinlock, pTmp);
     79    RTSpinlockAcquire(pThis->hSpinlock);
    8180    return VINF_SUCCESS;
    8281#else
     
    8988}
    9089
    91 DECLINLINE(void) vboxPciDevUnlock(PVBOXRAWPCIINS pThis,
    92                                   PRTSPINLOCKTMP pTmp)
     90DECLINLINE(void) vboxPciDevUnlock(PVBOXRAWPCIINS pThis)
    9391{
    9492#ifdef VBOX_WITH_SHARED_PCI_INTERRUPTS
    95     RTSpinlockReleaseNoInts(pThis->hSpinlock, pTmp);
     93    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    9694#else
    9795    NOREF(pTmp);
     
    184182    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    185183    int rc;
    186     RTSPINLOCKTMP aTmp;
    187 
    188     vboxPciDevLock(pThis, &aTmp);
     184
     185    vboxPciDevLock(pThis);
    189186
    190187    rc = vboxPciOsDevInit(pThis, fFlags);
    191188
    192     vboxPciDevUnlock(pThis, &aTmp);
     189    vboxPciDevUnlock(pThis);
    193190
    194191    return rc;
     
    202199    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    203200    int            rc;
    204     RTSPINLOCKTMP  aTmp;
    205 
    206     vboxPciDevLock(pThis, &aTmp);
     201
     202    vboxPciDevLock(pThis);
    207203
    208204    if (pThis->IrqHandler.pfnIrqHandler)
     
    215211    rc = vboxPciOsDevDeinit(pThis, fFlags);
    216212
    217     vboxPciDevUnlock(pThis, &aTmp);
     213    vboxPciDevUnlock(pThis);
    218214
    219215    return rc;
     
    265261    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    266262    int            rc;
    267     RTSPINLOCKTMP  aTmp;
    268 
    269     vboxPciDevLock(pThis, &aTmp);
     263
     264    vboxPciDevLock(pThis);
    270265
    271266    rc = vboxPciOsDevGetRegionInfo(pThis, iRegion,
    272267                                   pRegionStart, pu64RegionSize,
    273268                                   pfPresent, pfFlags);
    274     vboxPciDevUnlock(pThis, &aTmp);
     269    vboxPciDevUnlock(pThis);
    275270
    276271    return rc;
     
    289284    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    290285    int            rc;
    291     RTSPINLOCKTMP  aTmp;
    292 
    293     vboxPciDevLock(pThis, &aTmp);
     286
     287    vboxPciDevLock(pThis);
    294288
    295289    rc = vboxPciOsDevMapRegion(pThis, iRegion, RegionStart, u64RegionSize, fFlags, pRegionBase);
    296290
    297     vboxPciDevUnlock(pThis, &aTmp);
     291    vboxPciDevUnlock(pThis);
    298292
    299293    return rc;
     
    311305    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    312306    int            rc;
    313     RTSPINLOCKTMP  aTmp;
    314 
    315     vboxPciDevLock(pThis, &aTmp);
     307
     308    vboxPciDevLock(pThis);
    316309
    317310    rc = vboxPciOsDevUnmapRegion(pThis, iRegion, RegionStart, u64RegionSize, RegionBase);
    318311
    319     vboxPciDevUnlock(pThis, &aTmp);
     312    vboxPciDevUnlock(pThis);
    320313
    321314    return rc;
     
    330323{
    331324    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    332     RTSPINLOCKTMP  aTmp;
    333     int            rc;
    334 
    335     vboxPciDevLock(pThis, &aTmp);
     325    int            rc;
     326
     327    vboxPciDevLock(pThis);
    336328
    337329    rc = vboxPciOsDevPciCfgRead(pThis, Register, pValue);
    338330
    339     vboxPciDevUnlock(pThis, &aTmp);
     331    vboxPciDevUnlock(pThis);
    340332
    341333    return rc;
     
    351343    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    352344    int            rc;
    353     RTSPINLOCKTMP  aTmp;
    354 
    355     vboxPciDevLock(pThis, &aTmp);
     345
     346    vboxPciDevLock(pThis);
    356347
    357348    rc = vboxPciOsDevPciCfgWrite(pThis, Register, pValue);
    358349
    359     vboxPciDevUnlock(pThis, &aTmp);
     350    vboxPciDevUnlock(pThis);
    360351
    361352    return rc;
     
    370361    int            rc;
    371362    int32_t        iHostIrq = 0;
    372     RTSPINLOCKTMP  aTmp;
    373363
    374364    if (pfnHandler == NULL)
    375365        return VERR_INVALID_PARAMETER;
    376366
    377     vboxPciDevLock(pThis, &aTmp);
     367    vboxPciDevLock(pThis);
    378368
    379369    if (pThis->IrqHandler.pfnIrqHandler)
     
    393383    }
    394384
    395     vboxPciDevUnlock(pThis, &aTmp);
     385    vboxPciDevUnlock(pThis);
    396386
    397387    return rc;
     
    403393    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    404394    int            rc;
    405     RTSPINLOCKTMP  aTmp;
    406395
    407396    if (hIsr != 0xcafe0000)
    408397        return VERR_INVALID_PARAMETER;
    409398
    410     vboxPciDevLock(pThis, &aTmp);
     399    vboxPciDevLock(pThis);
    411400
    412401    rc = vboxPciOsDevUnregisterIrqHandler(pThis, pThis->IrqHandler.iHostIrq);
     
    417406        pThis->IrqHandler.iHostIrq = 0;
    418407    }
    419     vboxPciDevUnlock(pThis, &aTmp);
     408    vboxPciDevUnlock(pThis);
    420409
    421410    return rc;
     
    428417    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    429418    int            rc;
    430     RTSPINLOCKTMP  aTmp;
    431 
    432     vboxPciDevLock(pThis, &aTmp);
     419
     420    vboxPciDevLock(pThis);
    433421
    434422    rc = vboxPciOsDevPowerStateChange(pThis, aState);
     
    448436
    449437
    450     vboxPciDevUnlock(pThis, &aTmp);
     438    vboxPciDevUnlock(pThis);
    451439
    452440    return rc;
  • trunk/src/VBox/HostDrivers/VBoxUSB/VBoxUSBFilterMgr.cpp

    r36941 r40806  
    4646
    4747# define VBOXUSBFILTERMGR_LOCK() \
    48     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; \
    49     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp)
     48    RTSpinlockAcquire(g_Spinlock)
    5049
    5150# define VBOXUSBFILTERMGR_UNLOCK() \
    52     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp)
     51    RTSpinlockRelease(g_Spinlock)
    5352
    5453#else
     
    124123{
    125124#ifdef VBOXUSBFILTERMGR_USB_SPINLOCK
    126     int rc = RTSpinlockCreate(&g_Spinlock);
     125    int rc = RTSpinlockCreate(&g_Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxUSBFilter");
    127126#else
    128127    int rc = RTSemFastMutexCreate(&g_Mtx);
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