Changeset 28462 in vbox
- Timestamp:
- Apr 19, 2010 1:36:19 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r28210 r28462 211 211 { "RTR0MemKernelIsValidAddr", (void *)RTR0MemKernelIsValidAddr }, 212 212 { "RTR0MemAreKrnlAndUsrDifferent", (void *)RTR0MemAreKrnlAndUsrDifferent }, 213 /* These don't work yet on linux - use fast mutexes!214 213 { "RTSemMutexCreate", (void *)RTSemMutexCreate }, 215 214 { "RTSemMutexRequest", (void *)RTSemMutexRequest }, 215 { "RTSemMutexRequestDebug", (void *)RTSemMutexRequestDebug }, 216 { "RTSemMutexRequestNoResume", (void *)RTSemMutexRequestNoResume }, 217 { "RTSemMutexRequestNoResumeDebug", (void *)RTSemMutexRequestNoResumeDebug }, 216 218 { "RTSemMutexRelease", (void *)RTSemMutexRelease }, 217 219 { "RTSemMutexDestroy", (void *)RTSemMutexDestroy }, 218 */219 220 { "RTProcSelf", (void *)RTProcSelf }, 220 221 { "RTR0ProcHandleSelf", (void *)RTR0ProcHandleSelf }, -
trunk/src/VBox/HostDrivers/Support/linux/Makefile
r28283 r28462 94 94 r0drv/linux/semeventmulti-r0drv-linux.o \ 95 95 r0drv/linux/semfastmutex-r0drv-linux.o \ 96 r0drv/linux/semmutex-r0drv-linux.o \ 96 97 r0drv/linux/spinlock-r0drv-linux.o \ 97 98 r0drv/linux/thread-r0drv-linux.o \ -
trunk/src/VBox/HostDrivers/Support/linux/files_vboxdrv
r28283 r28462 39 39 ${PATH_ROOT}/include/iprt/handletable.h=>include/iprt/handletable.h \ 40 40 ${PATH_ROOT}/include/iprt/initterm.h=>include/iprt/initterm.h \ 41 ${PATH_ROOT}/include/iprt/list.h=>include/iprt/list.h \ 41 42 ${PATH_ROOT}/include/iprt/lockvalidator.h=>include/iprt/lockvalidator.h \ 42 43 ${PATH_ROOT}/include/iprt/log.h=>include/iprt/log.h \ … … 141 142 ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c=>r0drv/linux/semeventmulti-r0drv-linux.c \ 142 143 ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c=>r0drv/linux/semfastmutex-r0drv-linux.c \ 144 ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c=>r0drv/linux/semmutex-r0drv-linux.c \ 143 145 ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c=>r0drv/linux/spinlock-r0drv-linux.c \ 144 146 ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/string.h=>r0drv/linux/string.h \ -
trunk/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c
r28436 r28462 320 320 return rtSemMutexLinuxRequest(hMutexSem, cMillies, true /*fInterruptible*/); 321 321 } 322 RT_EXPORT_SYMBOL(RTSemMutexRequest );322 RT_EXPORT_SYMBOL(RTSemMutexRequestNoResume); 323 323 324 324 … … 364 364 IPRT_DEBUG_SEMS_STATE(pThis, 'u'); 365 365 } 366 rc = VINF_SUCCESS; 366 367 } 367 368 else -
trunk/src/VBox/Runtime/testcase/Makefile.kmk
r27800 r28462 91 91 tstRand \ 92 92 tstRTFsQueries \ 93 tstRTR0SemMutexDriver \ 93 94 tstR0ThreadPreemptionDriver \ 94 95 tstSemEvent \ … … 149 150 tstLdrObjR0 \ 150 151 tstRTR0MemUserKernel \ 152 tstRTR0SemMutex \ 151 153 tstR0ThreadPreemption 152 154 ifdef VBOX_WITH_RAW_MODE … … 394 396 endif 395 397 398 tstR0ThreadPreemptionDriver_TEMPLATE = VBOXR3TSTEXE 396 399 tstR0ThreadPreemptionDriver_SOURCES = tstR0ThreadPreemptionDriver.cpp 400 401 tstRTR0SemMutex_TEMPLATE = VBoxR0 402 tstRTR0SemMutex_INST = $(INST_TESTCASE) 403 tstRTR0SemMutex_DEFS = IN_RT_R0 404 tstRTR0SemMutex_SYSSUFF = .r0 405 tstRTR0SemMutex_SOURCES = tstRTR0SemMutex.cpp 406 tstRTR0SemMutex_LIBS = $(PATH_LIB)/RuntimeR0$(VBOX_SUFF_LIB) 407 if1of ($(VBOX_LDR_FMT), pe lx) 408 tstRTR0SemMutex_LIBS += $(PATH_LIB)/SUPR0$(VBOX_SUFF_LIB) 409 endif 410 411 tstRTR0SemMutexDriver_TEMPLATE = VBOXR3TSTEXE 412 tstRTR0SemMutexDriver_SOURCES = tstRTR0SemMutexDriver.cpp 397 413 398 414 tstRTFsQueries_SOURCES = tstRTFsQueries.cpp -
trunk/src/VBox/Runtime/testcase/tstRTR0SemMutex.cpp
r28430 r28462 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT R0 Testcase - Thread Preemption.3 * IPRT R0 Testcase - Mutex Semaphores. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2009 Sun Microsystems, Inc.7 * Copyright (C) 2009-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 32 32 * Header Files * 33 33 *******************************************************************************/ 34 #include <iprt/ thread.h>34 #include <iprt/semaphore.h> 35 35 36 36 #include <iprt/err.h> … … 38 38 #include <iprt/string.h> 39 39 #include <VBox/sup.h> 40 #include "tstR 0ThreadPreemption.h"40 #include "tstRTR0SemMutex.h" 41 41 42 42 … … 50 50 * @param pReqHdr The request header. Input / Output. Optional. 51 51 */ 52 DECLEXPORT(int) TSTR 0ThreadPreemptionSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation,53 52 DECLEXPORT(int) TSTRTR0SemMutexSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation, 53 uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr) 54 54 { 55 55 if (u64Arg) … … 63 63 *pszErr = '\0'; 64 64 65 #define SET_ERROR(szFmt) do { if (!*pszErr) RTStrPrintf(pszErr, cchErr, "!" szFmt); } while (0) 66 #define SET_ERROR1(szFmt, a1) do { if (!*pszErr) RTStrPrintf(pszErr, cchErr, "!" szFmt, a1); } while (0) 67 #define SET_ERROR2(szFmt, a1, a2) do { if (!*pszErr) RTStrPrintf(pszErr, cchErr, "!" szFmt, a1, a2); } while (0) 68 #define SET_ERROR3(szFmt, a1, a2, a3) do { if (!*pszErr) RTStrPrintf(pszErr, cchErr, "!" szFmt, a1, a2, a3); } while (0) 69 #define CHECK_RC_BREAK(rc, rcExpect, szOp) \ 70 if ((rc) != (rcExpect)) \ 71 { \ 72 RTStrPrintf(pszErr, cchErr, "!%s -> %Rrc, expected %Rrc. line %u", szOp, rc, rcExpect, __LINE__); \ 73 break; \ 74 } 75 76 65 77 /* 66 78 * The big switch. 67 79 */ 80 RTSEMMUTEX hMtx; 81 int rc; 68 82 switch (uOperation) 69 83 { 70 case TSTR 0THREADPREMEPTION_SANITY_OK:84 case TSTRTR0SEMMUTEX_SANITY_OK: 71 85 break; 72 86 73 case TSTR 0THREADPREMEPTION_SANITY_FAILURE:74 RTStrPrintf(pszErr, cchErr, "!42failure42%1024s", "");87 case TSTRTR0SEMMUTEX_SANITY_FAILURE: 88 SET_ERROR1("42failure42%1024s", ""); 75 89 break; 76 90 77 case TSTR0THREADPREMEPTION_BASIC: 78 { 79 if (!ASMIntAreEnabled()) 80 RTStrPrintf(pszErr, cchErr, "!Interrupts disabled"); 81 else if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD)) 82 RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns false by default"); 83 else 91 case TSTRTR0SEMMUTEX_BASIC: 92 rc = RTSemMutexCreate(&hMtx); 93 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexCreate"); 94 do 84 95 { 85 RTTHREADPREEMPTSTATE State = RTTHREADPREEMPTSTATE_INITIALIZER; 86 RTThreadPreemptDisable(&State); 87 if (RTThreadPreemptIsEnabled(NIL_RTTHREAD)) 88 RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after RTThreadPreemptDisable"); 89 else if (!ASMIntAreEnabled()) 90 RTStrPrintf(pszErr, cchErr, "!Interrupts disabled"); 91 RTThreadPreemptRestore(&State); 92 } 96 /* 97 * The interruptible version first. 98 */ 99 /* simple request and release, polling. */ 100 rc = RTSemMutexRequestNoResume(hMtx, 0); 101 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequestNoResume"); 102 rc = RTSemMutexRelease(hMtx); 103 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease"); 104 105 /* simple request and release, wait for ever. */ 106 rc = RTSemMutexRequestNoResume(hMtx, RT_INDEFINITE_WAIT); 107 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequestNoResume(indef_wait)"); 108 rc = RTSemMutexRelease(hMtx); 109 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease"); 110 111 /* simple request and release, wait a tiny while. */ 112 rc = RTSemMutexRequestNoResume(hMtx, 133); 113 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequestNoResume(133)"); 114 rc = RTSemMutexRelease(hMtx); 115 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease"); 116 117 /* nested request and release. */ 118 rc = RTSemMutexRequestNoResume(hMtx, RT_INDEFINITE_WAIT); 119 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequestNoResume#1"); 120 rc = RTSemMutexRequestNoResume(hMtx, RT_INDEFINITE_WAIT); 121 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequestNoResume#2"); 122 rc = RTSemMutexRequestNoResume(hMtx, RT_INDEFINITE_WAIT); 123 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequestNoResume#3"); 124 rc = RTSemMutexRelease(hMtx); 125 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease#3"); 126 rc = RTSemMutexRequestNoResume(hMtx, RT_INDEFINITE_WAIT); 127 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequestNoResume#3b"); 128 rc = RTSemMutexRelease(hMtx); 129 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease#3b"); 130 rc = RTSemMutexRelease(hMtx); 131 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease#2"); 132 rc = RTSemMutexRelease(hMtx); 133 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease#1"); 134 135 /* 136 * The uninterruptible variant. 137 */ 138 /* simple request and release, polling. */ 139 rc = RTSemMutexRequest(hMtx, 0); 140 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequest"); 141 rc = RTSemMutexRelease(hMtx); 142 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease"); 143 144 /* simple request and release, wait for ever. */ 145 rc = RTSemMutexRequest(hMtx, RT_INDEFINITE_WAIT); 146 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequest(indef_wait)"); 147 rc = RTSemMutexRelease(hMtx); 148 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease"); 149 150 /* simple request and release, wait a tiny while. */ 151 rc = RTSemMutexRequest(hMtx, 133); 152 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequest(133)"); 153 rc = RTSemMutexRelease(hMtx); 154 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease"); 155 156 /* nested request and release. */ 157 rc = RTSemMutexRequest(hMtx, RT_INDEFINITE_WAIT); 158 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequest#1"); 159 rc = RTSemMutexRequest(hMtx, RT_INDEFINITE_WAIT); 160 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequest#2"); 161 rc = RTSemMutexRequest(hMtx, RT_INDEFINITE_WAIT); 162 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequest#3"); 163 rc = RTSemMutexRelease(hMtx); 164 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease#3"); 165 rc = RTSemMutexRequest(hMtx, RT_INDEFINITE_WAIT); 166 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRequest#3b"); 167 rc = RTSemMutexRelease(hMtx); 168 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease#3b"); 169 rc = RTSemMutexRelease(hMtx); 170 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease#2"); 171 rc = RTSemMutexRelease(hMtx); 172 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexRelease#1"); 173 174 } while (false); 175 176 rc = RTSemMutexDestroy(hMtx); 177 CHECK_RC_BREAK(rc, VINF_SUCCESS, "RTSemMutexDestroy"); 93 178 break; 94 }95 96 case TSTR0THREADPREMEPTION_IS_PENDING:97 {98 RTTHREADPREEMPTSTATE State = RTTHREADPREEMPTSTATE_INITIALIZER;99 RTThreadPreemptDisable(&State);100 if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))101 {102 if (ASMIntAreEnabled())103 {104 uint64_t u64StartTS = RTTimeNanoTS();105 uint64_t u64StartSysTS = RTTimeSystemNanoTS();106 uint64_t cLoops = 0;107 uint64_t cNanosSysElapsed;108 uint64_t cNanosElapsed;109 bool fPending;110 do111 {112 fPending = RTThreadPreemptIsPending(NIL_RTTHREAD);113 cNanosElapsed = RTTimeNanoTS() - u64StartTS;114 cNanosSysElapsed = RTTimeSystemNanoTS() - u64StartSysTS;115 cLoops++;116 } while ( !fPending117 && cNanosElapsed < UINT64_C(2)*1000U*1000U*1000U118 && cNanosSysElapsed < UINT64_C(2)*1000U*1000U*1000U119 && cLoops < 100U*_1M);120 if (!fPending)121 RTStrPrintf(pszErr, cchErr, "!Preempt not pending after %'llu loops / %'llu ns / %'llu ns (sys)",122 cLoops, cNanosElapsed, cNanosSysElapsed);123 else if (cLoops == 1)124 RTStrPrintf(pszErr, cchErr, "!cLoops=1\n");125 else126 RTStrPrintf(pszErr, cchErr, "RTThreadPreemptIsPending returned true after %'llu loops / %'llu ns / %'llu ns (sys)",127 cLoops, cNanosElapsed, cNanosSysElapsed);128 }129 else130 RTStrPrintf(pszErr, cchErr, "!Interrupts disabled");131 }132 else133 RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after RTThreadPreemptDisable");134 RTThreadPreemptRestore(&State);135 break;136 }137 138 case TSTR0THREADPREMEPTION_NESTED:139 {140 bool const fDefault = RTThreadPreemptIsEnabled(NIL_RTTHREAD);141 RTTHREADPREEMPTSTATE State1 = RTTHREADPREEMPTSTATE_INITIALIZER;142 RTThreadPreemptDisable(&State1);143 if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))144 {145 RTTHREADPREEMPTSTATE State2 = RTTHREADPREEMPTSTATE_INITIALIZER;146 RTThreadPreemptDisable(&State2);147 if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))148 {149 RTTHREADPREEMPTSTATE State3 = RTTHREADPREEMPTSTATE_INITIALIZER;150 RTThreadPreemptDisable(&State3);151 if (RTThreadPreemptIsEnabled(NIL_RTTHREAD))152 RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 3rd RTThreadPreemptDisable");153 154 RTThreadPreemptRestore(&State3);155 if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) && !*pszErr)156 RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 1st RTThreadPreemptRestore");157 }158 else159 RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 2nd RTThreadPreemptDisable");160 161 RTThreadPreemptRestore(&State2);162 if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) && !*pszErr)163 RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 2nd RTThreadPreemptRestore");164 }165 else166 RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 1st RTThreadPreemptDisable");167 RTThreadPreemptRestore(&State1);168 if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) != fDefault && !*pszErr)169 RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns false after 3rd RTThreadPreemptRestore");170 break;171 }172 179 173 180 default: 174 RTStrPrintf(pszErr, cchErr, "!Unknown test #%d", uOperation);181 SET_ERROR1("Unknown test #%d", uOperation); 175 182 break; 176 183 } -
trunk/src/VBox/Runtime/testcase/tstRTR0SemMutex.h
r28430 r28462 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT R0 Testcase - Thread Preemption, common header.3 * IPRT R0 Testcase - Mutex Semaphores, common header. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2009 Sun Microsystems, Inc.7 * Copyright (C) 2009-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 31 31 #ifdef IN_RING0 32 32 RT_C_DECLS_BEGIN 33 DECLEXPORT(int) TSTR 0ThreadPreemptionSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation,34 33 DECLEXPORT(int) TSTRTR0SemMutexSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation, 34 uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr); 35 35 RT_C_DECLS_END 36 36 #endif 37 37 38 typedef enum TSTR 0THREADPREMEPTION38 typedef enum TSTRTR0SEMMUTEX 39 39 { 40 TSTR0THREADPREMEPTION_SANITY_OK = 1, 41 TSTR0THREADPREMEPTION_SANITY_FAILURE, 42 TSTR0THREADPREMEPTION_BASIC, 43 TSTR0THREADPREMEPTION_IS_PENDING, 44 TSTR0THREADPREMEPTION_NESTED 45 } TSTR0THREADPREMEPTION; 40 TSTRTR0SEMMUTEX_SANITY_OK = 1, 41 TSTRTR0SEMMUTEX_SANITY_FAILURE, 42 TSTRTR0SEMMUTEX_BASIC 43 } TSTRTR0SEMMUTEX; 46 44 -
trunk/src/VBox/Runtime/testcase/tstRTR0SemMutexDriver.cpp
r28430 r28462 5 5 6 6 /* 7 * Copyright (C) 2009 Sun Microsystems, Inc.7 * Copyright (C) 2009-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 43 43 #ifdef VBOX 44 44 # include <VBox/sup.h> 45 # include "tstR 0ThreadPreemption.h"45 # include "tstRTR0SemMutex.h" 46 46 #endif 47 47 … … 57 57 */ 58 58 RTTEST hTest; 59 int rc = RTTestInitAndCreate("tstR0 ThreadPreemption", &hTest);59 int rc = RTTestInitAndCreate("tstR0SemMutex", &hTest); 60 60 if (rc) 61 61 return rc; … … 73 73 rc = RTPathExecDir(szPath, sizeof(szPath)); 74 74 if (RT_SUCCESS(rc)) 75 rc = RTPathAppend(szPath, sizeof(szPath), "tstR0 ThreadPreemption.r0");75 rc = RTPathAppend(szPath, sizeof(szPath), "tstR0SemMutex.r0"); 76 76 if (RT_FAILURE(rc)) 77 77 { … … 81 81 82 82 void *pvImageBase; 83 rc = SUPR3LoadServiceModule(szPath, "tstR0 ThreadPreemption",84 "TSTR 0ThreadPreemptionSrvReqHandler",83 rc = SUPR3LoadServiceModule(szPath, "tstR0SemMutex", 84 "TSTRTR0SemMutexSrvReqHandler", 85 85 &pvImageBase); 86 86 if (RT_FAILURE(rc)) … … 104 104 Req.Hdr.cbReq = sizeof(Req); 105 105 Req.szMsg[0] = '\0'; 106 RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0 ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,107 TSTR 0THREADPREMEPTION_SANITY_OK, 0, &Req.Hdr), VINF_SUCCESS);106 RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0SemMutex", sizeof("tstR0SemMutex") - 1, 107 TSTRTR0SEMMUTEX_SANITY_OK, 0, &Req.Hdr), VINF_SUCCESS); 108 108 if (RT_FAILURE(rc)) 109 109 return RTTestSummaryAndDestroy(hTest); … … 115 115 Req.Hdr.cbReq = sizeof(Req); 116 116 Req.szMsg[0] = '\0'; 117 RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0 ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,118 TSTR 0THREADPREMEPTION_SANITY_FAILURE, 0, &Req.Hdr), VINF_SUCCESS);117 RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0SemMutex", sizeof("tstR0SemMutex") - 1, 118 TSTRTR0SEMMUTEX_SANITY_FAILURE, 0, &Req.Hdr), VINF_SUCCESS); 119 119 if (RT_FAILURE(rc)) 120 120 return RTTestSummaryAndDestroy(hTest); … … 130 130 Req.Hdr.cbReq = sizeof(Req); 131 131 Req.szMsg[0] = '\0'; 132 RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0 ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,133 TSTR 0THREADPREMEPTION_BASIC, 0, &Req.Hdr), VINF_SUCCESS);132 RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0SemMutex", sizeof("tstR0SemMutex") - 1, 133 TSTRTR0SEMMUTEX_BASIC, 0, &Req.Hdr), VINF_SUCCESS); 134 134 if (RT_FAILURE(rc)) 135 135 return RTTestSummaryAndDestroy(hTest); … … 143 143 144 144 /* 145 * Stay in ring-0 until preemption is pending.145 * More to come 146 146 */ 147 RTThreadSleep(250); /** @todo fix GIP initialization? */148 RTTestSub(hTest, "Pending Preemption");149 for (int i = 0; ; i++)150 {151 Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;152 Req.Hdr.cbReq = sizeof(Req);153 Req.szMsg[0] = '\0';154 RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,155 TSTR0THREADPREMEPTION_IS_PENDING, 0, &Req.Hdr), VINF_SUCCESS);156 if ( strcmp(Req.szMsg, "cLoops=1\n")157 || i >= 64)158 {159 if (Req.szMsg[0] == '!')160 RTTestIFailed("%s", &Req.szMsg[1]);161 else if (Req.szMsg[0])162 RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);163 break;164 }165 if ((i % 3) == 0)166 RTThreadYield();167 }168 169 /*170 * Test nested RTThreadPreemptDisable calls.171 */172 RTTestSub(hTest, "Nested");173 Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;174 Req.Hdr.cbReq = sizeof(Req);175 Req.szMsg[0] = '\0';176 RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,177 TSTR0THREADPREMEPTION_NESTED, 0, &Req.Hdr), VINF_SUCCESS);178 if (Req.szMsg[0] == '!')179 RTTestIFailed("%s", &Req.szMsg[1]);180 else if (Req.szMsg[0])181 RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);182 147 183 148 /*
Note:
See TracChangeset
for help on using the changeset viewer.