VirtualBox

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


Ignore:
Timestamp:
Aug 7, 2009 9:45:48 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50790
Message:

IPRT: RT_MORE_STRICT for r0rdv and r0drv/darwin.

Location:
trunk/src/VBox/Runtime
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/include/internal/iprt.h

    r21355 r22052  
    5252#endif
    5353
     54
     55/** @def RT_ASSERT_PREEMPT_CPUID_VAR
     56 * Partner to RT_ASSERT_PREEMPT_CPUID_VAR. Declares and initializes a variable
     57 * idAssertCpu to NIL_RTCPUID if preemption is enabled and to RTMpCpuId if
     58 * disabled.  When RT_MORE_STRICT isn't defined it declares an uninitialized
     59 * dummy variable.
     60 * 
     61 * Requires iprt/mp.h and iprt/asm.h.
     62 */
     63/** @def RT_ASSERT_PREEMPT_CPUID
     64 * Asserts that we didn't change CPU since RT_ASSERT_PREEMPT_CPUID_VAR if
     65 * preemption is disabled.  Will also detect changes in preemption
     66 * disable/enable status.  This is a noop when RT_MORE_STRICT isn't defined. */
     67#ifdef RT_MORE_STRICT
     68# define RT_ASSERT_PREEMPT_CPUID_VAR() \
     69    RTCPUID const idAssertCpu = RTThreadPreemptIsEnabled(NIL_RTTHREAD) ? NIL_RTCPUID : RTMpCpuId()
     70# define RT_ASSERT_PREEMPT_CPUID() \
     71   do \
     72   { \
     73        RTCPUID const idAssertCpuNow = RTThreadPreemptIsEnabled(NIL_RTTHREAD) ? NIL_RTCPUID : RTMpCpuId(); \
     74        AssertMsg(idAssertCpu == idAssertCpuNow,  ("%#x, %#x\n", idAssertCpu, idAssertCpuNow)); \
     75   } while (0)
     76                                                 
     77#else
     78# define RT_ASSERT_PREEMPT_CPUID_VAR()  RTCPUID idAssertCpuDummy
     79# define RT_ASSERT_PREEMPT_CPUID()      NOREF(idAssertCpuDummy)
     80#endif
     81
     82/** @def RT_ASSERT_INTS_ON
     83 * Asserts that interrupts are disabled when RT_MORE_STRICT is defined.   */
     84#ifdef RT_MORE_STRICT
     85# define RT_ASSERT_INTS_ON()            Assert(ASMIntAreEnabled())
     86#else
     87# define RT_ASSERT_INTS_ON()            do { } while (0)
     88#endif
     89
     90/** @def RT_ASSERT_PREEMPTIBLE
     91 * Asserts that preemption hasn't been disabled (using
     92 * RTThreadPreemptDisable) when RT_MORE_STRICT is defined. */
     93#ifdef RT_MORE_STRICT
     94# define RT_ASSERT_PREEMPTIBLE()        Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD))
     95#else
     96# define RT_ASSERT_PREEMPTIBLE()        do { } while (0)
     97#endif
     98
    5499#endif
    55100
  • trunk/src/VBox/Runtime/r0drv/alloc-r0drv.cpp

    r21337 r22052  
    3636#include "internal/iprt.h"
    3737
    38 #include <iprt/string.h>
     38#include <iprt/asm.h>
    3939#include <iprt/assert.h>
    4040#include <iprt/param.h>
     41#include <iprt/string.h>
     42#include <iprt/thread.h>
    4143#include "r0drv/alloc-r0drv.h"
    4244
     
    126128RTDECL(void *)  RTMemAlloc(size_t cb) RT_NO_THROW
    127129{
    128     PRTMEMHDR pHdr = rtMemAlloc(cb + RTR0MEM_FENCE_EXTRA, 0);
     130    PRTMEMHDR pHdr;
     131    RT_ASSERT_PREEMPTIBLE();
     132
     133    pHdr = rtMemAlloc(cb + RTR0MEM_FENCE_EXTRA, 0);
    129134    if (pHdr)
    130135    {
     
    153158RTDECL(void *)  RTMemAllocZ(size_t cb) RT_NO_THROW
    154159{
    155     PRTMEMHDR pHdr = rtMemAlloc(cb + RTR0MEM_FENCE_EXTRA, RTMEMHDR_FLAG_ZEROED);
     160    PRTMEMHDR pHdr;
     161    RT_ASSERT_PREEMPTIBLE();
     162
     163    pHdr = rtMemAlloc(cb + RTR0MEM_FENCE_EXTRA, RTMEMHDR_FLAG_ZEROED);
    156164    if (pHdr)
    157165    {
     
    186194    {
    187195        PRTMEMHDR pHdrOld = (PRTMEMHDR)pvOld - 1;
     196        RT_ASSERT_PREEMPTIBLE();
     197
    188198        if (pHdrOld->u32Magic == RTMEMHDR_MAGIC)
    189199        {
     
    228238{
    229239    PRTMEMHDR pHdr;
     240    RT_ASSERT_INTS_ON();
     241
    230242    if (!pv)
    231243        return;
     
    260272RTDECL(void *)    RTMemExecAlloc(size_t cb) RT_NO_THROW
    261273{
    262     PRTMEMHDR pHdr = rtMemAlloc(cb + RTR0MEM_FENCE_EXTRA, RTMEMHDR_FLAG_EXEC);
     274    PRTMEMHDR pHdr;
     275    RT_ASSERT_PREEMPTIBLE();
     276       
     277    pHdr = rtMemAlloc(cb + RTR0MEM_FENCE_EXTRA, RTMEMHDR_FLAG_EXEC);
    263278    if (pHdr)
    264279    {
     
    282297{
    283298    PRTMEMHDR pHdr;
     299    RT_ASSERT_INTS_ON();
     300
    284301    if (!pv)
    285302        return;
  • trunk/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp

    r8245 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
    3637#include <iprt/log.h>
    37 #include <iprt/assert.h>
    3838
    3939
    4040RTDECL(void) RTLogWriteDebugger(const char *pch, size_t cb)
    4141{
    42     kprintf("%.*s", cb, pch);
     42    kprintf("%.*s", (int)cb, pch);
    4343    return;
    4444}
  • trunk/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp

    r10608 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
    3637#include <iprt/log.h>
    37 #include <iprt/assert.h>
    3838
    3939
    4040RTDECL(void) RTLogWriteStdOut(const char *pch, size_t cb)
    4141{
    42     printf("%.*s", cb, pch);
     42    printf("%.*s", (int)cb, pch);
    4343    return;
    4444}
  • trunk/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp

    r8245 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
     37#include <iprt/mem.h>
    3638
    37 #include <iprt/alloc.h>
    3839#include <iprt/assert.h>
     40#include <iprt/thread.h>
    3941#include "r0drv/alloc-r0drv.h"
    4042
     
    5456    }
    5557    else
    56         printf("rmMemAlloc(%#x, %#x) failed\n", cb + sizeof(*pHdr), fFlags);
     58        printf("rmMemAlloc(%#zx, %#x) failed\n", cb + sizeof(*pHdr), fFlags);
    5759    return pHdr;
    5860}
     
    7678    AssertPtr(pPhys);
    7779    Assert(cb > 0);
     80    RT_ASSERT_PREEMPTIBLE();
    7881
    7982    /*
     
    105108RTR0DECL(void) RTMemContFree(void *pv, size_t cb)
    106109{
     110    RT_ASSERT_PREEMPTIBLE();
    107111    if (pv)
    108112    {
  • trunk/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp

    r14500 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
     37#include <iprt/assert.h>
    3638
    37 #include <iprt/assert.h>
     39#include <iprt/asm.h>
    3840#include <iprt/log.h>
     41#include <iprt/stdarg.h>
    3942#include <iprt/string.h>
    40 #include <iprt/stdarg.h>
    41 #include <iprt/asm.h>
    4243
    4344
  • trunk/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp

    r19919 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
     37
    3638#include <iprt/err.h>
    3739#include <iprt/assert.h>
  • trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp

    r21497 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
    36 
     36#include "internal/iprt.h"
    3737#include <iprt/memobj.h>
    3838
     
    4545#include <iprt/string.h>
    4646#include <iprt/thread.h>
    47 
    4847#include "internal/memobj.h"
    4948
  • trunk/src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp

    r21284 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
     37#include <iprt/mem.h>
    3638
    37 #include <iprt/mem.h>
     39#include <iprt/asm.h>
    3840#include <iprt/err.h>
    3941
     
    4143RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_t cb)
    4244{
     45    RT_ASSERT_INTS_ON();
    4346    int rc = copyin((const user_addr_t)R3PtrSrc, pvDst, cb);
    4447    if (RT_LIKELY(rc == 0))
     
    5053RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb)
    5154{
     55    RT_ASSERT_INTS_ON();
    5256    int rc = copyout(pvSrc, R3PtrDst, cb);
    5357    if (RT_LIKELY(rc == 0))
  • trunk/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp

    r19389 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
    36 
     36#include "internal/iprt.h"
    3737#include <iprt/mp.h>
     38
     39#include <iprt/asm.h>
    3840#include <iprt/cpuset.h>
    3941#include <iprt/err.h>
    40 #include <iprt/asm.h>
    4142#include "r0drv/mp-r0drv.h"
    4243
     44
     45/*******************************************************************************
     46*   Defined Constants And Macros                                               *
     47*******************************************************************************/
    4348#define MY_DARWIN_MAX_CPUS      (0xf + 1) /* see MAX_CPUS */
    4449
     
    202207RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
    203208{
     209    RT_ASSERT_INTS_ON();
     210
    204211    RTMPARGS Args;
    205212    Args.pfnWorker = pfnWorker;
     
    230237RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
    231238{
     239    RT_ASSERT_INTS_ON();
     240
    232241    int rc;
    233242    RTMPARGS Args;
     
    262271RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
    263272{
     273    RT_ASSERT_INTS_ON();
     274
    264275    int rc;
    265276    RTMPARGS Args;
     
    278289RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
    279290{
     291    RT_ASSERT_INTS_ON();
     292
    280293    /* no unicast IPI */
    281294    return VERR_NOT_SUPPORTED;
  • trunk/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp

    r8245 r22052  
    2929 */
    3030
     31
    3132/*******************************************************************************
    3233*   Header Files                                                               *
    3334*******************************************************************************/
    3435#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
    3537#include <iprt/process.h>
    3638
  • trunk/src/VBox/Runtime/r0drv/darwin/semaphore-r0drv-darwin.cpp

    r21537 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
    36 
     36#include "internal/iprt.h"
    3737#include <iprt/semaphore.h>
     38
    3839#include <iprt/alloc.h>
    3940#include <iprt/assert.h>
    4041#include <iprt/asm.h>
    4142#include <iprt/err.h>
     43#include <iprt/mp.h>
     44#include <iprt/thread.h>
    4245
    4346#include "internal/magics.h"
     
    115118    Assert(sizeof(RTSEMEVENTINTERNAL) > sizeof(void *));
    116119    AssertPtrReturn(pEventSem, VERR_INVALID_POINTER);
     120    RT_ASSERT_PREEMPTIBLE();
    117121
    118122    PRTSEMEVENTINTERNAL pEventInt = (PRTSEMEVENTINTERNAL)RTMemAlloc(sizeof(*pEventInt));
     
    147151                    ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic),
    148152                    VERR_INVALID_HANDLE);
     153    RT_ASSERT_INTS_ON();
    149154
    150155    lck_spin_lock(pEventInt->pSpinlock);
     
    178183                    ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic),
    179184                    VERR_INVALID_HANDLE);
     185    RT_ASSERT_PREEMPT_CPUID_VAR();
     186    RT_ASSERT_INTS_ON();
    180187
    181188    /** @todo should probably disable interrupts here... update
     
    188195        ASMAtomicIncU32(&pEventInt->cWaking);
    189196        thread_wakeup_prim((event_t)pEventInt, TRUE /* one thread */, THREAD_AWAKENED);
    190                 /** @todo this isn't safe. a scheduling interrupt on the other cpu while we're in here
     197        /** @todo this isn't safe. a scheduling interrupt on the other cpu while we're in here
    191198         * could cause the thread to be timed out before we manage to wake it up and the event
    192199         * ends up in the wrong state. ditto for posix signals.
    193                 * Update: check the return code; it will return KERN_NOT_WAITING if no one is around. */
     200        * Update: check the return code; it will return KERN_NOT_WAITING if no one is around. */
    194201    }
    195202    else
     
    197204
    198205    lck_spin_unlock(pEventInt->pSpinlock);
     206
     207    RT_ASSERT_PREEMPT_CPUID();
    199208    return VINF_SUCCESS;
    200209}
     
    208217                    ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic),
    209218                    VERR_INVALID_HANDLE);
    210 
     219    RT_ASSERT_PREEMPTIBLE();
     220       
    211221    lck_spin_lock(pEventInt->pSpinlock);
    212222
     
    306316    Assert(sizeof(RTSEMEVENTMULTIINTERNAL) > sizeof(void *));
    307317    AssertPtrReturn(pEventMultiSem, VERR_INVALID_POINTER);
     318    RT_ASSERT_PREEMPTIBLE();
    308319
    309320    PRTSEMEVENTMULTIINTERNAL pEventMultiInt = (PRTSEMEVENTMULTIINTERNAL)RTMemAlloc(sizeof(*pEventMultiInt));
     
    338349                    ("pEventMultiInt=%p u32Magic=%#x\n", pEventMultiInt, pEventMultiInt->u32Magic),
    339350                    VERR_INVALID_HANDLE);
     351    RT_ASSERT_INTS_ON();
    340352
    341353    lck_spin_lock(pEventMultiInt->pSpinlock);
     
    369381                    ("pEventMultiInt=%p u32Magic=%#x\n", pEventMultiInt, pEventMultiInt->u32Magic),
    370382                    VERR_INVALID_HANDLE);
     383    RT_ASSERT_PREEMPT_CPUID_VAR();
     384    RT_ASSERT_INTS_ON();
    371385
    372386    lck_spin_lock(pEventMultiInt->pSpinlock);
     
    381395
    382396    lck_spin_unlock(pEventMultiInt->pSpinlock);
     397
     398    RT_ASSERT_PREEMPT_CPUID();
    383399    return VINF_SUCCESS;
    384400}
     
    407423                    ("pEventMultiInt=%p u32Magic=%#x\n", pEventMultiInt, pEventMultiInt->u32Magic),
    408424                    VERR_INVALID_HANDLE);
     425    RT_ASSERT_PREEMPTIBLE();
    409426
    410427    lck_spin_lock(pEventMultiInt->pSpinlock);
     
    502519RTDECL(int)  RTSemMutexCreate(PRTSEMMUTEX pMutexSem)
    503520{
     521    RT_ASSERT_PREEMPTIBLE();
    504522    AssertCompile(sizeof(RTSEMMUTEXINTERNAL) > sizeof(void *));
    505523    PRTSEMMUTEXINTERNAL pMutexInt = (PRTSEMMUTEXINTERNAL)RTMemAlloc(sizeof(*pMutexInt));
     
    532550              ("pMutexInt->u32Magic=%RX32 pMutexInt=%p\n", pMutexInt->u32Magic, pMutexInt)
    533551              VERR_INVALID_PARAMETER);
     552    RT_ASSERT_INTS_ON();
    534553
    535554    /*
     
    559578              ("pMutexInt->u32Magic=%RX32 pMutexInt=%p\n", pMutexInt->u32Magic, pMutexInt)
    560579              VERR_INVALID_PARAMETER);
     580    RT_ASSERT_PREEMPTIBLE();
    561581
    562582    /*
     
    611631        return VERR_INVALID_PARAMETER;
    612632    }
     633    RT_ASSERT_PREEMPTIBLE();
    613634
    614635    /*
     
    632653    AssertCompile(sizeof(RTSEMFASTMUTEXINTERNAL) > sizeof(void *));
    633654    AssertPtrReturn(pMutexSem, VERR_INVALID_POINTER);
     655    RT_ASSERT_PREEMPTIBLE();
    634656
    635657    PRTSEMFASTMUTEXINTERNAL pFastInt = (PRTSEMFASTMUTEXINTERNAL)RTMemAlloc(sizeof(*pFastInt));
     
    660682                    ("pFastInt->u32Magic=%RX32 pFastInt=%p\n", pFastInt->u32Magic, pFastInt),
    661683                    VERR_INVALID_PARAMETER);
     684    RT_ASSERT_INTS_ON();
    662685
    663686    ASMAtomicIncU32(&pFastInt->u32Magic); /* make the handle invalid. */
     
    678701                    ("pFastInt->u32Magic=%RX32 pFastInt=%p\n", pFastInt->u32Magic, pFastInt),
    679702                    VERR_INVALID_PARAMETER);
     703    RT_ASSERT_PREEMPTIBLE();
    680704    lck_mtx_lock(pFastInt->pMtx);
    681705    return VINF_SUCCESS;
     
    690714                    ("pFastInt->u32Magic=%RX32 pFastInt=%p\n", pFastInt->u32Magic, pFastInt),
    691715                    VERR_INVALID_PARAMETER);
     716    RT_ASSERT_PREEMPTIBLE();
    692717    lck_mtx_unlock(pFastInt->pMtx);
    693718    return VINF_SUCCESS;
  • trunk/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp

    r8245 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
    3637#include <iprt/spinlock.h>
    37 #include <iprt/err.h>
    38 #include <iprt/alloc.h>
     38
    3939#include <iprt/assert.h>
    4040#include <iprt/asm.h>
     41#include <iprt/err.h>
     42#include <iprt/mem.h>
     43#include <iprt/thread.h>
    4144
    4245#include "internal/magics.h"
     
    6164RTDECL(int)  RTSpinlockCreate(PRTSPINLOCK pSpinlock)
    6265{
     66    RT_ASSERT_PREEMPTIBLE();
     67
    6368    /*
    6469     * Allocate.
  • trunk/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp

    r8245 r22052  
    2929 */
    3030
     31
    3132/*******************************************************************************
    3233*   Header Files                                                               *
    3334*******************************************************************************/
    3435#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
    3537#include <iprt/thread.h>
     38
     39#include <iprt/assert.h>
    3640#include <iprt/err.h>
    3741
     
    4650RTDECL(int) RTThreadSleep(unsigned cMillies)
    4751{
     52    RT_ASSERT_PREEMPTIBLE();
    4853    uint64_t u64Deadline;
    4954    clock_interval_to_deadline(cMillies, kMillisecondScale, &u64Deadline);
     
    5560RTDECL(bool) RTThreadYield(void)
    5661{
     62    RT_ASSERT_PREEMPTIBLE();
    5763    thread_block(THREAD_CONTINUE_NULL);
    5864    return true; /* this is fishy */
  • trunk/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp

    r8245 r22052  
    2929 */
    3030
     31
    3132/*******************************************************************************
    3233*   Header Files                                                               *
    3334*******************************************************************************/
    3435#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
    3537#include <iprt/thread.h>
     38
     39#include <iprt/asm.h>
     40#include <iprt/assert.h>
    3641#include <iprt/err.h>
    37 #include <iprt/assert.h>
    3842#include "internal/thread.h"
    3943
     
    102106            return VERR_INVALID_PARAMETER;
    103107    }
     108    RT_ASSERT_INTS_ON();
    104109
    105110    /*
     
    156161int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
    157162{
     163    RT_ASSERT_PREEMPTIBLE();
     164
    158165    thread_t NativeThread;
    159166    kern_return_t kr = kernel_thread_start(rtThreadNativeMain, pThreadInt, &NativeThread);
  • trunk/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp

    r21536 r22052  
    3434*******************************************************************************/
    3535#include "the-darwin-kernel.h"
     36#include "internal/iprt.h"
    3637#include <iprt/thread.h>
    3738
     
    191192{
    192193    Assert(hThread == NIL_RTTHREAD); NOREF(hThread);
    193     /** @todo Solaris: Implement RTThreadIsInInterrupt. Required for guest
     194    /** @todo Darwin: Implement RTThreadIsInInterrupt. Required for guest
    194195     *        additions! */
    195196    return !ASMIntAreEnabled();
  • trunk/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp

    r16332 r22052  
    3535#define LOG_GROUP RTLOGGROUP_TIME
    3636#include "the-darwin-kernel.h"
     37#include "internal/iprt.h"
    3738#include <iprt/time.h>
     39
    3840#include <iprt/asm.h>
    3941
  • trunk/src/VBox/Runtime/r0drv/initterm-r0drv.cpp

    r21337 r22052  
    3939#include <iprt/assert.h>
    4040#include <iprt/err.h>
     41#include <iprt/mp.h>
     42#include <iprt/thread.h>
    4143#ifndef IN_GUEST /* play safe for now */
    4244# include "r0drv/mp-r0drv.h"
     
    6870    int rc;
    6971    Assert(fReserved == 0);
     72    RT_ASSERT_PREEMPTIBLE();
    7073
    7174    /*
     
    106109RTR0DECL(void) RTR0Term(void)
    107110{
     111    int32_t cNewUsers;
     112    RT_ASSERT_PREEMPTIBLE();
     113
    108114    /*
    109115     * Last user does the cleanup.
    110116     */
    111     int32_t cNewUsers = ASMAtomicDecS32(&g_crtR0Users);
     117    cNewUsers = ASMAtomicDecS32(&g_crtR0Users);
    112118    Assert(cNewUsers >= 0);
    113119    if (cNewUsers != 0)
  • trunk/src/VBox/Runtime/r0drv/memobj-r0drv.cpp

    r21337 r22052  
    4242#include <iprt/err.h>
    4343#include <iprt/log.h>
     44#include <iprt/mp.h>
    4445#include <iprt/param.h>
    4546#include <iprt/process.h>
     47#include <iprt/thread.h>
    4648
    4749#include "internal/memobj.h"
     
    318320    AssertReturn(pMem->u32Magic == RTR0MEMOBJ_MAGIC, VERR_INVALID_HANDLE);
    319321    AssertReturn(pMem->enmType > RTR0MEMOBJTYPE_INVALID && pMem->enmType < RTR0MEMOBJTYPE_END, VERR_INVALID_HANDLE);
     322    RT_ASSERT_PREEMPTIBLE();
    320323
    321324    /*
     
    424427    AssertReturn(cb > 0, VERR_INVALID_PARAMETER);
    425428    AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER);
     429    RT_ASSERT_PREEMPTIBLE();
    426430
    427431    /* do the allocation. */
     
    449453    AssertReturn(cb > 0, VERR_INVALID_PARAMETER);
    450454    AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER);
     455    RT_ASSERT_PREEMPTIBLE();
    451456
    452457    /* do the allocation. */
     
    474479    AssertReturn(cb > 0, VERR_INVALID_PARAMETER);
    475480    AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER);
     481    RT_ASSERT_PREEMPTIBLE();
    476482
    477483    /* do the allocation. */
     
    509515    if (R0Process == NIL_RTR0PROCESS)
    510516        R0Process = RTR0ProcHandleSelf();
     517    RT_ASSERT_PREEMPTIBLE();
    511518
    512519    /* do the locking. */
     
    536543    AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER);
    537544    AssertPtrReturn(pvAligned, VERR_INVALID_POINTER);
     545    RT_ASSERT_PREEMPTIBLE();
    538546
    539547    /* do the allocation. */
     
    561569    AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER);
    562570    AssertReturn(PhysHighest >= cb, VERR_INVALID_PARAMETER);
     571    RT_ASSERT_PREEMPTIBLE();
    563572
    564573    /* do the allocation. */
     
    586595    AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER);
    587596    AssertReturn(PhysHighest >= cb, VERR_INVALID_PARAMETER);
     597    RT_ASSERT_PREEMPTIBLE();
    588598
    589599    /* do the allocation. */
     
    614624    AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER);
    615625    AssertReturn(Phys != NIL_RTHCPHYS, VERR_INVALID_PARAMETER);
     626    RT_ASSERT_PREEMPTIBLE();
    616627
    617628    /* do the allocation. */
     
    644655    if (pvFixed != (void *)-1)
    645656        AssertReturn(!((uintptr_t)pvFixed & (uAlignment - 1)), VERR_INVALID_PARAMETER);
     657    RT_ASSERT_PREEMPTIBLE();
    646658
    647659    /* do the reservation. */
     
    677689    if (R0Process == NIL_RTR0PROCESS)
    678690        R0Process = RTR0ProcHandleSelf();
     691    RT_ASSERT_PREEMPTIBLE();
    679692
    680693    /* do the reservation. */
     
    754767    AssertReturn(cbSub <= pMemToMap->cb, VERR_INVALID_PARAMETER);
    755768    AssertReturn((!offSub && !cbSub) || (offSub + cbSub) <= pMemToMap->cb, VERR_INVALID_PARAMETER);
     769    RT_ASSERT_PREEMPTIBLE();
    756770
    757771    /* adjust the request to simplify the native code. */
     
    818832    if (R0Process == NIL_RTR0PROCESS)
    819833        R0Process = RTR0ProcHandleSelf();
     834    RT_ASSERT_PREEMPTIBLE();
    820835
    821836    /* do the mapping. */
     
    860875    AssertReturn(offSub + cbSub <= pMemObj->cb, VERR_INVALID_PARAMETER);
    861876    AssertReturn(!(fProt & ~(RTMEM_PROT_NONE | RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC)), VERR_INVALID_PARAMETER);
     877    RT_ASSERT_PREEMPTIBLE();
    862878
    863879    /* do the job */
  • trunk/src/VBox/Runtime/r0drv/mpnotification-r0drv.c

    r21337 r22052  
    4242#include <iprt/spinlock.h>
    4343#include <iprt/string.h>
     44#include <iprt/thread.h>
    4445#include "r0drv/mp-r0drv.h"
    4546
     
    174175    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
    175176    AssertReturn(g_hRTMpNotifySpinLock != NIL_RTSPINLOCK, VERR_WRONG_ORDER);
     177    RT_ASSERT_PREEMPTIBLE();
    176178
    177179    RTSpinlockAcquire(g_hRTMpNotifySpinLock, &Tmp);
     
    241243    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
    242244    AssertReturn(g_hRTMpNotifySpinLock != NIL_RTSPINLOCK, VERR_WRONG_ORDER);
     245    RT_ASSERT_INTS_ON();
    243246
    244247    /*
  • trunk/src/VBox/Runtime/r0drv/powernotification-r0drv.c

    r21337 r22052  
    4242#include <iprt/spinlock.h>
    4343#include <iprt/string.h>
     44#include <iprt/thread.h>
    4445#include "r0drv/mp-r0drv.h"
    4546#include "r0drv/power-r0drv.h"
     
    170171    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
    171172    AssertReturn(g_hRTPowerNotifySpinLock != NIL_RTSPINLOCK, VERR_WRONG_ORDER);
     173    RT_ASSERT_PREEMPTIBLE();
    172174
    173175    RTSpinlockAcquire(g_hRTPowerNotifySpinLock, &Tmp);
     
    237239    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
    238240    AssertReturn(g_hRTPowerNotifySpinLock != NIL_RTSPINLOCK, VERR_WRONG_ORDER);
     241    RT_ASSERT_INTS_ON();
    239242
    240243    /*
  • trunk/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c

    r21995 r22052  
    2929 */
    3030
     31
    3132/*******************************************************************************
    3233*   Header Files                                                               *
    3334*******************************************************************************/
    3435#include "the-solaris-kernel.h"
    35 
     36#include "internal/iprt.h"
    3637#include <iprt/semaphore.h>
     38
    3739#include <iprt/alloc.h>
    3840#include <iprt/assert.h>
    3941#include <iprt/asm.h>
    4042#include <iprt/err.h>
    41 
     43#include <iprt/mp.h>
     44#include <iprt/thread.h>
    4245#include "internal/magics.h"
    4346
     
    9699                    ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic),
    97100                    VERR_INVALID_HANDLE);
     101    RT_ASSERT_INTS_ON();
    98102
    99103    mutex_enter(&pEventInt->Mtx);
     
    125129RTDECL(int)  RTSemEventSignal(RTSEMEVENT EventSem)
    126130{
    127 #ifdef RT_STRICT
    128     bool fInts = ASMIntAreEnabled();
    129 #endif
    130131    PRTSEMEVENTINTERNAL pEventInt = (PRTSEMEVENTINTERNAL)EventSem;
     132    RT_ASSERT_PREEMPT_CPUID_VAR();
    131133    AssertPtrReturn(pEventInt, VERR_INVALID_HANDLE);
    132134    AssertMsgReturn(pEventInt->u32Magic == RTSEMEVENT_MAGIC,
    133135                    ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic),
    134136                    VERR_INVALID_HANDLE);
     137    RT_ASSERT_INTS_ON();
    135138
    136139    mutex_enter(&pEventInt->Mtx);
     
    147150    mutex_exit(&pEventInt->Mtx);
    148151
    149 #ifdef RT_STRICT
    150     AssertMsg(fInts == ASMIntAreEnabled(), ("%d\n", fInts));
    151 #endif
     152    RT_ASSERT_PREEMPT_CPUID();
    152153    return VINF_SUCCESS;
    153154}
     155
    154156
    155157static int rtSemEventWait(RTSEMEVENT EventSem, unsigned cMillies, bool fInterruptible)
     
    161163                    ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic),
    162164                    VERR_INVALID_HANDLE);
     165    RT_ASSERT_PREEMPTIBLE();
    163166
    164167    mutex_enter(&pEventInt->Mtx);
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