Changeset 8853 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 15, 2008 1:57:31 PM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCMInternal.h
r8806 r8853 211 211 bool fResumeVM; 212 212 /** Set if erratum 170 affects the AMD cpu. */ 213 bool fAlwaysFlushTLB; 214 /** Set if we need to flush the TLB during the world switch. */ 213 215 bool fForceTLBFlush; 214 216 -
trunk/src/VBox/VMM/PGMInternal.h
r8659 r8853 36 36 #include <VBox/log.h> 37 37 #include <VBox/gmm.h> 38 #include <VBox/hwaccm.h> 38 39 #include <iprt/avl.h> 39 40 #include <iprt/assert.h> … … 266 267 #ifdef IN_GC 267 268 # define PGM_INVL_PG(GCVirt) ASMInvalidatePage((void *)(GCVirt)) 269 #elif defined(IN_RING0) 270 # define PGM_INVL_PG(GCVirt) HWACCMR0InvalidatePage(pVM, (RTGCPTR)(GCVirt)) 268 271 #else 269 272 # define PGM_INVL_PG(GCVirt) ((void)0) … … 277 280 #ifdef IN_GC 278 281 # define PGM_INVL_BIG_PG(GCVirt) ASMReloadCR3() 282 #elif defined(IN_RING0) 283 # define PGM_INVL_BIG_PG(GCVirt) HWACCMR0FlushTLB(pVM) 279 284 #else 280 285 # define PGM_INVL_BIG_PG(GCVirt) ((void)0) … … 286 291 #ifdef IN_GC 287 292 # define PGM_INVL_GUEST_TLBS() ASMReloadCR3() 293 #elif defined(IN_RING0) 294 # define PGM_INVL_GUEST_TLBS() HWACCMR0FlushTLB(pVM) 288 295 #else 289 296 # define PGM_INVL_GUEST_TLBS() ((void)0) -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r8454 r8853 908 908 static int pgmPoolCacheFreeOne(PPGMPOOL pPool, uint16_t iUser) 909 909 { 910 #ifdef IN_RING0 911 const PVM pVM = pPool->CTXSUFF(pVM); 912 #endif 910 913 Assert(pPool->iAgeHead != pPool->iAgeTail); /* We shouldn't be here if there < 2 cached entries! */ 911 914 STAM_COUNTER_INC(&pPool->StatCacheFreeUpOne); … … 1032 1035 static int pgmPoolCacheAlloc(PPGMPOOL pPool, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, uint16_t iUser, uint16_t iUserTable, PPPGMPOOLPAGE ppPage) 1033 1036 { 1037 #ifdef IN_RING0 1038 const PVM pVM = pPool->CTXSUFF(pVM); 1039 #endif 1034 1040 /* 1035 1041 * Look up the GCPhys in the hash. -
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r8554 r8853 807 807 return SVMR0RunGuestCode(pVM, pCtx); 808 808 } 809 } 810 811 /** 812 * Invalidates a guest page 813 * 814 * @returns VBox status code. 815 * @param pVM The VM to operate on. 816 * @param GCVirt Page to invalidate 817 */ 818 HWACCMR0DECL(int) HWACCMR0InvalidatePage(PVM pVM, RTGCPTR GCVirt) 819 { 820 if (pVM->hwaccm.s.svm.fSupported) 821 return SVMR0InvalidatePage(pVM, GCVirt); 822 823 return VINF_SUCCESS; 824 } 825 826 /** 827 * Flushes the guest TLB 828 * 829 * @returns VBox status code. 830 * @param pVM The VM to operate on. 831 */ 832 HWACCMR0DECL(int) HWACCMR0FlushTLB(PVM pVM) 833 { 834 if (pVM->hwaccm.s.svm.fSupported) 835 return SVMR0FlushTLB(pVM); 836 837 return VINF_SUCCESS; 809 838 } 810 839 -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r8848 r8853 170 170 { 171 171 Log(("SVMR0InitVM: AMD cpu with erratum 170 family %x model %x stepping %x\n", u32Family, u32Model, u32Stepping)); 172 pVM->hwaccm.s.svm.f ForceTLBFlush= true;172 pVM->hwaccm.s.svm.fAlwaysFlushTLB = true; 173 173 } 174 174 … … 681 681 uint64_t exitCode = (uint64_t)SVM_EXIT_INVALID; 682 682 SVM_VMCB *pVMCB; 683 bool fForceTLBFlush = false;684 683 bool fGuestStateSynced = false; 685 684 unsigned cResume = 0; … … 768 767 STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatInGC, x); 769 768 770 if ( pVM->hwaccm.s.svm.fResumeVM == false 771 || pVM->hwaccm.s.svm.fForceTLBFlush 772 || fForceTLBFlush) 769 if ( pVM->hwaccm.s.svm.fForceTLBFlush 770 || pVM->hwaccm.s.svm.fAlwaysFlushTLB) 773 771 { 774 772 pVMCB->ctrl.TLBCtrl.n.u1TLBFlush = 1; … … 778 776 779 777 /* In case we execute a goto ResumeExecution later on. */ 780 pVM->hwaccm.s.svm.fResumeVM = true;781 fForceTLBFlush = false;778 pVM->hwaccm.s.svm.fResumeVM = true; 779 pVM->hwaccm.s.svm.fForceTLBFlush = false; 782 780 783 781 Assert(sizeof(pVM->hwaccm.s.svm.pVMCBPhys) == 8); … … 1287 1285 1288 1286 /** @note Force a TLB flush. SVM requires us to do it manually. */ 1289 fForceTLBFlush = true;1287 pVM->hwaccm.s.svm.fForceTLBFlush = true; 1290 1288 } 1291 1289 if (rc == VINF_SUCCESS) … … 1599 1597 1600 1598 /* Force a TLB flush on VM entry. */ 1599 pVM->hwaccm.s.svm.fForceTLBFlush = true; 1600 1601 1601 pVM->hwaccm.s.svm.fResumeVM = false; 1602 1602 … … 1654 1654 } 1655 1655 Assert(rc == VERR_REM_FLUSHED_PAGES_OVERFLOW); 1656 return (rc == VERR_REM_FLUSHED_PAGES_OVERFLOW) ? VERR_EM_INTERPRETER :rc;1656 return rc; 1657 1657 } 1658 1658 … … 1703 1703 } 1704 1704 1705 1706 /** 1707 * Invalidates a guest page 1708 * 1709 * @returns VBox status code. 1710 * @param pVM The VM to operate on. 1711 * @param GCVirt Page to invalidate 1712 */ 1713 HWACCMR0DECL(int) SVMR0InvalidatePage(PVM pVM, RTGCPTR GCVirt) 1714 { 1715 SVM_VMCB *pVMCB; 1716 1717 Log2(("SVMR0InvalidatePage %VGv\n", GCVirt)); 1718 AssertReturn(pVM, VERR_INVALID_PARAMETER); 1719 Assert(pVM->hwaccm.s.svm.fSupported); 1720 1721 pVMCB = (SVM_VMCB *)pVM->hwaccm.s.svm.pVMCB; 1722 AssertMsgReturn(pVMCB, ("Invalid pVMCB\n"), VERR_EM_INTERNAL_ERROR); 1723 1724 SVMInvlpgA(GCVirt, pVMCB->ctrl.TLBCtrl.n.u32ASID); 1725 return VINF_SUCCESS; 1726 } 1727 1728 /** 1729 * Flushes the guest TLB 1730 * 1731 * @returns VBox status code. 1732 * @param pVM The VM to operate on. 1733 */ 1734 HWACCMR0DECL(int) SVMR0FlushTLB(PVM pVM) 1735 { 1736 Log2(("SVMR0FlushTLB\n")); 1737 pVM->hwaccm.s.svm.fForceTLBFlush = true; 1738 1739 return VINF_SUCCESS; 1740 } -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.h
r8155 r8853 125 125 HWACCMR0DECL(int) SVMR0LoadGuestState(PVM pVM, CPUMCTX *pCtx); 126 126 127 /** 128 * Invalidates a guest page 129 * 130 * @returns VBox status code. 131 * @param pVM The VM to operate on. 132 * @param GCVirt Page to invalidate 133 */ 134 HWACCMR0DECL(int) SVMR0InvalidatePage(PVM pVM, RTGCPTR GCVirt); 135 136 /** 137 * Flushes the guest TLB 138 * 139 * @returns VBox status code. 140 * @param pVM The VM to operate on. 141 */ 142 HWACCMR0DECL(int) SVMR0FlushTLB(PVM pVM); 143 127 144 128 145 /* Convert hidden selector attribute word between VMX and SVM formats. */
Note:
See TracChangeset
for help on using the changeset viewer.