VirtualBox

Changeset 41458 in vbox for trunk/src


Ignore:
Timestamp:
May 28, 2012 10:36:04 AM (13 years ago)
Author:
vboxsync
Message:

PGMPool: Adding A20 state to the page pool (partly disabled).

Location:
trunk/src/VBox/VMM
Files:
6 edited

Legend:

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

    r41391 r41458  
    978978
    979979        /* Create a reference back to the PDPT by using the index in its shadow page. */
    980         rc = pgmPoolAlloc(pVM, GCPdPt, enmKind, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3)->idx, iPdPt, &pShwPage);
     980        rc = pgmPoolAlloc(pVM, GCPdPt, enmKind, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
     981                          pVCpu->pgm.s.CTX_SUFF(pShwPageCR3)->idx, iPdPt, false /*fLockPage*/,
     982                          &pShwPage);
    981983        AssertRCReturn(rc, rc);
    982984
     
    10901092
    10911093        /* Create a reference back to the PDPT by using the index in its shadow page. */
    1092         rc = pgmPoolAlloc(pVM, GCPml4, enmKind, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3)->idx, iPml4, &pShwPage);
     1094        rc = pgmPoolAlloc(pVM, GCPml4, enmKind, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
     1095                          pVCpu->pgm.s.CTX_SUFF(pShwPageCR3)->idx, iPml4, false /*fLockPage*/,
     1096                          &pShwPage);
    10931097        AssertRCReturn(rc, rc);
    10941098    }
     
    11271131
    11281132        /* Create a reference back to the PDPT by using the index in its shadow page. */
    1129         rc = pgmPoolAlloc(pVM, GCPdPt, enmKind, pShwPage->idx, iPdPt, &pShwPage);
     1133        rc = pgmPoolAlloc(pVM, GCPdPt, enmKind, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
     1134                          pShwPage->idx, iPdPt, false /*fLockPage*/,
     1135                          &pShwPage);
    11301136        AssertRCReturn(rc, rc);
    11311137    }
     
    12231229        RTGCPTR64 GCPml4 = (RTGCPTR64)iPml4 << EPT_PML4_SHIFT;
    12241230
    1225         rc = pgmPoolAlloc(pVM, GCPml4, PGMPOOLKIND_EPT_PDPT_FOR_PHYS, PGMPOOL_IDX_NESTED_ROOT, iPml4, &pShwPage);
     1231        rc = pgmPoolAlloc(pVM, GCPml4, PGMPOOLKIND_EPT_PDPT_FOR_PHYS, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
     1232                          PGMPOOL_IDX_NESTED_ROOT, iPml4, false /*fLockPage*/,
     1233                          &pShwPage);
    12261234        AssertRCReturn(rc, rc);
    12271235    }
     
    12511259    {
    12521260        RTGCPTR64 GCPdPt = (RTGCPTR64)iPdPt << EPT_PDPT_SHIFT;
    1253 
    1254         rc = pgmPoolAlloc(pVM, GCPdPt, PGMPOOLKIND_EPT_PD_FOR_PHYS, pShwPage->idx, iPdPt, &pShwPage);
     1261        rc = pgmPoolAlloc(pVM, GCPdPt, PGMPOOLKIND_EPT_PD_FOR_PHYS, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
     1262                          pShwPage->idx, iPdPt, false /*fLockPage*/,
     1263                          &pShwPage);
    12551264        AssertRCReturn(rc, rc);
    12561265    }
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r41456 r41458  
    26792679            GCPhys = PGM_A20_APPLY(pVCpu, GCPhys | ((iPDDst & 1) * (PAGE_SIZE / 2)));
    26802680# endif
    2681             rc = pgmPoolAlloc(pVM, GCPhys, BTH_PGMPOOLKIND_PT_FOR_PT, pShwPde->idx, iPDDst, &pShwPage);
     2681            rc = pgmPoolAlloc(pVM, GCPhys, BTH_PGMPOOLKIND_PT_FOR_PT, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
     2682                              pShwPde->idx, iPDDst, false /*fLockPage*/,
     2683                              &pShwPage);
    26822684        }
    26832685        else
     
    27102712                    enmAccess = (fNoExecute) ? PGMPOOLACCESS_SUPERVISOR_R_NX  : PGMPOOLACCESS_SUPERVISOR_R;
    27112713            }
    2712             rc = pgmPoolAllocEx(pVM, GCPhys, BTH_PGMPOOLKIND_PT_FOR_BIG, enmAccess, pShwPde->idx, iPDDst, false /*fLockPage*/,
    2713                                 &pShwPage);
     2714            rc = pgmPoolAlloc(pVM, GCPhys, BTH_PGMPOOLKIND_PT_FOR_BIG, enmAccess, PGM_A20_IS_ENABLED(pVCpu),
     2715                              pShwPde->idx, iPDDst, false /*fLockPage*/,
     2716                              &pShwPage);
    27142717        }
    27152718        if (rc == VINF_SUCCESS)
     
    31863189    /* Virtual address = physical address */
    31873190    GCPhys = PGM_A20_APPLY(pVCpu, GCPtrPage & X86_PAGE_4K_BASE_MASK);
    3188     rc = pgmPoolAlloc(pVM, GCPhys & ~(RT_BIT_64(SHW_PD_SHIFT) - 1), BTH_PGMPOOLKIND_PT_FOR_PT, pShwPde->idx, iPDDst, &pShwPage);
    3189 
     3191    rc = pgmPoolAlloc(pVM, GCPhys & ~(RT_BIT_64(SHW_PD_SHIFT) - 1), BTH_PGMPOOLKIND_PT_FOR_PT, PGMPOOLACCESS_DONTCARE,
     3192                      PGM_A20_IS_ENABLED(pVCpu), pShwPde->idx, iPDDst, false /*fLockPage*/,
     3193                      &pShwPage);
    31903194    if (    rc == VINF_SUCCESS
    31913195        ||  rc == VINF_PGM_CACHED_PAGE)
     
    45964600
    45974601    Assert(!(GCPhysCR3 >> (PAGE_SHIFT + 32)));
    4598     rc = pgmPoolAllocEx(pVM, GCPhysCR3 & GST_CR3_PAGE_MASK, BTH_PGMPOOLKIND_ROOT, PGMPOOLACCESS_DONTCARE, SHW_POOL_ROOT_IDX,
    4599                         GCPhysCR3 >> PAGE_SHIFT, true /*fLockPage*/, &pNewShwPageCR3);
     4602    rc = pgmPoolAlloc(pVM, GCPhysCR3 & GST_CR3_PAGE_MASK, BTH_PGMPOOLKIND_ROOT, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
     4603                      SHW_POOL_ROOT_IDX, GCPhysCR3 >> PAGE_SHIFT, true /*fLockPage*/,
     4604                      &pNewShwPageCR3);
    46004605    AssertFatalRC(rc);
    46014606    rc = VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r41456 r41458  
    21672167 * @param   enmKind     The kind of mapping.
    21682168 * @param   enmAccess   Access type for the mapping (only relevant for big pages)
     2169 * @param   fA20Enabled Whether the CPU has the A20 gate enabled.
    21692170 * @param   iUser       The shadow page pool index of the user table.
    21702171 * @param   iUserTable  The index into the user table (shadowed).
    21712172 * @param   ppPage      Where to store the pointer to the page.
    21722173 */
    2173 static int pgmPoolCacheAlloc(PPGMPOOL pPool, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, PGMPOOLACCESS enmAccess, uint16_t iUser, uint32_t iUserTable, PPPGMPOOLPAGE ppPage)
     2174static int pgmPoolCacheAlloc(PPGMPOOL pPool, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, PGMPOOLACCESS enmAccess, bool fA20Enabled,
     2175                             uint16_t iUser, uint32_t iUserTable, PPPGMPOOLPAGE ppPage)
    21742176{
    21752177    /*
     
    21862188            if (pPage->GCPhys == GCPhys)
    21872189            {
    2188                 if (    (PGMPOOLKIND)pPage->enmKind == enmKind
    2189                     &&  (PGMPOOLACCESS)pPage->enmAccess == enmAccess)
     2190                if (   (PGMPOOLKIND)pPage->enmKind == enmKind
     2191                    && (PGMPOOLACCESS)pPage->enmAccess == enmAccess
     2192#if 0
     2193                    && pPage->fA20Enabled == fA20Enabled
     2194#endif
     2195                   )
    21902196                {
    21912197                    /* Put it at the start of the use list to make sure pgmPoolTrackAddUser
     
    49614967 * @param   enmKind     The kind of mapping.
    49624968 * @param   enmAccess   Access type for the mapping (only relevant for big pages)
     4969 * @param   fA20Enabled Whether the A20 gate is enabled or not.
    49634970 * @param   iUser       The shadow page pool index of the user table.
    49644971 * @param   iUserTable  The index into the user table (shadowed).
     
    49664973 * @param   ppPage      Where to store the pointer to the page. NULL is stored here on failure.
    49674974 */
    4968 int pgmPoolAllocEx(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, PGMPOOLACCESS enmAccess, uint16_t iUser, uint32_t iUserTable,
    4969                    bool fLockPage, PPPGMPOOLPAGE ppPage)
     4975int pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, PGMPOOLACCESS enmAccess, bool fA20Enabled,
     4976                 uint16_t iUser, uint32_t iUserTable, bool fLockPage, PPPGMPOOLPAGE ppPage)
    49704977{
    49714978    PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    49724979    STAM_PROFILE_ADV_START(&pPool->StatAlloc, a);
    4973     LogFlow(("pgmPoolAllocEx: GCPhys=%RGp enmKind=%s iUser=%d iUserTable=%#x\n", GCPhys, pgmPoolPoolKindToStr(enmKind), iUser, iUserTable));
     4980    LogFlow(("pgmPoolAlloc: GCPhys=%RGp enmKind=%s iUser=%d iUserTable=%#x\n", GCPhys, pgmPoolPoolKindToStr(enmKind), iUser, iUserTable));
    49744981    *ppPage = NULL;
    49754982    /** @todo CSAM/PGMPrefetchPage messes up here during CSAMR3CheckGates
     
    49814988    if (pPool->fCacheEnabled)
    49824989    {
    4983         int rc2 = pgmPoolCacheAlloc(pPool, GCPhys, enmKind, enmAccess, iUser, iUserTable, ppPage);
     4990        int rc2 = pgmPoolCacheAlloc(pPool, GCPhys, enmKind, enmAccess, fA20Enabled, iUser, iUserTable, ppPage);
    49844991        if (RT_SUCCESS(rc2))
    49854992        {
     
    49884995            pgmUnlock(pVM);
    49894996            STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a);
    4990             LogFlow(("pgmPoolAllocEx: cached returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d}\n", rc2, *ppPage, (*ppPage)->Core.Key, (*ppPage)->idx));
     4997            LogFlow(("pgmPoolAlloc: cached returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d}\n", rc2, *ppPage, (*ppPage)->Core.Key, (*ppPage)->idx));
    49914998            return rc2;
    49924999        }
     
    50045011        {
    50055012            pgmUnlock(pVM);
    5006             Log(("pgmPoolAllocEx: returns %Rrc (Free)\n", rc));
     5013            Log(("pgmPoolAlloc: returns %Rrc (Free)\n", rc));
    50075014            STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a);
    50085015            return rc;
     
    50245031    pPage->enmAccess = enmAccess;
    50255032    pPage->GCPhys = GCPhys;
     5033    pPage->fA20Enabled = fA20Enabled;
    50265034    pPage->fSeenNonGlobal = false;      /* Set this to 'true' to disable this feature. */
    50275035    pPage->fMonitored = false;
     
    50575065        pgmUnlock(pVM);
    50585066        STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a);
    5059         Log(("pgmPoolAllocEx: returns %Rrc (Insert)\n", rc3));
     5067        Log(("pgmPoolAlloc: returns %Rrc (Insert)\n", rc3));
    50605068        return rc3;
    50615069    }
     
    50815089        pgmPoolLockPage(pPool, pPage);
    50825090    pgmUnlock(pVM);
    5083     LogFlow(("pgmPoolAllocEx: returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d, .fCached=%RTbool, .fMonitored=%RTbool}\n",
     5091    LogFlow(("pgmPoolAlloc: returns %Rrc *ppPage=%p:{.Key=%RHp, .idx=%d, .fCached=%RTbool, .fMonitored=%RTbool}\n",
    50845092             rc, pPage, pPage->Core.Key, pPage->idx, pPage->fCached, pPage->fMonitored));
    50855093    STAM_PROFILE_ADV_STOP(&pPool->StatAlloc, a);
     
    52935301        Assert(pPage->idx == i);
    52945302        pPage->iNext      = i + 1;
     5303        pPage->fA20Enabled = true;
    52955304        pPage->fZeroed    = false;       /* This could probably be optimized, but better safe than sorry. */
    52965305        pPage->fSeenNonGlobal = false;
    52975306        pPage->fMonitored = false;
    5298 #ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
    52995307        pPage->fDirty     = false;
    5300 #endif
    53015308        pPage->fCached    = false;
    53025309        pPage->fReusedFlushPending = false;
     
    53045311        pPage->iAgeNext   = NIL_PGMPOOL_IDX;
    53055312        pPage->iAgePrev   = NIL_PGMPOOL_IDX;
     5313        pPage->GCPtrLastAccessHandlerRip = NIL_RTGCPTR;
     5314        pPage->GCPtrLastAccessHandlerFault = NIL_RTGCPTR;
     5315        pPage->cLastAccessHandler = 0;
    53065316        pPage->cLocked    = 0;
     5317#ifdef VBOX_STRICT
     5318        pPage->GCPtrDirtyFault = NIL_RTGCPTR;
     5319#endif
    53075320    }
    53085321    pPool->aPages[pPool->cCurPages - 1].iNext = NIL_PGMPOOL_IDX;
  • trunk/src/VBox/VMM/VMMR3/PGMBth.h

    r39078 r41458  
    163163    pVCpu->pgm.s.iShwUser      = SHW_POOL_ROOT_IDX;
    164164    pVCpu->pgm.s.iShwUserTable = GCPhysCR3 >> PAGE_SHIFT;
    165     int rc = pgmPoolAlloc(pVM, GCPhysCR3, BTH_PGMPOOLKIND_ROOT, pVCpu->pgm.s.iShwUser, pVCpu->pgm.s.iShwUserTable,
     165    int rc = pgmPoolAlloc(pVM, GCPhysCR3, BTH_PGMPOOLKIND_ROOT, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
     166                          pVCpu->pgm.s.iShwUser, pVCpu->pgm.s.iShwUserTable, false /*fLockPage*/,
    166167                          &pVCpu->pgm.s.pShwPageCR3R3);
    167168    if (rc == VERR_PGM_POOL_FLUSHED)
  • trunk/src/VBox/VMM/VMMR3/PGMShw.h

    r39739 r41458  
    194194    pgmLock(pVM);
    195195
    196     int rc = pgmPoolAllocEx(pVM, GCPhysCR3, PGMPOOLKIND_ROOT_NESTED, PGMPOOLACCESS_DONTCARE, PGMPOOL_IDX_NESTED_ROOT,
    197                             GCPhysCR3 >> PAGE_SHIFT, true /*fLockPage*/, &pNewShwPageCR3);
     196    int rc = pgmPoolAlloc(pVM, GCPhysCR3, PGMPOOLKIND_ROOT_NESTED, PGMPOOLACCESS_DONTCARE, PGM_A20_IS_ENABLED(pVCpu),
     197                          PGMPOOL_IDX_NESTED_ROOT, GCPhysCR3 >> PAGE_SHIFT, true /*fLockPage*/,
     198                          &pNewShwPageCR3);
    198199    AssertFatalRC(rc);
    199200
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r41456 r41458  
    39823982# endif
    39833983#endif
    3984 int             pgmPoolAllocEx(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, PGMPOOLACCESS enmAccess, uint16_t iUser,
    3985                                uint32_t iUserTable, bool fLockPage, PPPGMPOOLPAGE ppPage);
    3986 
    3987 DECLINLINE(int) pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint32_t iUserTable,
    3988                              PPPGMPOOLPAGE ppPage)
    3989 {
    3990     return pgmPoolAllocEx(pVM, GCPhys, enmKind, PGMPOOLACCESS_DONTCARE, iUser, iUserTable, false, ppPage);
    3991 }
    3992 
     3984int             pgmPoolAlloc(PVM pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, PGMPOOLACCESS enmAccess, bool fA20Enabled,
     3985                             uint16_t iUser, uint32_t iUserTable, bool fLockPage, PPPGMPOOLPAGE ppPage);
    39933986void            pgmPoolFree(PVM pVM, RTHCPHYS HCPhys, uint16_t iUser, uint32_t iUserTable);
    39943987void            pgmPoolFreeByPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable);
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