VirtualBox

Changeset 10032 in vbox


Ignore:
Timestamp:
Jun 30, 2008 5:03:54 PM (16 years ago)
Author:
vboxsync
Message:

Nested paging updates

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

Legend:

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

    r10026 r10032  
    12911291/** AMD64 CR3 level index.*/
    12921292#define PGMPOOL_IDX_AMD64_CR3   8
     1293/** Nested paging root.*/
     1294#define PGMPOOL_IDX_NESTED_ROOT 9
    12931295/** The first normal index. */
    1294 #define PGMPOOL_IDX_FIRST       9
     1296#define PGMPOOL_IDX_FIRST       10
    12951297/** The last valid index. (inclusive, 14 bits) */
    12961298#define PGMPOOL_IDX_LAST        0x3fff
     
    13871389    /** Shw: Root PAE page directory pointer table (legacy, 4 entries). */
    13881390    PGMPOOLKIND_ROOT_PDPT,
     1391    /** Shw: Root Nested paging table. */
     1392    PGMPOOLKIND_ROOT_NESTED,
    13891393
    13901394    /** The last valid entry. */
    1391     PGMPOOLKIND_LAST = PGMPOOLKIND_ROOT_PDPT
     1395    PGMPOOLKIND_LAST = PGMPOOLKIND_ROOT_NESTED
    13921396} PGMPOOLKIND;
    13931397
  • trunk/src/VBox/VMM/PGMPool.cpp

    r9899 r10032  
    273273    pPool->aPages[PGMPOOL_IDX_AMD64_CR3].enmKind   = PGMPOOLKIND_64BIT_PML4_FOR_64BIT_PML4;
    274274    pPool->aPages[PGMPOOL_IDX_AMD64_CR3].idx       = PGMPOOL_IDX_AMD64_CR3;
     275
     276    /* The Shadow AMD64 CR3. */
     277    pPool->aPages[PGMPOOL_IDX_NESTED_ROOT].Core.Key  = NIL_RTHCPHYS;
     278    pPool->aPages[PGMPOOL_IDX_NESTED_ROOT].GCPhys    = NIL_RTGCPHYS;
     279    pPool->aPages[PGMPOOL_IDX_NESTED_ROOT].pvPageHC  = pVM->pgm.s.pHCNestedRoot;
     280    pPool->aPages[PGMPOOL_IDX_NESTED_ROOT].enmKind   = PGMPOOLKIND_ROOT_NESTED;
     281    pPool->aPages[PGMPOOL_IDX_NESTED_ROOT].idx       = PGMPOOL_IDX_NESTED_ROOT;
    275282
    276283    /*
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r10026 r10032  
    824824    int            rc;
    825825    PGMPOOLKIND    enmPdpt, enmPd;
    826 
    827     AssertReturn(pVM->pgm.s.pHCPaePML4 && pVM->pgm.s.pHCShwAmd64CR3, VERR_INTERNAL_ERROR);
    828 
     826    unsigned       idxTopLevel;
     827
     828    AssertReturn(pVM->pgm.s.pHCPaePML4, VERR_INTERNAL_ERROR);
    829829    if (HWACCMIsNestedPagingActive(pVM))
    830830    {
    831         enmPdpt = PGMPOOLKIND_64BIT_PDPT_FOR_PHYS;
    832         enmPd   = PGMPOOLKIND_64BIT_PD_FOR_PHYS;
     831        enmPdpt     = PGMPOOLKIND_64BIT_PDPT_FOR_PHYS;
     832        enmPd       = PGMPOOLKIND_64BIT_PD_FOR_PHYS;
     833        idxTopLevel = PGMPOOL_IDX_NESTED_ROOT;
    833834    }
    834835    else
    835836    {
    836         enmPdpt = PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT;
    837         enmPd   = PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD;
     837        AssertReturn(pVM->pgm.s.pHCShwAmd64CR3, VERR_INTERNAL_ERROR);
     838
     839        enmPdpt     = PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT;
     840        enmPd       = PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD;
     841        idxTopLevel = pVM->pgm.s.pHCShwAmd64CR3->idx;
    838842    }
    839843
     
    847851
    848852        Assert(!(pPml4e->u & X86_PML4E_PG_MASK));
    849         rc = pgmPoolAlloc(pVM, pPml4eGst->u & X86_PML4E_PG_MASK, enmPdpt, pVM->pgm.s.pHCShwAmd64CR3->idx, iPml4e, &pShwPage);
     853        rc = pgmPoolAlloc(pVM, pPml4eGst->u & X86_PML4E_PG_MASK, enmPdpt, idxTopLevel, iPml4e, &pShwPage);
    850854        if (rc == VERR_PGM_POOL_FLUSHED)
    851855            return VINF_PGM_SYNC_CR3;
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r10027 r10032  
    11171117        case PGMPOOLKIND_ROOT_PAE_PD:
    11181118        case PGMPOOLKIND_ROOT_PDPT:
     1119        case PGMPOOLKIND_ROOT_NESTED:
    11191120            return false;
    11201121
     
    13301331                case PGMPOOLKIND_64BIT_PD_FOR_PHYS:
    13311332                case PGMPOOLKIND_64BIT_PML4_FOR_PHYS:
     1333                case PGMPOOLKIND_ROOT_NESTED:
    13321334                    break;
    13331335                default:
     
    13791381        case PGMPOOLKIND_64BIT_PD_FOR_PHYS:
    13801382        case PGMPOOLKIND_64BIT_PML4_FOR_PHYS:
     1383        case PGMPOOLKIND_ROOT_NESTED:
    13811384            /* Nothing to monitor here. */
    13821385            return VINF_SUCCESS;
     
    14641467        case PGMPOOLKIND_64BIT_PD_FOR_PHYS:
    14651468        case PGMPOOLKIND_64BIT_PML4_FOR_PHYS:
     1469        case PGMPOOLKIND_ROOT_NESTED:
    14661470            /* Nothing to monitor here. */
    14671471            return VINF_SUCCESS;
     
    21522156        case PGMPOOLKIND_ROOT_PAE_PD:
    21532157        case PGMPOOLKIND_ROOT_PDPT:
     2158        case PGMPOOLKIND_ROOT_NESTED:
    21542159        case PGMPOOLKIND_64BIT_PDPT_FOR_PHYS:
    21552160        case PGMPOOLKIND_64BIT_PD_FOR_PHYS:
     
    21992204        case PGMPOOLKIND_64BIT_PD_FOR_PHYS:
    22002205        case PGMPOOLKIND_64BIT_PML4_FOR_PHYS:
     2206        case PGMPOOLKIND_ROOT_NESTED:
    22012207            /** @todo can we return 0? (nobody is calling this...) */
    22022208            AssertFailed();
     
    25202526            /* GCPhys >> PAGE_SHIFT is the index here */
    25212527            break;
     2528        case PGMPOOLKIND_ROOT_NESTED:
     2529            Assert(pUser->iUserTable < X86_PG_PAE_ENTRIES);
     2530            break;
     2531
    25222532        default:
    25232533            AssertMsgFailed(("enmKind=%d\n", pUserPage->enmKind));
     
    25442554        case PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT:
    25452555        case PGMPOOLKIND_64BIT_PML4_FOR_64BIT_PML4:
     2556        case PGMPOOLKIND_ROOT_NESTED:
    25462557            u.pau64[pUser->iUserTable] = 0;
    25472558            break;
     
    32603271                /* Not root of shadowed pages currently, ignore it. */
    32613272                break;
     3273
     3274            case PGMPOOLKIND_ROOT_NESTED:
     3275                ASMMemZero32(u.pau64, PAGE_SIZE);
     3276                break;
    32623277        }
    32633278    }
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