- Timestamp:
- Jan 29, 2020 12:19:30 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices/testcase
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/testcase/tstDevice.cpp
r82902 r82904 849 849 AssertRC(rc); 850 850 851 rc = RTCritSectInitEx(&Dut.CritSectNop.s.CritSect, RTCRITSECT_FLAGS_NOP, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "DutNop"); 852 AssertRC(rc); 853 851 854 PPDMCRITSECT pCritSect; 852 855 /* Figure out how much we need. */ -
trunk/src/VBox/Devices/testcase/tstDeviceInternal.h
r82902 r82904 149 149 /** Flags. */ 150 150 uint32_t fFlags; 151 /** Assigned critical section. */ 152 PPDMCRITSECT pCritSect; 151 153 /** @todo: */ 152 154 } TMTIMER; … … 220 222 /** Pointer to a const I/O port handler. */ 221 223 typedef const RTDEVDUTIOPORT *PCRTDEVDUTIOPORT; 224 225 226 /** 227 * Registered SSM handlers. 228 */ 229 typedef struct TSTDEVDUTSSM 230 { 231 /** Node for the list of registered SSM handlers. */ 232 RTLISTNODE NdSsm; 233 /** Version */ 234 uint32_t uVersion; 235 PFNSSMDEVLIVEPREP pfnLivePrep; 236 PFNSSMDEVLIVEEXEC pfnLiveExec; 237 PFNSSMDEVLIVEVOTE pfnLiveVote; 238 PFNSSMDEVSAVEPREP pfnSavePrep; 239 PFNSSMDEVSAVEEXEC pfnSaveExec; 240 PFNSSMDEVSAVEDONE pfnSaveDone; 241 PFNSSMDEVLOADPREP pfnLoadPrep; 242 PFNSSMDEVLOADEXEC pfnLoadExec; 243 PFNSSMDEVLOADDONE pfnLoadDone; 244 } TSTDEVDUTSSM; 245 /** Pointer to the registered SSM handlers. */ 246 typedef TSTDEVDUTSSM *PTSTDEVDUTSSM; 247 /** Pointer to a const SSM handler. */ 248 typedef const TSTDEVDUTSSM *PCTSTDEVDUTSSM; 249 222 250 223 251 /** … … 320 348 /** List of PDM threads. */ 321 349 RTLISTANCHOR LstPdmThreads; 350 /** List of SSM handlers (just one normally). */ 351 RTLISTANCHOR LstSsmHandlers; 322 352 /** The SUP session we emulate. */ 323 353 TSTDEVSUPDRVSESSION SupSession; 354 /** The NOP critical section. */ 355 PDMCRITSECT CritSectNop; 324 356 /** The VM state associated with this device. */ 325 357 PVM pVm; -
trunk/src/VBox/Devices/testcase/tstDevicePdmDevHlp.cpp
r82903 r82904 122 122 pvUser, pszDesc, pszDesc, paExtDescs, phIoPorts)); 123 123 124 int rc = VERR_NOT_IMPLEMENTED; 125 AssertFailed(); 124 /** @todo Verify there is no overlapping. */ 125 126 RT_NOREF(pszDesc); 127 int rc = VINF_SUCCESS; 128 PRTDEVDUTIOPORT pIoPort = (PRTDEVDUTIOPORT)RTMemAllocZ(sizeof(RTDEVDUTIOPORT)); 129 if (RT_LIKELY(pIoPort)) 130 { 131 pIoPort->cPorts = cPorts; 132 pIoPort->pvUserR3 = pvUser; 133 pIoPort->pfnOutR3 = pfnOut; 134 pIoPort->pfnInR3 = pfnIn; 135 pIoPort->pfnOutStrR3 = pfnOutStr; 136 pIoPort->pfnInStrR3 = pfnInStr; 137 RTListAppend(&pDevIns->Internal.s.pDut->LstIoPorts, &pIoPort->NdIoPorts); 138 *phIoPorts = (IOMIOPORTHANDLE)pIoPort; 139 } 140 else 141 rc = VERR_NO_MEMORY; 126 142 127 143 LogFlow(("pdmR3DevHlp_IoPortCreateEx: caller='%s'/%d: returns %Rrc (*phIoPorts=%#x)\n", … … 137 153 LogFlow(("pdmR3DevHlp_IoPortMap: caller='%s'/%d: hIoPorts=%#x Port=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, hIoPorts, Port)); 138 154 139 int rc = VERR_NOT_IMPLEMENTED;140 AssertFailed();141 142 LogFlow(("pdmR3DevHlp_IoPortMap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));143 return rc;155 PRTDEVDUTIOPORT pIoPort = (PRTDEVDUTIOPORT)hIoPorts; 156 pIoPort->PortStart = Port; 157 158 LogFlow(("pdmR3DevHlp_IoPortMap: caller='%s'/%d: returns VINF_SUCCESS\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS)); 159 return VINF_SUCCESS; 144 160 } 145 161 … … 395 411 pfnLoadPrep, pfnLoadExec, pfnLoadDone)); 396 412 397 RT_NOREF(uVersion, cbGuess, pszBefore, pfnLivePrep, pfnLiveExec, pfnLiveVote, pfnSavePrep, pfnSaveExec, pfnSaveDone, 398 pfnLoadPrep, pfnLoadExec, pfnLoadDone); 399 int rc = VERR_NOT_IMPLEMENTED; 400 AssertFailed(); 413 RT_NOREF(cbGuess, pszBefore); 414 int rc = VINF_SUCCESS; 415 PTSTDEVDUTSSM pSsm = (PTSTDEVDUTSSM)RTMemAllocZ(sizeof(*pSsm)); 416 if (RT_LIKELY(pSsm)) 417 { 418 pSsm->uVersion = uVersion; 419 pSsm->pfnLivePrep = pfnLivePrep; 420 pSsm->pfnLiveExec = pfnLiveExec; 421 pSsm->pfnLiveVote = pfnLiveVote; 422 pSsm->pfnSavePrep = pfnSavePrep; 423 pSsm->pfnSaveExec = pfnSaveExec; 424 pSsm->pfnSaveDone = pfnSaveDone; 425 pSsm->pfnLoadPrep = pfnLoadPrep; 426 pSsm->pfnLoadExec = pfnLoadExec; 427 pSsm->pfnLoadDone = pfnLoadDone; 428 RTListAppend(&pDevIns->Internal.s.pDut->LstSsmHandlers, &pSsm->NdSsm); 429 } 430 else 431 rc = VERR_NO_MEMORY; 401 432 402 433 LogFlow(("pdmR3DevHlp_SSMRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); … … 1093 1124 pDevIns->pReg->szName, pDevIns->iInstance, enmClock, pfnCallback, pvUser, fFlags, pszDesc, pszDesc, phTimer)); 1094 1125 1095 int rc = VERR_NOT_IMPLEMENTED; 1096 AssertFailed(); 1126 int rc = VINF_SUCCESS; 1127 PTMTIMERR3 pTimer = (PTMTIMERR3)RTMemAllocZ(sizeof(TMTIMER)); 1128 if (RT_LIKELY(pTimer)) 1129 { 1130 pTimer->enmClock = enmClock; 1131 pTimer->pfnCallbackDev = pfnCallback; 1132 pTimer->pvUser = pvUser; 1133 pTimer->fFlags = fFlags; 1134 RTListAppend(&pDevIns->Internal.s.pDut->LstTimers, &pTimer->NdDevTimers); 1135 *phTimer = (TMTIMERHANDLE)pTimer; 1136 } 1137 else 1138 rc = VERR_NO_MEMORY; 1097 1139 1098 1140 LogFlow(("pdmR3DevHlp_TimerCreate: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); … … 1279 1321 { 1280 1322 RT_NOREF(pDevIns, hTimer); 1281 int rc = VERR_NOT_IMPLEMENTED; 1282 AssertFailed(); 1323 1324 #if 1 /** @todo */ 1325 int rc = VINF_SUCCESS; 1326 #else 1327 int rc = VERR_NOT_IMPLEMENTED; 1328 AssertFailed(); 1329 #endif 1330 1283 1331 return rc; 1284 1332 } … … 1304 1352 static DECLCALLBACK(int) pdmR3DevHlp_TimerSetCritSect(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect) 1305 1353 { 1306 RT_NOREF(pDevIns, hTimer, pCritSect); 1307 int rc = VERR_NOT_IMPLEMENTED; 1308 AssertFailed(); 1309 return rc; 1354 PDMDEV_ASSERT_DEVINS(pDevIns); 1355 1356 PTMTIMERR3 pTimer = (PTMTIMERR3)hTimer; 1357 pTimer->pCritSect = pCritSect; 1358 return VINF_SUCCESS; 1310 1359 } 1311 1360 … … 2844 2893 pDevIns->pReg->szName, pDevIns->iInstance, iLun, pBaseInterface, ppBaseInterface, pszDesc, pszDesc)); 2845 2894 2846 int rc = VERR_NOT_IMPLEMENTED; 2847 AssertFailed(); 2895 #if 1 2896 int rc = VERR_PDM_NO_ATTACHED_DRIVER; 2897 #else 2898 int rc = VERR_NOT_IMPLEMENTED; 2899 AssertFailed(); 2900 #endif 2848 2901 2849 2902 LogFlow(("pdmR3DevHlp_DriverAttach: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); … … 3251 3304 pDevIns->pReg->szName, pDevIns->iInstance, pCritSect, pszNameFmt, pszNameFmt)); 3252 3305 3253 RT_NOREF(pDevIns, pCritSect, RT_SRC_POS_ARGS, pszNameFmt, va); 3254 int rc = VERR_NOT_IMPLEMENTED; 3255 AssertFailed(); 3306 RT_NOREF(RT_SRC_POS_ARGS, pszNameFmt, va); 3307 int rc = RTCritSectInit(&pCritSect->s.CritSect); 3256 3308 3257 3309 LogFlow(("pdmR3DevHlp_CritSectInit: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); … … 3265 3317 PDMDEV_ASSERT_DEVINS(pDevIns); 3266 3318 3267 PPDMCRITSECT pCritSect = NULL; 3268 AssertFailed(); 3319 PPDMCRITSECT pCritSect = &pDevIns->Internal.s.pDut->CritSectNop; 3269 3320 3270 3321 LogFlow(("pdmR3DevHlp_CritSectGetNop: caller='%s'/%d: return %p\n", … … 3303 3354 /* 3304 3355 * Validate input. 3305 *3306 * Note! We only allow the automatically created default critical section3307 * to be replaced by this API.3308 3356 */ 3309 3357 PDMDEV_ASSERT_DEVINS(pDevIns); 3310 3358 AssertPtrReturn(pCritSect, VERR_INVALID_POINTER); 3311 3359 3312 #if 0 3313 LogFlow(("pdmR3DevHlp_SetDeviceCritSect: caller='%s'/%d: pCritSect=%p (%s)\n", 3314 pDevIns->pReg->szName, pDevIns->iInstance, pCritSect, pCritSect->s.pszName)); 3315 #endif 3316 3317 int rc = VERR_NOT_IMPLEMENTED; 3318 AssertFailed(); 3319 3320 LogFlow(("pdmR3DevHlp_SetDeviceCritSect: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); 3321 return rc; 3360 LogFlow(("pdmR3DevHlp_SetDeviceCritSect: caller='%s'/%d: pCritSect=%p\n", 3361 pDevIns->pReg->szName, pDevIns->iInstance, pCritSect)); 3362 3363 pDevIns->pCritSectRoR3 = pCritSect; 3364 LogFlow(("pdmR3DevHlp_SetDeviceCritSect: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS)); 3365 return VINF_SUCCESS; 3322 3366 } 3323 3367
Note:
See TracChangeset
for help on using the changeset viewer.