VirtualBox

Changeset 7629 in vbox for trunk/src


Ignore:
Timestamp:
Mar 28, 2008 3:07:31 PM (17 years ago)
Author:
vboxsync
Message:

Initial cleanup for PAE

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

Legend:

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

    r7072 r7629  
    13481348    STAM_REG(pVM, &pPGM->StatGCTrap0eUSWrite,               STAMTYPE_COUNTER, "/PGM/GC/Trap0e/User/Write",          STAMUNIT_OCCURENCES,     "Number of user mode write page faults.");
    13491349    STAM_REG(pVM, &pPGM->StatGCTrap0eUSReserved,            STAMTYPE_COUNTER, "/PGM/GC/Trap0e/User/Reserved",       STAMUNIT_OCCURENCES,     "Number of user mode reserved bit page faults.");
     1350    STAM_REG(pVM, &pPGM->StatGCTrap0eUSNXE,                 STAMTYPE_COUNTER, "/PGM/GC/Trap0e/User/NXE",            STAMUNIT_OCCURENCES,     "Number of user mode NXE page faults.");
    13501351    STAM_REG(pVM, &pPGM->StatGCTrap0eUSRead,                STAMTYPE_COUNTER, "/PGM/GC/Trap0e/User/Read",           STAMUNIT_OCCURENCES,     "Number of user mode read page faults.");
    13511352
     
    13541355    STAM_REG(pVM, &pPGM->StatGCTrap0eSVWrite,               STAMTYPE_COUNTER, "/PGM/GC/Trap0e/Supervisor/Write",    STAMUNIT_OCCURENCES,     "Number of supervisor mode write page faults.");
    13551356    STAM_REG(pVM, &pPGM->StatGCTrap0eSVReserved,            STAMTYPE_COUNTER, "/PGM/GC/Trap0e/Supervisor/Reserved", STAMUNIT_OCCURENCES,     "Number of supervisor mode reserved bit page faults.");
     1357    STAM_REG(pVM, &pPGM->StatGCTrap0eSNXE,                  STAMTYPE_COUNTER, "/PGM/GC/Trap0e/Supervisor/NXE",      STAMUNIT_OCCURENCES,     "Number of supervisor mode NXE page faults.");
    13561358    STAM_REG(pVM, &pPGM->StatGCTrap0eUnhandled,             STAMTYPE_COUNTER, "/PGM/GC/Trap0e/GuestPF/Unhandled",   STAMUNIT_OCCURENCES,     "Number of guest real page faults.");
    13571359    STAM_REG(pVM, &pPGM->StatGCTrap0eMap,                   STAMTYPE_COUNTER, "/PGM/GC/Trap0e/GuestPF/Map",         STAMUNIT_OCCURENCES,     "Number of guest page faults due to map accesses.");
     
    23132315     * Get page directory addresses.
    23142316     */
    2315     PVBOXPD     pPDSrc = pVM->pgm.s.pGuestPDHC;
     2317    PX86PD     pPDSrc = pVM->pgm.s.pGuestPDHC;
    23162318    Assert(pPDSrc);
    23172319    Assert(MMPhysGCPhys2HCVirt(pVM, (RTGCPHYS)(CPUMGetGuestCR3(pVM) & X86_CR3_PAGE_MASK), sizeof(*pPDSrc)) == pPDSrc);
     
    23222324    for (unsigned iPD = 0; iPD < ELEMENTS(pPDSrc->a); iPD++)
    23232325    {
    2324         VBOXPDE PdeSrc = pPDSrc->a[iPD];
     2326        X86PDE PdeSrc = pPDSrc->a[iPD];
    23252327        if (PdeSrc.n.u1Present)
    23262328        {
  • trunk/src/VBox/VMM/PGMBth.h

    r5999 r7629  
    2727PGM_BTH_DECL(int, Trap0eHandler)(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault);
    2828PGM_BTH_DECL(int, SyncCR3)(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal);
    29 PGM_BTH_DECL(int, SyncPage)(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError);
     29PGM_BTH_DECL(int, SyncPage)(PVM pVM, X86PDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError);
    3030PGM_BTH_DECL(int, VerifyAccessSyncPage)(PVM pVM, RTGCUINTPTR Addr, unsigned fPage, unsigned uError);
    3131PGM_BTH_DECL(int, InvalidatePage)(PVM pVM, RTGCPTR GCPtrPage);
  • trunk/src/VBox/VMM/PGMInternal.h

    r7625 r7629  
    211211 */
    212212#define PGM_WITH_PAGING(uType)  ((uType) >= PGM_TYPE_32BIT)
     213
     214/** Macro for checking if the guest supports the NX bit.
     215 * @param uType     PGM_TYPE_*
     216 * @remark  ASSUMES certain order of the PGM_TYPE_* values.
     217 */
     218#define PGM_WITH_NX(uType)  ((uType) >= PGM_TYPE_PAE)
    213219
    214220
     
    342348        RTHCPHYS                HCPhysPaePT1;
    343349        /** The HC virtual address of the 32-bit page table. */
    344         R3PTRTYPE(PVBOXPT)      pPTR3;
     350        R3PTRTYPE(PX86PT)       pPTR3;
    345351        /** The HC virtual address of the two PAE page table. (i.e 1024 entries instead of 512) */
    346352        R3PTRTYPE(PX86PTPAE)    paPaePTsR3;
    347353        /** The GC virtual address of the 32-bit page table. */
    348         GCPTRTYPE(PVBOXPT)      pPTGC;
     354        GCPTRTYPE(PX86PT)       pPTGC;
    349355        /** The GC virtual address of the two PAE page table. */
    350356        GCPTRTYPE(PX86PTPAE)    paPaePTsGC;
    351357        /** The GC virtual address of the 32-bit page table. */
    352         R0PTRTYPE(PVBOXPT)      pPTR0;
     358        R0PTRTYPE(PX86PT)       pPTR0;
    353359        /** The GC virtual address of the two PAE page table. */
    354360        R0PTRTYPE(PX86PTPAE)    paPaePTsR0;
     
    17641770    DECLR3CALLBACKMEMBER(int,       pfnR3BthInvalidatePage,(PVM pVM, RTGCPTR GCPtrPage));
    17651771    DECLR3CALLBACKMEMBER(int,       pfnR3BthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
    1766     DECLR3CALLBACKMEMBER(int,       pfnR3BthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
     1772    DECLR3CALLBACKMEMBER(int,       pfnR3BthSyncPage,(PVM pVM, X86PDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
    17671773    DECLR3CALLBACKMEMBER(int,       pfnR3BthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage));
    17681774    DECLR3CALLBACKMEMBER(int,       pfnR3BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
     
    17741780    DECLGCCALLBACKMEMBER(int,       pfnGCBthInvalidatePage,(PVM pVM, RTGCPTR GCPtrPage));
    17751781    DECLGCCALLBACKMEMBER(int,       pfnGCBthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
    1776     DECLGCCALLBACKMEMBER(int,       pfnGCBthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
     1782    DECLGCCALLBACKMEMBER(int,       pfnGCBthSyncPage,(PVM pVM, X86PDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
    17771783    DECLGCCALLBACKMEMBER(int,       pfnGCBthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage));
    17781784    DECLGCCALLBACKMEMBER(int,       pfnGCBthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
     
    17841790    DECLR0CALLBACKMEMBER(int,       pfnR0BthInvalidatePage,(PVM pVM, RTGCPTR GCPtrPage));
    17851791    DECLR0CALLBACKMEMBER(int,       pfnR0BthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
    1786     DECLR0CALLBACKMEMBER(int,       pfnR0BthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
     1792    DECLR0CALLBACKMEMBER(int,       pfnR0BthSyncPage,(PVM pVM, X86PDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
    17871793    DECLR0CALLBACKMEMBER(int,       pfnR0BthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage));
    17881794    DECLR0CALLBACKMEMBER(int,       pfnR0BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
     
    18471853     * @{ */
    18481854    /** The guest's page directory, HC pointer. */
    1849     R3R0PTRTYPE(PVBOXPD)        pGuestPDHC;
     1855    R3R0PTRTYPE(PX86PD)         pGuestPDHC;
    18501856    /** The guest's page directory, static GC mapping. */
    1851     GCPTRTYPE(PVBOXPD)          pGuestPDGC;
     1857    GCPTRTYPE(PX86PD)           pGuestPDGC;
    18521858    /** @} */
    18531859
     
    19931999    DECLR3CALLBACKMEMBER(int,       pfnR3BthInvalidatePage,(PVM pVM, RTGCPTR GCPtrPage));
    19942000    DECLR3CALLBACKMEMBER(int,       pfnR3BthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
    1995     DECLR3CALLBACKMEMBER(int,       pfnR3BthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
     2001    DECLR3CALLBACKMEMBER(int,       pfnR3BthSyncPage,(PVM pVM, X86PDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
    19962002    DECLR3CALLBACKMEMBER(int,       pfnR3BthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage));
    19972003    DECLR3CALLBACKMEMBER(int,       pfnR3BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
     
    20012007    DECLR0CALLBACKMEMBER(int,       pfnR0BthInvalidatePage,(PVM pVM, RTGCPTR GCPtrPage));
    20022008    DECLR0CALLBACKMEMBER(int,       pfnR0BthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
    2003     DECLR0CALLBACKMEMBER(int,       pfnR0BthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
     2009    DECLR0CALLBACKMEMBER(int,       pfnR0BthSyncPage,(PVM pVM, X86PDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
    20042010    DECLR0CALLBACKMEMBER(int,       pfnR0BthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage));
    20052011    DECLR0CALLBACKMEMBER(int,       pfnR0BthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
     
    20092015    DECLGCCALLBACKMEMBER(int,       pfnGCBthInvalidatePage,(PVM pVM, RTGCPTR GCPtrPage));
    20102016    DECLGCCALLBACKMEMBER(int,       pfnGCBthSyncCR3,(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal));
    2011     DECLGCCALLBACKMEMBER(int,       pfnGCBthSyncPage,(PVM pVM, VBOXPDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
     2017    DECLGCCALLBACKMEMBER(int,       pfnGCBthSyncPage,(PVM pVM, X86PDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError));
    20122018    DECLGCCALLBACKMEMBER(int,       pfnGCBthPrefetchPage,(PVM pVM, RTGCUINTPTR GCPtrPage));
    20132019    DECLGCCALLBACKMEMBER(int,       pfnGCBthVerifyAccessSyncPage,(PVM pVM, RTGCUINTPTR GCPtrPage, unsigned fFlags, unsigned uError));
     
    22392245    STAMCOUNTER     StatGCTrap0eUSWrite;
    22402246    STAMCOUNTER     StatGCTrap0eUSReserved;
     2247    STAMCOUNTER     StatGCTrap0eUSNXE;
    22412248    STAMCOUNTER     StatGCTrap0eUSRead;
    22422249
     
    22452252    STAMCOUNTER     StatGCTrap0eSVWrite;
    22462253    STAMCOUNTER     StatGCTrap0eSVReserved;
     2254    STAMCOUNTER     StatGCTrap0eSNXE;
    22472255
    22482256    STAMCOUNTER     StatGCTrap0eUnhandled;
     
    25052513int             pgmR3ChangeMode(PVM pVM, PGMMODE enmGuestMode);
    25062514
    2507 int             pgmR3SyncPTResolveConflict(PVM pVM, PPGMMAPPING pMapping, PVBOXPD pPDSrc, int iPDOld);
     2515int             pgmR3SyncPTResolveConflict(PVM pVM, PPGMMAPPING pMapping, PX86PD pPDSrc, int iPDOld);
    25082516PPGMMAPPING     pgmGetMapping(PVM pVM, RTGCPTR GCPtr);
    25092517void            pgmR3MapRelocate(PVM pVM, PPGMMAPPING pMapping, int iPDOld, int iPDNew);
     
    31993207        AssertMsgFailed(("Impossible! rc=%d PDPE=%#llx\n", rc, CTXSUFF(pPGM->pGstPaePDPTR)->a[iPdPtr].u));
    32003208    }
    3201     return 0;
     3209    return 0ULL;
    32023210}
    32033211
  • trunk/src/VBox/VMM/PGMMap.cpp

    r6916 r7629  
    159159         * 32-bit.
    160160         */
    161         pNew->aPTs[i].pPTR3    = (PVBOXPT)pbPTs;
     161        pNew->aPTs[i].pPTR3    = (PX86PT)pbPTs;
    162162        pNew->aPTs[i].pPTGC    = MMHyperR3ToGC(pVM, pNew->aPTs[i].pPTR3);
    163163        pNew->aPTs[i].pPTR0    = MMHyperR3ToR0(pVM, pNew->aPTs[i].pPTR3);
     
    876876/**
    877877 * Resolves a conflict between a page table based GC mapping and
    878  * the Guest OS page tables.
     878 * the Guest OS page tables. (32 bits version)
    879879 *
    880880 * @returns VBox status code.
     
    884884 * @param   iPDOld      The index to the start of the current mapping.
    885885 */
    886 int pgmR3SyncPTResolveConflict(PVM pVM, PPGMMAPPING pMapping, PVBOXPD pPDSrc, int iPDOld)
     886int pgmR3SyncPTResolveConflict(PVM pVM, PPGMMAPPING pMapping, PX86PD pPDSrc, int iPDOld)
    887887{
    888888    STAM_PROFILE_START(&pVM->pgm.s.StatHCResolveConflict, a);
     
    938938
    939939
    940 
    941940/**
    942941 * Checks guest PD for conflicts with VMM GC mappings.
     
    959958     * Resolve the page directory.
    960959     */
    961     PVBOXPD pPD = pVM->pgm.s.pGuestPDHC; /** @todo Fix PAE! */
     960    PX86PD pPD = pVM->pgm.s.pGuestPDHC; /** @todo Fix PAE! */
    962961    Assert(pPD);
    963     Assert(pPD == (PVBOXPD)MMPhysGCPhys2HCVirt(pVM, cr3 & X86_CR3_PAGE_MASK, sizeof(*pPD)));
     962    Assert(pPD == (PX86PD)MMPhysGCPhys2HCVirt(pVM, cr3 & X86_CR3_PAGE_MASK, sizeof(*pPD)));
    964963
    965964    /*
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r6906 r7629  
    6363*   Internal Functions                                                         *
    6464*******************************************************************************/
    65 /** @def DUMP_PDE_BIG
    66  * Debug routine for dumping a big PDE.
    67  */
    68 #ifdef DEBUG_Sander
    69 /** Debug routine for dumping a big PDE. */
    70 static void pgmDumpPDEBig(const char *pszPrefix, int iPD, VBOXPDE Pde)
    71 {
    72     Log(("%s: BIG %d u10PageNo=%08X P=%d W=%d U=%d CACHE=%d ACC=%d DIR=%d GBL=%d\n", pszPrefix, iPD, Pde.b.u10PageNo, Pde.b.u1Present, Pde.b.u1Write, Pde.b.u1User, Pde.b.u1CacheDisable, Pde.b.u1Accessed, Pde.b.u1Dirty, Pde.b.u1Global));
    73     Log(("%s: BIG %d WRT=%d AVAIL=%X RSV=%X PAT=%d\n", pszPrefix, iPD, Pde.b.u1WriteThru, Pde.b.u3Available, Pde.b.u8PageNoHigh, Pde.b.u1PAT));
    74 }
    75 #define DUMP_PDE_BIG(a, b, c) pgmDumpPDEBig(a, b, c)
    76 #else
    77 #define DUMP_PDE_BIG(a, b, c) do { } while (0)
    78 #endif
    79 
    80 
    8165
    8266#if 1///@todo ndef RT_ARCH_AMD64
     
    274258        else if (uErr & X86_TRAP_PF_RSVD)
    275259            STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eUSReserved);
     260        else if (uErr & X86_TRAP_PF_ID)
     261            STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eUSNXE);
    276262        else
    277263            STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eUSRead);
    278264    }
    279265    else
    280     {   //supervisor
     266    {   /* Supervisor */
    281267        if (!(uErr & X86_TRAP_PF_P))
    282268        {
     
    288274        else if (uErr & X86_TRAP_PF_RW)
    289275            STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eSVWrite);
     276        else if (uErr & X86_TRAP_PF_ID)
     277            STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eSNXE);
    290278        else if (uErr & X86_TRAP_PF_RSVD)
    291279            STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eSVReserved);
     
    582570PGMDECL(int) PGMInterpretInstruction(PVM pVM, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault)
    583571{
    584 #ifdef IN_RING0
    585     /** @todo */
    586     int rc = VINF_EM_RAW_EMULATE_INSTR;
    587 #else
    588572    uint32_t cb;
    589573    int rc = EMInterpretInstruction(pVM, pRegFrame, pvFault, &cb);
     
    592576    if (rc != VINF_SUCCESS)
    593577        Log(("PGMInterpretInstruction: returns %Rrc (pvFault=%VGv)\n", rc, pvFault));
    594 #endif
    595578    return rc;
    596579}
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r7577 r7629  
    246246        else
    247247        {
    248             PVBOXPT pPTSrc;
     248            PX86PT pPTSrc;
    249249#  ifdef IN_GC
    250250            rc = PGMGCDynMapGCPage(pVM, PdeSrc.u & GST_PDE_PG_MASK, (void **)&pPTSrc);
    251251#  else
    252             pPTSrc = (PVBOXPT)MMPhysGCPhys2HCVirt(pVM, PdeSrc.u & GST_PDE_PG_MASK, sizeof(*pPTSrc));
     252            pPTSrc = (PX86PT)MMPhysGCPhys2HCVirt(pVM, PdeSrc.u & GST_PDE_PG_MASK, sizeof(*pPTSrc));
    253253            if (pPTSrc == 0)
    254254                rc = VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS;
     
    611611                    }
    612612                }
    613 #  endif /* PGM_WITH_PAGING(PGM_GST_TYPE) */
     613#  endif /* PGM_WITH_PAGING(PGM_GST_TYPE) && !defined(IN_RING0) */
    614614                rc = PGM_BTH_NAME(SyncPage)(pVM, PdeSrc, (RTGCUINTPTR)pvFault, PGM_SYNC_NR_PAGES, uErr);
    615615                if (VBOX_SUCCESS(rc))
     
    755755PGM_BTH_DECL(int, InvalidatePage)(PVM pVM, RTGCUINTPTR GCPtrPage)
    756756{
    757 #if PGM_GST_TYPE == PGM_TYPE_32BIT
     757#if    PGM_GST_TYPE == PGM_TYPE_32BIT \
     758    || PGM_GST_TYPE == PGM_TYPE_PAE
    758759
    759760    LogFlow(("InvalidatePage %x\n", GCPtrPage));
     
    785786#  else /* PAE */
    786787    unsigned        iPDSrc;
    787     PX86PD          pPDSrc = pgmGstGetPaePDPtr(&pVM->pgm.s, GCPtrPage, &iPDSrc);
     788    PX86PDPAE       pPDSrc = pgmGstGetPaePDPtr(&pVM->pgm.s, GCPtrPage, &iPDSrc);
    788789
    789790    GSTPDE          PdeSrc;;
     
    942943            pPdeDst->u = 0;
    943944            STAM_COUNTER_INC(&pVM->pgm.s.CTXMID(Stat,InvalidatePage4MBPages));
    944             DUMP_PDE_BIG("PGMInvalidatePage", iPDSrc, PdeSrc);
    945945            PGM_INVL_BIG_PG(GCPtrPage);
    946946        }
     
    971971# endif
    972972    return VINF_SUCCESS;
    973 
    974 #elif PGM_GST_TYPE == PGM_TYPE_PAE
    975 # if PGM_SHW_TYPE == PGM_TYPE_PAE
    976 //# error not implemented
    977     return VERR_INTERNAL_ERROR;
    978 
    979 # else  /* PGM_SHW_TYPE != PGM_TYPE_AMD64 */
    980 #  error "Guest PAE mode, but not the shadow mode ; 32bit - maybe, but amd64 no."
    981 # endif /* PGM_SHW_TYPE != PGM_TYPE_AMD64 */
    982973
    983974#elif PGM_GST_TYPE == PGM_TYPE_AMD64
     
    11071098 * @remark  Not used for 2/4MB pages!
    11081099 */
    1109 DECLINLINE(void) PGM_BTH_NAME(SyncPageWorker)(PVM pVM, PSHWPTE pPteDst, GSTPDE PdeSrc, VBOXPTE PteSrc, PPGMPOOLPAGE pShwPage, unsigned iPTDst)
     1100DECLINLINE(void) PGM_BTH_NAME(SyncPageWorker)(PVM pVM, PSHWPTE pPteDst, GSTPDE PdeSrc, GSTPTE PteSrc, PPGMPOOLPAGE pShwPage, unsigned iPTDst)
    11101101{
    11111102    if (PteSrc.n.u1Present)
     
    12431234    LogFlow(("SyncPage: GCPtrPage=%VGv cPages=%d uErr=%#x\n", GCPtrPage, cPages, uErr));
    12441235
    1245 #if PGM_GST_TYPE == PGM_TYPE_32BIT
     1236#if    PGM_GST_TYPE == PGM_TYPE_32BIT \
     1237    || PGM_GST_TYPE == PGM_TYPE_PAE
    12461238
    12471239# if PGM_SHW_TYPE != PGM_TYPE_32BIT && PGM_SHW_TYPE != PGM_TYPE_PAE
     
    12941286        &&  (PdeSrc.n.u1User == PdeDst.n.u1User)
    12951287        &&  (PdeSrc.n.u1Write == PdeDst.n.u1Write || !PdeDst.n.u1Write)
     1288# if PGM_GST_TYPE == PGM_TYPE_PAE
     1289        &&  (PdeSrc.n.u1NoExecute == PdeDst.n.u1NoExecute)
     1290# endif
    12961291       )
    12971292    {
     
    13111306                 * 4KB Page - Map the guest page table.
    13121307                 */
    1313                 PVBOXPT pPTSrc;
     1308                PGSTPT pPTSrc;
    13141309                int rc = PGM_GCPHYS_2_PTR(pVM, PdeSrc.u & GST_PDE_PG_MASK, &pPTSrc);
    13151310                if (VBOX_SUCCESS(rc))
     
    13411336                            if (!pPTDst->a[iPTDst].n.u1Present)
    13421337                            {
    1343                                 VBOXPTE PteSrc = pPTSrc->a[offPTSrc + iPTDst];
     1338                                GSTPTE PteSrc = pPTSrc->a[offPTSrc + iPTDst];
    13441339                                RTGCUINTPTR GCPtrCurPage = ((RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(GST_PT_MASK << GST_PT_SHIFT)) | ((offPTSrc + iPTDst) << PAGE_SHIFT);
    13451340                                NOREF(GCPtrCurPage);
     
    13731368                    {
    13741369                        const unsigned iPTSrc = (GCPtrPage >> GST_PT_SHIFT) & GST_PT_MASK;
    1375                         VBOXPTE PteSrc = pPTSrc->a[iPTSrc];
     1370                        GSTPTE PteSrc = pPTSrc->a[iPTSrc];
    13761371                        const unsigned iPTDst = (GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK;
    13771372                        PGM_BTH_NAME(SyncPageWorker)(pVM, &pPTDst->a[iPTDst], PdeSrc, PteSrc, pShwPage, iPTDst);
     
    15291524            if (!pPTDst->a[iPTDst].n.u1Present)
    15301525            {
    1531                 VBOXPTE PteSrc;
     1526                GSTPTE PteSrc;
    15321527
    15331528                RTGCUINTPTR GCPtrCurPage = ((RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(GST_PT_MASK << GST_PT_SHIFT)) | ((offPTSrc + iPTDst) << PAGE_SHIFT);
     
    15561551# endif /* PGM_SYNC_N_PAGES */
    15571552    {
    1558         VBOXPTE PteSrc;
     1553        GSTPTE PteSrc;
    15591554        const unsigned iPTDst = (GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK;
    15601555        RTGCUINTPTR GCPtrCurPage = ((RTGCUINTPTR)GCPtrPage & ~(RTGCUINTPTR)(GST_PT_MASK << GST_PT_SHIFT)) | ((offPTSrc + iPTDst) << PAGE_SHIFT);
     
    16111606    if (    (uErr & X86_TRAP_PF_RSVD)
    16121607        ||  !pPdeSrc->n.u1Present
    1613 #if PGM_GST_TYPE == PGM_TYPE_PAE
     1608#  if PGM_WITH_NX(PGM_GST_TYPE)
    16141609        ||  ((uErr & X86_TRAP_PF_ID) &&  pPdeSrc->n.u1NoExecute)
    1615 #endif
     1610#  endif
    16161611        ||  ((uErr & X86_TRAP_PF_RW) && !pPdeSrc->n.u1Write)
    16171612        ||  ((uErr & X86_TRAP_PF_US) && !pPdeSrc->n.u1User) )
     
    17011696        const GSTPTE   PteSrc = *pPteSrc;
    17021697        if (    !PteSrc.n.u1Present
    1703 #if PGM_GST_TYPE == PGM_TYPE_PAE
     1698#  if PGM_WITH_NX(PGM_GST_TYPE)
    17041699            ||  ((uErr & X86_TRAP_PF_ID) && !PteSrc.n.u1NoExecute)
    1705 #endif
     1700#  endif
    17061701            ||  ((uErr & X86_TRAP_PF_RW) && !PteSrc.n.u1Write)
    17071702            ||  ((uErr & X86_TRAP_PF_US) && !PteSrc.n.u1User)
     
    18421837    LogFlow(("SyncPT: GCPtrPage=%VGv\n", GCPtrPage));
    18431838
    1844 #if PGM_GST_TYPE == PGM_TYPE_32BIT
     1839#if    PGM_GST_TYPE == PGM_TYPE_32BIT \
     1840    || PGM_GST_TYPE == PGM_TYPE_PAE
    18451841
    18461842# if PGM_SHW_TYPE != PGM_TYPE_32BIT && PGM_SHW_TYPE != PGM_TYPE_PAE
     
    18611857    SHWPDE          PdeDst = *pPdeDst;
    18621858
     1859# if PGM_GST_TYPE == PGM_TYPE_32BIT
    18631860    /*
    18641861     * Check for conflicts.
     
    18691866    {
    18701867        Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s));
    1871 # ifndef IN_RING3
     1868#  ifndef IN_RING3
    18721869        Log(("SyncPT: Conflict at %VGv\n", GCPtrPage));
    18731870        STAM_PROFILE_STOP(&pVM->pgm.s.CTXMID(Stat,SyncPT), a);
    18741871        return VERR_ADDRESS_CONFLICT;
    1875 # else
     1872#  else
    18761873        PPGMMAPPING pMapping = pgmGetMapping(pVM, (RTGCPTR)GCPtrPage);
    18771874        Assert(pMapping);
     
    18831880        }
    18841881        PdeDst = *pPdeDst;
    1885 # endif
     1882#  endif
    18861883    }
     1884# else /* PGM_GST_TYPE == PGM_TYPE_32BIT */
     1885    /* PAE and AMD64 modes are hardware accelerated only, so there are no mappings. */
     1886    Assert(!pgmMapAreMappingsEnabled(&pVM->pgm.s));
     1887# endif /* PGM_GST_TYPE == PGM_TYPE_32BIT */
    18871888    Assert(!PdeDst.n.u1Present); /* We're only supposed to call SyncPT on PDE!P and conflicts.*/
    18881889
     
    26032604            &&  (PdeSrc.n.u1User || fRawR0Enabled))
    26042605        {
     2606#  if PGM_GST_TYPE == PGM_TYPE_32BIT
    26052607            /*
    26062608             * Check for conflicts with GC mappings.
     
    26192621                }
    26202622
    2621 #ifdef IN_RING3
     2623#   ifdef IN_RING3
    26222624                int rc = pgmR3SyncPTResolveConflict(pVM, pMapping, pPDSrc, iPD);
    26232625                if (VBOX_FAILURE(rc))
     
    26312633                    pMapping = pMapping->pNextR3;
    26322634                iPdNoMapping = pMapping ? pMapping->GCPtr >> X86_PD_SHIFT : ~0U;
    2633 #else
     2635#   else
    26342636                LogFlow(("SyncCR3: detected conflict -> VINF_PGM_SYNC_CR3\n"));
    26352637                return VINF_PGM_SYNC_CR3;
    2636 #endif
    2637             }
    2638 
     2638#   endif
     2639            }
     2640#  else /* PGM_GST_TYPE == PGM_TYPE_32BIT */
     2641            /* PAE and AMD64 modes are hardware accelerated only, so there are no mappings. */
     2642            Assert(iPD != iPdNoMapping);
     2643#  endif /* PGM_GST_TYPE == PGM_TYPE_32BIT */
    26392644            /*
    26402645             * Sync page directory entry.
     
    27422747        else
    27432748        {
     2749#  if PGM_GST_TYPE == PGM_TYPE_32BIT
    27442750            Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s));
    27452751            const unsigned cPTs = pMapping->cPTs;
     
    27632769                        &&  (pPDSrc->a[iPD + iPT].n.u1User || fRawR0Enabled))
    27642770                    {
    2765 ifdef IN_RING3
     2771 ifdef IN_RING3
    27662772                        int rc = pgmR3SyncPTResolveConflict(pVM, pMapping, pPDSrc, iPD);
    27672773                        if (VBOX_FAILURE(rc))
     
    27762782                        iPdNoMapping = pMapping ? pMapping->GCPtr >> X86_PD_SHIFT : ~0U;
    27772783                        break;
    2778 else
     2784 else
    27792785                        LogFlow(("SyncCR3: detected conflict -> VINF_PGM_SYNC_CR3\n"));
    27802786                        return VINF_PGM_SYNC_CR3;
    2781 endif
     2787 endif
    27822788                    }
    27832789                }
     
    27882794                        iPdNoMapping = pMapping->GCPtr >> X86_PD_SHIFT;
    27892795                }
    2790             }
     2796#  else /* PGM_GST_TYPE == PGM_TYPE_32BIT */
     2797                /* PAE and AMD64 modes are hardware accelerated only, so there are no mappings. */
     2798                AssertFailed();
     2799#  endif /* PGM_GST_TYPE == PGM_TYPE_32BIT */
     2800            }
     2801
    27912802            /* advance. */
    27922803            iPD += cPTs - 1;
  • trunk/src/VBox/VMM/VMMAll/PGMAllGst.h

    r6927 r7629  
    134134   || PGM_GST_TYPE == PGM_TYPE_PAE \
    135135   || PGM_GST_TYPE == PGM_TYPE_AMD64
    136 
     136       
    137137#if PGM_GST_TYPE == PGM_TYPE_AMD64
    138138    /* later */
     
    179179         */
    180180        if (pfFlags)
     181        {
    181182            *pfFlags = (Pte.u & ~GST_PTE_PG_MASK)
    182183                     & ((Pde.u & (X86_PTE_RW | X86_PTE_US)) | ~(uint64_t)(X86_PTE_RW | X86_PTE_US));
     184# if PGM_WITH_NX(PGM_GST_TYPE)
     185            /* The NX bit is determined by a bitwise OR between the PT and PD */
     186            if (Pde.u & X86_PTE_PAE_NX)
     187                *pfFlags |= X86_PTE_PAE_NX;
     188# endif
     189        }
    183190        if (pGCPhys)
    184191            *pGCPhys = Pte.u & GST_PTE_PG_MASK;
     
    791798 || PGM_GST_TYPE == PGM_TYPE_PAE \
    792799 || PGM_GST_TYPE == PGM_TYPE_AMD64
     800
    793801#if PGM_GST_TYPE == PGM_TYPE_AMD64
    794802    AssertFailed();
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r7598 r7629  
    982982                else
    983983                {   /* (normal page) */
    984                     PVBOXPT pPT;
     984                    PX86PT pPT;
    985985                    rc = PGM_GCPHYS_2_PTR(pVM, Pde.u & X86_PDE_PG_MASK, &pPT);
    986986                    if (VBOX_SUCCESS(rc))
    987987                    {
    988                         VBOXPTE Pte = pPT->a[((RTGCUINTPTR)GCPtr >> X86_PT_SHIFT) & X86_PT_MASK];
     988                        X86PTE Pte = pPT->a[((RTGCUINTPTR)GCPtr >> X86_PT_SHIFT) & X86_PT_MASK];
    989989                        if (Pte.n.u1Present)
    990990                            return PGMPhysGCPhys2HCPtr(pVM, (Pte.u & X86_PTE_PG_MASK) | ((RTGCUINTPTR)GCPtr & PAGE_OFFSET_MASK), 1 /* we always stay within one page */, pHCPtr);
  • trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp

    r6854 r7629  
    106106    CHECK_SIZE(VBOXIDTR, 6);
    107107    CHECK_SIZE(VBOXGDTR, 6);
    108     CHECK_SIZE(VBOXPTE, 4);
    109     CHECK_SIZE(VBOXPDE, 4);
    110108    CHECK_SIZE(VBOXTSS, 136);
    111109    CHECK_SIZE(X86FXSTATE, 512);
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