VirtualBox

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

Location:
trunk/src/VBox/HostDrivers/Support/linux
Files:
5 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r85776 r87700  
    751751    return supdrvIDC(uReq, &g_DevExt, pSession, pReq);
    752752}
    753 
    754753EXPORT_SYMBOL(SUPDrvLinuxIDC);
     754
     755
     756/**
     757 * Used by native wrapper modules, forwarding to supdrvLdrRegisterWrappedModule
     758 * with device extension prepended to the argument list.
     759 */
     760SUPR0DECL(int)  SUPDrvLinuxLdrRegisterWrappedModule(PCSUPLDRWRAPPEDMODULE pWrappedModInfo, void *pvLnxModule, void **phMod)
     761{
     762    AssertPtrReturn(pvLnxModule, VERR_INVALID_POINTER);
     763    return supdrvLdrRegisterWrappedModule(&g_DevExt, pWrappedModInfo, pvLnxModule, phMod);
     764}
     765EXPORT_SYMBOL(SUPDrvLinuxLdrRegisterWrappedModule);
     766
     767
     768/**
     769 * Used by native wrapper modules, forwarding to supdrvLdrDeregisterWrappedModule
     770 * with device extension prepended to the argument list.
     771 */
     772SUPR0DECL(int) SUPDrvLinuxLdrDeregisterWrappedModule(PCSUPLDRWRAPPEDMODULE pWrappedModInfo, void **phMod)
     773{
     774    return supdrvLdrDeregisterWrappedModule(&g_DevExt, pWrappedModInfo, phMod);
     775}
     776EXPORT_SYMBOL(SUPDrvLinuxLdrDeregisterWrappedModule);
    755777
    756778
     
    12441266
    12451267
     1268void VBOXCALL   supdrvOSLdrRetainWrapperModule(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
     1269{
     1270    struct module *pLnxMod = (struct module *)pImage->pvWrappedNative;
     1271    Assert(!pImage->fLnxWrapperRef);
     1272    AssertReturnVoid(pLnxMod);
     1273    pImage->fLnxWrapperRef = try_module_get(pLnxMod);
     1274    RT_NOREF(pDevExt);
     1275}
     1276
     1277
     1278void VBOXCALL   supdrvOSLdrReleaseWrapperModule(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
     1279{
     1280    if (pImage->fLnxWrapperRef)
     1281    {
     1282        struct module *pLnxMod = (struct module *)pImage->pvWrappedNative;
     1283        pImage->fLnxWrapperRef = false;
     1284        module_put(pLnxMod);
     1285    }
     1286    RT_NOREF(pDevExt);
     1287}
     1288
     1289
    12461290#ifdef SUPDRV_WITH_MSR_PROBER
    12471291
     
    14121456    return VINF_SUCCESS;
    14131457}
     1458SUPR0_EXPORT_SYMBOL(SUPR0HCPhysToVirt);
    14141459
    14151460
     
    14301475    return 0;
    14311476}
     1477SUPR0_EXPORT_SYMBOL(SUPR0Printf);
    14321478
    14331479
     
    14491495    return fFlags;
    14501496}
     1497SUPR0_EXPORT_SYMBOL(SUPR0GetKernelFeatures);
    14511498
    14521499
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