VirtualBox

Changeset 93617 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Feb 6, 2022 8:35:16 AM (3 years ago)
Author:
vboxsync
Message:

VMM/PGMPool: Replaced MMR3HyperAllocOnceNoRel call with direct SUPR3PageAllocEx call, replacing a few associated MMHyperCCToR3/R0 calls with speedier pgmPoolConvertPageToR3/R0 ones. bugref:10093

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r93593 r93617  
    19841984    /** The VM handle - R0 Ptr. */
    19851985    R0PTRTYPE(PVMCC)            pVMR0;
     1986    /** The ring-3 pointer to this structure. */
     1987    R3PTRTYPE(struct PGMPOOL *) pPoolR3;
     1988    /** The ring-0 pointer to this structure. */
     1989    R0PTRTYPE(struct PGMPOOL *) pPoolR0;
    19861990    /** The max pool size. This includes the special IDs. */
    19871991    uint16_t                    cMaxPages;
     
    36663670void            pgmPoolResetDirtyPage(PVMCC pVM, RTGCPTR GCPtrPage);
    36673671
     3672/** Gets the ring-0 pointer for the given pool page. */
     3673DECLINLINE(R0PTRTYPE(PPGMPOOLPAGE)) pgmPoolConvertPageToR0(PPGMPOOL pPool, PPGMPOOLPAGE pPage)
     3674{
     3675#ifdef IN_RING3
     3676    size_t offPage = (uintptr_t)pPage - (uintptr_t)pPool;
     3677# ifdef VBOX_STRICT
     3678    size_t iPage   = (offPage - RT_UOFFSETOF(PGMPOOL, aPages)) / sizeof(*pPage);
     3679    AssertReturn(iPage < pPool->cMaxPages, NIL_RTR0PTR);
     3680    AssertReturn(iPage * sizeof(*pPage) + RT_UOFFSETOF(PGMPOOL, aPages) == offPage, NIL_RTR0PTR);
     3681# endif
     3682    return pPool->pPoolR0 + offPage;
     3683#else
     3684    RT_NOREF(pPool);
     3685    return pPage;
     3686#endif
     3687}
     3688
     3689/** Gets the ring-3 pointer for the given pool page. */
     3690DECLINLINE(R3PTRTYPE(PPGMPOOLPAGE)) pgmPoolConvertPageToR3(PPGMPOOL pPool, PPGMPOOLPAGE pPage)
     3691{
     3692#ifdef IN_RING3
     3693    RT_NOREF(pPool);
     3694    return pPage;
     3695#else
     3696    size_t offPage = (uintptr_t)pPage - (uintptr_t)pPool;
     3697# ifdef VBOX_STRICT
     3698    size_t iPage   = (offPage - RT_UOFFSETOF(PGMPOOL, aPages)) / sizeof(*pPage);
     3699    AssertReturn(iPage < pPool->cMaxPages, NIL_RTR3PTR);
     3700    AssertReturn(iPage * sizeof(*pPage) + RT_UOFFSETOF(PGMPOOL, aPages) == offPage, NIL_RTR3PTR);
     3701# endif
     3702    return pPool->pPoolR3 + offPage;
     3703#endif
     3704}
     3705
    36683706int             pgmR3ExitShadowModeBeforePoolFlush(PVMCPU pVCpu);
    36693707int             pgmR3ReEnterShadowModeAfterPoolFlush(PVM pVM, PVMCPU pVCpu);
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