VirtualBox

Ignore:
Timestamp:
Apr 25, 2010 12:36:09 AM (15 years ago)
Author:
vboxsync
Message:

spinlock-r0drv-linux.c: Added checks for consistent NoIrq usage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c

    r22139 r28702  
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6868    void                *pvUniDummy;
    6969#endif
     70#ifdef RT_STRICT
     71    /** Set if we've seen any fNoIrqs usage.
     72     * This must be consistent or it won't work you know. */
     73    bool                fNoIrqs;
     74#endif
    7075} RTSPINLOCKINTERNAL, *PRTSPINLOCKINTERNAL;
    7176
     
    8994    pThis->idCpuOwner  = NIL_RTCPUID;
    9095    pThis->idAssertCpu = NIL_RTCPUID;
     96#endif
     97#ifdef RT_STRICT
     98    pThis->fNoIrqs     = false;
    9199#endif
    92100    spin_lock_init(&pThis->Spinlock);
     
    129137
    130138    RT_ASSERT_PREEMPT_CPUID_SPIN_ACQUIRED(pThis);
     139#ifdef RT_STRICT
     140    pThis->fNoIrqs = true;
     141#endif
    131142}
    132143RT_EXPORT_SYMBOL(RTSpinlockAcquireNoInts);
     
    141152              ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
    142153    RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE(pThis);
    143     NOREF(pTmp);
     154    Assert(pThis->fNoIrqs);
    144155
    145156    spin_unlock_irqrestore(&pThis->Spinlock, pTmp->flFlags);
     
    157168              ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
    158169    NOREF(pTmp);
     170    Assert(!pThis->fNoIrqs || !ASMIntAreEnabled());
    159171
    160172    spin_lock(&pThis->Spinlock);
     
    173185    NOREF(pTmp);
    174186    RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE(pThis);
     187    Assert(!pThis->fNoIrqs || !ASMIntAreEnabled());
    175188
    176189    spin_unlock(&pThis->Spinlock);
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