Changeset 47820 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 16, 2013 7:47:36 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 88081
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/EMRaw.cpp
r47788 r47820 274 274 int rc; 275 275 276 /*277 *278 * The simple solution is to use the recompiler.279 * The better solution is to disassemble the current instruction and280 * try handle as many as possible without using REM.281 *282 */283 284 276 #ifdef LOG_ENABLED 285 277 /* … … 303 295 Log(("emR3RawExecuteInstruction: In patch block. eip=%RRv\n", (RTRCPTR)pCtx->eip)); 304 296 305 RTGCPTR pNewEip;306 rc = PATMR3HandleTrap(pVM, pCtx, pCtx->eip, & pNewEip);297 RTGCPTR uNewEip; 298 rc = PATMR3HandleTrap(pVM, pCtx, pCtx->eip, &uNewEip); 307 299 switch (rc) 308 300 { … … 313 305 case VINF_SUCCESS: 314 306 Log(("emR3RawExecuteInstruction: Executing instruction starting at new address %RGv IF=%d VMIF=%x\n", 315 pNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags));316 pCtx->eip = pNewEip;307 uNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags)); 308 pCtx->eip = uNewEip; 317 309 Assert(pCtx->eip); 318 310 … … 337 329 case VINF_PATCH_EMULATE_INSTR: 338 330 Log(("emR3RawExecuteInstruction: Emulate patched instruction at %RGv IF=%d VMIF=%x\n", 339 pNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags));340 pCtx->eip = pNewEip;331 uNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags)); 332 pCtx->eip = uNewEip; 341 333 return emR3RawExecuteInstruction(pVM, pVCpu, "PATCHIR"); 342 334 … … 346 338 case VERR_PATCH_DISABLED: 347 339 Log(("emR3RawExecuteInstruction: Disabled patch -> new eip %RGv IF=%d VMIF=%x\n", 348 pNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags));349 pCtx->eip = pNewEip;340 uNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags)); 341 pCtx->eip = uNewEip; 350 342 if (pCtx->eflags.Bits.u1IF) 351 343 { … … 368 360 } 369 361 370 STAM_PROFILE_START(&pVCpu->em.s.StatREMEmu, a); 362 363 /* 364 * Use IEM and fallback on REM if the functionality is missing. 365 * Once IEM gets mature enough, nothing should ever fall back. 366 */ 367 #if 0/*defined(VBOX_WITH_FIRST_IEM_STEP)*/ || !defined(VBOX_WITH_REM) 371 368 Log(("EMINS: %04x:%RGv RSP=%RGv\n", pCtx->cs.Sel, (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp)); 369 STAM_PROFILE_START(&pVCpu->em.s.StatIEMEmu, a); 370 rc = VBOXSTRICTRC_TODO(IEMExecOne(pVCpu)); 371 STAM_PROFILE_STOP(&pVCpu->em.s.StatIEMEmu, a); 372 if (rc == VINF_SUCCESS) 373 rc = VINF_EM_RESCHEDULE; 374 else if ( rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED 375 || rc == VERR_IEM_INSTR_NOT_IMPLEMENTED) 376 #endif 377 { 372 378 #ifdef VBOX_WITH_REM 373 EMRemLock(pVM); 374 /* Flush the recompiler TLB if the VCPU has changed. */ 375 if (pVM->em.s.idLastRemCpu != pVCpu->idCpu) 376 CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_ALL); 377 pVM->em.s.idLastRemCpu = pVCpu->idCpu; 378 379 rc = REMR3EmulateInstruction(pVM, pVCpu); 380 EMRemUnlock(pVM); 381 #else 382 rc = VBOXSTRICTRC_TODO(IEMExecOne(pVCpu)); 383 #endif 384 STAM_PROFILE_STOP(&pVCpu->em.s.StatREMEmu, a); 385 379 STAM_PROFILE_START(&pVCpu->em.s.StatREMEmu, b); 380 # if 1 //ndef VBOX_WITH_FIRST_IEM_STEP 381 Log(("EMINS[rem]: %04x:%RGv RSP=%RGv\n", pCtx->cs.Sel, (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp)); 382 //# elif defined(DEBUG_bird) 383 // AssertFailed(); 384 # endif 385 EMRemLock(pVM); 386 /* Flush the recompiler TLB if the VCPU has changed. */ 387 if (pVM->em.s.idLastRemCpu != pVCpu->idCpu) 388 CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_ALL); 389 pVM->em.s.idLastRemCpu = pVCpu->idCpu; 390 391 rc = REMR3EmulateInstruction(pVM, pVCpu); 392 EMRemUnlock(pVM); 393 STAM_PROFILE_STOP(&pVCpu->em.s.StatREMEmu, b); 394 #else /* !VBOX_WITH_REM */ 395 NOREF(pVM); 396 #endif /* !VBOX_WITH_REM */ 397 } 386 398 return rc; 387 399 } … … 833 845 pCtx->eip, u8TrapNo, uErrorCode, uCR2, (uint32_t)pCtx->cr0)); 834 846 835 RTGCPTR pNewEip;836 rc = PATMR3HandleTrap(pVM, pCtx, pCtx->eip, & pNewEip);847 RTGCPTR uNewEip; 848 rc = PATMR3HandleTrap(pVM, pCtx, pCtx->eip, &uNewEip); 837 849 switch (rc) 838 850 { … … 843 855 { 844 856 /** @todo execute a whole block */ 845 Log(("emR3RawPatchTrap: Executing faulting instruction at new address %RGv\n", pNewEip));857 Log(("emR3RawPatchTrap: Executing faulting instruction at new address %RGv\n", uNewEip)); 846 858 if (!(pVCpu->em.s.pPatmGCState->uVMFlags & X86_EFL_IF)) 847 859 Log(("emR3RawPatchTrap: Virtual IF flag disabled!!\n")); 848 860 849 pCtx->eip = pNewEip;861 pCtx->eip = uNewEip; 850 862 AssertRelease(pCtx->eip); 851 863 … … 878 890 case VINF_PATCH_EMULATE_INSTR: 879 891 Log(("emR3RawPatchTrap: Emulate patched instruction at %RGv IF=%d VMIF=%x\n", 880 pNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags));881 pCtx->eip = pNewEip;892 uNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags)); 893 pCtx->eip = uNewEip; 882 894 AssertRelease(pCtx->eip); 883 895 return emR3RawExecuteInstruction(pVM, pVCpu, "PATCHEMUL: "); … … 889 901 if (!(pVCpu->em.s.pPatmGCState->uVMFlags & X86_EFL_IF)) 890 902 Log(("emR3RawPatchTrap: Virtual IF flag disabled!!\n")); 891 pCtx->eip = pNewEip;903 pCtx->eip = uNewEip; 892 904 AssertRelease(pCtx->eip); 893 905
Note:
See TracChangeset
for help on using the changeset viewer.