VirtualBox

Changeset 7768 in vbox


Ignore:
Timestamp:
Apr 7, 2008 1:22:40 PM (17 years ago)
Author:
vboxsync
Message:

Added a VMState dev/usb/drvhlp.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/pdmdev.h

    r7755 r7768  
    22282228    DECLR3CALLBACKMEMBER(int, pfnPhysGCPtr2GCPhys, (PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys));
    22292229
     2230    /**
     2231     * Gets the VM state.
     2232     *
     2233     * @returns VM state.
     2234     * @param   pDevIns         The device instance.
     2235     * @thread  Any thread (just keep in mind that it's volatile info).
     2236     */
     2237    DECLR3CALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMDEVINS pDevIns));
     2238
    22302239    /** Space reserved for future members.
    22312240     * @{ */
    2232     DECLR3CALLBACKMEMBER(void, pfnReserved3,(void));
    22332241    DECLR3CALLBACKMEMBER(void, pfnReserved4,(void));
    22342242    DECLR3CALLBACKMEMBER(void, pfnReserved5,(void));
     
    26712679
    26722680/** Current PDMDEVHLP version number. */
    2673 #define PDM_DEVHLP_VERSION  0xf2050001
     2681#define PDM_DEVHLP_VERSION  0xf2050002
    26742682
    26752683
     
    33543362
    33553363/**
     3364 * @copydoc PDMDEVHLP::pfnVMState
     3365 */
     3366DECLINLINE(VMSTATE) PDMDevHlpVMState(PPDMDEVINS pDevIns)
     3367{
     3368    return pDevIns->pDevHlp->pfnVMState(pDevIns);
     3369}
     3370
     3371/**
    33563372 * @copydoc PDMDEVHLP::pfnA20Set
    33573373 */
  • trunk/include/VBox/pdmdrv.h

    r6221 r7768  
    655655    DECLR3CALLBACKMEMBER(int, pfnPDMThreadCreate,(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
    656656                                                  PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName));
     657
     658    /**
     659     * Gets the VM state.
     660     *
     661     * @returns VM state.
     662     * @param   pDrvIns         The driver instance.
     663     * @thread  Any thread (just keep in mind that it's volatile info).
     664     */
     665    DECLR3CALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMDRVINS pDrvIns));
     666
    657667#ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
    658668    /**
     
    667677     * @param   pszDesc         Description.
    668678     */
    669     DECLR3CALLBACKMEMBER(int, pfnPDMAsyncCompletionTemplateCreate,(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate, 
     679    DECLR3CALLBACKMEMBER(int, pfnPDMAsyncCompletionTemplateCreate,(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
    670680                                                                   PFNPDMASYNCCOMPLETEDRV pfnCompleted, const char *pszDesc));
    671681#endif
     
    680690
    681691/** Current DRVHLP version number. */
    682 #define PDM_DRVHLP_VERSION  0x90020000
     692#define PDM_DRVHLP_VERSION  0x90020001
    683693
    684694
     
    828838}
    829839
     840/**
     841 * @copydoc PDMDRVHLP::pfnVMState
     842 */
     843DECLINLINE(VMSTATE) PDMDrvHlpVMState(PPDMDRVINS pDrvIns)
     844{
     845    return pDrvIns->pDrvHlp->pfnVMState(pDrvIns);
     846}
     847
    830848#ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
    831849/**
    832850 * @copydoc PDMDRVHLP::pfnPDMAsyncCompletionTemplateCreate
    833851 */
    834 DECLINLINE(int) PDMDrvHlpPDMAsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate, 
     852DECLINLINE(int) PDMDrvHlpPDMAsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
    835853                                                          PFNPDMASYNCCOMPLETEDRV pfnCompleted, const char *pszDesc)
    836854{
  • trunk/include/VBox/pdmusb.h

    r5999 r7768  
    558558    DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMUSBINS pUsbIns, bool fFatal, const char *pszErrorID, const char *pszFormat, va_list va));
    559559
     560    /**
     561     * Gets the VM state.
     562     *
     563     * @returns VM state.
     564     * @param   pUsbIns             The USB device instance.
     565     * @thread  Any thread (just keep in mind that it's volatile info).
     566     */
     567    DECLR3CALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMUSBINS pUsbIns));
     568
    560569    /** Just a safety precaution. */
    561570    uint32_t                        u32TheEnd;
     
    567576
    568577/** Current USBHLP version number. */
    569 #define PDM_USBHLP_VERSION  0xec020000
     578#define PDM_USBHLP_VERSION  0xec020001
    570579
    571580#endif /* IN_RING3 */
     
    684693}
    685694
    686 
    687 /* inline wrappers */
    688 
    689 #endif
     695/**
     696 * @copydoc PDMUSBHLP::pfnVMState
     697 */
     698DECLINLINE(VMSTATE) PDMUsbHlpVMState(PPDMUSBINS pUsbIns)
     699{
     700    return pUsbIns->pUsbHlp->pfnVMState(pUsbIns);
     701}
     702
     703#endif /* IN_RING3 */
    690704
    691705
  • trunk/src/VBox/VMM/PDMDevice.cpp

    r7755 r7768  
    144144static DECLCALLBACK(int) pdmR3DevHlp_PhysReserve(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTUINT cbRange, const char *pszDesc);
    145145static DECLCALLBACK(int) pdmR3DevHlp_PhysGCPtr2GCPhys(PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys);
     146static DECLCALLBACK(VMSTATE) pdmR3DevHlp_VMState(PPDMDEVINS pDevIns);
    146147static DECLCALLBACK(bool) pdmR3DevHlp_A20IsEnabled(PPDMDEVINS pDevIns);
    147148static DECLCALLBACK(void) pdmR3DevHlp_A20Set(PPDMDEVINS pDevIns, bool fEnable);
     
    268269
    269270/** @def PDMDEV_ASSERT_DEVINS
    270  * Asserts the validity of the driver instance.
     271 * Asserts the validity of the device instance.
    271272 */
    272273#ifdef VBOX_STRICT
    273 # define PDMDEV_ASSERT_DEVINS(pDevIns)   do { Assert(pDevIns); Assert(pDevIns->u32Version == PDM_DEVINS_VERSION); Assert(pDevIns->pvInstanceDataR3 == (void *)&pDevIns->achInstanceData[0]); } while (0)
     274# define PDMDEV_ASSERT_DEVINS(pDevIns)   \
     275    do { \
     276        AssertPtr(pDevIns); \
     277        Assert(pDevIns->u32Version == PDM_DEVINS_VERSION); \
     278        Assert(pDevIns->pvInstanceDataR3 == (void *)&pDevIns->achInstanceData[0]); \
     279    } while (0)
    274280#else
    275281# define PDMDEV_ASSERT_DEVINS(pDevIns)   do { } while (0)
     
    334340    pdmR3DevHlp_PDMThreadCreate,
    335341    pdmR3DevHlp_PhysGCPtr2GCPhys,
    336     0,
     342    pdmR3DevHlp_VMState,
    337343    0,
    338344    0,
     
    428434    pdmR3DevHlp_PDMThreadCreate,
    429435    pdmR3DevHlp_PhysGCPtr2GCPhys,
    430     0,
     436    pdmR3DevHlp_VMState,
    431437    0,
    432438    0,
     
    32853291}
    32863292
     3293
    32873294/** @copydoc PDMDEVHLP::pfnPhysGCPtr2GCPhys */
    32883295static DECLCALLBACK(int) pdmR3DevHlp_PhysGCPtr2GCPhys(PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys)
     
    33023309
    33033310    return rc;
     3311}
     3312
     3313
     3314/** @copydoc PDMDEVHLP::pfnVMState */
     3315static DECLCALLBACK(VMSTATE) pdmR3DevHlp_VMState(PPDMDEVINS pDevIns)
     3316{
     3317    PDMDEV_ASSERT_DEVINS(pDevIns);
     3318
     3319    VMSTATE enmVMState = VMR3GetState(pDevIns->Internal.s.pVMHC);
     3320
     3321    LogFlow(("pdmR3DevHlp_VMState: caller='%s'/%d: returns %d (%s)\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance,
     3322             enmVMState, VMR3GetStateName(enmVMState)));
     3323    return enmVMState;
    33043324}
    33053325
  • trunk/src/VBox/VMM/PDMDriver.cpp

    r6796 r7768  
    9393static DECLCALLBACK(int) pdmR3DrvHlp_PDMThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
    9494                                                     PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName);
     95static DECLCALLBACK(VMSTATE) pdmR3DrvHlp_VMState(PPDMDRVINS pDrvIns);
     96
    9597
    9698#ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
     
    103105 */
    104106#ifdef VBOX_STRICT
    105 # define PDMDRV_ASSERT_DRVINS(pDrvIns)   do { Assert(pDrvIns); Assert(pDrvIns->u32Version == PDM_DRVINS_VERSION); Assert(pDrvIns->pvInstanceData == (void *)&pDrvIns->achInstanceData[0]); } while (0)
     107# define PDMDRV_ASSERT_DRVINS(pDrvIns) \
     108    do { \
     109        AssertPtr(pDrvIns); \
     110        Assert(pDrvIns->u32Version == PDM_DRVINS_VERSION); \
     111        Assert(pDrvIns->pvInstanceData == (void *)&pDrvIns->achInstanceData[0]); \
     112    } while (0)
    106113#else
    107114# define PDMDRV_ASSERT_DRVINS(pDrvIns)   do { } while (0)
     
    145152    pdmR3DrvHlp_USBRegisterHub,
    146153    pdmR3DrvHlp_PDMThreadCreate,
     154    pdmR3DrvHlp_VMState,
    147155#ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
    148156    pdmR3DrvHlp_PDMAsyncCompletionTemplateCreate,
     
    10741082}
    10751083
     1084
     1085/** @copydoc PDMDEVHLP::pfnVMState */
     1086static DECLCALLBACK(VMSTATE) pdmR3DrvHlp_VMState(PPDMDRVINS pDrvIns)
     1087{
     1088    PDMDRV_ASSERT_DRVINS(pDrvIns);
     1089
     1090    VMSTATE enmVMState = VMR3GetState(pDrvIns->Internal.s.pVM);
     1091
     1092    LogFlow(("pdmR3DrvHlp_VMState: caller='%s'/%d: returns %d (%s)\n", pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance,
     1093             enmVMState, VMR3GetStateName(enmVMState)));
     1094    return enmVMState;
     1095}
     1096
     1097
    10761098#ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
     1099/** @copydoc PDMDRVHLP::pfnPDMAsyncCompletionTemplateCreate */
    10771100static DECLCALLBACK(int) pdmR3DrvHlp_PDMAsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
    10781101                                                                      PFNPDMASYNCCOMPLETEDRV pfnCompleted, const char *pszDesc)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette