VirtualBox

Ignore:
Timestamp:
May 21, 2008 2:38:13 PM (17 years ago)
Author:
vboxsync
Message:

Nested paging updates. Extra paging mode added to prevent illegal changes to the shadow page table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r9001 r9021  
    4444
    4545/* Filter out some illegal combinations of guest and shadow paging, so we can remove redundant checks inside functions. */
    46 #if      PGM_GST_TYPE == PGM_TYPE_PAE && PGM_SHW_TYPE != PGM_TYPE_PAE
     46#if      PGM_GST_TYPE == PGM_TYPE_PAE && PGM_SHW_TYPE != PGM_TYPE_PAE && PGM_SHW_TYPE != PGM_TYPE_NESTED
    4747# error "Invalid combination; PAE guest implies PAE shadow"
    4848#endif
    4949
    5050#if     (PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT) \
    51     && !(PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_AMD64)
     51    && !(PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_AMD64 || PGM_SHW_TYPE == PGM_TYPE_NESTED)
    5252# error "Invalid combination; real or protected mode without paging implies 32 bits or PAE shadow paging."
    5353#endif
    5454
    5555#if     (PGM_GST_TYPE == PGM_TYPE_32BIT || PGM_GST_TYPE == PGM_TYPE_PAE) \
    56     && !(PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_PAE)
     56    && !(PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_NESTED)
    5757# error "Invalid combination; 32 bits guest paging or PAE implies 32 bits or PAE shadow paging."
    5858#endif
    5959
    60 #if    (PGM_GST_TYPE == PGM_TYPE_AMD64 && PGM_SHW_TYPE != PGM_TYPE_AMD64)
    61     || (PGM_SHW_TYPE == PGM_TYPE_AMD64 && PGM_GST_TYPE != PGM_TYPE_AMD64)
     60#if    (PGM_GST_TYPE == PGM_TYPE_AMD64 && PGM_SHW_TYPE != PGM_TYPE_AMD64 && PGM_SHW_TYPE != PGM_TYPE_NESTED) \
     61    || (PGM_SHW_TYPE == PGM_TYPE_AMD64 && PGM_GST_TYPE != PGM_TYPE_AMD64 && PGM_GST_TYPE != PGM_TYPE_PROT)
    6262# error "Invalid combination; AMD64 guest implies AMD64 shadow and vice versa"
    6363#endif
     
    7878PGM_BTH_DECL(int, Trap0eHandler)(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault)
    7979{
    80 #if PGM_GST_TYPE == PGM_TYPE_32BIT || PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT || PGM_GST_TYPE == PGM_TYPE_PAE || PGM_GST_TYPE == PGM_TYPE_AMD64
     80#if (PGM_GST_TYPE == PGM_TYPE_32BIT || PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT || PGM_GST_TYPE == PGM_TYPE_PAE || PGM_GST_TYPE == PGM_TYPE_AMD64) \
     81    && PGM_SHW_TYPE != PGM_TYPE_NESTED
    8182
    8283# if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE != PGM_TYPE_PAE
     
    846847PGM_BTH_DECL(int, InvalidatePage)(PVM pVM, RTGCUINTPTR GCPtrPage)
    847848{
    848 #if    PGM_GST_TYPE == PGM_TYPE_32BIT \
    849     || PGM_GST_TYPE == PGM_TYPE_PAE \
    850     || PGM_GST_TYPE == PGM_TYPE_AMD64
     849#if    PGM_WITH_PAGING(PGM_GST_TYPE) \
     850    && PGM_SHW_TYPE != PGM_TYPE_NESTED
    851851    int rc;
    852852
     
    14181418    LogFlow(("SyncPage: GCPtrPage=%VGv cPages=%d uErr=%#x\n", GCPtrPage, cPages, uErr));
    14191419
    1420 #if    PGM_GST_TYPE == PGM_TYPE_32BIT \
    1421     || PGM_GST_TYPE == PGM_TYPE_PAE
     1420#if    (PGM_GST_TYPE == PGM_TYPE_32BIT \
     1421    ||  PGM_GST_TYPE == PGM_TYPE_PAE) \
     1422    && PGM_SHW_TYPE != PGM_TYPE_NESTED
    14221423
    14231424# if PGM_WITH_NX(PGM_GST_TYPE)
     
    16601661    return VINF_PGM_SYNCPAGE_MODIFIED_PDE;
    16611662
    1662 #elif PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT
     1663#elif (PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT) \
     1664      && PGM_SHW_TYPE != PGM_TYPE_NESTED
    16631665
    16641666# ifdef PGM_SYNC_N_PAGES
     
    20912093    LogFlow(("SyncPT: GCPtrPage=%VGv\n", GCPtrPage));
    20922094
    2093 #if    PGM_GST_TYPE == PGM_TYPE_32BIT \
    2094     || PGM_GST_TYPE == PGM_TYPE_PAE
     2095#if   (   PGM_GST_TYPE == PGM_TYPE_32BIT \
     2096       || PGM_GST_TYPE == PGM_TYPE_PAE) \
     2097    && PGM_SHW_TYPE != PGM_TYPE_NESTED
    20952098
    20962099    /*
     
    24442447    return rc;
    24452448
    2446 #elif PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT
     2449#elif (PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT) \
     2450    && PGM_SHW_TYPE != PGM_TYPE_NESTED
    24472451
    24482452    int     rc     = VINF_SUCCESS;
     
    25192523PGM_BTH_DECL(int, PrefetchPage)(PVM pVM, RTGCUINTPTR GCPtrPage)
    25202524{
    2521 #if (PGM_GST_TYPE == PGM_TYPE_32BIT || PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT || PGM_GST_TYPE == PGM_TYPE_PAE) && PGM_SHW_TYPE != PGM_TYPE_AMD64
     2525    Assert(!HWACCMIsNestedPagingActive(pVM));
     2526#if (PGM_GST_TYPE == PGM_TYPE_32BIT || PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT || PGM_GST_TYPE == PGM_TYPE_PAE) \
     2527    && PGM_SHW_TYPE != PGM_TYPE_AMD64 && PGM_SHW_TYPE != PGM_TYPE_NESTED
    25222528    /*
    25232529     * Check that all Guest levels thru the PDE are present, getting the
     
    25962602    LogFlow(("VerifyAccessSyncPage: GCPtrPage=%VGv fPage=%#x uErr=%#x\n", GCPtrPage, fPage, uErr));
    25972603
    2598 #if (PGM_GST_TYPE == PGM_TYPE_32BIT ||  PGM_GST_TYPE == PGM_TYPE_REAL ||  PGM_GST_TYPE == PGM_TYPE_PROT || PGM_GST_TYPE == PGM_TYPE_PAE) && PGM_SHW_TYPE != PGM_TYPE_AMD64
     2604    Assert(!HWACCMIsNestedPagingActive(pVM));
     2605#if (PGM_GST_TYPE == PGM_TYPE_32BIT ||  PGM_GST_TYPE == PGM_TYPE_REAL ||  PGM_GST_TYPE == PGM_TYPE_PROT || PGM_GST_TYPE == PGM_TYPE_PAE) \
     2606    && PGM_SHW_TYPE != PGM_TYPE_AMD64 && PGM_SHW_TYPE != PGM_TYPE_NESTED
    25992607
    26002608# ifndef IN_RING0
     
    27512759PGM_BTH_DECL(int, SyncCR3)(PVM pVM, uint64_t cr0, uint64_t cr3, uint64_t cr4, bool fGlobal)
    27522760{
     2761#if PGM_SHW_TYPE == PGM_TYPE_NESTED
     2762    /* @todo check if this is really necessary */
     2763    HWACCMFlushTLB(pVM);
     2764    return VINF_SUCCESS;
     2765#else
    27532766    if (VM_FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3))
    27542767        fGlobal = true; /* Change this CR3 reload to be a global one. */
     
    31113124    return VINF_SUCCESS;
    31123125
    3113 #elif PGM_GST_TYPE == PGM_TYPE_AMD64
     3126# elif PGM_GST_TYPE == PGM_TYPE_AMD64
    31143127//# error not implemented
    31153128    return VERR_INTERNAL_ERROR;
    3116 #else /* guest real and protected mode */
     3129# else /* guest real and protected mode */
    31173130    return VINF_SUCCESS;
    3118 #endif
     3131# endif
     3132#endif /* PGM_SHW_TYPE != PGM_TYPE_NESTED */
    31193133}
    31203134
     
    31593173PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCUINTPTR GCPtr, RTGCUINTPTR cb)
    31603174{
     3175#if PGM_SHW_TYPE == PGM_TYPE_NESTED
     3176    return 0;
     3177#else
    31613178    unsigned    cErrors = 0;
    31623179
     
    37683785#endif
    37693786    return cErrors;
     3787
     3788#endif /* PGM_SHW_TYPE != PGM_TYPE_NESTED */
    37703789}
    37713790#endif /* VBOX_STRICT */
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