Changeset 22130 in vbox
- Timestamp:
- Aug 10, 2009 12:24:35 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50898
- Location:
- trunk/src/VBox/Runtime/r0drv
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c
r21349 r22130 35 35 #include "the-linux-kernel.h" 36 36 #include "internal/iprt.h" 37 #include <iprt/spinlock.h> 37 38 38 #include <iprt/spinlock.h>39 #include <iprt/err.h>40 #include <iprt/alloc.h>41 39 #include <iprt/assert.h> 42 40 #include <iprt/asm.h> 41 #include <iprt/err.h> 42 #include <iprt/mem.h> 43 #include <iprt/mp.h> 44 #include <iprt/thread.h> 43 45 #include "internal/magics.h" 44 46 … … 134 136 { 135 137 PRTSPINLOCKINTERNAL pSpinlockInt = (PRTSPINLOCKINTERNAL)Spinlock; 138 RT_ASSERT_PREEMPT_CPUID_VAR(); 136 139 AssertMsg(pSpinlockInt && pSpinlockInt->u32Magic == RTSPINLOCK_MAGIC, 137 140 ("pSpinlockInt=%p u32Magic=%08x\n", pSpinlockInt, pSpinlockInt ? (int)pSpinlockInt->u32Magic : 0)); … … 139 142 140 143 spin_lock(&pSpinlockInt->Spinlock); 144 145 #ifdef RT_MORE_STRICT 146 { 147 RTCPUID const idAssertCpuNow = RTMpCpuId(); /* Spinlocks are not preemptible, so we cannot be rescheduled. */ 148 AssertMsg(idAssertCpu == idAssertCpuNow || idAssertCpu == NIL_RTCPUID, ("%#x, %#x\n", idAssertCpu, idAssertCpuNow)); 149 pTmp->flFlags = idAssertCpuNow; 150 } 151 #endif 141 152 } 142 153 RT_EXPORT_SYMBOL(RTSpinlockAcquire); … … 146 157 { 147 158 PRTSPINLOCKINTERNAL pSpinlockInt = (PRTSPINLOCKINTERNAL)Spinlock; 159 #ifdef RT_MORE_STRICT 160 RTCPUID const idAssertCpu = pTmp->flFlags; 161 pTmp->flFlags = 0; 162 RT_ASSERT_PREEMPT_CPUID(); 163 #endif 148 164 AssertMsg(pSpinlockInt && pSpinlockInt->u32Magic == RTSPINLOCK_MAGIC, 149 165 ("pSpinlockInt=%p u32Magic=%08x\n", pSpinlockInt, pSpinlockInt ? (int)pSpinlockInt->u32Magic : 0)); … … 151 167 152 168 spin_unlock(&pSpinlockInt->Spinlock); 169 170 #ifdef RT_MORE_STRICT 171 if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD)) 172 RT_ASSERT_PREEMPT_CPUID(); 173 #endif 153 174 } 154 175 RT_EXPORT_SYMBOL(RTSpinlockRelease); -
trunk/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c
r22129 r22130 141 141 142 142 mutex_enter(&pSpinlockInt->Mtx); 143 RT_ASSERT_PREEMPT_CPUID(); 143 144 144 #ifdef RT_MORE_STRICT 145 /* Spinlocks are not preemptible, so we cannot be rescheduled. */ 146 pTmp->uFlags = idAssertCpu != NIL_RTCPUID ? idAssertCpu : RTMpCpuId(); 145 { 146 RTCPUID const idAssertCpuNow = RTMpCpuId(); /* Spinlocks are not preemptible, so we cannot be rescheduled. */ 147 AssertMsg(idAssertCpu == idAssertCpuNow || idAssertCpu == NIL_RTCPUID, ("%#x, %#x\n", idAssertCpu, idAssertCpuNow)); 148 pTmp->uFlags = idAssertCpuNow; 149 } 147 150 #endif 148 151 } … … 155 158 RTCPUID const idAssertCpu = pTmp->uFlags; 156 159 pTmp->uFlags = 0; 160 RT_ASSERT_PREEMPT_CPUID(); 157 161 #endif 158 162 AssertPtr(pSpinlockInt); 159 163 Assert(pSpinlockInt->u32Magic == RTSPINLOCK_MAGIC); 160 RT_ASSERT_PREEMPT_CPUID();161 164 NOREF(pTmp); 162 165 163 166 mutex_exit(&pSpinlockInt->Mtx); 167 168 #ifdef RT_MORE_STRICT 169 if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD)) 170 RT_ASSERT_PREEMPT_CPUID(); 171 #endif 164 172 } 165 173
Note:
See TracChangeset
for help on using the changeset viewer.