Changeset 57246 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Aug 7, 2015 7:51:45 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 102000
- Location:
- trunk/src/VBox/Runtime/r0drv/darwin
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp
r57074 r57246 101 101 AssertPtrReturn(phEventSem, VERR_INVALID_POINTER); 102 102 RT_ASSERT_PREEMPTIBLE(); 103 IPRT_DARWIN_SAVE_EFL_AC(); 103 104 104 105 PRTSEMEVENTINTERNAL pThis = (PRTSEMEVENTINTERNAL)RTMemAlloc(sizeof(*pThis)); … … 115 116 { 116 117 *phEventSem = pThis; 118 IPRT_DARWIN_RESTORE_EFL_AC(); 117 119 return VINF_SUCCESS; 118 120 } … … 121 123 RTMemFree(pThis); 122 124 } 125 IPRT_DARWIN_RESTORE_EFL_AC(); 123 126 return VERR_NO_MEMORY; 124 127 } … … 147 150 { 148 151 Assert(pThis->u32Magic != RTSEMEVENT_MAGIC); 152 IPRT_DARWIN_SAVE_EFL_AC(); 153 149 154 lck_spin_destroy(pThis->pSpinlock, g_pDarwinLockGroup); 150 155 RTMemFree(pThis); 156 157 IPRT_DARWIN_RESTORE_EFL_AC(); 151 158 } 152 159 } … … 160 167 AssertMsgReturn(pThis->u32Magic == RTSEMEVENT_MAGIC, ("pThis=%p u32Magic=%#x\n", pThis, pThis->u32Magic), VERR_INVALID_HANDLE); 161 168 RT_ASSERT_INTS_ON(); 169 IPRT_DARWIN_SAVE_EFL_AC(); 162 170 163 171 lck_spin_lock(pThis->pSpinlock); … … 177 185 rtR0SemEventDarwinRelease(pThis); 178 186 187 IPRT_DARWIN_RESTORE_EFL_AC(); 179 188 return VINF_SUCCESS; 180 189 } … … 190 199 RT_ASSERT_PREEMPT_CPUID_VAR(); 191 200 RT_ASSERT_INTS_ON(); 201 IPRT_DARWIN_SAVE_EFL_AC(); 192 202 193 203 rtR0SemEventDarwinRetain(pThis); … … 218 228 219 229 RT_ASSERT_PREEMPT_CPUID(); 230 IPRT_DARWIN_RESTORE_EFL_AC(); 220 231 return VINF_SUCCESS; 221 232 } … … 240 251 AssertMsgReturn(pThis->u32Magic == RTSEMEVENT_MAGIC, ("%p u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_PARAMETER); 241 252 AssertReturn(RTSEMWAIT_FLAGS_ARE_VALID(fFlags), VERR_INVALID_PARAMETER); 253 IPRT_DARWIN_SAVE_EFL_AC(); 242 254 243 255 rtR0SemEventDarwinRetain(pThis); … … 308 320 */ 309 321 ASMAtomicWriteBool(&pThis->fHaveBlockedThreads, true); 310 IPRT_DARWIN_SAVE_EFL_AC();311 322 wait_interrupt_t fInterruptible = fFlags & RTSEMWAIT_FLAGS_INTERRUPTIBLE ? THREAD_ABORTSAFE : THREAD_UNINT; 312 323 wait_result_t rcWait; … … 320 331 (event_t)&Waiter, fInterruptible, u64AbsTime); 321 332 } 322 IPRT_DARWIN_RESTORE_EFL_AC();323 333 324 334 /* … … 370 380 lck_spin_unlock(pThis->pSpinlock); 371 381 rtR0SemEventDarwinRelease(pThis); 382 IPRT_DARWIN_RESTORE_EFL_AC(); 372 383 return rc; 373 384 } -
trunk/src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp
r57074 r57246 104 104 AssertPtrReturn(phEventMultiSem, VERR_INVALID_POINTER); 105 105 RT_ASSERT_PREEMPTIBLE(); 106 IPRT_DARWIN_SAVE_EFL_AC(); 106 107 107 108 PRTSEMEVENTMULTIINTERNAL pThis = (PRTSEMEVENTMULTIINTERNAL)RTMemAlloc(sizeof(*pThis)); … … 117 118 { 118 119 *phEventMultiSem = pThis; 120 IPRT_DARWIN_RESTORE_EFL_AC(); 119 121 return VINF_SUCCESS; 120 122 } … … 123 125 RTMemFree(pThis); 124 126 } 127 IPRT_DARWIN_RESTORE_EFL_AC(); 125 128 return VERR_NO_MEMORY; 126 129 } … … 148 151 if (RT_UNLIKELY(ASMAtomicDecU32(&pThis->cRefs) == 0)) 149 152 { 153 IPRT_DARWIN_SAVE_EFL_AC(); 150 154 Assert(pThis->u32Magic != RTSEMEVENTMULTI_MAGIC); 155 151 156 lck_spin_destroy(pThis->pSpinlock, g_pDarwinLockGroup); 152 157 RTMemFree(pThis); 158 159 IPRT_DARWIN_RESTORE_EFL_AC(); 153 160 } 154 161 } … … 164 171 Assert(pThis->cRefs > 0); 165 172 RT_ASSERT_INTS_ON(); 173 IPRT_DARWIN_SAVE_EFL_AC(); 166 174 167 175 lck_spin_lock(pThis->pSpinlock); … … 178 186 rtR0SemEventMultiDarwinRelease(pThis); 179 187 188 IPRT_DARWIN_RESTORE_EFL_AC(); 180 189 return VINF_SUCCESS; 181 190 } … … 189 198 RT_ASSERT_PREEMPT_CPUID_VAR(); 190 199 RT_ASSERT_INTS_ON(); 200 IPRT_DARWIN_SAVE_EFL_AC(); 191 201 192 202 rtR0SemEventMultiDarwinRetain(pThis); … … 214 224 215 225 RT_ASSERT_PREEMPT_CPUID(); 226 IPRT_DARWIN_RESTORE_EFL_AC(); 216 227 return VINF_SUCCESS; 217 228 } … … 225 236 RT_ASSERT_PREEMPT_CPUID_VAR(); 226 237 RT_ASSERT_INTS_ON(); 238 IPRT_DARWIN_SAVE_EFL_AC(); 227 239 228 240 rtR0SemEventMultiDarwinRetain(pThis); … … 235 247 236 248 RT_ASSERT_PREEMPT_CPUID(); 249 IPRT_DARWIN_RESTORE_EFL_AC(); 237 250 return VINF_SUCCESS; 238 251 } … … 259 272 if (uTimeout != 0 || (fFlags & RTSEMWAIT_FLAGS_INDEFINITE)) 260 273 RT_ASSERT_PREEMPTIBLE(); 274 IPRT_DARWIN_SAVE_EFL_AC(); 261 275 262 276 rtR0SemEventMultiDarwinRetain(pThis); … … 323 337 * Do the actual waiting. 324 338 */ 325 IPRT_DARWIN_SAVE_EFL_AC();326 339 ASMAtomicWriteBool(&pThis->fHaveBlockedThreads, true); 327 340 wait_interrupt_t fInterruptible = fFlags & RTSEMWAIT_FLAGS_INTERRUPTIBLE ? THREAD_ABORTSAFE : THREAD_UNINT; … … 336 349 (event_t)pThis, fInterruptible, u64AbsTime); 337 350 } 338 IPRT_DARWIN_RESTORE_EFL_AC();339 351 340 352 /* … … 384 396 lck_spin_unlock(pThis->pSpinlock); 385 397 rtR0SemEventMultiDarwinRelease(pThis); 398 399 IPRT_DARWIN_RESTORE_EFL_AC(); 386 400 return rc; 387 401 } -
trunk/src/VBox/Runtime/r0drv/darwin/semfastmutex-r0drv-darwin.cpp
r57074 r57246 67 67 AssertPtrReturn(phFastMtx, VERR_INVALID_POINTER); 68 68 RT_ASSERT_PREEMPTIBLE(); 69 IPRT_DARWIN_SAVE_EFL_AC(); 69 70 70 71 PRTSEMFASTMUTEXINTERNAL pThis = (PRTSEMFASTMUTEXINTERNAL)RTMemAlloc(sizeof(*pThis)); … … 77 78 { 78 79 *phFastMtx = pThis; 80 IPRT_DARWIN_RESTORE_EFL_AC(); 79 81 return VINF_SUCCESS; 80 82 } … … 82 84 RTMemFree(pThis); 83 85 } 86 IPRT_DARWIN_RESTORE_EFL_AC(); 84 87 return VERR_NO_MEMORY; 85 88 } … … 94 97 AssertMsgReturn(pThis->u32Magic == RTSEMFASTMUTEX_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), VERR_INVALID_HANDLE); 95 98 RT_ASSERT_INTS_ON(); 99 IPRT_DARWIN_SAVE_EFL_AC(); 96 100 97 101 ASMAtomicWriteU32(&pThis->u32Magic, RTSEMFASTMUTEX_MAGIC_DEAD); … … 101 105 RTMemFree(pThis); 102 106 107 IPRT_DARWIN_RESTORE_EFL_AC(); 103 108 return VINF_SUCCESS; 104 109 } -
trunk/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp
r57074 r57246 81 81 AssertReturn(!(fFlags & ~RTSEMMUTEX_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER); 82 82 RT_ASSERT_PREEMPTIBLE(); 83 IPRT_DARWIN_SAVE_EFL_AC(); 83 84 84 85 AssertCompile(sizeof(RTSEMMUTEXINTERNAL) > sizeof(void *)); … … 96 97 { 97 98 *phMutexSem = pThis; 99 IPRT_DARWIN_RESTORE_EFL_AC(); 98 100 return VINF_SUCCESS; 99 101 } … … 101 103 RTMemFree(pThis); 102 104 } 105 IPRT_DARWIN_RESTORE_EFL_AC(); 103 106 return VERR_NO_MEMORY; 104 107 } … … 110 113 static void rtSemMutexDarwinFree(PRTSEMMUTEXINTERNAL pThis) 111 114 { 115 IPRT_DARWIN_SAVE_EFL_AC(); 116 112 117 lck_spin_unlock(pThis->pSpinlock); 113 118 lck_spin_destroy(pThis->pSpinlock, g_pDarwinLockGroup); 114 119 RTMemFree(pThis); 120 121 IPRT_DARWIN_RESTORE_EFL_AC(); 115 122 } 116 123 … … 127 134 AssertMsgReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, ("u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis), VERR_INVALID_HANDLE); 128 135 RT_ASSERT_INTS_ON(); 136 IPRT_DARWIN_SAVE_EFL_AC(); 129 137 130 138 /* … … 142 150 lck_spin_unlock(pThis->pSpinlock); 143 151 152 IPRT_DARWIN_RESTORE_EFL_AC(); 144 153 return VINF_SUCCESS; 145 154 } … … 171 180 * Go to sleep, use the address of the mutex instance as sleep/blocking/event id. 172 181 */ 173 IPRT_DARWIN_SAVE_EFL_AC();174 182 wait_result_t rcWait; 175 183 if (cMillies == RT_INDEFINITE_WAIT) … … 184 192 (event_t)pThis, fInterruptible, u64AbsTime); 185 193 } 186 IPRT_DARWIN_RESTORE_EFL_AC();187 194 188 195 /* … … 268 275 AssertReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, VERR_INVALID_HANDLE); 269 276 RT_ASSERT_PREEMPTIBLE(); 277 IPRT_DARWIN_SAVE_EFL_AC(); 270 278 271 279 /* … … 298 306 /* Yawn, time for a nap... */ 299 307 else 300 return rtR0SemMutexDarwinRequestSleep(pThis, cMillies, fInterruptible, hNativeSelf); 308 { 309 rc = rtR0SemMutexDarwinRequestSleep(pThis, cMillies, fInterruptible, hNativeSelf); 310 IPRT_DARWIN_RESTORE_EFL_ONLY_AC(); 311 return rc; 312 } 301 313 302 314 lck_spin_unlock(pThis->pSpinlock); 315 IPRT_DARWIN_RESTORE_EFL_ONLY_AC(); 303 316 return rc; 304 317 } … … 338 351 AssertReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, VERR_INVALID_HANDLE); 339 352 RT_ASSERT_PREEMPTIBLE(); 353 IPRT_DARWIN_SAVE_EFL_AC(); 340 354 341 355 /* … … 353 367 pThis->hNativeOwner = NIL_RTNATIVETHREAD; 354 368 if (pThis->cWaiters > 0) 355 { 356 int rc2=thread_wakeup_prim((event_t)pThis, TRUE /* one_thread */, THREAD_AWAKENED); 357 } 369 thread_wakeup_prim((event_t)pThis, TRUE /* one_thread */, THREAD_AWAKENED); 358 370 359 371 } … … 365 377 366 378 AssertRC(rc); 379 IPRT_DARWIN_RESTORE_EFL_ONLY_AC(); 367 380 return VINF_SUCCESS; 368 381 } … … 377 390 AssertPtrReturn(pThis, false); 378 391 AssertReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, false); 392 IPRT_DARWIN_SAVE_EFL_AC(); 379 393 380 394 /* … … 385 399 lck_spin_unlock(pThis->pSpinlock); 386 400 401 IPRT_DARWIN_RESTORE_EFL_AC(); 387 402 return fRc; 388 403 } -
trunk/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp
r57230 r57246 70 70 { 71 71 RT_ASSERT_PREEMPTIBLE(); 72 AssertReturn(fFlags == RTSPINLOCK_FLAGS_INTERRUPT_SAFE || fFlags == RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, VERR_INVALID_PARAMETER); 72 73 IPRT_DARWIN_SAVE_EFL_AC(); 73 AssertReturn(fFlags == RTSPINLOCK_FLAGS_INTERRUPT_SAFE || fFlags == RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, VERR_INVALID_PARAMETER);74 74 75 75 /* -
trunk/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp
r57074 r57246 69 69 { 70 70 Assert(g_pDarwinLockGroup); 71 IPRT_DARWIN_SAVE_EFL_AC(); 71 72 72 73 for (size_t i = 0; i < RT_ELEMENTS(g_aPreemptHacks); i++) … … 76 77 return VERR_NO_MEMORY; /* (The caller will invoke rtThreadPreemptDarwinTerm) */ 77 78 } 79 IPRT_DARWIN_RESTORE_EFL_AC(); 78 80 return VINF_SUCCESS; 79 81 } … … 87 89 void rtThreadPreemptDarwinTerm(void) 88 90 { 91 IPRT_DARWIN_SAVE_EFL_AC(); 92 89 93 for (size_t i = 0; i < RT_ELEMENTS(g_aPreemptHacks); i++) 90 94 if (g_aPreemptHacks[i].pSpinLock) … … 93 97 g_aPreemptHacks[i].pSpinLock = NULL; 94 98 } 99 100 IPRT_DARWIN_RESTORE_EFL_AC(); 95 101 } 96 102
Note:
See TracChangeset
for help on using the changeset viewer.