VirtualBox

Changeset 14133 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 12, 2008 4:37:47 PM (16 years ago)
Author:
vboxsync
Message:

#1865: final pae change.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGM.cpp

    r14038 r14133  
    14131413     */
    14141414    pVM->pgm.s.pHC32BitPD    = (PX86PD)MMR3PageAllocLow(pVM);
    1415     pVM->pgm.s.apHCPaePDs[0] = (PX86PDPAE)MMR3PageAlloc(pVM);
    1416     pVM->pgm.s.apHCPaePDs[1] = (PX86PDPAE)MMR3PageAlloc(pVM);
    1417     AssertRelease((uintptr_t)pVM->pgm.s.apHCPaePDs[0] + PAGE_SIZE == (uintptr_t)pVM->pgm.s.apHCPaePDs[1]);
    1418     pVM->pgm.s.apHCPaePDs[2] = (PX86PDPAE)MMR3PageAlloc(pVM);
    1419     AssertRelease((uintptr_t)pVM->pgm.s.apHCPaePDs[1] + PAGE_SIZE == (uintptr_t)pVM->pgm.s.apHCPaePDs[2]);
    1420     pVM->pgm.s.apHCPaePDs[3] = (PX86PDPAE)MMR3PageAlloc(pVM);
    1421     AssertRelease((uintptr_t)pVM->pgm.s.apHCPaePDs[2] + PAGE_SIZE == (uintptr_t)pVM->pgm.s.apHCPaePDs[3]);
     1415    pVM->pgm.s.apShwPaePDsR3[0] = (PX86PDPAE)MMR3PageAlloc(pVM);
     1416    pVM->pgm.s.apShwPaePDsR3[1] = (PX86PDPAE)MMR3PageAlloc(pVM);
     1417    AssertRelease((uintptr_t)pVM->pgm.s.apShwPaePDsR3[0] + PAGE_SIZE == (uintptr_t)pVM->pgm.s.apShwPaePDsR3[1]);
     1418    pVM->pgm.s.apShwPaePDsR3[2] = (PX86PDPAE)MMR3PageAlloc(pVM);
     1419    AssertRelease((uintptr_t)pVM->pgm.s.apShwPaePDsR3[1] + PAGE_SIZE == (uintptr_t)pVM->pgm.s.apShwPaePDsR3[2]);
     1420    pVM->pgm.s.apShwPaePDsR3[3] = (PX86PDPAE)MMR3PageAlloc(pVM);
     1421    AssertRelease((uintptr_t)pVM->pgm.s.apShwPaePDsR3[2] + PAGE_SIZE == (uintptr_t)pVM->pgm.s.apShwPaePDsR3[3]);
     1422#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
     1423    pVM->pgm.s.apShwPaePDsR0[0] = (uintptr_t)pVM->pgm.s.apShwPaePDsR3[0];
     1424    pVM->pgm.s.apShwPaePDsR0[1] = (uintptr_t)pVM->pgm.s.apShwPaePDsR3[1];
     1425    pVM->pgm.s.apShwPaePDsR0[2] = (uintptr_t)pVM->pgm.s.apShwPaePDsR3[2];
     1426    pVM->pgm.s.apShwPaePDsR0[3] = (uintptr_t)pVM->pgm.s.apShwPaePDsR3[3];
     1427#endif
    14221428    pVM->pgm.s.pShwPaePdptR3 = (PX86PDPT)MMR3PageAllocLow(pVM);
    14231429#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
     
    14301436
    14311437    if (    !pVM->pgm.s.pHC32BitPD
    1432         ||  !pVM->pgm.s.apHCPaePDs[0]
    1433         ||  !pVM->pgm.s.apHCPaePDs[1]
    1434         ||  !pVM->pgm.s.apHCPaePDs[2]
    1435         ||  !pVM->pgm.s.apHCPaePDs[3]
     1438        ||  !pVM->pgm.s.apShwPaePDsR3[0]
     1439        ||  !pVM->pgm.s.apShwPaePDsR3[1]
     1440        ||  !pVM->pgm.s.apShwPaePDsR3[2]
     1441        ||  !pVM->pgm.s.apShwPaePDsR3[3]
    14361442        ||  !pVM->pgm.s.pShwPaePdptR3
    14371443        ||  !pVM->pgm.s.pShwNestedRootR3)
     
    14441450    pVM->pgm.s.HCPhys32BitPD    = MMPage2Phys(pVM, pVM->pgm.s.pHC32BitPD);
    14451451    Assert(MMPagePhys2Page(pVM, pVM->pgm.s.HCPhys32BitPD) == pVM->pgm.s.pHC32BitPD);
    1446     pVM->pgm.s.aHCPhysPaePDs[0] = MMPage2Phys(pVM, pVM->pgm.s.apHCPaePDs[0]);
    1447     pVM->pgm.s.aHCPhysPaePDs[1] = MMPage2Phys(pVM, pVM->pgm.s.apHCPaePDs[1]);
    1448     pVM->pgm.s.aHCPhysPaePDs[2] = MMPage2Phys(pVM, pVM->pgm.s.apHCPaePDs[2]);
    1449     pVM->pgm.s.aHCPhysPaePDs[3] = MMPage2Phys(pVM, pVM->pgm.s.apHCPaePDs[3]);
     1452    pVM->pgm.s.aHCPhysPaePDs[0] = MMPage2Phys(pVM, pVM->pgm.s.apShwPaePDsR3[0]);
     1453    pVM->pgm.s.aHCPhysPaePDs[1] = MMPage2Phys(pVM, pVM->pgm.s.apShwPaePDsR3[1]);
     1454    pVM->pgm.s.aHCPhysPaePDs[2] = MMPage2Phys(pVM, pVM->pgm.s.apShwPaePDsR3[2]);
     1455    pVM->pgm.s.aHCPhysPaePDs[3] = MMPage2Phys(pVM, pVM->pgm.s.apShwPaePDsR3[3]);
    14501456    pVM->pgm.s.HCPhysPaePDPT    = MMPage2Phys(pVM, pVM->pgm.s.pShwPaePdptR3);
    14511457    pVM->pgm.s.HCPhysNestedRoot = MMPage2Phys(pVM, pVM->pgm.s.pShwNestedRootR3);
     
    14571463    ASMMemZero32(pVM->pgm.s.pShwPaePdptR3, PAGE_SIZE);
    14581464    ASMMemZero32(pVM->pgm.s.pShwNestedRootR3, PAGE_SIZE);
    1459     for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.apHCPaePDs); i++)
    1460     {
    1461         ASMMemZero32(pVM->pgm.s.apHCPaePDs[i], PAGE_SIZE);
     1465    for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.apShwPaePDsR3); i++)
     1466    {
     1467        ASMMemZero32(pVM->pgm.s.apShwPaePDsR3[i], PAGE_SIZE);
    14621468        pVM->pgm.s.pShwPaePdptR3->a[i].u = X86_PDPE_P | PGM_PLXFLAGS_PERMANENT | pVM->pgm.s.aHCPhysPaePDs[i];
    14631469        /* The flags will be corrected when entering and leaving long mode. */
     
    17651771     * Reserve space for mapping the paging pages into guest context.
    17661772     */
    1767     int rc = MMR3HyperReserve(pVM, PAGE_SIZE * (2 + RT_ELEMENTS(pVM->pgm.s.apHCPaePDs) + 1 + 2 + 2), "Paging", &GCPtr);
     1773    int rc = MMR3HyperReserve(pVM, PAGE_SIZE * (2 + RT_ELEMENTS(pVM->pgm.s.apShwPaePDsR3) + 1 + 2 + 2), "Paging", &GCPtr);
    17681774    AssertRCReturn(rc, rc);
    17691775    pVM->pgm.s.pGC32BitPD = GCPtr;
     
    18131819    GCPtr += PAGE_SIZE; /* reserved page */
    18141820
    1815     for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.apHCPaePDs); i++)
     1821    for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.apShwPaePDsR3); i++)
    18161822    {
    18171823        rc = PGMMap(pVM, GCPtr, pVM->pgm.s.aHCPhysPaePDs[i], PAGE_SIZE, 0);
    18181824        AssertRCReturn(rc, rc);
    1819         pVM->pgm.s.apGCPaePDs[i] = GCPtr;
     1825        pVM->pgm.s.apShwPaePDsRC[i] = GCPtr;
    18201826        GCPtr += PAGE_SIZE;
    18211827    }
    18221828    /* A bit of paranoia is justified. */
    1823     AssertRelease(pVM->pgm.s.apGCPaePDs[0] + PAGE_SIZE == pVM->pgm.s.apGCPaePDs[1]);
    1824     AssertRelease(pVM->pgm.s.apGCPaePDs[1] + PAGE_SIZE == pVM->pgm.s.apGCPaePDs[2]);
    1825     AssertRelease(pVM->pgm.s.apGCPaePDs[2] + PAGE_SIZE == pVM->pgm.s.apGCPaePDs[3]);
     1829    AssertRelease(pVM->pgm.s.apShwPaePDsRC[0] + PAGE_SIZE == pVM->pgm.s.apShwPaePDsRC[1]);
     1830    AssertRelease(pVM->pgm.s.apShwPaePDsRC[1] + PAGE_SIZE == pVM->pgm.s.apShwPaePDsRC[2]);
     1831    AssertRelease(pVM->pgm.s.apShwPaePDsRC[2] + PAGE_SIZE == pVM->pgm.s.apShwPaePDsRC[3]);
    18261832    GCPtr += PAGE_SIZE; /* reserved page */
    18271833
     
    18971903    pVM->pgm.s.pGC32BitPD    += offDelta;
    18981904    pVM->pgm.s.pGuestPDRC    += offDelta;
    1899     AssertCompile(RT_ELEMENTS(pVM->pgm.s.apGCPaePDs) == RT_ELEMENTS(pVM->pgm.s.apGstPaePDsRC));
    1900     for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.apGCPaePDs); i++)
    1901     {
    1902         pVM->pgm.s.apGCPaePDs[i]    += offDelta;
     1905    AssertCompile(RT_ELEMENTS(pVM->pgm.s.apShwPaePDsRC) == RT_ELEMENTS(pVM->pgm.s.apGstPaePDsRC));
     1906    for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.apShwPaePDsRC); i++)
     1907    {
     1908        pVM->pgm.s.apShwPaePDsRC[i] += offDelta;
    19031909        pVM->pgm.s.apGstPaePDsRC[i] += offDelta;
    19041910    }
  • trunk/src/VBox/VMM/PGMInternal.h

    r14093 r14133  
    20592059    /** @name PAE Shadow Paging
    20602060     * @{ */
    2061     /** The four PDs for the low 4GB - HC Ptr.
     2061    /** The four PDs for the low 4GB - R3 Ptr.
    20622062     * Even though these are 4 pointers, what they point at is a single table.
    20632063     * Thus, it's possible to walk the 2048 entries starting where apHCPaePDs[0] points. */
    2064 #if 0///@todo def VBOX_WITH_2X_4GB_ADDR_SPACE
    2065     R3PTRTYPE(PX86PDPAE)            apHCPaePDs[4];
    2066 #else
    2067     R3R0PTRTYPE(PX86PDPAE)          apHCPaePDs[4];
    2068 #endif
    2069     /** The four PDs for the low 4GB - GC Ptr.
     2064    R3PTRTYPE(PX86PDPAE)            apShwPaePDsR3[4];
     2065#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
     2066    /** The four PDs for the low 4GB - R0 Ptr.
    20702067     * Same kind of mapping as apHCPaePDs. */
    2071     RCPTRTYPE(PX86PDPAE)            apGCPaePDs[4];
     2068    R0PTRTYPE(PX86PDPAE)            apShwPaePDsR0[4];
     2069#endif
     2070    /** The four PDs for the low 4GB - RC Ptr.
     2071     * Same kind of mapping as apHCPaePDs. */
     2072    RCPTRTYPE(PX86PDPAE)            apShwPaePDsRC[4];
    20722073    /** The Physical Address (HC) of the four PDs for the low 4GB.
    20732074     * These are *NOT* 4 contiguous pages. */
     
    38243825    return pPD;
    38253826#else
    3826     //PX86PDPAE       pPD = pPGM->CTX_SUFF(apShwPaePDs)[iPdpt];
    3827     PX86PDPAE       pPD = pPGM->CTXMID(ap,PaePDs)[iPdpt];
     3827    PX86PDPAE       pPD = pPGM->CTX_SUFF(apShwPaePDs)[iPdpt];
    38283828    Assert(pPD);
    38293829    return pPD;
     
    38493849    return pPD->a[iPd].u;
    38503850#else
    3851     //return pPGM->CTX_SUFF(apShwPaePDs)[iPdpt]->a[iPd].u;
    3852     return pPGM->CTXMID(ap,PaePDs)[iPdpt]->a[iPd].u;
     3851    return pPGM->CTX_SUFF(apShwPaePDs)[iPdpt]->a[iPd].u;
    38533852#endif
    38543853}
     
    38723871    return &pPD->a[iPd];
    38733872#else
    3874     //Assert(pPGM->CTX_SUFF(apShwPaePDs)[iPdpt]);
    3875     //return &pPGM->CTX_SUFF(apShwPaePDs)[iPdpt]->a[iPd];
    3876     return &pPGM->CTXMID(ap,PaePDs)[iPdpt]->a[iPd];
     3873    Assert(pPGM->CTX_SUFF(apShwPaePDs)[iPdpt]);
     3874    return &pPGM->CTX_SUFF(apShwPaePDs)[iPdpt]->a[iPd];
    38773875#endif
    38783876}
  • trunk/src/VBox/VMM/PGMMap.cpp

    r14131 r14133  
    731731        unsigned iPDE = iOldPDE * 2 % 512;
    732732        pPGM->apInterPaePDs[iPD]->a[iPDE].u = 0;
    733         pPGM->apHCPaePDs[iPD]->a[iPDE].u    = 0;
     733        pPGM->apShwPaePDsR3[iPD]->a[iPDE].u = 0;
    734734        iPDE++;
    735735        pPGM->apInterPaePDs[iPD]->a[iPDE].u = 0;
    736         pPGM->apHCPaePDs[iPD]->a[iPDE].u    = 0;
     736        pPGM->apShwPaePDsR3[iPD]->a[iPDE].u = 0;
    737737
    738738        /* Clear the PGM_PDFLAGS_MAPPING flag for the page directory pointer entry. (legacy PAE guest mode) */
     
    784784        const unsigned iPD = iNewPDE / 256;
    785785        unsigned iPDE = iNewPDE * 2 % 512;
    786         if (pPGM->apHCPaePDs[iPD]->a[iPDE].n.u1Present)
    787             pgmPoolFree(pVM, pPGM->apHCPaePDs[iPD]->a[iPDE].u & X86_PDE_PAE_PG_MASK, PGMPOOL_IDX_PAE_PD, iNewPDE * 2);
     786        if (pPGM->apShwPaePDsR3[iPD]->a[iPDE].n.u1Present)
     787            pgmPoolFree(pVM, pPGM->apShwPaePDsR3[iPD]->a[iPDE].u & X86_PDE_PAE_PG_MASK, PGMPOOL_IDX_PAE_PD, iNewPDE * 2);
    788788        X86PDEPAE PdePae0;
    789789        PdePae0.u = PGM_PDFLAGS_MAPPING | X86_PDE_P | X86_PDE_A | X86_PDE_RW | X86_PDE_US | pMap->aPTs[i].HCPhysPaePT0;
    790790        pPGM->apInterPaePDs[iPD]->a[iPDE] = PdePae0;
    791         pPGM->apHCPaePDs[iPD]->a[iPDE]    = PdePae0;
     791        pPGM->apShwPaePDsR3[iPD]->a[iPDE] = PdePae0;
    792792
    793793        iPDE++;
    794         if (pPGM->apHCPaePDs[iPD]->a[iPDE].n.u1Present)
    795             pgmPoolFree(pVM, pPGM->apHCPaePDs[iPD]->a[iPDE].u & X86_PDE_PAE_PG_MASK, PGMPOOL_IDX_PAE_PD, iNewPDE * 2 + 1);
     794        if (pPGM->apShwPaePDsR3[iPD]->a[iPDE].n.u1Present)
     795            pgmPoolFree(pVM, pPGM->apShwPaePDsR3[iPD]->a[iPDE].u & X86_PDE_PAE_PG_MASK, PGMPOOL_IDX_PAE_PD, iNewPDE * 2 + 1);
    796796        X86PDEPAE PdePae1;
    797797        PdePae1.u = PGM_PDFLAGS_MAPPING | X86_PDE_P | X86_PDE_A | X86_PDE_RW | X86_PDE_US | pMap->aPTs[i].HCPhysPaePT1;
    798798        pPGM->apInterPaePDs[iPD]->a[iPDE] = PdePae1;
    799         pPGM->apHCPaePDs[iPD]->a[iPDE]    = PdePae1;
     799        pPGM->apShwPaePDsR3[iPD]->a[iPDE] = PdePae1;
    800800
    801801        /* Set the PGM_PDFLAGS_MAPPING flag in the page directory pointer entry. (legacy PAE guest mode) */
  • trunk/src/VBox/VMM/PGMPool.cpp

    r14038 r14133  
    262262    pPool->aPages[PGMPOOL_IDX_PAE_PD].Core.Key  = NIL_RTHCPHYS;
    263263    pPool->aPages[PGMPOOL_IDX_PAE_PD].GCPhys    = NIL_RTGCPHYS;
    264     pPool->aPages[PGMPOOL_IDX_PAE_PD].pvPageR3  = pVM->pgm.s.apHCPaePDs[0];
     264    pPool->aPages[PGMPOOL_IDX_PAE_PD].pvPageR3  = pVM->pgm.s.apShwPaePDsR3[0];
    265265    pPool->aPages[PGMPOOL_IDX_PAE_PD].enmKind   = PGMPOOLKIND_ROOT_PAE_PD;
    266266    pPool->aPages[PGMPOOL_IDX_PAE_PD].idx       = PGMPOOL_IDX_PAE_PD;
     
    271271        pPool->aPages[PGMPOOL_IDX_PAE_PD_0 + i].Core.Key  = NIL_RTHCPHYS;
    272272        pPool->aPages[PGMPOOL_IDX_PAE_PD_0 + i].GCPhys    = NIL_RTGCPHYS;
    273         pPool->aPages[PGMPOOL_IDX_PAE_PD_0 + i].pvPageR3  = pVM->pgm.s.apHCPaePDs[i];
     273        pPool->aPages[PGMPOOL_IDX_PAE_PD_0 + i].pvPageR3  = pVM->pgm.s.apShwPaePDsR3[i];
    274274        pPool->aPages[PGMPOOL_IDX_PAE_PD_0 + i].enmKind   = PGMPOOLKIND_PAE_PD_FOR_PAE_PD;
    275275        pPool->aPages[PGMPOOL_IDX_PAE_PD_0 + i].idx       = PGMPOOL_IDX_PAE_PD_0 + i;
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r14131 r14133  
    23242324    const unsigned  iPdpt    = (GCPtrPage >> X86_PDPT_SHIFT); NOREF(iPdpt);
    23252325    PX86PDPT        pPdptDst = pgmShwGetPaePDPTPtr(&pVM->pgm.s); NOREF(pPdptDst);
    2326     PSHWPDE         pPdeDst = pgmShwGetPaePDEPtr(&pVM->pgm.s, GCPtrPage);
     2326    PSHWPDE         pPdeDst  = pgmShwGetPaePDEPtr(&pVM->pgm.s, GCPtrPage);
    23272327
    23282328# elif PGM_SHW_TYPE == PGM_TYPE_AMD64
     
    32143214        X86PDPE         PdpeSrc;
    32153215        PGSTPD          pPDSrc    = pgmGstGetPaePDPtr(&pVM->pgm.s, iPdpt << X86_PDPT_SHIFT, &iPDSrc, &PdpeSrc);
    3216         PX86PDPAE       pPDPAE    = pVM->pgm.s.CTXMID(ap,PaePDs)[0];
    32173216        PX86PDEPAE      pPDEDst   = pgmShwGetPaePDEPtr(&pVM->pgm.s, iPdpt << X86_PDPT_SHIFT);
    32183217        PX86PDPT        pPdptDst  = pgmShwGetPaePDPTPtr(&pVM->pgm.s);
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r14038 r14133  
    115115        case PGMPOOL_IDX_PAE_PD:
    116116        case PGMPOOL_IDX_PAE_PD_0:
    117             return pVM->pgm.s.apGCPaePDs[0];
     117            return pVM->pgm.s.apShwPaePDsRC[0];
    118118        case PGMPOOL_IDX_PAE_PD_1:
    119             return pVM->pgm.s.apGCPaePDs[1];
     119            return pVM->pgm.s.apShwPaePDsRC[1];
    120120        case PGMPOOL_IDX_PAE_PD_2:
    121             return pVM->pgm.s.apGCPaePDs[2];
     121            return pVM->pgm.s.apShwPaePDsRC[2];
    122122        case PGMPOOL_IDX_PAE_PD_3:
    123             return pVM->pgm.s.apGCPaePDs[3];
     123            return pVM->pgm.s.apShwPaePDsRC[3];
    124124        case PGMPOOL_IDX_PDPT:
    125125            return pVM->pgm.s.pShwPaePdptRC;
  • trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp

    r14038 r14133  
    416416    GEN_CHECK_OFF(PGM, pGC32BitPD);
    417417    GEN_CHECK_OFF(PGM, HCPhys32BitPD);
    418     GEN_CHECK_OFF(PGM, apHCPaePDs);
    419     GEN_CHECK_OFF(PGM, apGCPaePDs);
     418    GEN_CHECK_OFF(PGM, apShwPaePDsR3);
     419#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
     420    GEN_CHECK_OFF(PGM, apShwPaePDsR0);
     421#endif
     422    GEN_CHECK_OFF(PGM, apShwPaePDsRC);
    420423    GEN_CHECK_OFF(PGM, aHCPhysPaePDs);
    421424    GEN_CHECK_OFF(PGM, pShwPaePdptR3);
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