VirtualBox

Changeset 28425 in vbox for trunk/include


Ignore:
Timestamp:
Apr 16, 2010 6:06:35 PM (15 years ago)
Author:
vboxsync
Message:

Added PDMDRVHLP::pfnCallR0 / PDMDrvHlpCallR0 / PFNPDMDRVREQHANDLERR0 for making it possible for a driver to call it's ring-0 side via a private interface.

Location:
trunk/include/VBox
Files:
4 edited

Legend:

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

    r27254 r28425  
    3636
    3737#include <VBox/types.h>
     38#include <VBox/sup.h>
    3839
    3940RT_C_DECLS_BEGIN
     
    5758VMMDECL(bool)   PDMVMMDevHeapIsEnabled(PVM pVM);
    5859
    59 #ifdef IN_RING3
     60
    6061/** @defgroup grp_pdm_r3    The PDM Host Context Ring-3 API
    6162 * @ingroup grp_pdm
     
    129130VMMR3DECL(void) PDMR3ReleaseOwnedLocks(PVM pVM);
    130131/** @} */
    131 #endif
    132132
    133133
    134 #ifdef IN_RC
    135 /** @defgroup grp_pdm_gc    The PDM Guest Context API
     134
     135/** @defgroup grp_pdm_rc    The PDM Raw-Mode Context API
    136136 * @ingroup grp_pdm
    137137 * @{
    138138 */
    139139/** @} */
    140 #endif
     140
     141
     142
     143/** @defgroup grp_pdm_r0    The PDM Ring-0 Context API
     144 * @ingroup grp_pdm
     145 * @{
     146 */
     147
     148/**
     149 * Request buffer for PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER.
     150 * @see PDMR0DriverCallReqHandler.
     151 */
     152typedef struct PDMDRIVERCALLREQHANDLERREQ
     153{
     154    /** The header. */
     155    SUPVMMR0REQHDR      Hdr;
     156    /** The driver instance. */
     157    PPDMDRVINSR0        pDrvInsR0;
     158    /** The operation. */
     159    uint32_t            uOperation;
     160    /** Explicit alignment padding. */
     161    uint32_t            u32Alignment;
     162    /** Optional 64-bit integer argument. */
     163    uint64_t            u64Arg;
     164} PDMDRIVERCALLREQHANDLERREQ;
     165/** Pointer to a PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER
     166 * request buffer. */
     167typedef PDMDRIVERCALLREQHANDLERREQ *PPDMDRIVERCALLREQHANDLERREQ;
     168
     169VMMR0_INT_DECL(int) PDMR0DriverCallReqHandler(PVM pVM, PPDMDRIVERCALLREQHANDLERREQ pReq);
     170
     171/** @} */
    141172
    142173RT_C_DECLS_END
  • trunk/include/VBox/pdmcommon.h

    r26001 r28425  
    136136typedef FNPDMDRVASYNCNOTIFY *PFNPDMDRVASYNCNOTIFY;
    137137
     138/**
     139 * The ring-0 driver request handle.
     140 *
     141 * @returns VBox status code. PDMDrvHlpCallR0 will return this.
     142 * @param   pDrvIns     The driver instance (the ring-0 mapping).
     143 * @param   uOperation  The operation.
     144 * @param   u64Arg      Optional integer argument for the operation.
     145 */
     146typedef DECLCALLBACK(int) FNPDMDRVREQHANDLERR0(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg);
     147/** Ring-0 pointer to a FNPDMDRVREQHANDLERR0. */
     148typedef R0PTRTYPE(FNPDMDRVREQHANDLERR0 *) PFNPDMDRVREQHANDLERR0;
     149
    138150/** @} */
    139151
  • trunk/include/VBox/pdmdrv.h

    r28329 r28425  
    403403
    404404/** Converts a pointer to the PDMDRVINS::IBase to a pointer to PDMDRVINS. */
    405 #define PDMIBASE_2_PDMDRV(pInterface) ( (PPDMDRVINS)((char *)(pInterface) - RT_OFFSETOF(PDMDRVINS, IBase)) )
     405#define PDMIBASE_2_PDMDRV(pInterface)   ( (PPDMDRVINS)((char *)(pInterface) - RT_OFFSETOF(PDMDRVINS, IBase)) )
     406
     407/** @def PDMDRVINS_2_RCPTR
     408 * Converts a PDM Driver instance pointer a RC PDM Driver instance pointer.
     409 */
     410#define PDMDRVINS_2_RCPTR(pDrvIns)      ( (RCPTRTYPE(PPDMDRVINS))((RTGCUINTPTR)(pDrvIns)->pvInstanceDataRC - RT_OFFSETOF(PDMDRVINS, achInstanceData)) )
     411
     412/** @def PDMDRVINS_2_R3PTR
     413 * Converts a PDM Driver instance pointer a R3 PDM Driver instance pointer.
     414 */
     415#define PDMDRVINS_2_R3PTR(pDrvIns)      ( (R3PTRTYPE(PPDMDRVINS))((RTHCUINTPTR)(pDrvIns)->pvInstanceDataR3 - RT_OFFSETOF(PDMDRVINS, achInstanceData)) )
     416
     417/** @def PDMDRVINS_2_R0PTR
     418 * Converts a PDM Driver instance pointer a R0 PDM Driver instance pointer.
     419 */
     420#define PDMDRVINS_2_R0PTR(pDrvIns)      ( (R0PTRTYPE(PPDMDRVINS))((RTR0UINTPTR)(pDrvIns)->pvInstanceDataR0 - RT_OFFSETOF(PDMDRVINS, achInstanceData)) )
     421
     422
    406423
    407424/**
     
    11601177    DECLR3CALLBACKMEMBER(int, pfnCritSectInit,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect,
    11611178                                               RT_SRC_POS_DECL, const char *pszName));
     1179
     1180    /**
     1181     * Call the ring-0 request handler routine of the driver.
     1182     *
     1183     * For this to work, the driver must be ring-0 enabled and export a request
     1184     * handler function.  The name of the function must be the driver name in the
     1185     * PDMDRVREG struct prefixed with 'drvR0' and suffixed with 'ReqHandler'.  It
     1186     * shall take the exact same arguments as this function and be declared using
     1187     * PDMBOTHCBDECL.  See FNPDMDRVREQHANDLERR0.
     1188     *
     1189     * @returns VBox status code.
     1190     * @retval  VERR_SYMBOL_NOT_FOUND if the driver doesn't export the required
     1191     *          handler function.
     1192     * @retval  VERR_ACCESS_DENIED if the driver isn't ring-0 capable.
     1193     *
     1194     * @param   pDevIns             The device instance.
     1195     * @param   uOperation          The operation to perform.
     1196     * @param   u64Arg              64-bit integer argument.
     1197     * @thread  Any
     1198     */
     1199    DECLR3CALLBACKMEMBER(int, pfnCallR0,(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg));
     1200
    11621201    /** Just a safety precaution. */
    11631202    uint32_t                        u32TheEnd;
     
    15261565}
    15271566
     1567/**
     1568 * @copydoc PDMDRVHLP::pfnCallR0
     1569 */
     1570DECLINLINE(int) PDMDrvHlpCallR0(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg)
     1571{
     1572    return pDrvIns->pHlpR3->pfnCallR0(pDrvIns, uOperation, u64Arg);
     1573}
     1574
    15281575
    15291576/** Pointer to callbacks provided to the VBoxDriverRegister() call. */
  • trunk/include/VBox/vmm.h

    r28422 r28425  
    300300    /** Call GMMR0FreeLargePage(). */
    301301    VMMR0_DO_GMM_FREE_LARGE_PAGE,
    302     /** Call GMMR0QueryVMMMemoryStatsReq */
     302    /** Call GMMR0QueryVMMMemoryStatsReq(). */
    303303    VMMR0_DO_GMM_QUERY_VMM_MEM_STATS,
    304304    /** Call GMMR0BalloonedPages(). */
     
    319319    /** Query a GVMM or GMM configuration value. */
    320320    VMMR0_DO_GCFGM_QUERY_VALUE,
     321
     322    /** Call PDMR0DriverCallReqHandler. */
     323    VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER,
    321324
    322325    /** The start of the R0 service operations. */
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