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

static void kldrDyldStackCleanupOne ( PKLDRDYLDMOD  pMod,
int  rc 
) [static]

Worker routine for kldrDyldStackDropFrame() and kldrDyldDoLoad().

Parameters:
pMod The module to perform cleanups on.
rc Used for state verification.

Definition at line 1126 of file kLdrDyld.c.

References KLDRDYLDMOD::enmState, g_cActiveLoadCalls, g_fActiveGC, KLDRDYLD_ASSERT, kldrDyldModUnloadPrerequisites(), kldrDyldModUnmap(), KLDRSTATE_FIXED_UP, KLDRSTATE_GOOD, KLDRSTATE_INITIALIZING, KLDRSTATE_LOADED_PREREQUISITES, KLDRSTATE_MAPPED, KLDRSTATE_PENDING_DESTROY, KLDRSTATE_PENDING_GC, KLDRSTATE_PENDING_INITIALIZATION, KLDRSTATE_PENDING_TERMINATION, KLDRSTATE_RELOADED, KLDRSTATE_RELOADED_FIXED_UP, KLDRSTATE_RELOADED_LOADED_PREREQUISITES, and KLDRSTATE_TERMINATING.

Referenced by kldrDyldDoLoad(), kldrDyldDoLoad2(), and kldrDyldStackDropFrame().

{
    switch (pMod->enmState)
    {
        /*
         * Just push it along to the PENDING_DESTROY state.
         */
        case KLDRSTATE_MAPPED:
            KLDRDYLD_ASSERT(rc);
            kldrDyldModUnmap(pMod);
            KLDRDYLD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_DESTROY);
            break;

        /*
         * Move back to PENDING_GC.
         */
        case KLDRSTATE_RELOADED:
            KLDRDYLD_ASSERT(rc);
            pMod->enmState = KLDRSTATE_PENDING_GC;
            break;

        /*
         * Unload prerequisites and unmap the modules.
         */
        case KLDRSTATE_LOADED_PREREQUISITES:
        case KLDRSTATE_FIXED_UP:
            KLDRDYLD_ASSERT(rc);
            kldrDyldModUnloadPrerequisites(pMod);
            KLDRDYLD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_DESTROY);
            kldrDyldModUnmap(pMod);
            KLDRDYLD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_DESTROY);
            break;

        /*
         * Unload prerequisites and push it back to PENDING_GC.
         */
        case KLDRSTATE_RELOADED_LOADED_PREREQUISITES:
        case KLDRSTATE_RELOADED_FIXED_UP:
            kldrDyldModUnloadPrerequisites(pMod);
            KLDRDYLD_ASSERT(pMod->enmState == KLDRSTATE_PENDING_GC);
            break;

        /*
         * Nothing to do, just asserting sanity.
         */
        case KLDRSTATE_INITIALIZING:
            /* Implies there is another load going on. */
            KLDRDYLD_ASSERT(g_cActiveLoadCalls > 1);
            break;
        case KLDRSTATE_TERMINATING:
            /* GC in progress. */
            KLDRDYLD_ASSERT(g_fActiveGC);
            break;
        case KLDRSTATE_PENDING_TERMINATION:
        case KLDRSTATE_PENDING_INITIALIZATION:
        case KLDRSTATE_PENDING_GC:
        case KLDRSTATE_PENDING_DESTROY:
            KLDRDYLD_ASSERT(rc);
            break;
        case KLDRSTATE_GOOD:
            break;

        /*
         * Bad states.
         */
        default:
            KLDRDYLD_ASSERT(!"drop frame bad state (a)");
            break;
    }
}


Generated by  Doxygen 1.6.0   Back to index