VirtualBox

Changeset 30027 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Jun 4, 2010 11:06:02 AM (15 years ago)
Author:
vboxsync
Message:

Deal with different load addresses of shared modules

Location:
trunk/src/VBox/VMM/VMMR0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r29983 r30027  
    35463546        if (!pRecVM)
    35473547        {
    3548             pRecVM = (PGMMSHAREDMODULEPERVM)RTMemAllocZ(sizeof(*pRecVM));
     3548            pRecVM = (PGMMSHAREDMODULEPERVM)RTMemAllocZ(RT_OFFSETOF(GMMSHAREDMODULEPERVM, aRegions[cRegions]));
    35493549            if (!pRecVM)
    35503550            {
     
    35543554            }
    35553555            pRecVM->Core.Key = GCBaseAddr;
     3556            pRecVM->cRegions = cRegions;
     3557
     3558            /* Save the region data as they can differ between VMs (address space scrambling or simply different loading order) */
     3559            for (unsigned i = 0; i < cRegions; i++)
     3560            {
     3561                pRecVM->aRegions[i].GCRegionAddr      = pRegions[i].GCRegionAddr;
     3562                pRecVM->aRegions[i].cbRegion          = RT_ALIGN_T(pRegions[i].cbRegion, PAGE_SIZE, uint32_t);
     3563                pRecVM->aRegions[i].u32Alignment      = 0;
     3564                pRecVM->aRegions[i].paHCPhysPageID    = NULL; /* unused */
     3565            }
    35563566
    35573567            bool ret = RTAvlGCPtrInsert(&pGVM->gmm.s.pSharedModuleTree, &pRecVM->Core);
     
    40534063typedef struct
    40544064{
    4055     PGVM    pGVM;
    4056     VMCPUID idCpu;
     4065    PGVM                    pGVM;
     4066    VMCPUID                 idCpu;
    40574067} GMMCHECKSHAREDMODULEINFO, *PGMMCHECKSHAREDMODULEINFO;
    40584068
     
    40704080    {
    40714081        Log(("gmmR0CheckSharedModule: check %s %s base=%RGv size=%x collision=%d\n", pGlobalModule->szName, pGlobalModule->szVersion, pGlobalModule->Core.Key, pGlobalModule->cbModule, pLocalModule->fCollision));
    4072         PGMR0SharedModuleCheck(pInfo->pGVM->pVM, pInfo->idCpu, pGlobalModule, pInfo->pGVM);
     4082        PGMR0SharedModuleCheck(pInfo->pGVM->pVM, pInfo->pGVM, pInfo->idCpu, pGlobalModule, pLocalModule->cRegions, pLocalModule->aRegions);
    40734083    }
    40744084    return 0;
     
    41554165
    41564166        Log(("GMMR0CheckSharedModules\n"));
    4157         Info.pGVM = pGVM;
    4158         Info.idCpu = pVCpu->idCpu;
     4167        Info.pGVM     = pGVM;
     4168        Info.idCpu    = pVCpu->idCpu;
    41594169
    41604170        RTAvlGCPtrDoWithAll(&pGVM->gmm.s.pSharedModuleTree, true /* fFromLeft */, gmmR0CheckSharedModule, &Info);
  • trunk/src/VBox/VMM/VMMR0/GMMR0Internal.h

    r29424 r30027  
    3838typedef GMMVMSIZES *PGMMVMSIZES;
    3939
     40
    4041/**
    4142 * Shared module registration info (per VM)
     
    5253    bool                        fCollision;
    5354    /** Alignment. */
    54     bool                        bAlignment[7];
     55    bool                        bAlignment[3];
     56
     57    /** Number of included region descriptors */
     58    uint32_t                    cRegions;
     59
     60    /** Shared region descriptor(s). */
     61    GMMSHAREDREGIONDESC         aRegions[1];
    5562} GMMSHAREDMODULEPERVM;
    5663/** Pointer to a GMMSHAREDMODULEPERVM. */
  • trunk/src/VBox/VMM/VMMR0/PGMR0SharedPage.cpp

    r30013 r30027  
    4040 * @param   idCpu       VCPU id
    4141 * @param   pModule     Module description
     42 * @param   cRegions    Number of regions
     43 * @param   pRegions    Region array
    4244 * @param   pGVM        Pointer to the GVM instance data.
    4345 */
    44 VMMR0DECL(int) PGMR0SharedModuleCheck(PVM pVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule, PGVM pGVM)
     46VMMR0DECL(int) PGMR0SharedModuleCheck(PVM pVM, PGVM pGVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule, uint32_t cRegions, PGMMSHAREDREGIONDESC pRegions)
    4547{
    4648    int                rc = VINF_SUCCESS;
     
    5557
    5658    /* Check every region of the shared module. */
    57     for (unsigned idxModule = 0; idxModule < pModule->cRegions; idxModule++)
     59    for (unsigned idxRegion = 0; idxRegion < cRegions; idxRegion++)
    5860    {
    59         Assert((pModule->aRegions[idxModule].cbRegion & 0xfff) == 0);
    60         Assert((pModule->aRegions[idxModule].GCRegionAddr & 0xfff) == 0);
     61        Assert((pRegions[idxRegion].cbRegion & 0xfff) == 0);
     62        Assert((pRegions[idxRegion].GCRegionAddr & 0xfff) == 0);
    6163
    62         RTGCPTR  GCRegion  = pModule->aRegions[idxModule].GCRegionAddr;
    63         unsigned cbRegion = pModule->aRegions[idxModule].cbRegion & ~0xfff;
     64        RTGCPTR  GCRegion  = pRegions[idxRegion].GCRegionAddr;
     65        unsigned cbRegion = pRegions[idxRegion].cbRegion & ~0xfff;
    6466        unsigned idxPage = 0;
    6567        bool     fValidChanges = false;
     
    111113        if (fValidChanges)
    112114        {
    113             rc = GMMR0SharedModuleCheckRange(pGVM, pModule, idxModule, idxPage, paPageDesc);
     115            rc = GMMR0SharedModuleCheckRange(pGVM, pModule, idxRegion, idxPage, paPageDesc);
    114116            AssertRC(rc);
    115117            if (RT_FAILURE(rc))
     
    132134                    Assert(!PGM_PAGE_IS_SHARED(pPage));
    133135
    134                     Log(("PGMR0SharedModuleCheck: shared page gc virt=%RGv phys %RGp host %RHp->%RHp\n", pModule->aRegions[idxModule].GCRegionAddr + i * PAGE_SIZE, paPageDesc[i].GCPhys, PGM_PAGE_GET_HCPHYS(pPage), paPageDesc[i].HCPhys));
     136                    Log(("PGMR0SharedModuleCheck: shared page gc virt=%RGv phys %RGp host %RHp->%RHp\n", pRegions[idxRegion].GCRegionAddr + i * PAGE_SIZE, paPageDesc[i].GCPhys, PGM_PAGE_GET_HCPHYS(pPage), paPageDesc[i].HCPhys));
    135137                    if (paPageDesc[i].HCPhys != PGM_PAGE_GET_HCPHYS(pPage))
    136138                    {
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