VirtualBox

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.

File:
1 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)
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