VirtualBox

Changeset 22788 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Sep 4, 2009 3:37:07 PM (15 years ago)
Author:
vboxsync
Message:

Minor pgm pool optimizations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r22783 r22788  
    39943994DECLINLINE(void) pgmPoolTrackDerefPTPae32Bit(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PX86PTPAE pShwPT, PCX86PT pGstPT)
    39953995{
    3996     for (unsigned i = 0; i < RT_ELEMENTS(pShwPT->a); i++)
     3996    for (unsigned i = pPage->iFirstPresent; i < RT_ELEMENTS(pShwPT->a); i++)
    39973997        if (pShwPT->a[i].n.u1Present)
    39983998        {
     
    40004000                  i, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pGstPT->a[i].u & X86_PTE_PG_MASK));
    40014001            pgmPoolTracDerefGCPhysHint(pPool, pPage, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pGstPT->a[i].u & X86_PTE_PG_MASK);
     4002            if (!--pPage->cPresent)
     4003                break;
    40024004        }
    40034005}
     
    40144016DECLINLINE(void) pgmPoolTrackDerefPTPaePae(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PX86PTPAE pShwPT, PCX86PTPAE pGstPT)
    40154017{
    4016     for (unsigned i = 0; i < RT_ELEMENTS(pShwPT->a); i++)
     4018    for (unsigned i = pPage->iFirstPresent; i < RT_ELEMENTS(pShwPT->a); i++)
    40174019        if (pShwPT->a[i].n.u1Present)
    40184020        {
     
    40204022                  i, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pGstPT->a[i].u & X86_PTE_PAE_PG_MASK));
    40214023            pgmPoolTracDerefGCPhysHint(pPool, pPage, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, pGstPT->a[i].u & X86_PTE_PAE_PG_MASK);
     4024            if (!--pPage->cPresent)
     4025                break;
    40224026        }
    40234027}
     
    40334037DECLINLINE(void) pgmPoolTrackDerefPT32Bit4MB(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PX86PT pShwPT)
    40344038{
    4035     RTGCPHYS GCPhys = pPage->GCPhys;
    4036     for (unsigned i = 0; i < RT_ELEMENTS(pShwPT->a); i++, GCPhys += PAGE_SIZE)
     4039    RTGCPHYS GCPhys = pPage->GCPhys + PAGE_SIZE * pPage->iFirstPresent;
     4040    for (unsigned i = pPage->iFirstPresent; i < RT_ELEMENTS(pShwPT->a); i++, GCPhys += PAGE_SIZE)
    40374041        if (pShwPT->a[i].n.u1Present)
    40384042        {
     
    40404044                  i, pShwPT->a[i].u & X86_PTE_PG_MASK, GCPhys));
    40414045            pgmPoolTracDerefGCPhys(pPool, pPage, pShwPT->a[i].u & X86_PTE_PG_MASK, GCPhys);
     4046            if (!--pPage->cPresent)
     4047                break;
    40424048        }
    40434049}
     
    40534059DECLINLINE(void) pgmPoolTrackDerefPTPaeBig(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PX86PTPAE pShwPT)
    40544060{
    4055     RTGCPHYS GCPhys = pPage->GCPhys;
    4056     for (unsigned i = 0; i < RT_ELEMENTS(pShwPT->a); i++, GCPhys += PAGE_SIZE)
     4061    RTGCPHYS GCPhys = pPage->GCPhys + PAGE_SIZE * pPage->iFirstPresent;
     4062    for (unsigned i = pPage->iFirstPresent; i < RT_ELEMENTS(pShwPT->a); i++, GCPhys += PAGE_SIZE)
    40574063        if (pShwPT->a[i].n.u1Present)
    40584064        {
     
    40604066                  i, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, GCPhys));
    40614067            pgmPoolTracDerefGCPhys(pPool, pPage, pShwPT->a[i].u & X86_PTE_PAE_PG_MASK, GCPhys);
     4068            if (!--pPage->cPresent)
     4069                break;
     4070        }
     4071}
     4072
     4073
     4074/**
     4075 * Clear references to shadowed pages in an EPT page table.
     4076 *
     4077 * @param   pPool       The pool.
     4078 * @param   pPage       The page.
     4079 * @param   pShwPML4    The shadow page directory pointer table (mapping of the page).
     4080 */
     4081DECLINLINE(void) pgmPoolTrackDerefPTEPT(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PEPTPT pShwPT)
     4082{
     4083    RTGCPHYS GCPhys = pPage->GCPhys + PAGE_SIZE * pPage->iFirstPresent;
     4084    for (unsigned i = pPage->iFirstPresent; i < RT_ELEMENTS(pShwPT->a); i++, GCPhys += PAGE_SIZE)
     4085        if (pShwPT->a[i].n.u1Present)
     4086        {
     4087            Log4(("pgmPoolTrackDerefPTEPT: i=%d pte=%RX64 GCPhys=%RX64\n",
     4088                  i, pShwPT->a[i].u & EPT_PTE_PG_MASK, pPage->GCPhys));
     4089            pgmPoolTracDerefGCPhys(pPool, pPage, pShwPT->a[i].u & EPT_PTE_PG_MASK, GCPhys);
     4090            if (!--pPage->cPresent)
     4091                break;
    40624092        }
    40634093}
     
    41864216        }
    41874217    }
    4188 }
    4189 
    4190 
    4191 /**
    4192  * Clear references to shadowed pages in an EPT page table.
    4193  *
    4194  * @param   pPool       The pool.
    4195  * @param   pPage       The page.
    4196  * @param   pShwPML4    The shadow page directory pointer table (mapping of the page).
    4197  */
    4198 DECLINLINE(void) pgmPoolTrackDerefPTEPT(PPGMPOOL pPool, PPGMPOOLPAGE pPage, PEPTPT pShwPT)
    4199 {
    4200     RTGCPHYS GCPhys = pPage->GCPhys;
    4201     for (unsigned i = 0; i < RT_ELEMENTS(pShwPT->a); i++, GCPhys += PAGE_SIZE)
    4202         if (pShwPT->a[i].n.u1Present)
    4203         {
    4204             Log4(("pgmPoolTrackDerefPTEPT: i=%d pte=%RX64 GCPhys=%RX64\n",
    4205                   i, pShwPT->a[i].u & EPT_PTE_PG_MASK, pPage->GCPhys));
    4206             pgmPoolTracDerefGCPhys(pPool, pPage, pShwPT->a[i].u & EPT_PTE_PG_MASK, GCPhys);
    4207         }
    42084218}
    42094219
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