VirtualBox

Changeset 9008

Show
Ignore:
Timestamp:
05/21/08 12:17:41 (8 months ago)
Author:
vboxsync
Message:

Changes for proper flushing of the TLB for physical registration changes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/hwacc_svm.h

    r8948 r9008  
    686686DECLASM(void) SVMInvlpgA(RTGCPTR pPageGC, uint32_t u32ASID); 
    687687 
     688#ifdef IN_RING0 
     689 
     690/** 
     691 * Invalidates a guest page 
     692 * 
     693 * @returns VBox status code. 
     694 * @param   pVM         The VM to operate on. 
     695 * @param   GCVirt      Page to invalidate 
     696 */ 
     697HWACCMR0DECL(int) SVMR0InvalidatePage(PVM pVM, RTGCPTR GCVirt); 
     698 
     699#endif /* IN_RING0 */ 
     700 
    688701/** @} */ 
    689702 
  • trunk/include/VBox/hwaccm.h

    r8853 r9008  
    6666#define HWACCMIsEnabled(a)    (a->fHWACCMEnabled) 
    6767 
     68/** 
     69 * Invalidates a guest page 
     70 * 
     71 * @returns VBox status code. 
     72 * @param   pVM         The VM to operate on. 
     73 * @param   GCVirt      Page to invalidate 
     74 */ 
     75HWACCMDECL(int) HWACCMInvalidatePage(PVM pVM, RTGCPTR GCVirt); 
     76 
     77#ifndef IN_GC 
     78/** 
     79 * Flushes the guest TLB 
     80 * 
     81 * @returns VBox status code. 
     82 * @param   pVM         The VM to operate on. 
     83 */ 
     84HWACCMDECL(int) HWACCMFlushTLB(PVM pVM); 
     85#else 
     86/* Nop in GC */ 
     87#define HWACCMFlushTLB(pVM)     do { } while (0) 
     88#endif 
     89 
    6890#ifdef IN_RING0 
    6991/** @defgroup grp_hwaccm_r0    The VM Hardware Manager API 
  • trunk/src/VBox/VMM/Makefile.kmk

    r8797 r9008  
    102102        VMMAll/CPUMAllRegs.cpp \ 
    103103        VMMAll/DBGFAll.cpp \ 
     104        VMMAll/HWACCMAll.cpp \ 
    104105        VMMAll/IOMAll.cpp \ 
    105106        VMMAll/IOMAllMMIO.cpp \ 
     
    390391        VMMAll/EMAll.cpp \ 
    391392        VMMAll/EMAllA.asm \ 
     393        VMMAll/HWACCMAll.cpp \ 
    392394        VMMAll/IOMAll.cpp \ 
    393395        VMMAll/IOMAllMMIO.cpp \ 
  • trunk/src/VBox/VMM/PGMInternal.h

    r9001 r9008  
    268268# define PGM_INVL_PG(GCVirt)        ASMInvalidatePage((void *)(GCVirt)) 
    269269#elif defined(IN_RING0) 
    270 # define PGM_INVL_PG(GCVirt)        HWACCMR0InvalidatePage(pVM, (RTGCPTR)(GCVirt)) 
     270# define PGM_INVL_PG(GCVirt)        HWACCMInvalidatePage(pVM, (RTGCPTR)(GCVirt)) 
    271271#else 
    272 # define PGM_INVL_PG(GCVirt)        ((void)0
     272# define PGM_INVL_PG(GCVirt)        HWACCMInvalidatePage(pVM, (RTGCPTR)(GCVirt)
    273273#endif 
    274274 
     
    281281# define PGM_INVL_BIG_PG(GCVirt)    ASMReloadCR3() 
    282282#elif defined(IN_RING0) 
    283 # define PGM_INVL_BIG_PG(GCVirt)    HWACCMR0FlushTLB(pVM) 
     283# define PGM_INVL_BIG_PG(GCVirt)    HWACCMFlushTLB(pVM) 
    284284#else 
    285 # define PGM_INVL_BIG_PG(GCVirt)    ((void)0
     285# define PGM_INVL_BIG_PG(GCVirt)    HWACCMFlushTLB(pVM
    286286#endif 
    287287 
     
    292292# define PGM_INVL_GUEST_TLBS()      ASMReloadCR3() 
    293293#elif defined(IN_RING0) 
    294 # define PGM_INVL_GUEST_TLBS()      HWACCMR0FlushTLB(pVM) 
     294# define PGM_INVL_GUEST_TLBS()      HWACCMFlushTLB(pVM) 
    295295#else 
    296 # define PGM_INVL_GUEST_TLBS()      ((void)0
     296# define PGM_INVL_GUEST_TLBS()      HWACCMFlushTLB(pVM
    297297#endif 
    298298 
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r8155 r9008  
    166166        } 
    167167        pVM->pgm.s.fPhysCacheFlushPending = true; 
     168        HWACCMFlushTLB(pVM); 
    168169#ifndef IN_RING3 
    169170        REMNotifyHandlerPhysicalRegister(pVM, enmType, GCPhys, GCPhysLast - GCPhys + 1, !!pfnHandlerR3); 
     
    298299         * Clear the page bits and notify the REM about this change. 
    299300         */ 
     301        HWACCMFlushTLB(pVM); 
    300302        pgmHandlerPhysicalResetRamFlags(pVM, pCur); 
    301303        pgmHandlerPhysicalDeregisterNotifyREM(pVM, pCur); 
     
    540542                                                     pCur->Core.KeyLast - GCPhys + 1, !!pCur->pfnHandlerR3, fRestoreAsRAM); 
    541543#endif 
     544                    HWACCMFlushTLB(pVM); 
    542545                    pgmUnlock(pVM); 
    543546                    Log(("PGMHandlerPhysicalModify: GCPhysCurrent=%VGp -> GCPhys=%VGp GCPhysLast=%VGp\n", 
     
    631634 
    632635/** 
    633  * Splitts a physical access handler in two. 
     636 * Splits a physical access handler in two. 
    634637 * 
    635638 * @returns VBox status code. 
     
    813816                } 
    814817                pVM->pgm.s.fPhysCacheFlushPending = true; 
     818                HWACCMFlushTLB(pVM); 
    815819 
    816820                rc = VINF_SUCCESS; 
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r8958 r9008  
    908908static int pgmPoolCacheFreeOne(PPGMPOOL pPool, uint16_t iUser) 
    909909{ 
    910 #ifdef IN_RING0 
     910#ifndef IN_GC 
    911911    const PVM pVM = pPool->CTXSUFF(pVM); 
    912912#endif 
     
    10351035static int pgmPoolCacheAlloc(PPGMPOOL pPool, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint16_t iUserTable, PPPGMPOOLPAGE ppPage) 
    10361036{ 
    1037 #ifdef IN_RING0 
     1037#ifndef IN_GC 
    10381038    const PVM pVM = pPool->CTXSUFF(pVM); 
    10391039#endif 
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp

    r8879 r9008  
    812812        return SVMR0RunGuestCode(pVM, pCtx, &HWACCMR0Globals.aCpuInfo[idCpu]); 
    813813    } 
    814 } 
    815  
    816 /** 
    817  * Invalidates a guest page 
    818  * 
    819  * @returns VBox status code. 
    820  * @param   pVM         The VM to operate on. 
    821  * @param   GCVirt      Page to invalidate 
    822  */ 
    823 HWACCMR0DECL(int) HWACCMR0InvalidatePage(PVM pVM, RTGCPTR GCVirt) 
    824 { 
    825     if (pVM->hwaccm.s.svm.fSupported) 
    826         return SVMR0InvalidatePage(pVM, GCVirt); 
    827  
    828     return VINF_SUCCESS; 
    829 } 
    830  
    831 /** 
    832  * Flushes the guest TLB 
    833  * 
    834  * @returns VBox status code. 
    835  * @param   pVM         The VM to operate on. 
    836  */ 
    837 HWACCMR0DECL(int) HWACCMR0FlushTLB(PVM pVM) 
    838 { 
    839     if (pVM->hwaccm.s.svm.fSupported) 
    840         return SVMR0FlushTLB(pVM); 
    841  
    842     return VINF_SUCCESS; 
    843814} 
    844815 
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r8965 r9008  
    266266        pVMCB->ctrl.u16InterceptWrCRx = RT_BIT(0) | RT_BIT(3) | RT_BIT(4) | RT_BIT(8); 
    267267    else 
    268         pVMCB->ctrl.u16InterceptWrCRx = RT_BIT(0) | RT_BIT(4) | RT_BIT(8); 
     268        pVMCB->ctrl.u16InterceptWrCRx = RT_BIT(0) | RT_BIT(8); 
    269269 
    270270    /* Intercept all DRx reads and writes. */ 
     
    14141414            break; 
    14151415        case 4: 
     1416            Assert(!pVM->hwaccm.s.svm.fNestedPaging); 
    14161417            pVM->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR4; 
    14171418            break; 
     
    18771878} 
    18781879 
    1879 /** 
    1880  * Flushes the guest TLB 
    1881  * 
    1882  * @returns VBox status code. 
    1883  * @param   pVM         The VM to operate on. 
    1884  */ 
    1885 HWACCMR0DECL(int) SVMR0FlushTLB(PVM pVM) 
    1886 { 
    1887     Log2(("SVMR0FlushTLB\n")); 
    1888     pVM->hwaccm.s.svm.fForceTLBFlush = true; 
    1889     STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushTLBManual); 
    1890     return VINF_SUCCESS; 
    1891 } 
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.h

    r8878 r9008  
    127127HWACCMR0DECL(int) SVMR0LoadGuestState(PVM pVM, CPUMCTX *pCtx); 
    128128 
    129 /** 
    130  * Invalidates a guest page 
    131  * 
    132  * @returns VBox status code. 
    133  * @param   pVM         The VM to operate on. 
    134  * @param   GCVirt      Page to invalidate 
    135  */ 
    136 HWACCMR0DECL(int) SVMR0InvalidatePage(PVM pVM, RTGCPTR GCVirt); 
    137  
    138 /** 
    139  * Flushes the guest TLB 
    140  * 
    141  * @returns VBox status code. 
    142  * @param   pVM         The VM to operate on. 
    143  */ 
    144 HWACCMR0DECL(int) SVMR0FlushTLB(PVM pVM); 
    145  
    146129 
    147130/* Convert hidden selector attribute word between VMX and SVM formats. */ 
  • trunk/src/VBox/VMM/VMMR0/PGMR0.cpp

    r9001 r9008  
    8282 
    8383    /* AMD uses the host's paging mode; Intel's version is on the todo list */ 
    84     Assert(enmShwPagingMode == PGMMODE_32_BIT || enmShwPagingMode == PGMMODE_PAE); // || enmShwPagingMode == PGMMODE_AMD64); 
     84    Assert(enmShwPagingMode == PGMMODE_32_BIT || enmShwPagingMode == PGMMODE_PAE || enmShwPagingMode == PGMMODE_AMD64); 
    8585 
    8686#ifdef VBOX_WITH_STATISTICS 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy