PGMR0SharedPage.cpp revision d89d64f261b0fecda692038bc6351dedf996c563
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * PGM - Page Manager and Monitor, Ring-0.
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * Copyright (C) 2007 Oracle Corporation
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * available from http://www.virtualbox.org. This file is free software;
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * General Public License (GPL) as published by the Free Software
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
f9fc8c7343143818644af6caf51a2b2520b8b7a9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
546cd3313d635980a2cc168a79a58b4f0858d784vboxsync/*******************************************************************************
546cd3313d635980a2cc168a79a58b4f0858d784vboxsync* Header Files *
546cd3313d635980a2cc168a79a58b4f0858d784vboxsync*******************************************************************************/
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * Check a registered module for shared page changes
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * @returns The following VBox status codes.
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * @param pVM The VM handle.
395d92a7732aad3c0b9baecedfabba5113b84485vboxsync * @param idCpu VCPU id
395d92a7732aad3c0b9baecedfabba5113b84485vboxsync * @param pModule Module description
395d92a7732aad3c0b9baecedfabba5113b84485vboxsync * @param cRegions Number of regions
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * @param pRegions Region array
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync * @param pGVM Pointer to the GVM instance data.
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsyncVMMR0DECL(int) PGMR0SharedModuleCheck(PVM pVM, PGVM pGVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule, uint32_t cRegions, PGMMSHAREDREGIONDESC pRegions)
a3f342a86f026f46fed32aae20ca045db066d141vboxsync bool fFlushTLBs = false;
15617cf4cb5fa181f4d6f55f987a883cf298cce6vboxsync Log(("PGMR0SharedModuleCheck: check %s %s base=%RGv size=%x\n", pModule->szName, pModule->szVersion, pModule->Core.Key, pModule->cbModule));
a3f342a86f026f46fed32aae20ca045db066d141vboxsync /* Check every region of the shared module. */
unsigned idxPage = 0;
bool fValidChanges = false;
if (paPageDesc)
if (!paPageDesc)
AssertFailed();
goto end;
while (cbRegion)
if ( pPage
fValidChanges = true;
idxPage++;
if (fValidChanges)
for (unsigned i = 0; i < idxPage; i++)
if (!pPage)
AssertFailed();
goto end;
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));
bool fFlush = false;
rc = pgmPoolTrackUpdateGCPhys(pVM, paPageDesc[i].GCPhys, pPage, true /* clear the entries */, &fFlush);
goto end;
Assert(rc == VINF_SUCCESS || (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3) && (pVCpu->pgm.s.fSyncFlags & PGM_SYNC_CLEAR_PGM_POOL)));
end:
if (fFlushTLBs)
if (paPageDesc)
return rc;