VirtualBox

Changeset 22418 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Aug 24, 2009 3:47:01 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
51399
Message:

IPRT: RTThreadPreemptDisble/Restore must work the SPL/PIL as well for the code to work reliably on S10.

Location:
trunk/src/VBox/Runtime/r0drv/solaris
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c

    r22151 r22418  
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    113113    if (!ASMIntAreEnabled())
    114114        return false;
     115    if (getpil() >= DISP_LEVEL)
     116        return false;
    115117    return true;
    116118}
     
    120122{
    121123    Assert(hThread == NIL_RTTHREAD);
    122     /** @todo Review this! */
    123124    return CPU->cpu_runrun   != 0
    124125        || CPU->cpu_kprunrun != 0;
     
    143144{
    144145    AssertPtr(pState);
    145     Assert(pState->u32Reserved == 0);
    146     pState->u32Reserved = 42;
     146    Assert(pState->uOldPil == UINT32_MAX);
    147147
    148148    kpreempt_disable();
     149/// @todo check out splr and splx on S10!
     150//    if (ASMIntAreEnabled())
     151        pState->uOldPil = splr(ipltospl(DISP_LEVEL));
     152//    else
     153//    {
     154//        /* splr doesn't restore the interrupt flag on S10. */
     155//        pState->uOldPil = getpil();
     156//        if (pState->uOldPil < DISP_LEVEL)
     157//            pState->uOldPil = splx(DISP_LEVEL);
     158//    }
     159    Assert(pState->uOldPil != UINT32_MAX)
    149160    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    150161}
     
    154165{
    155166    AssertPtr(pState);
    156     Assert(pState->u32Reserved == 42);
    157     pState->u32Reserved = 0;
     167    Assert(pState->uOldPil != UINT32_MAX)
    158168    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
    159169
     170    splx(pState->uOldPil);
    160171    kpreempt_enable();
     172
     173    pState->uOldPil = UINT32_MAX;
    161174}
    162175
     
    164177RTDECL(bool) RTThreadIsInInterrupt(RTTHREAD hThread)
    165178{
     179    /** @todo it looks like checking for spl > LOCK_LEVEL and interrupts disabled
     180     *        is more accurate than this... */
    166181    /* This is the best we currently can do here. :-( */
    167182    return !RTThreadPreemptIsEnabled(hThread)
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c

    r22407 r22418  
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    8282{
    8383    Assert(hThread == NIL_RTTHREAD);
    84     if (    vbi_is_preempt_enabled()
    85         &&  ASMIntAreEnabled()
    86         &&  getpil() < DISP_LEVEL)
    87         return true;
    88     return false;
     84    if (!vbi_is_preempt_enabled())
     85        return false;
     86    if (!ASMIntAreEnabled())
     87        return false;
     88    if (getpil() >= DISP_LEVEL)
     89        return false;
     90    return true;
    8991}
    9092
     
    114116{
    115117    AssertPtr(pState);
    116     Assert(pState->u32Reserved == 0);
    117     pState->u32Reserved = 42;
     118    Assert(pState->uOldPil == UINT32_MAX);
     119
    118120    vbi_preempt_disable();
     121/// @todo check out splr and splx on S10!
     122//    if (ASMIntAreEnabled())
     123        pState->uOldPil = splr(ipltospl(DISP_LEVEL));
     124//    else
     125//    {
     126//        /* splr doesn't restore the interrupt flag on S10. */
     127//        pState->uOldPil = getpil();
     128//        if (pState->uOldPil < DISP_LEVEL)
     129//            pState->uOldPil = splx(DISP_LEVEL);
     130//    }
     131
     132    Assert(pState->uOldPil != UINT32_MAX)
    119133    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    120134}
     
    124138{
    125139    AssertPtr(pState);
    126     Assert(pState->u32Reserved == 42);
    127     pState->u32Reserved = 0;
     140    Assert(pState->uOldPil != UINT32_MAX)
    128141    RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
     142
     143    splx(pState->uOldPil);
    129144    vbi_preempt_enable();
     145
     146    pState->uOldPil = UINT32_MAX;
    130147}
    131148
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