Changeset 22052 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Aug 7, 2009 9:45:48 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50790
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/include/internal/iprt.h
r21355 r22052 52 52 #endif 53 53 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 54 99 #endif 55 100 -
trunk/src/VBox/Runtime/r0drv/alloc-r0drv.cpp
r21337 r22052 36 36 #include "internal/iprt.h" 37 37 38 #include <iprt/ string.h>38 #include <iprt/asm.h> 39 39 #include <iprt/assert.h> 40 40 #include <iprt/param.h> 41 #include <iprt/string.h> 42 #include <iprt/thread.h> 41 43 #include "r0drv/alloc-r0drv.h" 42 44 … … 126 128 RTDECL(void *) RTMemAlloc(size_t cb) RT_NO_THROW 127 129 { 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); 129 134 if (pHdr) 130 135 { … … 153 158 RTDECL(void *) RTMemAllocZ(size_t cb) RT_NO_THROW 154 159 { 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); 156 164 if (pHdr) 157 165 { … … 186 194 { 187 195 PRTMEMHDR pHdrOld = (PRTMEMHDR)pvOld - 1; 196 RT_ASSERT_PREEMPTIBLE(); 197 188 198 if (pHdrOld->u32Magic == RTMEMHDR_MAGIC) 189 199 { … … 228 238 { 229 239 PRTMEMHDR pHdr; 240 RT_ASSERT_INTS_ON(); 241 230 242 if (!pv) 231 243 return; … … 260 272 RTDECL(void *) RTMemExecAlloc(size_t cb) RT_NO_THROW 261 273 { 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); 263 278 if (pHdr) 264 279 { … … 282 297 { 283 298 PRTMEMHDR pHdr; 299 RT_ASSERT_INTS_ON(); 300 284 301 if (!pv) 285 302 return; -
trunk/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp
r8245 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 36 37 #include <iprt/log.h> 37 #include <iprt/assert.h>38 38 39 39 40 40 RTDECL(void) RTLogWriteDebugger(const char *pch, size_t cb) 41 41 { 42 kprintf("%.*s", cb, pch);42 kprintf("%.*s", (int)cb, pch); 43 43 return; 44 44 } -
trunk/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp
r10608 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 36 37 #include <iprt/log.h> 37 #include <iprt/assert.h>38 38 39 39 40 40 RTDECL(void) RTLogWriteStdOut(const char *pch, size_t cb) 41 41 { 42 printf("%.*s", cb, pch);42 printf("%.*s", (int)cb, pch); 43 43 return; 44 44 } -
trunk/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp
r8245 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 37 #include <iprt/mem.h> 36 38 37 #include <iprt/alloc.h>38 39 #include <iprt/assert.h> 40 #include <iprt/thread.h> 39 41 #include "r0drv/alloc-r0drv.h" 40 42 … … 54 56 } 55 57 else 56 printf("rmMemAlloc(%# x, %#x) failed\n", cb + sizeof(*pHdr), fFlags);58 printf("rmMemAlloc(%#zx, %#x) failed\n", cb + sizeof(*pHdr), fFlags); 57 59 return pHdr; 58 60 } … … 76 78 AssertPtr(pPhys); 77 79 Assert(cb > 0); 80 RT_ASSERT_PREEMPTIBLE(); 78 81 79 82 /* … … 105 108 RTR0DECL(void) RTMemContFree(void *pv, size_t cb) 106 109 { 110 RT_ASSERT_PREEMPTIBLE(); 107 111 if (pv) 108 112 { -
trunk/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp
r14500 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 37 #include <iprt/assert.h> 36 38 37 #include <iprt/as sert.h>39 #include <iprt/asm.h> 38 40 #include <iprt/log.h> 41 #include <iprt/stdarg.h> 39 42 #include <iprt/string.h> 40 #include <iprt/stdarg.h>41 #include <iprt/asm.h>42 43 43 44 -
trunk/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp
r19919 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 37 36 38 #include <iprt/err.h> 37 39 #include <iprt/assert.h> -
trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
r21497 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 36 #include "internal/iprt.h" 37 37 #include <iprt/memobj.h> 38 38 … … 45 45 #include <iprt/string.h> 46 46 #include <iprt/thread.h> 47 48 47 #include "internal/memobj.h" 49 48 -
trunk/src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp
r21284 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 37 #include <iprt/mem.h> 36 38 37 #include <iprt/ mem.h>39 #include <iprt/asm.h> 38 40 #include <iprt/err.h> 39 41 … … 41 43 RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_t cb) 42 44 { 45 RT_ASSERT_INTS_ON(); 43 46 int rc = copyin((const user_addr_t)R3PtrSrc, pvDst, cb); 44 47 if (RT_LIKELY(rc == 0)) … … 50 53 RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb) 51 54 { 55 RT_ASSERT_INTS_ON(); 52 56 int rc = copyout(pvSrc, R3PtrDst, cb); 53 57 if (RT_LIKELY(rc == 0)) -
trunk/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp
r19389 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 36 #include "internal/iprt.h" 37 37 #include <iprt/mp.h> 38 39 #include <iprt/asm.h> 38 40 #include <iprt/cpuset.h> 39 41 #include <iprt/err.h> 40 #include <iprt/asm.h>41 42 #include "r0drv/mp-r0drv.h" 42 43 44 45 /******************************************************************************* 46 * Defined Constants And Macros * 47 *******************************************************************************/ 43 48 #define MY_DARWIN_MAX_CPUS (0xf + 1) /* see MAX_CPUS */ 44 49 … … 202 207 RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 203 208 { 209 RT_ASSERT_INTS_ON(); 210 204 211 RTMPARGS Args; 205 212 Args.pfnWorker = pfnWorker; … … 230 237 RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 231 238 { 239 RT_ASSERT_INTS_ON(); 240 232 241 int rc; 233 242 RTMPARGS Args; … … 262 271 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 263 272 { 273 RT_ASSERT_INTS_ON(); 274 264 275 int rc; 265 276 RTMPARGS Args; … … 278 289 RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) 279 290 { 291 RT_ASSERT_INTS_ON(); 292 280 293 /* no unicast IPI */ 281 294 return VERR_NOT_SUPPORTED; -
trunk/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp
r8245 r22052 29 29 */ 30 30 31 31 32 /******************************************************************************* 32 33 * Header Files * 33 34 *******************************************************************************/ 34 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 35 37 #include <iprt/process.h> 36 38 -
trunk/src/VBox/Runtime/r0drv/darwin/semaphore-r0drv-darwin.cpp
r21537 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 36 #include "internal/iprt.h" 37 37 #include <iprt/semaphore.h> 38 38 39 #include <iprt/alloc.h> 39 40 #include <iprt/assert.h> 40 41 #include <iprt/asm.h> 41 42 #include <iprt/err.h> 43 #include <iprt/mp.h> 44 #include <iprt/thread.h> 42 45 43 46 #include "internal/magics.h" … … 115 118 Assert(sizeof(RTSEMEVENTINTERNAL) > sizeof(void *)); 116 119 AssertPtrReturn(pEventSem, VERR_INVALID_POINTER); 120 RT_ASSERT_PREEMPTIBLE(); 117 121 118 122 PRTSEMEVENTINTERNAL pEventInt = (PRTSEMEVENTINTERNAL)RTMemAlloc(sizeof(*pEventInt)); … … 147 151 ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic), 148 152 VERR_INVALID_HANDLE); 153 RT_ASSERT_INTS_ON(); 149 154 150 155 lck_spin_lock(pEventInt->pSpinlock); … … 178 183 ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic), 179 184 VERR_INVALID_HANDLE); 185 RT_ASSERT_PREEMPT_CPUID_VAR(); 186 RT_ASSERT_INTS_ON(); 180 187 181 188 /** @todo should probably disable interrupts here... update … … 188 195 ASMAtomicIncU32(&pEventInt->cWaking); 189 196 thread_wakeup_prim((event_t)pEventInt, TRUE /* one thread */, THREAD_AWAKENED); 190 197 /** @todo this isn't safe. a scheduling interrupt on the other cpu while we're in here 191 198 * could cause the thread to be timed out before we manage to wake it up and the event 192 199 * ends up in the wrong state. ditto for posix signals. 193 200 * Update: check the return code; it will return KERN_NOT_WAITING if no one is around. */ 194 201 } 195 202 else … … 197 204 198 205 lck_spin_unlock(pEventInt->pSpinlock); 206 207 RT_ASSERT_PREEMPT_CPUID(); 199 208 return VINF_SUCCESS; 200 209 } … … 208 217 ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic), 209 218 VERR_INVALID_HANDLE); 210 219 RT_ASSERT_PREEMPTIBLE(); 220 211 221 lck_spin_lock(pEventInt->pSpinlock); 212 222 … … 306 316 Assert(sizeof(RTSEMEVENTMULTIINTERNAL) > sizeof(void *)); 307 317 AssertPtrReturn(pEventMultiSem, VERR_INVALID_POINTER); 318 RT_ASSERT_PREEMPTIBLE(); 308 319 309 320 PRTSEMEVENTMULTIINTERNAL pEventMultiInt = (PRTSEMEVENTMULTIINTERNAL)RTMemAlloc(sizeof(*pEventMultiInt)); … … 338 349 ("pEventMultiInt=%p u32Magic=%#x\n", pEventMultiInt, pEventMultiInt->u32Magic), 339 350 VERR_INVALID_HANDLE); 351 RT_ASSERT_INTS_ON(); 340 352 341 353 lck_spin_lock(pEventMultiInt->pSpinlock); … … 369 381 ("pEventMultiInt=%p u32Magic=%#x\n", pEventMultiInt, pEventMultiInt->u32Magic), 370 382 VERR_INVALID_HANDLE); 383 RT_ASSERT_PREEMPT_CPUID_VAR(); 384 RT_ASSERT_INTS_ON(); 371 385 372 386 lck_spin_lock(pEventMultiInt->pSpinlock); … … 381 395 382 396 lck_spin_unlock(pEventMultiInt->pSpinlock); 397 398 RT_ASSERT_PREEMPT_CPUID(); 383 399 return VINF_SUCCESS; 384 400 } … … 407 423 ("pEventMultiInt=%p u32Magic=%#x\n", pEventMultiInt, pEventMultiInt->u32Magic), 408 424 VERR_INVALID_HANDLE); 425 RT_ASSERT_PREEMPTIBLE(); 409 426 410 427 lck_spin_lock(pEventMultiInt->pSpinlock); … … 502 519 RTDECL(int) RTSemMutexCreate(PRTSEMMUTEX pMutexSem) 503 520 { 521 RT_ASSERT_PREEMPTIBLE(); 504 522 AssertCompile(sizeof(RTSEMMUTEXINTERNAL) > sizeof(void *)); 505 523 PRTSEMMUTEXINTERNAL pMutexInt = (PRTSEMMUTEXINTERNAL)RTMemAlloc(sizeof(*pMutexInt)); … … 532 550 ("pMutexInt->u32Magic=%RX32 pMutexInt=%p\n", pMutexInt->u32Magic, pMutexInt) 533 551 VERR_INVALID_PARAMETER); 552 RT_ASSERT_INTS_ON(); 534 553 535 554 /* … … 559 578 ("pMutexInt->u32Magic=%RX32 pMutexInt=%p\n", pMutexInt->u32Magic, pMutexInt) 560 579 VERR_INVALID_PARAMETER); 580 RT_ASSERT_PREEMPTIBLE(); 561 581 562 582 /* … … 611 631 return VERR_INVALID_PARAMETER; 612 632 } 633 RT_ASSERT_PREEMPTIBLE(); 613 634 614 635 /* … … 632 653 AssertCompile(sizeof(RTSEMFASTMUTEXINTERNAL) > sizeof(void *)); 633 654 AssertPtrReturn(pMutexSem, VERR_INVALID_POINTER); 655 RT_ASSERT_PREEMPTIBLE(); 634 656 635 657 PRTSEMFASTMUTEXINTERNAL pFastInt = (PRTSEMFASTMUTEXINTERNAL)RTMemAlloc(sizeof(*pFastInt)); … … 660 682 ("pFastInt->u32Magic=%RX32 pFastInt=%p\n", pFastInt->u32Magic, pFastInt), 661 683 VERR_INVALID_PARAMETER); 684 RT_ASSERT_INTS_ON(); 662 685 663 686 ASMAtomicIncU32(&pFastInt->u32Magic); /* make the handle invalid. */ … … 678 701 ("pFastInt->u32Magic=%RX32 pFastInt=%p\n", pFastInt->u32Magic, pFastInt), 679 702 VERR_INVALID_PARAMETER); 703 RT_ASSERT_PREEMPTIBLE(); 680 704 lck_mtx_lock(pFastInt->pMtx); 681 705 return VINF_SUCCESS; … … 690 714 ("pFastInt->u32Magic=%RX32 pFastInt=%p\n", pFastInt->u32Magic, pFastInt), 691 715 VERR_INVALID_PARAMETER); 716 RT_ASSERT_PREEMPTIBLE(); 692 717 lck_mtx_unlock(pFastInt->pMtx); 693 718 return VINF_SUCCESS; -
trunk/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp
r8245 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 36 37 #include <iprt/spinlock.h> 37 #include <iprt/err.h> 38 #include <iprt/alloc.h> 38 39 39 #include <iprt/assert.h> 40 40 #include <iprt/asm.h> 41 #include <iprt/err.h> 42 #include <iprt/mem.h> 43 #include <iprt/thread.h> 41 44 42 45 #include "internal/magics.h" … … 61 64 RTDECL(int) RTSpinlockCreate(PRTSPINLOCK pSpinlock) 62 65 { 66 RT_ASSERT_PREEMPTIBLE(); 67 63 68 /* 64 69 * Allocate. -
trunk/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp
r8245 r22052 29 29 */ 30 30 31 31 32 /******************************************************************************* 32 33 * Header Files * 33 34 *******************************************************************************/ 34 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 35 37 #include <iprt/thread.h> 38 39 #include <iprt/assert.h> 36 40 #include <iprt/err.h> 37 41 … … 46 50 RTDECL(int) RTThreadSleep(unsigned cMillies) 47 51 { 52 RT_ASSERT_PREEMPTIBLE(); 48 53 uint64_t u64Deadline; 49 54 clock_interval_to_deadline(cMillies, kMillisecondScale, &u64Deadline); … … 55 60 RTDECL(bool) RTThreadYield(void) 56 61 { 62 RT_ASSERT_PREEMPTIBLE(); 57 63 thread_block(THREAD_CONTINUE_NULL); 58 64 return true; /* this is fishy */ -
trunk/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp
r8245 r22052 29 29 */ 30 30 31 31 32 /******************************************************************************* 32 33 * Header Files * 33 34 *******************************************************************************/ 34 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 35 37 #include <iprt/thread.h> 38 39 #include <iprt/asm.h> 40 #include <iprt/assert.h> 36 41 #include <iprt/err.h> 37 #include <iprt/assert.h>38 42 #include "internal/thread.h" 39 43 … … 102 106 return VERR_INVALID_PARAMETER; 103 107 } 108 RT_ASSERT_INTS_ON(); 104 109 105 110 /* … … 156 161 int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) 157 162 { 163 RT_ASSERT_PREEMPTIBLE(); 164 158 165 thread_t NativeThread; 159 166 kern_return_t kr = kernel_thread_start(rtThreadNativeMain, pThreadInt, &NativeThread); -
trunk/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp
r21536 r22052 34 34 *******************************************************************************/ 35 35 #include "the-darwin-kernel.h" 36 #include "internal/iprt.h" 36 37 #include <iprt/thread.h> 37 38 … … 191 192 { 192 193 Assert(hThread == NIL_RTTHREAD); NOREF(hThread); 193 /** @todo Solaris: Implement RTThreadIsInInterrupt. Required for guest194 /** @todo Darwin: Implement RTThreadIsInInterrupt. Required for guest 194 195 * additions! */ 195 196 return !ASMIntAreEnabled(); -
trunk/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp
r16332 r22052 35 35 #define LOG_GROUP RTLOGGROUP_TIME 36 36 #include "the-darwin-kernel.h" 37 #include "internal/iprt.h" 37 38 #include <iprt/time.h> 39 38 40 #include <iprt/asm.h> 39 41 -
trunk/src/VBox/Runtime/r0drv/initterm-r0drv.cpp
r21337 r22052 39 39 #include <iprt/assert.h> 40 40 #include <iprt/err.h> 41 #include <iprt/mp.h> 42 #include <iprt/thread.h> 41 43 #ifndef IN_GUEST /* play safe for now */ 42 44 # include "r0drv/mp-r0drv.h" … … 68 70 int rc; 69 71 Assert(fReserved == 0); 72 RT_ASSERT_PREEMPTIBLE(); 70 73 71 74 /* … … 106 109 RTR0DECL(void) RTR0Term(void) 107 110 { 111 int32_t cNewUsers; 112 RT_ASSERT_PREEMPTIBLE(); 113 108 114 /* 109 115 * Last user does the cleanup. 110 116 */ 111 int32_tcNewUsers = ASMAtomicDecS32(&g_crtR0Users);117 cNewUsers = ASMAtomicDecS32(&g_crtR0Users); 112 118 Assert(cNewUsers >= 0); 113 119 if (cNewUsers != 0) -
trunk/src/VBox/Runtime/r0drv/memobj-r0drv.cpp
r21337 r22052 42 42 #include <iprt/err.h> 43 43 #include <iprt/log.h> 44 #include <iprt/mp.h> 44 45 #include <iprt/param.h> 45 46 #include <iprt/process.h> 47 #include <iprt/thread.h> 46 48 47 49 #include "internal/memobj.h" … … 318 320 AssertReturn(pMem->u32Magic == RTR0MEMOBJ_MAGIC, VERR_INVALID_HANDLE); 319 321 AssertReturn(pMem->enmType > RTR0MEMOBJTYPE_INVALID && pMem->enmType < RTR0MEMOBJTYPE_END, VERR_INVALID_HANDLE); 322 RT_ASSERT_PREEMPTIBLE(); 320 323 321 324 /* … … 424 427 AssertReturn(cb > 0, VERR_INVALID_PARAMETER); 425 428 AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER); 429 RT_ASSERT_PREEMPTIBLE(); 426 430 427 431 /* do the allocation. */ … … 449 453 AssertReturn(cb > 0, VERR_INVALID_PARAMETER); 450 454 AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER); 455 RT_ASSERT_PREEMPTIBLE(); 451 456 452 457 /* do the allocation. */ … … 474 479 AssertReturn(cb > 0, VERR_INVALID_PARAMETER); 475 480 AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER); 481 RT_ASSERT_PREEMPTIBLE(); 476 482 477 483 /* do the allocation. */ … … 509 515 if (R0Process == NIL_RTR0PROCESS) 510 516 R0Process = RTR0ProcHandleSelf(); 517 RT_ASSERT_PREEMPTIBLE(); 511 518 512 519 /* do the locking. */ … … 536 543 AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER); 537 544 AssertPtrReturn(pvAligned, VERR_INVALID_POINTER); 545 RT_ASSERT_PREEMPTIBLE(); 538 546 539 547 /* do the allocation. */ … … 561 569 AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER); 562 570 AssertReturn(PhysHighest >= cb, VERR_INVALID_PARAMETER); 571 RT_ASSERT_PREEMPTIBLE(); 563 572 564 573 /* do the allocation. */ … … 586 595 AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER); 587 596 AssertReturn(PhysHighest >= cb, VERR_INVALID_PARAMETER); 597 RT_ASSERT_PREEMPTIBLE(); 588 598 589 599 /* do the allocation. */ … … 614 624 AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER); 615 625 AssertReturn(Phys != NIL_RTHCPHYS, VERR_INVALID_PARAMETER); 626 RT_ASSERT_PREEMPTIBLE(); 616 627 617 628 /* do the allocation. */ … … 644 655 if (pvFixed != (void *)-1) 645 656 AssertReturn(!((uintptr_t)pvFixed & (uAlignment - 1)), VERR_INVALID_PARAMETER); 657 RT_ASSERT_PREEMPTIBLE(); 646 658 647 659 /* do the reservation. */ … … 677 689 if (R0Process == NIL_RTR0PROCESS) 678 690 R0Process = RTR0ProcHandleSelf(); 691 RT_ASSERT_PREEMPTIBLE(); 679 692 680 693 /* do the reservation. */ … … 754 767 AssertReturn(cbSub <= pMemToMap->cb, VERR_INVALID_PARAMETER); 755 768 AssertReturn((!offSub && !cbSub) || (offSub + cbSub) <= pMemToMap->cb, VERR_INVALID_PARAMETER); 769 RT_ASSERT_PREEMPTIBLE(); 756 770 757 771 /* adjust the request to simplify the native code. */ … … 818 832 if (R0Process == NIL_RTR0PROCESS) 819 833 R0Process = RTR0ProcHandleSelf(); 834 RT_ASSERT_PREEMPTIBLE(); 820 835 821 836 /* do the mapping. */ … … 860 875 AssertReturn(offSub + cbSub <= pMemObj->cb, VERR_INVALID_PARAMETER); 861 876 AssertReturn(!(fProt & ~(RTMEM_PROT_NONE | RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC)), VERR_INVALID_PARAMETER); 877 RT_ASSERT_PREEMPTIBLE(); 862 878 863 879 /* do the job */ -
trunk/src/VBox/Runtime/r0drv/mpnotification-r0drv.c
r21337 r22052 42 42 #include <iprt/spinlock.h> 43 43 #include <iprt/string.h> 44 #include <iprt/thread.h> 44 45 #include "r0drv/mp-r0drv.h" 45 46 … … 174 175 AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER); 175 176 AssertReturn(g_hRTMpNotifySpinLock != NIL_RTSPINLOCK, VERR_WRONG_ORDER); 177 RT_ASSERT_PREEMPTIBLE(); 176 178 177 179 RTSpinlockAcquire(g_hRTMpNotifySpinLock, &Tmp); … … 241 243 AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER); 242 244 AssertReturn(g_hRTMpNotifySpinLock != NIL_RTSPINLOCK, VERR_WRONG_ORDER); 245 RT_ASSERT_INTS_ON(); 243 246 244 247 /* -
trunk/src/VBox/Runtime/r0drv/powernotification-r0drv.c
r21337 r22052 42 42 #include <iprt/spinlock.h> 43 43 #include <iprt/string.h> 44 #include <iprt/thread.h> 44 45 #include "r0drv/mp-r0drv.h" 45 46 #include "r0drv/power-r0drv.h" … … 170 171 AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER); 171 172 AssertReturn(g_hRTPowerNotifySpinLock != NIL_RTSPINLOCK, VERR_WRONG_ORDER); 173 RT_ASSERT_PREEMPTIBLE(); 172 174 173 175 RTSpinlockAcquire(g_hRTPowerNotifySpinLock, &Tmp); … … 237 239 AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER); 238 240 AssertReturn(g_hRTPowerNotifySpinLock != NIL_RTSPINLOCK, VERR_WRONG_ORDER); 241 RT_ASSERT_INTS_ON(); 239 242 240 243 /* -
trunk/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c
r21995 r22052 29 29 */ 30 30 31 31 32 /******************************************************************************* 32 33 * Header Files * 33 34 *******************************************************************************/ 34 35 #include "the-solaris-kernel.h" 35 36 #include "internal/iprt.h" 36 37 #include <iprt/semaphore.h> 38 37 39 #include <iprt/alloc.h> 38 40 #include <iprt/assert.h> 39 41 #include <iprt/asm.h> 40 42 #include <iprt/err.h> 41 43 #include <iprt/mp.h> 44 #include <iprt/thread.h> 42 45 #include "internal/magics.h" 43 46 … … 96 99 ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic), 97 100 VERR_INVALID_HANDLE); 101 RT_ASSERT_INTS_ON(); 98 102 99 103 mutex_enter(&pEventInt->Mtx); … … 125 129 RTDECL(int) RTSemEventSignal(RTSEMEVENT EventSem) 126 130 { 127 #ifdef RT_STRICT128 bool fInts = ASMIntAreEnabled();129 #endif130 131 PRTSEMEVENTINTERNAL pEventInt = (PRTSEMEVENTINTERNAL)EventSem; 132 RT_ASSERT_PREEMPT_CPUID_VAR(); 131 133 AssertPtrReturn(pEventInt, VERR_INVALID_HANDLE); 132 134 AssertMsgReturn(pEventInt->u32Magic == RTSEMEVENT_MAGIC, 133 135 ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic), 134 136 VERR_INVALID_HANDLE); 137 RT_ASSERT_INTS_ON(); 135 138 136 139 mutex_enter(&pEventInt->Mtx); … … 147 150 mutex_exit(&pEventInt->Mtx); 148 151 149 #ifdef RT_STRICT 150 AssertMsg(fInts == ASMIntAreEnabled(), ("%d\n", fInts)); 151 #endif 152 RT_ASSERT_PREEMPT_CPUID(); 152 153 return VINF_SUCCESS; 153 154 } 155 154 156 155 157 static int rtSemEventWait(RTSEMEVENT EventSem, unsigned cMillies, bool fInterruptible) … … 161 163 ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic), 162 164 VERR_INVALID_HANDLE); 165 RT_ASSERT_PREEMPTIBLE(); 163 166 164 167 mutex_enter(&pEventInt->Mtx);
Note:
See TracChangeset
for help on using the changeset viewer.