VirtualBox

Changeset 26137 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Feb 1, 2010 9:13:44 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57139
Message:

PDM: Added PDMIBASERC and PDMIBASER0.

Location:
trunk/include/VBox
Files:
2 edited

Legend:

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

    r25986 r26137  
    6565
    6666
    67 /**
    68  * PDM Driver Base Interface.
     67/** @name PDMIBASE
     68 * @{
     69 */
     70
     71/**
     72 * PDM Base Interface.
    6973 *
    7074 * Everyone implements this.
     
    117121        } \
    118122    } while (0)
     123
     124/** @} */
     125
     126
     127/** @name PDMIBASERC
     128 * @{
     129 */
     130
     131/**
     132 * PDM Base Interface for querying ring-mode context interfaces in
     133 * ring-3.
     134 *
     135 * This is mandatory for drivers present in raw-mode context.
     136 */
     137typedef struct PDMIBASERC
     138{
     139    /**
     140     * Queries an ring-mode context interface to the driver.
     141     *
     142     * @returns Pointer to interface.
     143     * @returns NULL if the interface was not supported by the driver.
     144     * @param   pInterface          Pointer to this interface structure.
     145     * @param   pszIID              The interface ID, a UUID string.
     146     * @thread  Any thread.
     147     */
     148    DECLR3CALLBACKMEMBER(RTRCPTR, pfnQueryInterface,(struct PDMIBASERC *pInterface, const char *pszIID));
     149} PDMIBASERC;
     150/** Pointer to a PDM Base Interface for query ring-mode context interfaces. */
     151typedef PDMIBASERC *PPDMIBASERC;
     152/** PDMIBASERC interface ID. */
     153#define PDMIBASERC_IID                          "f6a6c649-6cb3-493f-9737-4653f221aeca"
     154
     155/**
     156 * Helper macro for quering an interface from PDMIBASERC.
     157 *
     158 * @returns PDMIBASERC::pfnQueryInterface return value.
     159 *
     160 * @param   pIBaseRC        Pointer to the base ring-0 interface.
     161 * @param   InterfaceType   The interface type name.  The interface ID is
     162 *                          derived from this by appending _IID.
     163 *
     164 * @remarks Unlike PDMIBASE_QUERY_INTERFACE, this macro is not able to do any
     165 *          implicit type checking for you.
     166 */
     167#define PDMIBASERC_QUERY_INTERFACE(pIBaseRC, InterfaceType)  \
     168    ( (InterfaceType *)(pIBaseRC)->pfnQueryInterface(pIBaseRC, InterfaceType##_IID ) )
     169
     170/**
     171 * Helper macro for implementing PDMIBASERC::pfnQueryInterface.
     172 *
     173 * Return @a pInterface if @a pszIID matches the @a InterfaceType.  This will
     174 * perform basic type checking.
     175 *
     176 * @param   pIns            Pointer to the instance data.
     177 * @param   pszIID          The ID of the interface that is being queried.
     178 * @param   InterfaceType   The interface type name.  The interface ID is
     179 *                          derived from this by appending _IID.
     180 * @param   pInterface      The interface address expression.  This must resolve
     181 *                          to some address within the instance data.
     182 */
     183#define PDMIBASERC_RETURN_INTERFACE(pIns, pszIID, InterfaceType, pInterface)  \
     184    do { \
     185        Assert((uintptr_t)pInterface - PDMINS_2_DATA(pIns, uintptr_t) < _4M); \
     186        if (RTUuidCompare2Strs((pszIID), InterfaceType##_IID) == 0) \
     187        { \
     188            InterfaceType *pReturnInterfaceTypeCheck = (pInterface); \
     189            return (uintptr_t)pReturnInterfaceTypeCheck \
     190                 - PDMINS_2_DATA(pIns, uintptr_t) \
     191                 + PDMINS_2_DATA_RCPTR(pIns); \
     192        } \
     193    } while (0)
     194
     195/** @} */
     196
     197
     198/** @name PDMIBASER0
     199 * @{
     200 */
     201
     202/**
     203 * PDM Base Interface for querying ring-0 interfaces in ring-3.
     204 *
     205 * This is mandatory for drivers present in ring-0 context.
     206 */
     207typedef struct PDMIBASER0
     208{
     209    /**
     210     * Queries an ring-0 interface to the driver.
     211     *
     212     * @returns Pointer to interface.
     213     * @returns NULL if the interface was not supported by the driver.
     214     * @param   pInterface          Pointer to this interface structure.
     215     * @param   pszIID              The interface ID, a UUID string.
     216     * @thread  Any thread.
     217     */
     218    DECLR3CALLBACKMEMBER(RTR0PTR, pfnQueryInterface,(struct PDMIBASER0 *pInterface, const char *pszIID));
     219} PDMIBASER0;
     220/** Pointer to a PDM Base Interface for query ring-0 context interfaces. */
     221typedef PDMIBASER0 *PPDMIBASER0;
     222/** PDMIBASER0 interface ID. */
     223#define PDMIBASER0_IID                          "9c9b99b8-7f53-4f59-a3c2-5bc9659c7944"
     224
     225/**
     226 * Helper macro for quering an interface from PDMIBASER0.
     227 *
     228 * @returns PDMIBASER0::pfnQueryInterface return value.
     229 *
     230 * @param   pIBaseR0        Pointer to the base ring-0 interface.
     231 * @param   InterfaceType   The interface type name.  The interface ID is
     232 *                          derived from this by appending _IID.
     233 *
     234 * @remarks Unlike PDMIBASE_QUERY_INTERFACE, this macro is not able to do any
     235 *          implicit type checking for you.
     236 */
     237#define PDMIBASER0_QUERY_INTERFACE(pIBaseR0, InterfaceType)  \
     238    ( (InterfaceType *)(pIBaseR0)->pfnQueryInterface(pIBaseR0, InterfaceType##_IID ) )
     239
     240/**
     241 * Helper macro for implementing PDMIBASER0::pfnQueryInterface.
     242 *
     243 * Return @a pInterface if @a pszIID matches the @a InterfaceType.  This will
     244 * perform basic type checking.
     245 *
     246 * @param   pIns            Pointer to the instance data.
     247 * @param   pszIID          The ID of the interface that is being queried.
     248 * @param   InterfaceType   The interface type name.  The interface ID is
     249 *                          derived from this by appending _IID.
     250 * @param   pInterface      The interface address expression.  This must resolve
     251 *                          to some address within the instance data.
     252 */
     253#define PDMIBASER0_RETURN_INTERFACE(pIns, pszIID, InterfaceType, pInterface)  \
     254    do { \
     255        Assert((uintptr_t)pInterface - PDMINS_2_DATA(pIns, uintptr_t) < _4M); \
     256        if (RTUuidCompare2Strs((pszIID), InterfaceType##_IID) == 0) \
     257        { \
     258            InterfaceType *pReturnInterfaceTypeCheck = (pInterface); \
     259            return (uintptr_t)pReturnInterfaceTypeCheck \
     260                 - PDMINS_2_DATA(pIns, uintptr_t) \
     261                 + PDMINS_2_DATA_R0PTR(pIns); \
     262        } \
     263    } while (0)
     264
     265/** @} */
    119266
    120267
  • trunk/include/VBox/types.h

    r25993 r26137  
    315315
    316316
    317 /** Pointer to a PDM Driver Base Interface. */
     317/** Pointer to a PDM Base Interface. */
    318318typedef struct PDMIBASE *PPDMIBASE;
    319 /** Pointer to a pointer to a PDM Driver Base Interface. */
     319/** Pointer to a pointer to a PDM Base Interface. */
    320320typedef PPDMIBASE *PPPDMIBASE;
    321321
Note: See TracChangeset for help on using the changeset viewer.

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