VirtualBox

Ignore:
Timestamp:
Aug 6, 2015 11:27:10 PM (9 years ago)
Author:
vboxsync
Message:

IPRT/r0drv/darwin: More EFLAGS.AC paranoia.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp

    r56290 r57228  
    7070{
    7171    RT_ASSERT_PREEMPTIBLE();
     72    IPRT_DARWIN_SAVE_EFL_AC();
    7273    AssertReturn(fFlags == RTSPINLOCK_FLAGS_INTERRUPT_SAFE || fFlags == RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, VERR_INVALID_PARAMETER);
    7374
     
    7778    AssertCompile(sizeof(RTSPINLOCKINTERNAL) > sizeof(void *));
    7879    PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)RTMemAlloc(sizeof(*pThis));
    79     if (!pThis)
    80         return VERR_NO_MEMORY;
     80    if (pThis)
     81    {
     82        /*
     83         * Initialize & return.
     84         */
     85        pThis->u32Magic  = RTSPINLOCK_MAGIC;
     86        pThis->fIntSaved = 0;
     87        pThis->fFlags    = fFlags;
     88        pThis->pszName   = pszName;
     89        Assert(g_pDarwinLockGroup);
     90        pThis->pSpinLock = lck_spin_alloc_init(g_pDarwinLockGroup, LCK_ATTR_NULL);
     91        if (pThis->pSpinLock)
     92        {
     93            *pSpinlock = pThis;
     94            IPRT_DARWIN_RESTORE_EFL_AC();
     95            return VINF_SUCCESS;
     96        }
    8197
    82     /*
    83      * Initialize & return.
    84      */
    85     pThis->u32Magic  = RTSPINLOCK_MAGIC;
    86     pThis->fIntSaved = 0;
    87     pThis->fFlags    = fFlags;
    88     pThis->pszName   = pszName;
    89     Assert(g_pDarwinLockGroup);
    90     pThis->pSpinLock = lck_spin_alloc_init(g_pDarwinLockGroup, LCK_ATTR_NULL);
    91     if (!pThis->pSpinLock)
    92     {
    9398        RTMemFree(pThis);
    94         return VERR_NO_MEMORY;
    9599    }
    96 
    97     *pSpinlock = pThis;
    98     return VINF_SUCCESS;
     100    IPRT_DARWIN_RESTORE_EFL_AC();
     101    return VERR_NO_MEMORY;
    99102}
    100103
     
    116119     */
    117120    ASMAtomicIncU32(&pThis->u32Magic);
     121    IPRT_DARWIN_SAVE_EFL_AC();
    118122
    119123    Assert(g_pDarwinLockGroup);
     
    122126
    123127    RTMemFree(pThis);
     128
     129    IPRT_DARWIN_RESTORE_EFL_AC();
    124130    return VINF_SUCCESS;
    125131}
     
    138144        lck_spin_lock(pThis->pSpinLock);
    139145        pThis->fIntSaved = fIntSaved;
     146        IPRT_DARWIN_RESTORE_EFL_ONLY_AC_EX(fIntSaved);
    140147    }
    141148    else
     149    {
     150        IPRT_DARWIN_SAVE_EFL_AC();
    142151        lck_spin_lock(pThis->pSpinLock);
     152        IPRT_DARWIN_RESTORE_EFL_ONLY_AC();
     153    }
    143154}
    144155
     
    158169    }
    159170    else
     171    {
     172        IPRT_DARWIN_SAVE_EFL_AC();
    160173        lck_spin_unlock(pThis->pSpinLock);
     174        IPRT_DARWIN_RESTORE_EFL_ONLY_AC();
     175    }
    161176}
    162177
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