Changeset 40304 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Feb 29, 2012 8:02:14 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 76552
- Location:
- trunk/src/VBox/Runtime/r0drv/os2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/os2/memuserkernel-r0drv-os2.cpp
r28800 r40304 46 46 RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb) 47 47 { 48 int rc = KernCopyOut((void *)R3PtrDst, pvSrc, cb);48 int rc = KernCopyOut((void *)R3PtrDst, (void *)pvSrc, cb); 49 49 if (RT_LIKELY(rc == 0)) 50 50 return VINF_SUCCESS; -
trunk/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp
r33269 r40304 34 34 *******************************************************************************/ 35 35 #include "the-os2-kernel.h" 36 #include "internal/iprt.h" 36 37 37 38 #include <iprt/semaphore.h> 38 #include <iprt/alloc.h>39 39 #include <iprt/asm.h> 40 40 #include <iprt/assert.h> 41 41 #include <iprt/err.h> 42 #include <iprt/mem.h> 43 #include <iprt/lockvalidator.h> 42 44 43 45 #include "internal/magics.h" … … 155 157 156 158 157 static int rtSemEventWait(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies, bool fInterruptible) 158 { 159 PRTSEMEVENTINTERNAL pThis = (PRTSEMEVENTINTERNAL)hEventSem; 159 /** 160 * Worker for RTSemEventWaitEx and RTSemEventWaitExDebug. 161 * 162 * @returns VBox status code. 163 * @param pThis The event semaphore. 164 * @param fFlags See RTSemEventWaitEx. 165 * @param uTimeout See RTSemEventWaitEx. 166 * @param pSrcPos The source code position of the wait. 167 */ 168 static int rtR0SemEventOs2Wait(PRTSEMEVENTINTERNAL pThis, uint32_t fFlags, uint64_t uTimeout, 169 PCRTLOCKVALSRCPOS pSrcPos) 170 { 171 /* 172 * Validate and convert input. 173 */ 174 if (!pThis) 175 return VERR_INVALID_HANDLE; 160 176 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 161 177 AssertMsgReturn(pThis->u32Magic == RTSEMEVENT_MAGIC, ("u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis), VERR_INVALID_HANDLE); 162 178 AssertReturn(RTSEMWAIT_FLAGS_ARE_VALID(fFlags), VERR_INVALID_PARAMETER); 179 180 ULONG cMsTimeout = rtR0SemWaitOs2ConvertTimeout(fFlags, uTimeout); 181 ULONG fBlock = BLOCK_SPINLOCK; 182 if (!(fFlags & RTSEMWAIT_FLAGS_INTERRUPTIBLE)) 183 fBlock |= BLOCK_UNINTERRUPTABLE; 184 185 /* 186 * Do the job. 187 */ 163 188 KernAcquireSpinLock(&pThis->Spinlock); 164 189 … … 175 200 176 201 ULONG ulData = (ULONG)VERR_INTERNAL_ERROR; 177 rc = KernBlock((ULONG)pThis, 178 cMillies == RT_INDEFINITE_WAIT ? SEM_INDEFINITE_WAIT : cMillies, 179 BLOCK_SPINLOCK | (!fInterruptible ? BLOCK_UNINTERRUPTABLE : 0), 202 rc = KernBlock((ULONG)pThis, cMsTimeout, fBlock, 180 203 &pThis->Spinlock, 181 204 &ulData); … … 199 222 200 223 case ERROR_TIMEOUT: 201 Assert(cM illies != RT_INDEFINITE_WAIT);224 Assert(cMsTimeout != SEM_INDEFINITE_WAIT); 202 225 ASMAtomicDecU32(&pThis->cWaiters); 203 226 rc = VERR_TIMEOUT; … … 205 228 206 229 case ERROR_INTERRUPT: 207 Assert(f Interruptible);230 Assert(fFlags & RTSEMWAIT_FLAGS_INTERRUPTIBLE); 208 231 ASMAtomicDecU32(&pThis->cWaiters); 209 232 rc = VERR_INTERRUPTED; … … 222 245 223 246 224 RTDECL(int) RTSemEventWait(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies) 225 { 226 return rtSemEventWait(hEventSem, cMillies, false /* not interruptible */); 227 } 228 229 230 RTDECL(int) RTSemEventWaitNoResume(RTSEMEVENT hEventSem, RTMSINTERVAL cMillies) 231 { 232 return rtSemEventWait(hEventSem, cMillies, true /* interruptible */); 247 RTDECL(int) RTSemEventWaitEx(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout) 248 { 249 #ifndef RTSEMEVENT_STRICT 250 return rtR0SemEventOs2Wait(hEventSem, fFlags, uTimeout, NULL); 251 #else 252 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 253 return rtR0SemEventOs2Wait(hEventSem, fFlags, uTimeout, &SrcPos); 254 #endif 255 } 256 257 258 RTDECL(int) RTSemEventWaitExDebug(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout, 259 RTHCUINTPTR uId, RT_SRC_POS_DECL) 260 { 261 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 262 return rtR0SemEventOs2Wait(hEventSem, fFlags, uTimeout, &SrcPos); 233 263 } 234 264 -
trunk/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp
r33155 r40304 34 34 *******************************************************************************/ 35 35 #include "the-os2-kernel.h" 36 #include "internal/iprt.h" 36 37 37 38 #include <iprt/semaphore.h> 38 #include <iprt/alloc.h>39 39 #include <iprt/asm.h> 40 40 #include <iprt/assert.h> 41 41 #include <iprt/err.h> 42 #include <iprt/lockvalidator.h> 43 #include <iprt/mem.h> 42 44 #include "internal/magics.h" 43 45 … … 164 166 165 167 166 static int rtSemEventMultiWait(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies, bool fInterruptible) 167 { 168 PRTSEMEVENTMULTIINTERNAL pThis = (PRTSEMEVENTMULTIINTERNAL)hEventMultiSem; 168 /** 169 * Worker for RTSemEventWaitEx and RTSemEventWaitExDebug. 170 * 171 * @returns VBox status code. 172 * @param pThis The event semaphore. 173 * @param fFlags See RTSemEventWaitEx. 174 * @param uTimeout See RTSemEventWaitEx. 175 * @param pSrcPos The source code position of the wait. 176 */ 177 static int rtR0SemEventMultiOs2Wait(PRTSEMEVENTMULTIINTERNAL pThis, uint32_t fFlags, uint64_t uTimeout, 178 PCRTLOCKVALSRCPOS pSrcPos) 179 { 180 /* 181 * Validate and convert the input. 182 */ 183 if (!pThis) 184 return VERR_INVALID_HANDLE; 169 185 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 170 186 AssertMsgReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, 171 187 ("pThis=%p u32Magic=%#x\n", pThis, pThis->u32Magic), 172 188 VERR_INVALID_HANDLE); 173 189 AssertReturn(RTSEMWAIT_FLAGS_ARE_VALID(fFlags), VERR_INVALID_PARAMETER); 190 191 ULONG cMsTimeout = rtR0SemWaitOs2ConvertTimeout(fFlags, uTimeout); 192 ULONG fBlock = BLOCK_SPINLOCK; 193 if (!(fFlags & RTSEMWAIT_FLAGS_INTERRUPTIBLE)) 194 fBlock |= BLOCK_UNINTERRUPTABLE; 195 196 /* 197 * Do the job. 198 */ 174 199 KernAcquireSpinLock(&pThis->Spinlock); 175 200 … … 182 207 183 208 ULONG ulData = (ULONG)VERR_INTERNAL_ERROR; 184 rc = KernBlock((ULONG)pThis, 185 cMillies == RT_INDEFINITE_WAIT ? SEM_INDEFINITE_WAIT : cMillies, 186 BLOCK_SPINLOCK | (!fInterruptible ? BLOCK_UNINTERRUPTABLE : 0), 209 rc = KernBlock((ULONG)pThis, cMsTimeout, fBlock, 187 210 &pThis->Spinlock, 188 211 &ulData); … … 207 230 208 231 case ERROR_TIMEOUT: 209 Assert(cM illies != RT_INDEFINITE_WAIT);232 Assert(cMsTimeout != SEM_INDEFINITE_WAIT); 210 233 ASMAtomicDecU32(&pThis->cWaiters); 211 234 rc = VERR_TIMEOUT; … … 213 236 214 237 case ERROR_INTERRUPT: 215 Assert(f Interruptible);238 Assert(fFlags & RTSEMWAIT_FLAGS_INTERRUPTIBLE); 216 239 ASMAtomicDecU32(&pThis->cWaiters); 217 240 rc = VERR_INTERRUPTED; … … 230 253 231 254 232 RTDECL(int) RTSemEventMultiWait(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies) 233 { 234 return rtSemEventMultiWait(hEventMultiSem, cMillies, false /* not interruptible */); 235 } 236 237 238 RTDECL(int) RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI hEventMultiSem, RTMSINTERVAL cMillies) 239 { 240 return rtSemEventMultiWait(hEventMultiSem, cMillies, true /* interruptible */); 255 RTDECL(int) RTSemEventMultiWaitEx(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout) 256 { 257 #ifndef RTSEMEVENT_STRICT 258 return rtR0SemEventMultiOs2Wait(hEventMultiSem, fFlags, uTimeout, NULL); 259 #else 260 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 261 return rtR0SemEventMultiOs2Wait(hEventMultiSem, fFlags, uTimeout, &SrcPos); 262 #endif 263 } 264 265 266 RTDECL(int) RTSemEventMultiWaitExDebug(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout, 267 RTHCUINTPTR uId, RT_SRC_POS_DECL) 268 { 269 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 270 return rtR0SemEventMultiOs2Wait(hEventMultiSem, fFlags, uTimeout, &SrcPos); 241 271 } 242 272
Note:
See TracChangeset
for help on using the changeset viewer.