VirtualBox

Changeset 30646 in vbox


Ignore:
Timestamp:
Jul 6, 2010 8:00:31 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63381
Message:

Reregister all shared modules after VM restore

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.h

    r30555 r30646  
    479479/** Inconsistent local and global registration records. */
    480480#define VERR_PGM_SHARED_MODULE_REGISTRATION_INCONSISTENCY (-1650)
     481/** No registered modules. */
     482#define VINF_PGM_SHARED_MODULE_NONE_REGISTERED  (1651)
    481483/** @} */
    482484
  • trunk/include/VBox/types.h

    r28800 r30646  
    826826 * Page mapping lock.
    827827 *
    828  * @remarks This doesn't work in structures shared between
    829  *          ring-3, ring-0 and/or GC.
    830828 */
    831829typedef struct PGMPAGEMAPLOCK
     
    835833    /** Just a dummy for the time being. */
    836834    uint32_t    u32Dummy;
     835    uint32_t    u32Dummy1;
     836# if HC_ARCH_BITS == 64
     837    uint32_t    u32Align[2];
     838# endif
    837839#else
    838840    /** Pointer to the PGMPAGE and lock type.
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp

    r30601 r30646  
    8585
    8686
    87 static DECLCALLBACK(int) VBoxServicePageSharingEmptyTreeCallback(PAVLPVNODECORE pNode, void *);
     87static DECLCALLBACK(int) VBoxServicePageSharingEmptyTreeCallback(PAVLPVNODECORE pNode, void *pvUser);
    8888
    8989static PAVLPVNODECORE   pKnownModuleTree = NULL;
     
    487487
    488488    /* Check all registered modules. */
    489     VbglR3CheckSharedModules();
    490 
    491     /* Activate new module tree. */
    492     pKnownModuleTree = pNewTree;
     489    int rc = VbglR3CheckSharedModules();
     490    if (rc == VINF_PGM_SHARED_MODULE_NONE_REGISTERED)
     491    {
     492        bool fUnregister = false;
     493        /* The VM was restored, so reregister all modules the next time. */
     494        RTAvlPVDestroy(&pKnownModuleTree, VBoxServicePageSharingEmptyTreeCallback, &fUnregister);
     495        pKnownModuleTree = NULL;
     496    }
     497    else
     498    {
     499        /* Activate new module tree. */
     500        pKnownModuleTree = pNewTree;
     501    }
    493502}
    494503
     
    496505 * RTAvlPVDestroy callback.
    497506 */
    498 static DECLCALLBACK(int) VBoxServicePageSharingEmptyTreeCallback(PAVLPVNODECORE pNode, void *)
     507static DECLCALLBACK(int) VBoxServicePageSharingEmptyTreeCallback(PAVLPVNODECORE pNode, void *pvUser)
    499508{
    500509    PKNOWN_MODULE pModule = (PKNOWN_MODULE)pNode;
     510    bool *pfUnregister = (bool *)pvUser;
    501511
    502512    VBoxServiceVerbose(3, "VBoxServicePageSharingEmptyTreeCallback %s %s\n", pModule->Info.szModule, pModule->szFileVersion);
    503513
    504     /* Defererence module in the hypervisor. */
    505     int rc = VbglR3UnregisterSharedModule(pModule->Info.szModule, pModule->szFileVersion, (RTGCPTR64)pModule->Info.modBaseAddr, pModule->Info.modBaseSize);
    506     AssertRC(rc);
     514    /* Dereference module in the hypervisor. */
     515    if (    !pfUnregister
     516        ||  *pfUnregister == true)
     517    {
     518    #ifdef RT_ARCH_X86
     519        int rc = VbglR3UnregisterSharedModule(pModule->Info.szModule, pModule->szFileVersion, (RTGCPTR32)pModule->Info.modBaseAddr, pModule->Info.modBaseSize);
     520    #else
     521        int rc = VbglR3UnregisterSharedModule(pModule->Info.szModule, pModule->szFileVersion, (RTGCPTR64)pModule->Info.modBaseAddr, pModule->Info.modBaseSize);
     522    #endif
     523        AssertRC(rc);
     524    }
    507525
    508526    if (pModule->hModule)
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r30604 r30646  
    41694169
    41704170        Log(("GMMR0CheckSharedModules\n"));
    4171         Info.pGVM     = pGVM;
    4172         Info.idCpu    = pVCpu->idCpu;
    4173 
    4174         RTAvlGCPtrDoWithAll(&pGVM->gmm.s.pSharedModuleTree, true /* fFromLeft */, gmmR0CheckSharedModule, &Info);
     4171        if (pGVM->gmm.s.pSharedModuleTree != NULL)
     4172        {
     4173            Info.pGVM     = pGVM;
     4174            Info.idCpu    = pVCpu->idCpu;
     4175
     4176            RTAvlGCPtrDoWithAll(&pGVM->gmm.s.pSharedModuleTree, true /* fFromLeft */, gmmR0CheckSharedModule, &Info);
     4177            rc = VINF_SUCCESS;
     4178        }
     4179        else
     4180            rc = VINF_PGM_SHARED_MODULE_NONE_REGISTERED;
    41754181
    41764182        Log(("GMMR0CheckSharedModules done!\n"));
    4177         rc = VINF_SUCCESS;
     4183
    41784184        GMM_CHECK_SANITY_UPON_LEAVING(pGMM);
    41794185    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette