VirtualBox

Changeset 30041 in vbox


Ignore:
Timestamp:
Jun 4, 2010 4:24:14 PM (15 years ago)
Author:
vboxsync
Message:

Part 2 of the page fusion test case

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VMMDev/VMMDev.cpp

    r30033 r30041  
    18381838                pRequestHeader->rc = VINF_SUCCESS;
    18391839            }
     1840            break;
     1841        }
     1842
     1843        case VMMDevReq_DebugIsPageShared:
     1844        {
     1845# ifdef DEBUG
     1846            VMMDevPageIsSharedRequest *pReq = (VMMDevPageIsSharedRequest *)pRequestHeader;
     1847
     1848            if (pRequestHeader->size != sizeof(VMMDevPageIsSharedRequest))
     1849                pRequestHeader->rc = VERR_INVALID_PARAMETER;
     1850            else
     1851                pRequestHeader->rc = PGMR3SharedModuleGetPageState(PDMDevHlpGetVM(pDevIns), pReq->GCPtrPage, &pReq->fShared, &pReq->fReadWrite);
     1852# else
     1853            pRequestHeader->rc = VERR_NOT_IMPLEMENTED;
     1854# endif
    18401855            break;
    18411856        }
  • trunk/src/VBox/VMM/PGMSharedPage.cpp

    r30013 r30041  
    176176#endif
    177177}
     178
     179/**
     180 * Query the state of a page in a shared module
     181 *
     182 * @returns VBox status code.
     183 * @param   pVM                 VM handle
     184 * @param   GCPtrPage           Page address
     185 * @param   pfShared            Shared status (out)
     186 * @param   pfReadWrite         Read/write status (out)
     187 */
     188VMMR3DECL(int) PGMR3SharedModuleGetPageState(PVM pVM, RTGCPTR GCPtrPage, bool *pfShared, bool *pfReadWrite)
     189{
     190#if defined(VBOX_WITH_PAGE_SHARING) && defined(DEBUG)
     191    /* Debug only API for the page fusion testcase. */
     192    RTGCPHYS GCPhys;
     193    uint64_t fFlags;
     194
     195    pgmLock(pVM);
     196
     197    int rc = PGMGstGetPage(VMMGetCpu(pVM), GCPtrPage, &fFlags, &GCPhys);
     198    if (rc == VINF_SUCCESS)
     199    {
     200        PPGMPAGE pPage = pgmPhysGetPage(&pVM->pgm.s, GCPhys);
     201        if (pPage)
     202        {
     203            *pfShared    = PGM_PAGE_IS_SHARED(pPage);
     204            *pfReadWrite = !!(fFlags & X86_PTE_RW);
     205        }
     206        else
     207            rc = VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS;
     208    }
     209
     210    pgmUnlock(pVM);
     211    return rc;
     212#else
     213    return VERR_NOT_IMPLEMENTED;
     214#endif
     215}
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