VirtualBox

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/r0drv/darwin
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • 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
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