Changeset 84459 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- May 22, 2020 12:55:07 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 138166
- Location:
- trunk/src/VBox/VMM/VMMR0
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/PDMR0DevHlp.cpp
r84332 r84459 61 61 * Internal Functions * 62 62 *********************************************************************************************************************************/ 63 static bool pdmR0IsaSetIrq(PGVM pGVM, int iIrq, int iLevel, uint32_t uTagSrc);64 63 65 64 … … 1364 1363 }; 1365 1364 1365 1366 #ifdef VBOX_WITH_DBGF_TRACING 1367 /** 1368 * The Ring-0 Device Helper Callbacks - tracing variant. 1369 */ 1370 extern DECLEXPORT(const PDMDEVHLPR0) g_pdmR0DevHlpTracing = 1371 { 1372 PDM_DEVHLPR0_VERSION, 1373 pdmR0DevHlpTracing_IoPortSetUpContextEx, 1374 pdmR0DevHlpTracing_MmioSetUpContextEx, 1375 pdmR0DevHlp_Mmio2SetUpContext, 1376 pdmR0DevHlpTracing_PCIPhysRead, 1377 pdmR0DevHlpTracing_PCIPhysWrite, 1378 pdmR0DevHlpTracing_PCISetIrq, 1379 pdmR0DevHlpTracing_ISASetIrq, 1380 pdmR0DevHlpTracing_IoApicSendMsi, 1381 pdmR0DevHlp_PhysRead, 1382 pdmR0DevHlp_PhysWrite, 1383 pdmR0DevHlp_A20IsEnabled, 1384 pdmR0DevHlp_VMState, 1385 pdmR0DevHlp_VMSetError, 1386 pdmR0DevHlp_VMSetErrorV, 1387 pdmR0DevHlp_VMSetRuntimeError, 1388 pdmR0DevHlp_VMSetRuntimeErrorV, 1389 pdmR0DevHlp_GetVM, 1390 pdmR0DevHlp_GetVMCPU, 1391 pdmR0DevHlp_GetCurrentCpuId, 1392 pdmR0DevHlp_TimerToPtr, 1393 pdmR0DevHlp_TimerFromMicro, 1394 pdmR0DevHlp_TimerFromMilli, 1395 pdmR0DevHlp_TimerFromNano, 1396 pdmR0DevHlp_TimerGet, 1397 pdmR0DevHlp_TimerGetFreq, 1398 pdmR0DevHlp_TimerGetNano, 1399 pdmR0DevHlp_TimerIsActive, 1400 pdmR0DevHlp_TimerIsLockOwner, 1401 pdmR0DevHlp_TimerLockClock, 1402 pdmR0DevHlp_TimerLockClock2, 1403 pdmR0DevHlp_TimerSet, 1404 pdmR0DevHlp_TimerSetFrequencyHint, 1405 pdmR0DevHlp_TimerSetMicro, 1406 pdmR0DevHlp_TimerSetMillies, 1407 pdmR0DevHlp_TimerSetNano, 1408 pdmR0DevHlp_TimerSetRelative, 1409 pdmR0DevHlp_TimerStop, 1410 pdmR0DevHlp_TimerUnlockClock, 1411 pdmR0DevHlp_TimerUnlockClock2, 1412 pdmR0DevHlp_TMTimeVirtGet, 1413 pdmR0DevHlp_TMTimeVirtGetFreq, 1414 pdmR0DevHlp_TMTimeVirtGetNano, 1415 pdmR0DevHlp_QueueToPtr, 1416 pdmR0DevHlp_QueueAlloc, 1417 pdmR0DevHlp_QueueInsert, 1418 pdmR0DevHlp_QueueInsertEx, 1419 pdmR0DevHlp_QueueFlushIfNecessary, 1420 pdmR0DevHlp_TaskTrigger, 1421 pdmR0DevHlp_SUPSemEventSignal, 1422 pdmR0DevHlp_SUPSemEventWaitNoResume, 1423 pdmR0DevHlp_SUPSemEventWaitNsAbsIntr, 1424 pdmR0DevHlp_SUPSemEventWaitNsRelIntr, 1425 pdmR0DevHlp_SUPSemEventGetResolution, 1426 pdmR0DevHlp_SUPSemEventMultiSignal, 1427 pdmR0DevHlp_SUPSemEventMultiReset, 1428 pdmR0DevHlp_SUPSemEventMultiWaitNoResume, 1429 pdmR0DevHlp_SUPSemEventMultiWaitNsAbsIntr, 1430 pdmR0DevHlp_SUPSemEventMultiWaitNsRelIntr, 1431 pdmR0DevHlp_SUPSemEventMultiGetResolution, 1432 pdmR0DevHlp_CritSectGetNop, 1433 pdmR0DevHlp_SetDeviceCritSect, 1434 pdmR0DevHlp_CritSectEnter, 1435 pdmR0DevHlp_CritSectEnterDebug, 1436 pdmR0DevHlp_CritSectTryEnter, 1437 pdmR0DevHlp_CritSectTryEnterDebug, 1438 pdmR0DevHlp_CritSectLeave, 1439 pdmR0DevHlp_CritSectIsOwner, 1440 pdmR0DevHlp_CritSectIsInitialized, 1441 pdmR0DevHlp_CritSectHasWaiters, 1442 pdmR0DevHlp_CritSectGetRecursion, 1443 pdmR0DevHlp_CritSectScheduleExitEvent, 1444 pdmR0DevHlp_DBGFTraceBuf, 1445 pdmR0DevHlp_PCIBusSetUpContext, 1446 pdmR0DevHlp_IommuSetUpContext, 1447 pdmR0DevHlp_PICSetUpContext, 1448 pdmR0DevHlp_ApicSetUpContext, 1449 pdmR0DevHlp_IoApicSetUpContext, 1450 pdmR0DevHlp_HpetSetUpContext, 1451 NULL /*pfnReserved1*/, 1452 NULL /*pfnReserved2*/, 1453 NULL /*pfnReserved3*/, 1454 NULL /*pfnReserved4*/, 1455 NULL /*pfnReserved5*/, 1456 NULL /*pfnReserved6*/, 1457 NULL /*pfnReserved7*/, 1458 NULL /*pfnReserved8*/, 1459 NULL /*pfnReserved9*/, 1460 NULL /*pfnReserved10*/, 1461 PDM_DEVHLPR0_VERSION 1462 }; 1463 #endif 1464 1465 1366 1466 /** @} */ 1367 1467 … … 1643 1743 * @remarks The caller holds the PDM lock. 1644 1744 */ 1645 static boolpdmR0IsaSetIrq(PGVM pGVM, int iIrq, int iLevel, uint32_t uTagSrc)1745 DECLHIDDEN(bool) pdmR0IsaSetIrq(PGVM pGVM, int iIrq, int iLevel, uint32_t uTagSrc) 1646 1746 { 1647 1747 if (RT_LIKELY( ( pGVM->pdm.s.IoApic.pDevInsR0 -
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r84007 r84459 54 54 RT_C_DECLS_BEGIN 55 55 extern DECLEXPORT(const PDMDEVHLPR0) g_pdmR0DevHlp; 56 #ifdef VBOX_WITH_DBGF_TRACING 57 extern DECLEXPORT(const PDMDEVHLPR0) g_pdmR0DevHlpTracing; 58 #endif 56 59 extern DECLEXPORT(const PDMPICHLP) g_pdmR0PicHlp; 57 60 extern DECLEXPORT(const PDMIOAPICHLP) g_pdmR0IoApicHlp; … … 139 142 140 143 /* 144 * Free the DBGF tracing tracking structures if necessary. 145 */ 146 if (pDevIns->Internal.s.hDbgfTraceEvtSrc != NIL_DBGFTRACEREVTSRC) 147 { 148 RTR0MemObjFree(pDevIns->Internal.s.hDbgfTraceObj, true); 149 pDevIns->Internal.s.hDbgfTraceObj = NIL_RTR0MEMOBJ; 150 } 151 152 /* 141 153 * Free the ring-3 mapping and instance memory. 142 154 */ … … 222 234 * 223 235 * @returns VBox status code. 224 * @param pGVM The global (ring-0) VM structure. 225 * @param pDevReg The device registration structure. 226 * @param iInstance The device instance number. 227 * @param cbInstanceR3 The size of the ring-3 instance data. 228 * @param cbInstanceRC The size of the raw-mode instance data. 229 * @param hMod The module implementing the device. On success, the 230 * @param RCPtrMapping The raw-mode context mapping address, NIL_RTGCPTR if 231 * not to include raw-mode. 232 * @param ppDevInsR3 Where to return the ring-3 device instance address. 236 * @param pGVM The global (ring-0) VM structure. 237 * @param pDevReg The device registration structure. 238 * @param iInstance The device instance number. 239 * @param cbInstanceR3 The size of the ring-3 instance data. 240 * @param cbInstanceRC The size of the raw-mode instance data. 241 * @param hMod The module implementing the device. 242 * @param hDbgfTraceEvtSrc The DBGF tarcer event source handle. 243 * @param RCPtrMapping The raw-mode context mapping address, NIL_RTGCPTR if 244 * not to include raw-mode. 245 * @param ppDevInsR3 Where to return the ring-3 device instance address. 233 246 * @thread EMT(0) 234 247 */ 235 248 static int pdmR0DeviceCreateWorker(PGVM pGVM, PCPDMDEVREGR0 pDevReg, uint32_t iInstance, uint32_t cbInstanceR3, 236 uint32_t cbInstanceRC, RTRGPTR RCPtrMapping, void *hMod, PPDMDEVINSR3 *ppDevInsR3) 249 uint32_t cbInstanceRC, RTRGPTR RCPtrMapping, DBGFTRACEREVTSRC hDbgfTraceEvtSrc, 250 void *hMod, PPDMDEVINSR3 *ppDevInsR3) 237 251 { 238 252 /* … … 285 299 pDevIns->u32Version = PDM_DEVINSR0_VERSION; 286 300 pDevIns->iInstance = iInstance; 301 #ifdef VBOX_WITH_DBGF_TRACING 302 pDevIns->pHlpR0 = hDbgfTraceEvtSrc == NIL_DBGFTRACEREVTSRC ? &g_pdmR0DevHlp : &g_pdmR0DevHlpTracing; 303 #else 287 304 pDevIns->pHlpR0 = &g_pdmR0DevHlp; 305 #endif 288 306 pDevIns->pvInstanceDataR0 = (uint8_t *)pDevIns + cbRing0 + cbRing3 + cbRC; 289 307 pDevIns->pvInstanceDataForR0 = &pDevIns->achInstanceData[0]; … … 314 332 pDevIns->Internal.s.pInsR3R0 = pDevInsR3; 315 333 pDevIns->Internal.s.pIntR3R0 = &pDevInsR3->Internal.s; 334 pDevIns->Internal.s.hDbgfTraceEvtSrc = hDbgfTraceEvtSrc; 316 335 317 336 /* … … 342 361 pDevInsR3->Internal.s.fIntFlags = RCPtrMapping == NIL_RTRGPTR ? PDMDEVINSINT_FLAGS_R0_ENABLED 343 362 : PDMDEVINSINT_FLAGS_R0_ENABLED | PDMDEVINSINT_FLAGS_RC_ENABLED; 363 pDevInsR3->Internal.s.hDbgfTraceEvtSrc = hDbgfTraceEvtSrc; 344 364 345 365 /* … … 369 389 370 390 /* 371 * Add to the device instance array and set its handle value. 391 * If the device is being traced we have to set up a single page for tracking 392 * I/O and MMIO region registrations so we can inject our own handlers. 372 393 */ 373 AssertCompile(sizeof(pGVM->pdmr0.padding) == sizeof(pGVM->pdmr0)); 374 uint32_t idxR0Device = pGVM->pdmr0.s.cDevInstances; 375 if (idxR0Device < RT_ELEMENTS(pGVM->pdmr0.s.apDevInstances)) 394 if (hDbgfTraceEvtSrc != NIL_DBGFTRACEREVTSRC) 376 395 { 377 pGVM->pdmr0.s.apDevInstances[idxR0Device] = pDevIns; 378 pGVM->pdmr0.s.cDevInstances = idxR0Device + 1; 379 pDevIns->Internal.s.idxR0Device = idxR0Device; 380 pDevInsR3->Internal.s.idxR0Device = idxR0Device; 381 382 /* 383 * Call the early constructor if present. 384 */ 385 if (pDevReg->pfnEarlyConstruct) 386 rc = pDevReg->pfnEarlyConstruct(pDevIns); 396 pDevIns->Internal.s.hDbgfTraceObj = NIL_RTR0MEMOBJ; 397 rc = RTR0MemObjAllocPage(&pDevIns->Internal.s.hDbgfTraceObj, PDM_MAX_DEVICE_DBGF_TRACING_TRACK, false /*fExecutable*/); 387 398 if (RT_SUCCESS(rc)) 388 399 { 400 pDevIns->Internal.s.paDbgfTraceTrack = (PPDMDEVINSDBGFTRACK)RTR0MemObjAddress(pDevIns->Internal.s.hDbgfTraceObj); 401 pDevIns->Internal.s.idxDbgfTraceTrackNext = 0; 402 pDevIns->Internal.s.cDbgfTraceTrackMax = PDM_MAX_DEVICE_DBGF_TRACING_TRACK / sizeof(PDMDEVINSDBGFTRACK); 403 RT_BZERO(pDevIns->Internal.s.paDbgfTraceTrack, PDM_MAX_DEVICE_DBGF_TRACING_TRACK); 404 } 405 } 406 407 if (RT_SUCCESS(rc)) 408 { 409 /* 410 * Add to the device instance array and set its handle value. 411 */ 412 AssertCompile(sizeof(pGVM->pdmr0.padding) == sizeof(pGVM->pdmr0)); 413 uint32_t idxR0Device = pGVM->pdmr0.s.cDevInstances; 414 if (idxR0Device < RT_ELEMENTS(pGVM->pdmr0.s.apDevInstances)) 415 { 416 pGVM->pdmr0.s.apDevInstances[idxR0Device] = pDevIns; 417 pGVM->pdmr0.s.cDevInstances = idxR0Device + 1; 418 pDevIns->Internal.s.idxR0Device = idxR0Device; 419 pDevInsR3->Internal.s.idxR0Device = idxR0Device; 420 389 421 /* 390 * We're done.422 * Call the early constructor if present. 391 423 */ 392 *ppDevInsR3 = RTR0MemObjAddressR3(hMapObj); 393 return rc; 424 if (pDevReg->pfnEarlyConstruct) 425 rc = pDevReg->pfnEarlyConstruct(pDevIns); 426 if (RT_SUCCESS(rc)) 427 { 428 /* 429 * We're done. 430 */ 431 *ppDevInsR3 = RTR0MemObjAddressR3(hMapObj); 432 return rc; 433 } 434 435 /* 436 * Bail out. 437 */ 438 if (pDevIns->pReg->pfnFinalDestruct) 439 pDevIns->pReg->pfnFinalDestruct(pDevIns); 440 441 pGVM->pdmr0.s.apDevInstances[idxR0Device] = NULL; 442 Assert(pGVM->pdmr0.s.cDevInstances == idxR0Device + 1); 443 pGVM->pdmr0.s.cDevInstances = idxR0Device; 394 444 } 395 396 /*397 * Bail out.398 */399 if (pDevIns->pReg->pfnFinalDestruct)400 pDevIns->pReg->pfnFinalDestruct(pDevIns);401 402 pGVM->pdmr0.s.apDevInstances[idxR0Device] = NULL;403 Assert(pGVM->pdmr0.s.cDevInstances == idxR0Device + 1);404 pGVM->pdmr0.s.cDevInstances = idxR0Device;405 445 } 446 447 if ( hDbgfTraceEvtSrc != NIL_DBGFTRACEREVTSRC 448 && pDevIns->Internal.s.hDbgfTraceObj != NIL_RTR0MEMOBJ) 449 RTR0MemObjFree(pDevIns->Internal.s.hDbgfTraceObj, true); 406 450 407 451 RTR0MemObjFree(hMapObj, true); … … 515 559 { 516 560 rc = pdmR0DeviceCreateWorker(pGVM, pDevReg, pReq->iInstance, pReq->cbInstanceR3, pReq->cbInstanceRC, 517 NIL_RTRCPTR /** @todo new raw-mode */, hMod, &pReq->pDevInsR3); 561 NIL_RTRCPTR /** @todo new raw-mode */, pReq->hDbgfTracerEvtSrc, 562 hMod, &pReq->pDevInsR3); 518 563 if (RT_SUCCESS(rc)) 519 564 hMod = NULL; /* keep the module reference */
Note:
See TracChangeset
for help on using the changeset viewer.