VirtualBox

Changeset 87700 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Feb 10, 2021 8:21:04 PM (4 years ago)
Author:
vboxsync
Message:

SUPDrv,++: Experimental support for wrapping .r0 modules in native kernel modules on linux, so that perf and similar tools work better. Minor IOC version increase as SUP_IOCTL_LDR_OPEN now support just opening a module w/o preparing the loading. SUPDrv must export all the symbols in g_aFunctions the linux way now, or linux won't see them, so introduced a SUPR0_EXPORT_SYMBOL macro similar to RT_EXPORT_SYMBOL. bugref:9937

File:
1 edited

Legend:

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

    r87542 r87700  
    606606extern DECLEXPORT(PSUPGLOBALINFOPAGE)   g_pSUPGlobalInfoPage;
    607607
    608 #elif !defined(IN_RING0) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS)
     608#elif !defined(IN_RING0) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS) || defined(VBOX_WITH_KMOD_WRAPPED_R0_MODS)
    609609extern DECLIMPORT(PSUPGLOBALINFOPAGE)   g_pSUPGlobalInfoPage;
    610610
     
    20062006typedef FNSUPDRVDESTRUCTOR *PFNSUPDRVDESTRUCTOR;
    20072007
     2008/**
     2009 * Service request callback function.
     2010 *
     2011 * @returns VBox status code.
     2012 * @param   pSession    The caller's session.
     2013 * @param   uOperation  The operation identifier.
     2014 * @param   u64Arg      64-bit integer argument.
     2015 * @param   pReqHdr     The request header. Input / Output. Optional.
     2016 */
     2017typedef DECLCALLBACKTYPE(int, FNSUPR0SERVICEREQHANDLER,(PSUPDRVSESSION pSession, uint32_t uOperation,
     2018                                                        uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr));
     2019/** Pointer to a FNR0SERVICEREQHANDLER(). */
     2020typedef R0PTRTYPE(FNSUPR0SERVICEREQHANDLER *) PFNSUPR0SERVICEREQHANDLER;
     2021
     2022/**
     2023 * Symbol entry for a wrapped module (SUPLDRWRAPPEDMODULE).
     2024 */
     2025typedef struct SUPLDRWRAPMODSYMBOL
     2026{
     2027    /** The symbol namel. */
     2028    const char *pszSymbol;
     2029    /** The symbol address/value. */
     2030    PFNRT       pfnValue;
     2031} SUPLDRWRAPMODSYMBOL;
     2032/** Pointer to a symbol entry for a wrapped module. */
     2033typedef SUPLDRWRAPMODSYMBOL const *PCSUPLDRWRAPMODSYMBOL;
     2034
     2035/**
     2036 * Registration structure for SUPR0LdrRegisterWrapperModule.
     2037 *
     2038 * This is used to register a .r0 module when loaded manually as a native kernel
     2039 * module/extension/driver/whatever.
     2040 */
     2041typedef struct SUPLDRWRAPPEDMODULE
     2042{
     2043    /** Magic value (SUPLDRWRAPPEDMODULE_MAGIC). */
     2044    uint32_t                    uMagic;
     2045    /** The structure version. */
     2046    uint16_t                    uVersion;
     2047    /** SUPLDRWRAPPEDMODULE_F_XXX.   */
     2048    uint16_t                    fFlags;
     2049
     2050    /** As close as possible to the start of the image. */
     2051    void                       *pvImageStart;
     2052    /** As close as possible to the end of the image. */
     2053    void                       *pvImageEnd;
     2054
     2055    /** @name Standar entry points
     2056     * @{ */
     2057    /** Pointer to the module initialization function (optional). */
     2058    DECLCALLBACKMEMBER(int,     pfnModuleInit,(void *hMod));
     2059    /** Pointer to the module termination function (optional). */
     2060    DECLCALLBACKMEMBER(void,    pfnModuleTerm,(void *hMod));
     2061    /** The VMMR0EntryFast entry point for VMMR0. */
     2062    PFNRT                       pfnVMMR0EntryFast;
     2063    /** The VMMR0EntryEx entry point for VMMR0. */
     2064    PFNRT                       pfnVMMR0EntryEx;
     2065    /** The service request handler entry point. */
     2066    PFNSUPR0SERVICEREQHANDLER   pfnServiceReqHandler;
     2067    /** @} */
     2068
     2069    /** The symbol table. */
     2070    PCSUPLDRWRAPMODSYMBOL       paSymbols;
     2071    /** Number of symbols. */
     2072    uint32_t                    cSymbols;
     2073
     2074    /** The normal VBox module name. */
     2075    char                        szName[32];
     2076    /** Repeating the magic value here (SUPLDRWRAPPEDMODULE_MAGIC). */
     2077    uint32_t                    uEndMagic;
     2078} SUPLDRWRAPPEDMODULE;
     2079/** Pointer to the wrapped module registration structure. */
     2080typedef SUPLDRWRAPPEDMODULE const *PCSUPLDRWRAPPEDMODULE;
     2081
     2082/** Magic value for the wrapped module structure (Doris lessing). */
     2083#define SUPLDRWRAPPEDMODULE_MAGIC       UINT32_C(0x19191117)
     2084/** Current SUPLDRWRAPPEDMODULE structure version. */
     2085#define SUPLDRWRAPPEDMODULE_VERSION     UINT16_C(0x0001)
     2086
     2087/** Set if this is the VMMR0 module.   */
     2088#define SUPLDRWRAPPEDMODULE_F_VMMR0     UINT16_C(0x0001)
     2089
     2090
    20082091SUPR0DECL(void *) SUPR0ObjRegister(PSUPDRVSESSION pSession, SUPDRVOBJTYPE enmType, PFNSUPDRVDESTRUCTOR pfnDestructor, void *pvUser1, void *pvUser2);
    20092092SUPR0DECL(int) SUPR0ObjAddRef(void *pvObj, PSUPDRVSESSION pSession);
     
    20362119SUPR0DECL(int) SUPR0LdrModRetain(PSUPDRVSESSION pSession, void *hMod);
    20372120SUPR0DECL(int) SUPR0LdrModRelease(PSUPDRVSESSION pSession, void *hMod);
     2121#ifdef RT_OS_LINUX
     2122SUPR0DECL(int) SUPDrvLinuxLdrRegisterWrappedModule(PCSUPLDRWRAPPEDMODULE pWrappedModInfo, void *pvLnxModule, void **phMod);
     2123SUPR0DECL(int) SUPDrvLinuxLdrDeregisterWrappedModule(PCSUPLDRWRAPPEDMODULE pWrappedModInfo, void **phMod);
     2124#endif
    20382125SUPR0DECL(int) SUPR0GetVTSupport(uint32_t *pfCaps);
    20392126SUPR0DECL(int) SUPR0GetHwvirtMsrs(PSUPHWVIRTMSRS pMsrs, uint32_t fCaps, bool fForce);
     
    24582545
    24592546
    2460 /**
    2461  * Service request callback function.
    2462  *
    2463  * @returns VBox status code.
    2464  * @param   pSession    The caller's session.
    2465  * @param   uOperation  The operation identifier.
    2466  * @param   u64Arg      64-bit integer argument.
    2467  * @param   pReqHdr     The request header. Input / Output. Optional.
    2468  */
    2469 typedef DECLCALLBACKTYPE(int, FNSUPR0SERVICEREQHANDLER,(PSUPDRVSESSION pSession, uint32_t uOperation,
    2470                                                         uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr));
    2471 /** Pointer to a FNR0SERVICEREQHANDLER(). */
    2472 typedef R0PTRTYPE(FNSUPR0SERVICEREQHANDLER *) PFNSUPR0SERVICEREQHANDLER;
    2473 
    2474 
    24752547/** @defgroup   grp_sup_r0_idc  The IDC Interface
    24762548 * @{
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