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

static int kldrModLXFixupMapping ( PKLDRMOD  pMod,
void *  pvUser 
) [static]

Fixup the mapping made by kLdrModMap().

The caller is only responsible for not calling this function more than once without doing kLDrModReload() inbetween.

0 on success, non-zero OS or kLdr status code on failure.
pMod The module.
pfnGetImport The callback for resolving external (imported) symbols.
pvUser The callback user argument.

Definition at line 1980 of file kLdrModLX.c.

References KLDRMOD::aSegments, KLDR_ERR_NOT_MAPPED, kldrModLXDoProtect(), kldrModLXRelocateBits(), KLDRSEG::LinkAddress, KLDRMOD::pvData, and KLDRMODLX::pvMapping.

    int rc, rc2;

     * Mapped?
    if (!pModLX->pvMapping)
        return KLDR_ERR_NOT_MAPPED;

     * Before doing anything we'll have to make all pages writable.
    rc = kldrModLXDoProtect(pModLX, (void *)pModLX->pvMapping, 1 /* unprotect */);
    if (rc)
        return rc;

     * Apply fixups and resolve imports.
    rc = kldrModLXRelocateBits(pMod, (void *)pModLX->pvMapping, (KUPTR)pModLX->pvMapping,
                               pMod->aSegments[0].LinkAddress, pfnGetImport, pvUser);

     * Restore protection.
    rc2 = kldrModLXDoProtect(pModLX, (void *)pModLX->pvMapping, 0 /* protect */);
    if (!rc && rc2)
        rc = rc2;
    return rc;

Generated by  Doxygen 1.6.0   Back to index