Changeset 22150 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Aug 11, 2009 9:41:58 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50921
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/include/internal/iprt.h
r22139 r22150 131 131 #endif 132 132 133 /** @def RT_ASSERT_PREEMPT_CPUID_DISABLE 134 * For use in RTThreadPreemptDisable implementations after having disabled 135 * preemption. Requires iprt/mp.h. */ 136 #ifdef RT_MORE_STRICT 137 # define RT_ASSERT_PREEMPT_CPUID_DISABLE(pStat) \ 138 do \ 139 { \ 140 Assert((pStat)->idCpu == NIL_RTCPUID); \ 141 (pStat)->idCpu = RTMpCpuId(); \ 142 } while (0) 143 #else 144 # define RT_ASSERT_PREEMPT_CPUID_DISABLE(pStat) \ 145 Assert((pStat)->idCpu == NIL_RTCPUID) 146 #endif 147 148 /** @def RT_ASSERT_PREEMPT_CPUID_RESTORE 149 * For use in RTThreadPreemptRestore implementations before restoring 150 * preemption. Requires iprt/mp.h. */ 151 #ifdef RT_MORE_STRICT 152 # define RT_ASSERT_PREEMPT_CPUID_RESTORE(pStat) \ 153 do \ 154 { \ 155 RTCPUID const idAssertCpuNow = RTMpCpuId(); \ 156 AssertMsg((pStat)->idCpu == idAssertCpuNow, ("%#x, %#x\n", (pStat)->idCpu, idAssertCpuNow)); \ 157 (pStat)->idCpu = NIL_RTCPUID; \ 158 } while (0) 159 #else 160 # define RT_ASSERT_PREEMPT_CPUID_RESTORE(pStat) do { } while (0) 161 #endif 162 163 133 164 /** @def RT_ASSERT_INTS_ON 134 165 * Asserts that interrupts are disabled when RT_MORE_STRICT is defined. */ -
trunk/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp
r22052 r22150 141 141 { 142 142 AssertPtr(pState); 143 Assert(pState->u chDummy != 42);144 pState->u chDummy= 42;143 Assert(pState->u32Reserved == 0); 144 pState->u32Reserved = 42; 145 145 146 146 /* … … 164 164 ASMSetFlags(fSavedFlags); 165 165 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 166 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState); 166 167 } 167 168 … … 170 171 { 171 172 AssertPtr(pState); 172 Assert(pState->uchDummy == 42); 173 pState->uchDummy = 0; 173 Assert(pState->u32Reserved == 42); 174 pState->u32Reserved = 0; 175 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState); 174 176 175 177 RTCPUID idCpu = RTMpCpuId(); -
trunk/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c
r21536 r22150 143 143 { 144 144 AssertPtr(pState); 145 Assert(pState->u chDummy != 42);146 pState->u chDummy= 42;145 Assert(pState->u32Reserved == 0); 146 pState->u32Reserved = 42; 147 147 148 148 critical_enter(); 149 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState); 149 150 } 150 151 … … 153 154 { 154 155 AssertPtr(pState); 155 Assert(pState->u chDummy== 42);156 pState->u chDummy= 0;156 Assert(pState->u32Reserved == 42); 157 pState->u32Reserved = 0; 157 158 159 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState); 158 160 critical_exit(); 159 161 } -
trunk/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp
r21337 r22150 42 42 { 43 43 AssertPtr(pState); 44 Assert(pState->u chDummy != 42);45 pState->u chDummy= 42;44 Assert(pState->u32Reserved == 0); 45 pState->u32Reserved = 42; 46 46 } 47 47 RT_EXPORT_SYMBOL(RTThreadPreemptDisable); -
trunk/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp
r21337 r22150 42 42 { 43 43 AssertPtr(pState); 44 Assert(pState->u chDummy== 42);45 pState->u chDummy= 0;44 Assert(pState->u32Reserved == 42); 45 pState->u32Reserved = 0; 46 46 } 47 47 RT_EXPORT_SYMBOL(RTThreadPreemptRestore); -
trunk/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
r22057 r22150 35 35 #include "the-linux-kernel.h" 36 36 #include "internal/iprt.h" 37 38 37 #include <iprt/thread.h> 38 39 39 #include <iprt/asm.h> 40 40 #include <iprt/assert.h> 41 41 #include <iprt/err.h> 42 #include <iprt/mp.h> 42 43 43 44 … … 160 161 #ifdef CONFIG_PREEMPT 161 162 AssertPtr(pState); 162 Assert(pState->u chDummy != 42);163 pState->u chDummy= 42;163 Assert(pState->u32Reserved == 0); 164 pState->u32Reserved = 42; 164 165 preempt_disable(); 166 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState); 165 167 166 168 #else /* !CONFIG_PREEMPT */ 167 169 int32_t c; 168 170 AssertPtr(pState); 171 Assert(pState->u32Reserved == 0); 169 172 170 173 /* Do our own accounting. */ 171 174 c = ASMAtomicIncS32(&g_acPreemptDisabled[smp_processor_id()]); 172 175 AssertMsg(c > 0 && c < 32, ("%d\n", c)); 173 pState->uchDummy = (unsigned char )c; 176 pState->u32Reserved = c; 177 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState); 174 178 #endif 175 179 } … … 181 185 #ifdef CONFIG_PREEMPT 182 186 AssertPtr(pState); 183 Assert(pState->u chDummy== 42);184 pState->uchDummy = 0;187 Assert(pState->u32Reserved == 42); 188 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState); 185 189 preempt_enable(); 186 190 … … 188 192 int32_t volatile *pc; 189 193 AssertPtr(pState); 190 AssertMsg(pState->uchDummy > 0 && pState->uchDummy < 32, ("%d\n", pState->uchDummy)); 194 AssertMsg(pState->u32Reserved > 0 && pState->u32Reserved < 32, ("%d\n", pState->u32Reserved)); 195 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState); 191 196 192 197 /* Do our own accounting. */ 193 198 pc = &g_acPreemptDisabled[smp_processor_id()]; 194 AssertMsg(pState->uchDummy == (uint32_t)*pc, ("uchDummy=%d *pc=%d \n", pState->uchDummy, *pc)); 195 ASMAtomicUoWriteS32(pc, pState->uchDummy - 1); 196 #endif 199 AssertMsg(pState->u32Reserved == (uint32_t)*pc, ("u32Reserved=%d *pc=%d \n", pState->u32Reserved, *pc)); 200 ASMAtomicUoWriteS32(pc, pState->u32Reserved - 1); 201 #endif 202 pState->u32Reserved = 0; 197 203 } 198 204 RT_EXPORT_SYMBOL(RTThreadPreemptRestore); -
trunk/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp
r21536 r22150 169 169 170 170 KeRaiseIrql(DISPATCH_LEVEL, &pState->uchOldIrql); 171 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState); 171 172 } 172 173 … … 176 177 AssertPtr(pState); 177 178 179 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState); 178 180 KeLowerIrql(pState->uchOldIrql); 179 181 pState->uchOldIrql = 255; -
trunk/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp
r21536 r22150 134 134 { 135 135 AssertPtr(pState); 136 Assert(pState->u32Reserved == 0); 136 137 137 138 /* No preemption on OS/2, so do our own accounting. */ 138 139 int32_t c = ASMAtomicIncS32(&g_acPreemptDisabled[ASMGetApicId()]); 139 140 AssertMsg(c > 0 && c < 32, ("%d\n", c)); 140 pState->uchDummy = (unsigned char)c; 141 pState->u32Reserved = c; 142 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState); 141 143 } 142 144 … … 145 147 { 146 148 AssertPtr(pState); 147 AssertMsg(pState->uchDummy > 0 && pState->uchDummy < 32, ("%d\n", pState->uchDummy)); 149 AssertMsg(pState->u32Reserved > 0 && pState->u32Reserved < 32, ("%d\n", pState->u32Reserved)); 150 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState); 148 151 149 152 /* No preemption on OS/2, so do our own accounting. */ 150 153 int32_t volatile *pc = &g_acPreemptDisabled[ASMGetApicId()]; 151 AssertMsg(pState->u chDummy == (uint32_t)*pc, ("uchDummy=%d *pc=%d \n", pState->uchDummy, *pc));152 ASMAtomicUoWriteS32(pc, pState->u chDummy- 1);153 pState->u chDummy= 0;154 AssertMsg(pState->u32Reserved == (uint32_t)*pc, ("uchDummy=%d *pc=%d \n", pState->u32Reserved, *pc)); 155 ASMAtomicUoWriteS32(pc, pState->u32Reserved - 1); 156 pState->u32Reserved = 0; 154 157 } 155 158 -
trunk/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c
r22073 r22150 142 142 { 143 143 AssertPtr(pState); 144 Assert(pState->u chDummy != 42);145 pState->u chDummy= 42;144 Assert(pState->u32Reserved == 0); 145 pState->u32Reserved = 42; 146 146 147 147 kpreempt_disable(); 148 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState); 148 149 } 149 150 … … 152 153 { 153 154 AssertPtr(pState); 154 Assert(pState->uchDummy == 42); 155 pState->uchDummy = 0; 155 Assert(pState->u32Reserved == 42); 156 pState->u32Reserved = 0; 157 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState); 156 158 157 159 kpreempt_enable(); -
trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c
r22073 r22150 40 40 #include <iprt/assert.h> 41 41 #include <iprt/err.h> 42 #include <iprt/mp.h> 42 43 43 44 … … 138 139 { 139 140 AssertPtr(pState); 140 Assert(pState->u chDummy != 42);141 pState->u chDummy= 42;141 Assert(pState->u32Reserved == 0); 142 pState->u32Reserved = 42; 142 143 vbi_preempt_disable(); 144 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState); 143 145 } 144 146 … … 147 149 { 148 150 AssertPtr(pState); 149 Assert(pState->uchDummy == 42); 150 pState->uchDummy = 0; 151 Assert(pState->u32Reserved == 42); 152 pState->u32Reserved = 0; 153 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState); 151 154 vbi_preempt_enable(); 152 155 }
Note:
See TracChangeset
for help on using the changeset viewer.