Changeset 72598 in vbox
- Timestamp:
- Jun 18, 2018 1:32:05 PM (7 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/EMHM.cpp
r72488 r72598 150 150 rcStrict = VINF_EM_DBG_STEPPED; 151 151 Log(("EMR3HmSingleInstruction: returns %Rrc (rip %llx -> %llx)\n", VBOXSTRICTRC_VAL(rcStrict), uOldRip, pCtx->rip)); 152 CPUM_IMPORT_EXTRN_RET(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK); 152 153 return rcStrict; 153 154 } … … 176 177 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 177 178 #endif 178 int rc;179 179 NOREF(rcRC); 180 180 … … 196 196 */ 197 197 STAM_PROFILE_START(&pVCpu->em.s.StatIEMEmu, a); 198 rc = VBOXSTRICTRC_TODO(IEMExecOne(pVCpu)); 198 VBOXSTRICTRC rcStrict; 199 uint32_t idxContinueExitRec = pVCpu->em.s.idxContinueExitRec; 200 RT_UNTRUSTED_NONVOLATILE_COPY_FENCE(); 201 if (idxContinueExitRec >= RT_ELEMENTS(pVCpu->em.s.aExitRecords)) 202 { 203 CPUM_IMPORT_EXTRN_RET(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK); 204 rcStrict = VBOXSTRICTRC_TODO(IEMExecOne(pVCpu)); 205 } 206 else 207 { 208 RT_UNTRUSTED_VALIDATED_FENCE(); 209 rcStrict = EMHistoryExec(pVCpu, &pVCpu->em.s.aExitRecords[idxContinueExitRec], 0); 210 LogFlow(("emR3HmExecuteInstruction: %Rrc (EMHistoryExec)\n", VBOXSTRICTRC_VAL(rcStrict))); 211 } 199 212 STAM_PROFILE_STOP(&pVCpu->em.s.StatIEMEmu, a); 200 213 201 if ( rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED202 || rc == VERR_IEM_INSTR_NOT_IMPLEMENTED)214 if ( rcStrict == VERR_IEM_ASPECT_NOT_IMPLEMENTED 215 || rcStrict == VERR_IEM_INSTR_NOT_IMPLEMENTED) 203 216 { 204 217 #ifdef VBOX_WITH_REM … … 210 223 pVM->em.s.idLastRemCpu = pVCpu->idCpu; 211 224 212 rc = REMR3EmulateInstruction(pVM, pVCpu);225 rcStrict = REMR3EmulateInstruction(pVM, pVCpu); 213 226 EMRemUnlock(pVM); 214 227 STAM_PROFILE_STOP(&pVCpu->em.s.StatREMEmu, b); … … 222 235 HMR3NotifyEmulated(pVCpu); 223 236 #endif 224 return rc;237 return VBOXSTRICTRC_TODO(rcStrict); 225 238 } 226 239 … … 260 273 STAM_PROFILE_START(&pVCpu->em.s.StatIOEmu, a); 261 274 262 /* 263 * Try to restart the io instruction that was refused in ring-0. 264 */ 265 VBOXSTRICTRC rcStrict = HMR3RestartPendingIOInstr(pVM, pVCpu, pCtx); 266 if (IOM_SUCCESS(rcStrict)) 267 { 275 VBOXSTRICTRC rcStrict; 276 uint32_t idxContinueExitRec = pVCpu->em.s.idxContinueExitRec; 277 RT_UNTRUSTED_NONVOLATILE_COPY_FENCE(); 278 if (idxContinueExitRec >= RT_ELEMENTS(pVCpu->em.s.aExitRecords)) 279 { 280 /* 281 * Try to restart the io instruction that was refused in ring-0. 282 */ 283 rcStrict = HMR3RestartPendingIOInstr(pVM, pVCpu, pCtx); 284 if (IOM_SUCCESS(rcStrict)) 285 { 286 STAM_COUNTER_INC(&pVCpu->em.s.CTX_SUFF(pStats)->StatIoRestarted); 287 STAM_PROFILE_STOP(&pVCpu->em.s.StatIOEmu, a); 288 return VBOXSTRICTRC_TODO(rcStrict); /* rip already updated. */ 289 } 290 AssertMsgReturn(rcStrict == VERR_NOT_FOUND, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)), 291 RT_SUCCESS_NP(rcStrict) ? VERR_IPE_UNEXPECTED_INFO_STATUS : VBOXSTRICTRC_TODO(rcStrict)); 292 293 /* 294 * Hand it over to the interpreter. 295 */ 296 CPUM_IMPORT_EXTRN_RET(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK); 297 rcStrict = IEMExecOne(pVCpu); 298 LogFlow(("emR3HmExecuteIOInstruction: %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 299 } 300 else 301 { 302 RT_UNTRUSTED_VALIDATED_FENCE(); 303 CPUM_IMPORT_EXTRN_RET(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK); 304 Assert(!HMR3HasPendingIOInstr(pVCpu)); 305 rcStrict = EMHistoryExec(pVCpu, &pVCpu->em.s.aExitRecords[idxContinueExitRec], 0); 306 LogFlow(("emR3HmExecuteIOInstruction: %Rrc (EMHistoryExec)\n", VBOXSTRICTRC_VAL(rcStrict))); 268 307 STAM_COUNTER_INC(&pVCpu->em.s.CTX_SUFF(pStats)->StatIoRestarted); 269 STAM_PROFILE_STOP(&pVCpu->em.s.StatIOEmu, a); 270 return VBOXSTRICTRC_TODO(rcStrict); /* rip already updated. */ 271 } 272 AssertMsgReturn(rcStrict == VERR_NOT_FOUND, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)), 273 RT_SUCCESS_NP(rcStrict) ? VERR_IPE_UNEXPECTED_INFO_STATUS : VBOXSTRICTRC_TODO(rcStrict)); 274 275 /* 276 * Hand it over to the interpreter. 277 */ 278 rcStrict = IEMExecOne(pVCpu); 279 LogFlow(("emR3HmExecuteIOInstruction: %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 308 } 309 280 310 STAM_COUNTER_INC(&pVCpu->em.s.CTX_SUFF(pStats)->StatIoIem); 281 311 STAM_PROFILE_STOP(&pVCpu->em.s.StatIOEmu, a); … … 303 333 if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL)) 304 334 { 335 CPUM_IMPORT_EXTRN_RET(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_CR3 | CPUMCTX_EXTRN_CR4); 305 336 Assert(pVCpu->em.s.enmState != EMSTATE_WAIT_SIPI); 306 337 int rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); … … 314 345 /* Prefetch pages for EIP and ESP. */ 315 346 /** @todo This is rather expensive. Should investigate if it really helps at all. */ 347 /** @todo this should be skipped! */ 348 CPUM_IMPORT_EXTRN_RET(pVCpu, CPUMCTX_EXTRN_CS | CPUMCTX_EXTRN_SS); 316 349 rc = PGMPrefetchPage(pVCpu, SELMToFlat(pVM, DISSELREG_CS, CPUMCTX2CORE(pCtx), pCtx->rip)); 317 350 if (rc == VINF_SUCCESS) -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r72560 r72598 38 38 *********************************************************************************************************************************/ 39 39 #define LOG_GROUP LOG_GROUP_HM 40 #define VMCPU_INCL_CPUM_GST_CTX 40 41 #include <VBox/vmm/cpum.h> 41 42 #include <VBox/vmm/stam.h> … … 3298 3299 3299 3300 /** 3301 * Checks if there is an I/O instruction pending. 3302 * 3303 * @returns true if pending, false if not. 3304 * @param pVCpu The cross context virtual CPU structure. 3305 */ 3306 VMMR3_INT_DECL(bool) HMR3HasPendingIOInstr(PVMCPU pVCpu) 3307 { 3308 return pVCpu->hm.s.PendingIO.enmType != HMPENDINGIO_INVALID 3309 && pVCpu->hm.s.PendingIO.GCPtrRip == pVCpu->cpum.GstCtx.rip; 3310 } 3311 3312 3313 /** 3300 3314 * Restart an I/O instruction that was refused in ring-0 3301 3315 *
Note:
See TracChangeset
for help on using the changeset viewer.