Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

int kldrDyldModReload ( PKLDRDYLDMOD  pMod  ) 

Reloads the module.

Reloading means that all modified pages are restored to their original state. Whether this includes the code segments depends on whether the fixups depend on the addend in the place they are fixing up - so it's format specific.

Returns:
0 on success, non-zero native OS or kLdr status code on failure.
Parameters:
pMod The module which needs to be unmapped and set pending for destruction.

Definition at line 892 of file kLdrDyldMod.c.

References KLDRDYLDMOD::cRefs, KLDRDYLDMOD::enmState, KLDRDYLDMOD::fAllocatedTLS, KLDRDYLDMOD::fMapped, KLDRDYLDMOD_ASSERT, kLdrModAllocTLS(), kLdrModFreeTLS(), kLdrModReload(), KLDRSTATE_GC, KLDRSTATE_MAPPED, KLDRSTATE_PENDING_DESTROY, KLDRSTATE_RELOADED, and KLDRDYLDMOD::pMod.

Referenced by kldrDyldDoLoad(), and kldrDyldGetPrerequisite().

{
    int rc;

    /* sanity */
    KLDRDYLDMOD_ASSERT(pMod->cRefs > 0);
    KLDRDYLDMOD_ASSERT(pMod->fMapped);

    switch (pMod->enmState)
    {
        case KLDRSTATE_MAPPED:
        case KLDRSTATE_GC:
        case KLDRSTATE_PENDING_DESTROY:
            break;
        default:
            KLDRDYLDMOD_ASSERT(!"invalid state");
            return -1;
    }

    /* Free TLS before reloading. */
    if (pMod->fAllocatedTLS)
    {
        kLdrModFreeTLS(pMod->pMod);
        pMod->fAllocatedTLS = 0;
    }

    /* Let the module interpreter do the reloading of the mapping. */
    rc = kLdrModReload(pMod->pMod);
    if (!rc)
    {
        rc = kLdrModAllocTLS(pMod->pMod);
        if (!rc)
        {
            pMod->fAllocatedTLS = 1;
            pMod->enmState = KLDRSTATE_RELOADED;
        }
    }
    return rc;
}


Generated by  Doxygen 1.6.0   Back to index