VirtualBox

Changeset 22038 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 6, 2009 4:27:13 PM (15 years ago)
Author:
vboxsync
Message:

semspinmutex-r0drv-generic.c: Return VERR_SEM_BAD_CONTEXT if interrupts are disabled when on solaris and in the default case (see #4147).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c

    r21933 r22038  
    184184    }
    185185
    186 #elif defined(RT_OS_LINUX) || defined(RT_OS_OS2) || defined(RT_OS_SOLARIS)
    187     /*
    188      * OSes on which RTSemEventSignal can be called from any context.
    189      */
     186#elif defined(RT_OS_SOLARIS)
     187    /*
     188     * Solaris:  RTSemEventSignal will do bad stuff on S10 if interrupts are disabled.
     189     */
     190    if (!ASMIntAreEnabled())
     191        return VERR_SEM_BAD_CONTEXT;
     192
    190193    pState->fSpin = !RTThreadPreemptIsEnabled(NIL_RTTHREAD);
    191194    if (RTThreadIsInInterrupt(NIL_RTTHREAD))
     
    198201    RTThreadPreemptDisable(&pState->PreemptState);
    199202
     203#elif defined(RT_OS_LINUX) || defined(RT_OS_OS2)
     204    /*
     205     * OSes on which RTSemEventSignal can be called from any context.
     206     */
     207    pState->fSpin = !RTThreadPreemptIsEnabled(NIL_RTTHREAD);
     208    if (RTThreadIsInInterrupt(NIL_RTTHREAD))
     209    {
     210        if (!(pThis->fFlags & RTSEMSPINMUTEX_FLAGS_IRQ_SAFE))
     211            rc = VINF_SEM_BAD_CONTEXT; /* Try, but owner might be interrupted. */
     212        pState->fSpin = true;
     213    }
     214    pState->PreemptState = StateInit;
     215    RTThreadPreemptDisable(&pState->PreemptState);
     216
    200217#else /* PORTME: Check for context where we cannot wake up threads. */
    201218    /*
    202      * Default: ASSUME thread can be woken up from all context except interrupt.
     219     * Default: ASSUME thread can be woken up if interrupts are enabled and
     220     *          we're not in an interrupt context.
    203221     *          ASSUME that we can go to sleep if preemption is enabled.
    204222     */
    205     if (RTThreadIsInInterrupt(NIL_RTTHREAD))
     223    if (    RTThreadIsInInterrupt(NIL_RTTHREAD)
     224        ||  !ASMIntAreEnabled())
    206225        return VERR_SEM_BAD_CONTEXT;
     226
    207227    pState->fSpin = !RTThreadPreemptIsEnabled(NIL_RTTHREAD);
    208228    pState->PreemptState = StateInit;
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