Changeset 73327 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jul 23, 2018 2:25:42 PM (7 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/NEMAllNativeTemplate-win.cpp.h
r73323 r73327 849 849 /* Control registers. */ 850 850 bool fMaybeChangedMode = false; 851 bool fFlushTlb = false; 852 bool fFlushGlobalTlb = false; 851 bool fUpdateCr3 = false; 853 852 if (fWhat & CPUMCTX_EXTRN_CR_MASK) 854 853 { … … 860 859 CPUMSetGuestCR0(pVCpu, aValues[iReg].Reg64); 861 860 fMaybeChangedMode = true; 862 fFlushTlb = fFlushGlobalTlb = true; /// @todo fix this863 861 } 864 862 iReg++; … … 871 869 { 872 870 CPUMSetGuestCR3(pVCpu, aValues[iReg].Reg64); 873 f FlushTlb= true;871 fUpdateCr3 = true; 874 872 } 875 873 iReg++; … … 881 879 CPUMSetGuestCR4(pVCpu, aValues[iReg].Reg64); 882 880 fMaybeChangedMode = true; 883 fFlushTlb = fFlushGlobalTlb = true; /// @todo fix this884 881 } 885 882 iReg++; … … 1099 1096 1100 1097 /* Typical. */ 1101 if (!fMaybeChangedMode && !f FlushTlb)1098 if (!fMaybeChangedMode && !fUpdateCr3) 1102 1099 return VINF_SUCCESS; 1103 1100 … … 1108 1105 { 1109 1106 int rc = PGMChangeMode(pVCpu, pVCpu->cpum.GstCtx.cr0, pVCpu->cpum.GstCtx.cr4, pVCpu->cpum.GstCtx.msrEFER); 1110 AssertMsg (rc == VINF_SUCCESS, ("rc=%Rrc\n", rc)); NOREF(rc);1111 } 1112 1113 if (f FlushTlb)1114 { 1115 int rc = PGM FlushTLB(pVCpu, pVCpu->cpum.GstCtx.cr3, fFlushGlobalTlb);1116 AssertMsg (rc == VINF_SUCCESS, ("rc=%Rrc\n", rc)); NOREF(rc);1107 AssertMsgReturn(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc), RT_FAILURE_NP(rc) ? rc : VERR_NEM_IPE_1); 1108 } 1109 1110 if (fUpdateCr3) 1111 { 1112 int rc = PGMUpdateCR3(pVCpu, pVCpu->cpum.GstCtx.cr3); 1113 AssertMsgReturn(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc), RT_FAILURE_NP(rc) ? rc : VERR_NEM_IPE_2); 1117 1114 } 1118 1115 … … 1144 1141 AssertReturn(idCpu < pGVM->cCpus, VERR_INVALID_VMCPU_HANDLE); 1145 1142 1146 return nemR0WinImportState(pGVM, &pGVM->aCpus[idCpu], &pVCpu->cpum.GstCtx, fWhat );1143 return nemR0WinImportState(pGVM, &pGVM->aCpus[idCpu], &pVCpu->cpum.GstCtx, fWhat, true /*fCanUpdateCr3*/); 1147 1144 # else 1148 1145 RT_NOREF(pVCpu, fWhat); … … 1849 1846 DECLINLINE(VBOXSTRICTRC) nemR0WinImportStateStrict(PGVM pGVM, PGVMCPU pGVCpu, PVMCPU pVCpu, uint64_t fWhat, const char *pszCaller) 1850 1847 { 1851 int rc = nemR0WinImportState(pGVM, pGVCpu, &pVCpu->cpum.GstCtx, fWhat );1848 int rc = nemR0WinImportState(pGVM, pGVCpu, &pVCpu->cpum.GstCtx, fWhat, true /*fCanUpdateCr3*/); 1852 1849 if (RT_SUCCESS(rc)) 1853 1850 { … … 4363 4360 { 4364 4361 # ifdef IN_RING0 4365 int rc2 = nemR0WinImportState(pGVM, pGVCpu, &pVCpu->cpum.GstCtx, fImport | CPUMCTX_EXTRN_NEM_WIN_EVENT_INJECT); 4362 int rc2 = nemR0WinImportState(pGVM, pGVCpu, &pVCpu->cpum.GstCtx, fImport | CPUMCTX_EXTRN_NEM_WIN_EVENT_INJECT, 4363 true /*fCanUpdateCr3*/); 4366 4364 if (RT_SUCCESS(rc2)) 4367 4365 pVCpu->cpum.GstCtx.fExtrn &= ~fImport; -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r73324 r73327 1442 1442 VMMDECL(int) PGMShwMakePageWritable(PVMCPU pVCpu, RTGCPTR GCPtr, uint32_t fOpFlags) 1443 1443 { 1444 return pdmShwModifyPage(pVCpu, GCPtr, X86_PTE_RW, ~(uint64_t)0, fOpFlags); 1444 if (pVCpu->pgm.s.enmShadowMode != PGMMODE_NONE) /* avoid assertions */ 1445 return pdmShwModifyPage(pVCpu, GCPtr, X86_PTE_RW, ~(uint64_t)0, fOpFlags); 1446 return VINF_SUCCESS; 1445 1447 } 1446 1448 -
trunk/src/VBox/VMM/VMMR0/NEMR0Native-win.cpp
r73323 r73327 85 85 #if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) 86 86 NEM_TMPL_STATIC int nemR0WinExportState(PGVM pGVM, PGVMCPU pGVCpu, PCPUMCTX pCtx); 87 NEM_TMPL_STATIC int nemR0WinImportState(PGVM pGVM, PGVMCPU pGVCpu, PCPUMCTX pCtx, uint64_t fWhat );87 NEM_TMPL_STATIC int nemR0WinImportState(PGVM pGVM, PGVMCPU pGVCpu, PCPUMCTX pCtx, uint64_t fWhat, bool fCanUpdateCr3); 88 88 NEM_TMPL_STATIC int nemR0WinQueryCpuTick(PGVM pGVM, PGVMCPU pGVCpu, uint64_t *pcTicks, uint32_t *pcAux); 89 89 NEM_TMPL_STATIC int nemR0WinResumeCpuTickOnAll(PGVM pGVM, PGVMCPU pGVCpu, uint64_t uPausedTscValue); … … 1316 1316 * 1317 1317 * @returns VBox status code. 1318 * @param pGVM The ring-0 VM handle. 1319 * @param pGVCpu The ring-0 VCPU handle. 1320 * @param pCtx The CPU context structure to import into. 1321 * @param fWhat What to import, CPUMCTX_EXTRN_XXX. 1318 * @param pGVM The ring-0 VM handle. 1319 * @param pGVCpu The ring-0 VCPU handle. 1320 * @param pCtx The CPU context structure to import into. 1321 * @param fWhat What to import, CPUMCTX_EXTRN_XXX. 1322 * @param fCanUpdateCr3 Whether it's safe to update CR3 or not. 1322 1323 */ 1323 NEM_TMPL_STATIC int nemR0WinImportState(PGVM pGVM, PGVMCPU pGVCpu, PCPUMCTX pCtx, uint64_t fWhat )1324 NEM_TMPL_STATIC int nemR0WinImportState(PGVM pGVM, PGVMCPU pGVCpu, PCPUMCTX pCtx, uint64_t fWhat, bool fCanUpdateCr3) 1324 1325 { 1325 1326 HV_INPUT_GET_VP_REGISTERS *pInput = (HV_INPUT_GET_VP_REGISTERS *)pGVCpu->nem.s.HypercallData.pbPage; … … 1719 1720 /* Control registers. */ 1720 1721 bool fMaybeChangedMode = false; 1721 bool fFlushTlb = false; 1722 bool fFlushGlobalTlb = false; 1722 bool fUpdateCr3 = false; 1723 1723 if (fWhat & CPUMCTX_EXTRN_CR_MASK) 1724 1724 { … … 1730 1730 CPUMSetGuestCR0(pVCpu, paValues[iReg].Reg64); 1731 1731 fMaybeChangedMode = true; 1732 fFlushTlb = fFlushGlobalTlb = true; /// @todo fix this1733 1732 } 1734 1733 iReg++; … … 1746 1745 { 1747 1746 CPUMSetGuestCR3(pVCpu, paValues[iReg].Reg64); 1748 f FlushTlb= true;1747 fUpdateCr3 = true; 1749 1748 } 1750 1749 iReg++; … … 1757 1756 CPUMSetGuestCR4(pVCpu, paValues[iReg].Reg64); 1758 1757 fMaybeChangedMode = true; 1759 fFlushTlb = fFlushGlobalTlb = true; /// @todo fix this1760 1758 } 1761 1759 iReg++; … … 2161 2159 2162 2160 /* Typical. */ 2163 if (!fMaybeChangedMode && !f FlushTlb)2161 if (!fMaybeChangedMode && !fUpdateCr3) 2164 2162 return VINF_SUCCESS; 2165 2163 … … 2171 2169 { 2172 2170 rc = PGMChangeMode(pVCpu, pCtx->cr0, pCtx->cr4, pCtx->msrEFER); 2173 AssertMsg(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc)); 2174 } 2175 2176 if (fFlushTlb) 2177 { 2178 LogFlow(("nemR0WinImportState: -> VERR_NEM_FLUSH_TLB!\n")); 2179 /** @todo eliminate the VERR_NEM_FLUSH_TLB/VINF_NEM_FLUSH_TLB complication */ 2180 rc = VERR_NEM_FLUSH_TLB; /* Calling PGMFlushTLB w/o long jump setup doesn't work, ring-3 does it. */ 2171 AssertMsgReturn(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc), RT_FAILURE_NP(rc) ? rc : VERR_NEM_IPE_1); 2172 } 2173 2174 if (fUpdateCr3) 2175 { 2176 if (fCanUpdateCr3) 2177 { 2178 LogFlow(("nemR0WinImportState: -> PGMUpdateCR3!\n")); 2179 rc = PGMUpdateCR3(pVCpu, pCtx->cr3); 2180 AssertMsgReturn(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc), RT_FAILURE_NP(rc) ? rc : VERR_NEM_IPE_2); 2181 } 2182 else 2183 { 2184 LogFlow(("nemR0WinImportState: -> VERR_NEM_FLUSH_TLB!\n")); 2185 rc = VERR_NEM_FLUSH_TLB; /* Calling PGMFlushTLB w/o long jump setup doesn't work, ring-3 does it. */ 2186 } 2181 2187 } 2182 2188 … … 2213 2219 * Call worker. 2214 2220 */ 2215 rc = nemR0WinImportState(pGVM, pGVCpu, &pVCpu->cpum.GstCtx, fWhat );2221 rc = nemR0WinImportState(pGVM, pGVCpu, &pVCpu->cpum.GstCtx, fWhat, false /*fCanUpdateCr3*/); 2216 2222 } 2217 2223 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.