VirtualBox

Changeset 37249 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 30, 2011 10:03:45 AM (14 years ago)
Author:
vboxsync
Message:

SUPDrv: solaris native loading tweaking.

Location:
trunk/src/VBox/HostDrivers/Support
Files:
8 edited

Legend:

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

    r37230 r37249  
    40654065
    40664066        if (pImage->fNative)
    4067             rc = supdrvOSLdrLoad(pDevExt, pImage, pReq->u.In.abImage);
     4067            rc = supdrvOSLdrLoad(pDevExt, pImage, pReq->u.In.abImage, pReq);
    40684068        else
    40694069            memcpy(pImage->pvImage, &pReq->u.In.abImage[0], pImage->cbImageBits);
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r37228 r37249  
    577577 * @returns IPRT status code.
    578578 * @param   pDevExt             The device globals.
    579  * @param   pImage              The image data (up to date except for some
    580  *                              entry point pointers).
     579 * @param   pImage              The image data (up to date). Adjust entrypoints
     580 *                              and exports if necessary.
    581581 * @param   pbImageBits         The image bits as loaded by ring-3.
    582  */
    583 int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits);
     582 * @param   pReq                Pointer to the request packet so that the VMMR0
     583 *                              entry points can be adjusted.
     584 */
     585int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq);
    584586
    585587
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

    r37116 r37249  
    776776
    777777
    778 int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
    779 {
    780     NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
     778int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
     779{
     780    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
    781781    return VERR_NOT_SUPPORTED;
    782782}
  • trunk/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c

    r29501 r37249  
    616616
    617617
    618 int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
    619 {
    620     NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
     618int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
     619{
     620    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
    621621    return VERR_NOT_SUPPORTED;
    622622}
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r35495 r37249  
    740740
    741741
    742 int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
    743 {
    744     NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
     742int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
     743{
     744    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
    745745    return VERR_NOT_SUPPORTED;
    746746}
  • trunk/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp

    r28854 r37249  
    397397
    398398
    399 int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
    400 {
    401     NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
     399int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
     400{
     401    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
    402402    return VERR_NOT_SUPPORTED;
    403403}
  • trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c

    r37228 r37249  
    3636#include <sys/modctl.h>
    3737#include <sys/kobj.h>
     38#include <sys/kobj_impl.h>
    3839#include <sys/open.h>
    3940#include <sys/conf.h>
     
    952953    /*
    953954     * Get the module info.
     955     *
     956     * Note! The text section is actually not at mi_base, but and the next
     957     *       alignment boundrary and there seems to be no easy way of
     958     *       getting at this address.  This sabotages supdrvOSLdrLoad.
     959     *       Bastards!
    954960     */
    955961    struct modinfo ModInfo;
     
    960966
    961967    mod_release_mod(pImage->pSolModCtl);
    962     LogRel(("supdrvOSLdrOpen: succeeded for '%s' (mi_base=%p mi_base=%#x), id=%d ctl=%p\n",
     968    LogRel(("supdrvOSLdrOpen: succeeded for '%s' (mi_base=%p mi_size=%#x), id=%d ctl=%p\n",
    963969            pszFilename, ModInfo.mi_base, ModInfo.mi_size, idMod, pModCtl));
    964970    return VINF_SUCCESS;
     
    975981
    976982
    977 int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
    978 {
     983/**
     984 * Resolves a module entry point address.
     985 *
     986 * @returns VBox status code.
     987 * @param   pImage              The image.
     988 * @param   pszSymbol           The symbol name.
     989 * @param   ppvValue            Where to store the value.  On input this holds
     990 *                              the symbol value SUPLib calculated.
     991 */
     992static int supdrvSolLdrResolvEp(PSUPDRVLDRIMAGE pImage, const char *pszSymbol, void **ppvValue)
     993{
     994    /* Don't try resolve symbols which, according to SUPLib, aren't there. */
     995    if (!*ppvValue)
     996        return VINF_SUCCESS;
     997
     998    uintptr_t uValue = modlookup_by_modctl(pImage->pSolModCtl, pszSymbol);
     999    if (!uValue)
     1000    {
     1001        LogRel(("supdrvOSLdrLoad on %s failed to resolve %s\n", pImage->szName, pszSymbol));
     1002        return VERR_SYMBOL_NOT_FOUND;
     1003    }
     1004    *ppvValue = (void *)uValue;
     1005    return VINF_SUCCESS;
     1006}
     1007
     1008
     1009int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
     1010{
     1011#if 0 /* This doesn't work because of text alignment. */
    9791012    /*
    9801013     * Comparing is very very difficult since text and data may be allocated
     
    9841017    if (memcmp(pImage->pvImage, pbImageBits, cbCompare))
    9851018    {
    986         LogRel(("Image mismatch: %s\n", pImage->szName));
     1019        LogRel(("Image mismatch: %s (%p)\n", pImage->szName, pImage->pvImage));
    9871020        LogRel(("Native: %.*Rhxs\n", cbCompare, pImage->pvImage));
    9881021        LogRel(("SUPLib: %.*Rhxs\n", cbCompare, pbImageBits));
    9891022        return VERR_LDR_MISMATCH_NATIVE;
    9901023    }
    991 
    992 
    993     /*
    994      * Get the symbol addresses.
     1024#endif
     1025
     1026    /*
     1027     * Get the exported symbol addresses.
    9951028     */
    9961029    int rc;
     
    10181051
    10191052        rc = iSym == UINT32_MAX ? VINF_SUCCESS : VERR_LDR_GENERAL_FAILURE;
     1053
     1054        /*
     1055         * Get the standard module entry points.
     1056         */
     1057        if (RT_SUCCESS(rc))
     1058        {
     1059            rc = supdrvSolLdrResolvEp(pImage, "ModuleInit", (void **)&pImage->pfnModuleInit);
     1060            if (RT_SUCCESS(rc))
     1061                rc = supdrvSolLdrResolvEp(pImage, "ModuleTerm", (void **)&pImage->pfnModuleTerm);
     1062
     1063            switch (pReq->u.In.eEPType)
     1064            {
     1065                case SUPLDRLOADEP_VMMR0:
     1066                {
     1067                    if (RT_SUCCESS(rc))
     1068                        rc = supdrvSolLdrResolvEp(pImage, "VMMR0EntryInt",  (void **)&pReq->u.In.EP.VMMR0.pvVMMR0EntryInt);
     1069                    if (RT_SUCCESS(rc))
     1070                        rc = supdrvSolLdrResolvEp(pImage, "VMMR0EntryFast", (void **)&pReq->u.In.EP.VMMR0.pvVMMR0EntryFast);
     1071                    if (RT_SUCCESS(rc))
     1072                        rc = supdrvSolLdrResolvEp(pImage, "VMMR0EntryEx",   (void **)&pReq->u.In.EP.VMMR0.pvVMMR0EntryEx);
     1073                    break;
     1074                }
     1075
     1076                case SUPLDRLOADEP_SERVICE:
     1077                {
     1078                    /** @todo we need the name of the entry point. */
     1079                    return VERR_NOT_SUPPORTED;
     1080                }
     1081            }
     1082        }
     1083
    10201084        mod_release_mod(pImage->pSolModCtl);
    10211085    }
     
    10591123
    10601124
    1061 int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
    1062 {
    1063     NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
     1125int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
     1126{
     1127    NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits); NOREF(pReq);
    10641128    return VERR_NOT_SUPPORTED;
    10651129}
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r30360 r37249  
    766766}
    767767
    768 int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits)
    769 {
    770     NOREF(pDevExt); NOREF(pImage); NOREF(pbImageBits);
     768int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const uint8_t *pbImageBits, PSUPLDRLOAD pReq)
     769{
     770    NOREF(pDevExt); NOREF(pReq);
    771771    if (pImage->pvNtSectionObj)
    772772    {
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