VirtualBox

Changeset 40806 in vbox for trunk/src/VBox/Devices/Bus


Ignore:
Timestamp:
Apr 6, 2012 9:05:19 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77321
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/SrvPciRawR0.cpp

    r39086 r40806  
    9595static DECLCALLBACK(bool) pcirawr0Isr(void* pContext, int32_t iHostIrq)
    9696{
    97     RTSPINLOCKTMP aTmp;
    9897    PPCIRAWDEV    pThis = (PPCIRAWDEV)pContext;
    9998
     
    114113#endif
    115114
    116     RTSpinlockAcquireNoInts(pThis->hSpinlock, &aTmp);
     115    RTSpinlockAcquire(pThis->hSpinlock);
    117116    pThis->iPendingIrq = iHostIrq;
    118     RTSpinlockReleaseNoInts(pThis->hSpinlock, &aTmp);
     117    RTSpinlockReleaseNoInts(pThis->hSpinlock);
    119118
    120119    /**
     
    575574        if (RT_SUCCESS(rc))
    576575        {
    577             rc = RTSpinlockCreate(&pNew->hSpinlock);
     576            rc = RTSpinlockCreate(&pNew->hSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "PciRaw");
    578577            AssertRC(rc);
    579578            rc = RTSemEventCreate(&pNew->hIrqEvent);
     
    862861{
    863862    int            rc = VINF_SUCCESS;
    864     RTSPINLOCKTMP  aTmp;
    865863    bool           fTerminate = false;
    866864    int32_t        iPendingIrq = 0;
     
    870868    GET_PORT(TargetDevice);
    871869
    872     RTSpinlockAcquireNoInts(pDev->hSpinlock, &aTmp);
     870    RTSpinlockAcquire(pDev->hSpinlock);
    873871    iPendingIrq = pDev->iPendingIrq;
    874872    pDev->iPendingIrq = 0;
    875873    fTerminate = pDev->fTerminate;
    876     RTSpinlockReleaseNoInts(pDev->hSpinlock, &aTmp);
     874    RTSpinlockReleaseNoInts(pDev->hSpinlock);
    877875
    878876    /* Block until new IRQs arrives */
     
    887885                if (!ASMAtomicReadBool(&pDev->fTerminate))
    888886                {
    889                     RTSpinlockAcquireNoInts(pDev->hSpinlock, &aTmp);
     887                    RTSpinlockAcquire(pDev->hSpinlock);
    890888                    iPendingIrq = pDev->iPendingIrq;
    891889                    pDev->iPendingIrq = 0;
    892                     RTSpinlockReleaseNoInts(pDev->hSpinlock, &aTmp);
     890                    RTSpinlockReleaseNoInts(pDev->hSpinlock);
    893891                }
    894892                else
Note: See TracChangeset for help on using the changeset viewer.

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