Changeset 12986 in vbox
- Timestamp:
- Oct 4, 2008 11:41:17 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 37419
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pdmdrv.h
r12476 r12986 921 921 typedef DECLCALLBACK(int) FNPDMVBOXDRIVERSREGISTER(PCPDMDRVREGCB pCallbacks, uint32_t u32Version); 922 922 923 /**924 * Register external drivers925 *926 * @returns VBox status code.927 * @param pVM The VM to operate on.928 * @param pfnCallback Driver registration callback929 */930 923 PDMR3DECL(int) PDMR3RegisterDrivers(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback); 931 924 -
trunk/include/VBox/pdmthread.h
r12324 r12986 284 284 285 285 #ifdef IN_RING3 286 /**287 * Creates a PDM thread for internal use in the VM.288 *289 * @returns VBox status code.290 * @param pVM The VM handle.291 * @param ppThread Where to store the thread 'handle'.292 * @param pvUser The user argument to the thread function.293 * @param pfnThread The thread function.294 * @param pfnWakeUp The wakup callback. This is called on the EMT thread when295 * a state change is pending.296 * @param cbStack See RTThreadCreate.297 * @param enmType See RTThreadCreate.298 * @param pszName See RTThreadCreate.299 */300 286 PDMR3DECL(int) PDMR3ThreadCreate(PVM pVM, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADINT pfnThread, 301 287 PFNPDMTHREADWAKEUPINT pfnWakeUp, size_t cbStack, RTTHREADTYPE enmType, const char *pszName); 302 303 /**304 * Creates a PDM thread for VM use by some external party.305 *306 * @returns VBox status code.307 * @param pVM The VM handle.308 * @param ppThread Where to store the thread 'handle'.309 * @param pvUser The user argument to the thread function.310 * @param pfnThread The thread function.311 * @param pfnWakeUp The wakup callback. This is called on the EMT thread when312 * a state change is pending.313 * @param cbStack See RTThreadCreate.314 * @param enmType See RTThreadCreate.315 * @param pszName See RTThreadCreate.316 */317 288 PDMR3DECL(int) PDMR3ThreadCreateExternal(PVM pVM, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADEXT pfnThread, 318 289 PFNPDMTHREADWAKEUPEXT pfnWakeUp, size_t cbStack, RTTHREADTYPE enmType, const char *pszName); 319 320 /**321 * Destroys a PDM thread.322 *323 * This will wakeup the thread, tell it to terminate, and wait for it terminate.324 *325 * @returns VBox status code.326 * This reflects the success off destroying the thread and not the exit code327 * of the thread as this is stored in *pRcThread.328 * @param pThread The thread to destroy.329 * @param pRcThread Where to store the thread exit code. Optional.330 * @thread The emulation thread (EMT).331 */332 290 PDMR3DECL(int) PDMR3ThreadDestroy(PPDMTHREAD pThread, int *pRcThread); 333 334 /**335 * Called by the PDM thread in response to a wakeup call with336 * suspending as the new state.337 *338 * The thread will block in side this call until the state is changed in339 * response to a VM state change or to the device/driver/whatever calling the340 * PDMR3ThreadResume API.341 *342 * @returns VBox status code.343 * On failure, terminate the thread.344 * @param pThread The PDM thread.345 */346 291 PDMR3DECL(int) PDMR3ThreadIAmSuspending(PPDMTHREAD pThread); 347 348 /**349 * Called by the PDM thread in response to a resuming state.350 *351 * The purpose of this API is to tell the PDMR3ThreadResume caller that352 * the the PDM thread has successfully resumed. It will also do the353 * state transition from the resuming to the running state.354 *355 * @returns VBox status code.356 * On failure, terminate the thread.357 * @param pThread The PDM thread.358 */359 292 PDMR3DECL(int) PDMR3ThreadIAmRunning(PPDMTHREAD pThread); 360 361 /**362 * Called by the PDM thread instead of RTThreadSleep.363 *364 * The difference is that the sleep will be interrupted on state change. The365 * thread must be in the running state, otherwise it will return immediately.366 *367 * @returns VBox status code.368 * @retval VINF_SUCCESS on success or state change.369 * @retval VERR_INTERRUPTED on signal or APC.370 *371 * @param pThread The PDM thread.372 * @param cMillies The number of milliseconds to sleep.373 */374 293 PDMR3DECL(int) PDMR3ThreadSleep(PPDMTHREAD pThread, unsigned cMillies); 375 376 /**377 * Suspends the thread.378 *379 * This can be called at the power off / suspend notifications to suspend the380 * PDM thread a bit early. The thread will be automatically suspend upon381 * completion of the device/driver notification cycle.382 *383 * The caller is responsible for serializing the control operations on the384 * thread. That basically means, always do these calls from the EMT.385 *386 * @returns VBox status code.387 * @param pThread The PDM thread.388 */389 294 PDMR3DECL(int) PDMR3ThreadSuspend(PPDMTHREAD pThread); 390 391 /**392 * Resumes the thread.393 *394 * This can be called the power on / resume notifications to resume the395 * PDM thread a bit early. The thread will be automatically resumed upon396 * return from these two notification callbacks (devices/drivers).397 *398 * The caller is responsible for serializing the control operations on the399 * thread. That basically means, always do these calls from the EMT.400 *401 * @returns VBox status code.402 * @param pThread The PDM thread.403 */404 295 PDMR3DECL(int) PDMR3ThreadResume(PPDMTHREAD pThread); 405 296 #endif /* IN_RING3 */ -
trunk/include/VBox/pdmusb.h
r12895 r12986 763 763 typedef DECLCALLBACK(int) FNPDMVBOXUSBREGISTER(PCPDMUSBREGCB pCallbacks, uint32_t u32Version); 764 764 765 766 /** 767 * Creates a USB proxy device instance. 768 * 769 * This will find an appropriate HUB for the USB device, create the necessary CFGM stuff 770 * and try instantiate the proxy device. 771 * 772 * @returns VBox status code. 773 * @param pVM The VM handle. 774 * @param pUuid The UUID thats to be associated with the device. 775 * @param fRemote Whether it's a remove or local device. 776 * @param pszAddress The address string. 777 * @param pvBackend Pointer to the backend. 778 * @param iUsbVersion The preferred USB version. 779 * @param fMaskedIfs The interfaces to hide from the guest. 780 */ 781 PDMR3DECL(int) PDMR3USBCreateProxyDevice(PVM pVM, PCRTUUID pUuid, bool fRemote, const char *pszAddress, void *pvBackend, 782 uint32_t iUsbVersion, uint32_t fMaskedIfs); 783 784 /** 785 * Detaches and destroys a USB device. 786 * 787 * @returns VBox status code. 788 * @param pVM The VM handle. 789 * @param pUuid The UUID associated with the device to detach. 790 * @thread EMT 791 */ 792 PDMR3DECL(int) PDMR3USBDetachDevice(PVM pVM, PCRTUUID pUuid); 793 794 /** 795 * Checks if there are any USB hubs attached. 796 * 797 * @returns true / false accordingly. 798 * @param pVM Pointer to the shared VM structure. 799 */ 765 PDMR3DECL(int) PDMR3USBCreateProxyDevice(PVM pVM, PCRTUUID pUuid, bool fRemote, const char *pszAddress, void *pvBackend, 766 uint32_t iUsbVersion, uint32_t fMaskedIfs); 767 PDMR3DECL(int) PDMR3USBDetachDevice(PVM pVM, PCRTUUID pUuid); 800 768 PDMR3DECL(bool) PDMR3USBHasHub(PVM pVM); 801 769 -
trunk/src/VBox/VMM/PDMDriver.cpp
r12975 r12986 68 68 * Internal Functions * 69 69 *******************************************************************************/ 70 /** @name Driver Helpers71 * @{72 */73 static DECLCALLBACK(int) pdmR3DrvHlp_Attach(PPDMDRVINS pDrvIns, PPDMIBASE *ppBaseInterface);74 static DECLCALLBACK(int) pdmR3DrvHlp_Detach(PPDMDRVINS pDrvIns);75 static DECLCALLBACK(int) pdmR3DrvHlp_DetachSelf(PPDMDRVINS pDrvIns);76 static DECLCALLBACK(int) pdmR3DrvHlp_MountPrepare(PPDMDRVINS pDrvIns, const char *pszFilename, const char *pszCoreDriver);77 static DECLCALLBACK(int) pdmR3DrvHlp_VMSetError(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...);78 static DECLCALLBACK(int) pdmR3DrvHlp_VMSetErrorV(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va);79 static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeError(PPDMDRVINS pDrvIns, bool fFatal, const char *pszErrorID, const char *pszFormat, ...);80 static DECLCALLBACK(int) pdmR3DrvHlp_VMSetRuntimeErrorV(PPDMDRVINS pDrvIns, bool fFatal, const char *pszErrorID, const char *pszFormat, va_list va);81 static DECLCALLBACK(bool) pdmR3DrvHlp_AssertEMT(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction);82 static DECLCALLBACK(bool) pdmR3DrvHlp_AssertOther(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction);83 static DECLCALLBACK(int) pdmR3DrvHlp_PDMQueueCreate(PPDMDRVINS pDrvIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval, PFNPDMQUEUEDRV pfnCallback, PPDMQUEUE *ppQueue);84 static DECLCALLBACK(int) pdmR3DrvHlp_PDMPollerRegister(PPDMDRVINS pDrvIns, PFNPDMDRVPOLLER pfnPoller);85 static DECLCALLBACK(uint64_t) pdmR3DrvHlp_TMGetVirtualFreq(PPDMDRVINS pDrvIns);86 static DECLCALLBACK(uint64_t) pdmR3DrvHlp_TMGetVirtualTime(PPDMDRVINS pDrvIns);87 static DECLCALLBACK(int) pdmR3DrvHlp_TMTimerCreate(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, const char *pszDesc, PPTMTIMERR3 ppTimer);88 static DECLCALLBACK(int) pdmR3DrvHlp_SSMRegister(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,89 PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,90 PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone);91 static DECLCALLBACK(int) pdmR3DrvHlp_SSMDeregister(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance);92 static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegister(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc);93 static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterF(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...);94 static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterV(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args);95 static DECLCALLBACK(int) pdmR3DrvHlp_SUPCallVMMR0Ex(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg);96 static DECLCALLBACK(int) pdmR3DrvHlp_USBRegisterHub(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp);97 static DECLCALLBACK(int) pdmR3DrvHlp_PDMThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,98 PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName);99 static DECLCALLBACK(VMSTATE) pdmR3DrvHlp_VMState(PPDMDRVINS pDrvIns);100 101 102 #ifdef VBOX_WITH_PDM_ASYNC_COMPLETION103 static DECLCALLBACK(int) pdmR3DrvHlp_PDMAsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,104 PFNPDMASYNCCOMPLETEDRV pfnCompleted, const char *pszDesc);105 #endif106 107 70 /** @def PDMDRV_ASSERT_DRVINS 108 71 * Asserts the validity of the driver instance. … … 123 86 static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName); 124 87 125 126 /*******************************************************************************127 * Global Variables *128 *******************************************************************************/129 /**130 * The driver helper structure.131 */132 const PDMDRVHLP g_pdmR3DrvHlp =133 {134 PDM_DRVHLP_VERSION,135 pdmR3DrvHlp_Attach,136 pdmR3DrvHlp_Detach,137 pdmR3DrvHlp_DetachSelf,138 pdmR3DrvHlp_MountPrepare,139 pdmR3DrvHlp_AssertEMT,140 pdmR3DrvHlp_AssertOther,141 pdmR3DrvHlp_VMSetError,142 pdmR3DrvHlp_VMSetErrorV,143 pdmR3DrvHlp_VMSetRuntimeError,144 pdmR3DrvHlp_VMSetRuntimeErrorV,145 pdmR3DrvHlp_PDMQueueCreate,146 pdmR3DrvHlp_PDMPollerRegister,147 pdmR3DrvHlp_TMGetVirtualFreq,148 pdmR3DrvHlp_TMGetVirtualTime,149 pdmR3DrvHlp_TMTimerCreate,150 pdmR3DrvHlp_SSMRegister,151 pdmR3DrvHlp_SSMDeregister,152 pdmR3DrvHlp_STAMRegister,153 pdmR3DrvHlp_STAMRegisterF,154 pdmR3DrvHlp_STAMRegisterV,155 pdmR3DrvHlp_SUPCallVMMR0Ex,156 pdmR3DrvHlp_USBRegisterHub,157 pdmR3DrvHlp_PDMThreadCreate,158 pdmR3DrvHlp_VMState,159 #ifdef VBOX_WITH_PDM_ASYNC_COMPLETION160 pdmR3DrvHlp_PDMAsyncCompletionTemplateCreate,161 #endif162 0 /* the end */163 };164 88 165 89 … … 558 482 } 559 483 484 485 486 487 /** @name Driver Helpers 488 * @{ 489 */ 560 490 561 491 /** @copydoc PDMDRVHLP::pfnAttach */ … … 895 825 896 826 897 898 827 /** @copydoc PDMDRVHLP::pfnPDMPollerRegister */ 899 828 static DECLCALLBACK(int) pdmR3DrvHlp_PDMPollerRegister(PPDMDRVINS pDrvIns, PFNPDMDRVPOLLER pfnPoller) … … 941 870 return TMVirtualGet(pDrvIns->Internal.s.pVM); 942 871 } 872 943 873 944 874 /** @copydoc PDMDRVHLP::pfnTMTimerCreate */ … … 1118 1048 #endif 1119 1049 1050 1051 /** 1052 * The driver helper structure. 1053 */ 1054 const PDMDRVHLP g_pdmR3DrvHlp = 1055 { 1056 PDM_DRVHLP_VERSION, 1057 pdmR3DrvHlp_Attach, 1058 pdmR3DrvHlp_Detach, 1059 pdmR3DrvHlp_DetachSelf, 1060 pdmR3DrvHlp_MountPrepare, 1061 pdmR3DrvHlp_AssertEMT, 1062 pdmR3DrvHlp_AssertOther, 1063 pdmR3DrvHlp_VMSetError, 1064 pdmR3DrvHlp_VMSetErrorV, 1065 pdmR3DrvHlp_VMSetRuntimeError, 1066 pdmR3DrvHlp_VMSetRuntimeErrorV, 1067 pdmR3DrvHlp_PDMQueueCreate, 1068 pdmR3DrvHlp_PDMPollerRegister, 1069 pdmR3DrvHlp_TMGetVirtualFreq, 1070 pdmR3DrvHlp_TMGetVirtualTime, 1071 pdmR3DrvHlp_TMTimerCreate, 1072 pdmR3DrvHlp_SSMRegister, 1073 pdmR3DrvHlp_SSMDeregister, 1074 pdmR3DrvHlp_STAMRegister, 1075 pdmR3DrvHlp_STAMRegisterF, 1076 pdmR3DrvHlp_STAMRegisterV, 1077 pdmR3DrvHlp_SUPCallVMMR0Ex, 1078 pdmR3DrvHlp_USBRegisterHub, 1079 pdmR3DrvHlp_PDMThreadCreate, 1080 pdmR3DrvHlp_VMState, 1081 #ifdef VBOX_WITH_PDM_ASYNC_COMPLETION 1082 pdmR3DrvHlp_PDMAsyncCompletionTemplateCreate, 1083 #endif 1084 PDM_DRVHLP_VERSION /* u32TheEnd */ 1085 }; 1086 1087 /** @} */ -
trunk/src/VBox/VMM/PDMQueue.cpp
r12985 r12986 19 19 * additional information or have any questions. 20 20 */ 21 22 21 23 22 -
trunk/src/VBox/VMM/PDMThread.cpp
r12324 r12986 213 213 if (RT_SUCCESS(rc)) 214 214 { 215 (*ppThread)->pvUser = pvUser; 216 (*ppThread)->Internal.s.enmType = PDMTHREADTYPE_DEVICE; 217 (*ppThread)->u.Dev.pDevIns = pDevIns; 218 (*ppThread)->u.Dev.pfnThread = pfnThread; 219 (*ppThread)->u.Dev.pfnWakeUp = pfnWakeUp; 215 PPDMTHREAD pThread = *ppThread; 216 pThread->pvUser = pvUser; 217 pThread->Internal.s.enmType = PDMTHREADTYPE_DEVICE; 218 pThread->u.Dev.pDevIns = pDevIns; 219 pThread->u.Dev.pfnThread = pfnThread; 220 pThread->u.Dev.pfnWakeUp = pfnWakeUp; 220 221 rc = pdmR3ThreadInit(pVM, ppThread, cbStack, enmType, pszName); 221 222 } … … 245 246 if (RT_SUCCESS(rc)) 246 247 { 247 (*ppThread)->pvUser = pvUser; 248 (*ppThread)->Internal.s.enmType = PDMTHREADTYPE_USB; 249 (*ppThread)->u.Usb.pUsbIns = pUsbIns; 250 (*ppThread)->u.Usb.pfnThread = pfnThread; 251 (*ppThread)->u.Usb.pfnWakeUp = pfnWakeUp; 248 PPDMTHREAD pThread = *ppThread; 249 pThread->pvUser = pvUser; 250 pThread->Internal.s.enmType = PDMTHREADTYPE_USB; 251 pThread->u.Usb.pUsbIns = pUsbIns; 252 pThread->u.Usb.pfnThread = pfnThread; 253 pThread->u.Usb.pfnWakeUp = pfnWakeUp; 252 254 rc = pdmR3ThreadInit(pVM, ppThread, cbStack, enmType, pszName); 253 255 } … … 277 279 if (RT_SUCCESS(rc)) 278 280 { 279 (*ppThread)->pvUser = pvUser; 280 (*ppThread)->Internal.s.enmType = PDMTHREADTYPE_DRIVER; 281 (*ppThread)->u.Drv.pDrvIns = pDrvIns; 282 (*ppThread)->u.Drv.pfnThread = pfnThread; 283 (*ppThread)->u.Drv.pfnWakeUp = pfnWakeUp; 281 PPDMTHREAD pThread = *ppThread; 282 pThread->pvUser = pvUser; 283 pThread->Internal.s.enmType = PDMTHREADTYPE_DRIVER; 284 pThread->u.Drv.pDrvIns = pDrvIns; 285 pThread->u.Drv.pfnThread = pfnThread; 286 pThread->u.Drv.pfnWakeUp = pfnWakeUp; 284 287 rc = pdmR3ThreadInit(pVM, ppThread, cbStack, enmType, pszName); 285 288 } … … 308 311 if (RT_SUCCESS(rc)) 309 312 { 310 (*ppThread)->pvUser = pvUser; 311 (*ppThread)->Internal.s.enmType = PDMTHREADTYPE_INTERNAL; 312 (*ppThread)->u.Int.pfnThread = pfnThread; 313 (*ppThread)->u.Int.pfnWakeUp = pfnWakeUp; 313 PPDMTHREAD pThread = *ppThread; 314 pThread->pvUser = pvUser; 315 pThread->Internal.s.enmType = PDMTHREADTYPE_INTERNAL; 316 pThread->u.Int.pfnThread = pfnThread; 317 pThread->u.Int.pfnWakeUp = pfnWakeUp; 314 318 rc = pdmR3ThreadInit(pVM, ppThread, cbStack, enmType, pszName); 315 319 } … … 338 342 if (RT_SUCCESS(rc)) 339 343 { 340 (*ppThread)->pvUser = pvUser; 341 (*ppThread)->Internal.s.enmType = PDMTHREADTYPE_EXTERNAL; 342 (*ppThread)->u.Ext.pfnThread = pfnThread; 343 (*ppThread)->u.Ext.pfnWakeUp = pfnWakeUp; 344 PPDMTHREAD pThread = *ppThread; 345 pThread->pvUser = pvUser; 346 pThread->Internal.s.enmType = PDMTHREADTYPE_EXTERNAL; 347 pThread->u.Ext.pfnThread = pfnThread; 348 pThread->u.Ext.pfnWakeUp = pfnWakeUp; 344 349 rc = pdmR3ThreadInit(pVM, ppThread, cbStack, enmType, pszName); 345 350 } -
trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp
r12984 r12986 19 19 * additional information or have any questions. 20 20 */ 21 21 22 22 23 /*******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.