Changeset 8985 in vbox for trunk/src/VBox
- Timestamp:
- May 20, 2008 9:03:33 PM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/EM.cpp
r8851 r8985 2056 2056 EMR3CheckRawForcedActions(pVM); 2057 2057 2058 rc = TRPMForwardTrap(pVM, CPUMCTX2CORE(pCtx), u8Interrupt, uErrorCode, enmError, TRPM_TRAP );2058 rc = TRPMForwardTrap(pVM, CPUMCTX2CORE(pCtx), u8Interrupt, uErrorCode, enmError, TRPM_TRAP, -1); 2059 2059 if (rc == VINF_SUCCESS /* Don't use VBOX_SUCCESS */) 2060 2060 { -
trunk/src/VBox/VMM/TRPM.cpp
r8155 r8985 1385 1385 1386 1386 /* There's a handler -> let's execute it in raw mode */ 1387 rc = TRPMForwardTrap(pVM, CPUMCTX2CORE(pCtx), u8Interrupt, 0, TRPM_TRAP_NO_ERRORCODE, enmEvent );1387 rc = TRPMForwardTrap(pVM, CPUMCTX2CORE(pCtx), u8Interrupt, 0, TRPM_TRAP_NO_ERRORCODE, enmEvent, -1); 1388 1388 if (rc == VINF_SUCCESS /* Don't use VBOX_SUCCESS */) 1389 1389 { -
trunk/src/VBox/VMM/VMMAll/TRPMAll.cpp
r8818 r8985 1 #define VBOX_WITH_STATISTICS 1 2 /* $Id$ */ 2 3 /** @file … … 30 31 #include <VBox/patm.h> 31 32 #include <VBox/selm.h> 33 #include <VBox/stam.h> 32 34 #include "TRPMInternal.h" 33 35 #include <VBox/vm.h> … … 356 358 * @param enmError TRPM_TRAP_HAS_ERRORCODE or TRPM_TRAP_NO_ERRORCODE. 357 359 * @param enmType TRPM event type 360 * @param iOrgTrap The original trap. 358 361 * @internal 359 362 */ 360 TRPMDECL(int) TRPMForwardTrap(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t iGate, uint32_t opsize, TRPMERRORCODE enmError, TRPMEVENT enmType )363 TRPMDECL(int) TRPMForwardTrap(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t iGate, uint32_t opsize, TRPMERRORCODE enmError, TRPMEVENT enmType, int32_t iOrgTrap) 361 364 { 362 365 #ifdef TRPM_FORWARD_TRAPS_IN_GC … … 414 417 * Well, only if the IF flag is set. 415 418 */ 416 /* 417 * @todo if the trap handler was modified and marked invalid, then we should *now* go back to the host context and install a new patch. 418 * 419 */ 419 /** @todo if the trap handler was modified and marked invalid, then we should *now* go back to the host context and install a new patch. */ 420 420 if ( pVM->trpm.s.aGuestTrapHandler[iGate] 421 421 && (eflags.Bits.u1IF) 422 422 #ifndef VBOX_RAW_V86 423 && !(eflags.Bits.u1VM) /* @todo implement when needed (illegal for same privilege level transfers). */423 && !(eflags.Bits.u1VM) /** @todo implement when needed (illegal for same privilege level transfers). */ 424 424 #endif 425 425 && !PATMIsPatchGCAddr(pVM, (RTGCPTR)pRegFrame->eip) … … 456 456 if (VBOX_FAILURE(rc)) 457 457 { 458 /* The page might be out of sync. (@todo might cross a page boundary) */458 /* The page might be out of sync. */ /** @todo might cross a page boundary) */ 459 459 Log(("Page %VGv out of sync -> prefetch and try again\n", pIDTEntry)); 460 460 rc = PGMPrefetchPage(pVM, pIDTEntry); /** @todo r=bird: rainy day: this isn't entirely safe because of access bit virtualiziation and CSAM. */ … … 516 516 if (VBOX_FAILURE(rc)) 517 517 { 518 /* The page might be out of sync. (@todo might cross a page boundary) */518 /* The page might be out of sync. */ /** @todo might cross a page boundary) */ 519 519 Log(("Page %VGv out of sync -> prefetch and try again\n", pGdtEntry)); 520 520 rc = PGMPrefetchPage(pVM, pGdtEntry); /** @todo r=bird: rainy day: this isn't entirely safe because of access bit virtualiziation and CSAM. */ … … 662 662 Log4(("Stack %VGv pos %02d: %08x\n", &pTrapStack[j], j, pTrapStack[j])); 663 663 664 const char *pszPrefix = "";665 const char *szEFlags = "";666 667 664 Log4(("eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n" 668 665 "eip=%08x esp=%08x ebp=%08x iopl=%d\n" … … 695 692 STAM_COUNTER_INC(&pVM->trpm.s.CTXALLSUFF(paStatForwardedIRQ)[iGate]); 696 693 STAM_PROFILE_ADV_STOP(CTXSUFF(&pVM->trpm.s.StatForwardProf), a); 694 if (iOrgTrap >= 0 && iOrgTrap < (int)RT_ELEMENTS(pVM->trpm.s.aStatGCTraps)) 695 STAM_PROFILE_ADV_STOP(&pVM->trpm.s.aStatGCTraps[iOrgTrap], o); 697 696 698 697 CPUMGCCallGuestTrapHandler(pRegFrame, GuestIdte.Gen.u16SegSel | 1, pVM->trpm.s.aGuestTrapHandler[iGate], eflags.u32, ss_r0, (RTGCPTR)esp_r0); -
trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp
r8831 r8985 48 48 #include <iprt/assert.h> 49 49 50 /******************************************************************************* 51 * Defined Constants And Macros * 52 *******************************************************************************/ 50 53 /* still here. MODR/M byte parsing */ 51 54 #define X86_OPCODE_MODRM_MOD_MASK 0xc0 … … 53 56 #define X86_OPCODE_MODRM_RM_MASK 0x07 54 57 58 /** @todo fix/remove/permanent-enable this when DIS/PATM handles invalid lock sequences. */ 59 #define DTRACE_EXPERIMENT 60 61 62 /******************************************************************************* 63 * Structures and Typedefs * 64 *******************************************************************************/ 55 65 /** Pointer to a readonly hypervisor trap record. */ 56 66 typedef const struct TRPMGCHYPER *PCTRPMGCHYPER; … … 193 203 Log(("trpmGCExitTrap: u8Interrupt=%d (%#x) rc=%Vrc\n", u8Interrupt, u8Interrupt, rc)); 194 204 AssertFatalMsgRC(rc, ("PDMGetInterrupt failed with %Vrc\n", rc)); 195 rc = TRPMForwardTrap(pVM, pRegFrame, (uint32_t)u8Interrupt, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_HARDWARE_INT );205 rc = TRPMForwardTrap(pVM, pRegFrame, (uint32_t)u8Interrupt, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_HARDWARE_INT, uOldActiveVector); 196 206 /* can't return if successful */ 197 207 Assert(rc != VINF_SUCCESS); … … 362 372 return trpmGCExitTrap(pVM, VINF_EM_RAW_EMULATE_INSTR, pRegFrame); 363 373 364 if ( PATMIsPatchGCAddr(pVM, (RTGCPTR)pRegFrame->eip) 365 && Cpu.pCurInstr->opcode == OP_ILLUD2) 374 /* 375 * UD2 in a patch? 376 */ 377 if ( Cpu.pCurInstr->opcode == OP_ILLUD2 378 && PATMIsPatchGCAddr(pVM, (RTGCPTR)pRegFrame->eip)) 366 379 { 367 380 rc = PATMGCHandleIllegalInstrTrap(pVM, pRegFrame); 368 if (rc == VINF_SUCCESS || rc == VINF_EM_RAW_EMULATE_INSTR || rc == VINF_PATM_DUPLICATE_FUNCTION || rc == VINF_PATM_PENDING_IRQ_AFTER_IRET || rc == VINF_EM_RESCHEDULE) 381 if ( rc == VINF_SUCCESS 382 || rc == VINF_EM_RAW_EMULATE_INSTR 383 || rc == VINF_PATM_DUPLICATE_FUNCTION 384 || rc == VINF_PATM_PENDING_IRQ_AFTER_IRET 385 || rc == VINF_EM_RESCHEDULE) 369 386 return trpmGCExitTrap(pVM, rc, pRegFrame); 370 387 } 371 /* Note: monitor causes an #UD exception instead of #GP when not executed in ring 0. */ 388 /* 389 * Speed up dtrace and don't entrust invalid lock sequences to the recompiler. 390 */ 391 else if (Cpu.prefix & PREFIX_LOCK) 392 { 393 Log(("TRPMGCTrap06Handler: pc=%RGv op=%d\n", pRegFrame->eip, Cpu.pCurInstr->opcode)); 394 #ifdef DTRACE_EXPERIMENT /** @todo fix/remove/permanent-enable this when DIS/PATM handles invalid lock sequences. */ 395 Assert(!PATMIsPatchGCAddr(pVM, (RTGCPTR)pRegFrame->eip)); 396 rc = TRPMForwardTrap(pVM, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP, 0x6); 397 Assert(rc == VINF_EM_RAW_GUEST_TRAP); 398 #else 399 rc = VINF_EM_RAW_EMULATE_INSTR; 400 #endif 401 } 402 /* 403 * Handle MONITOR - it causes an #UD exception instead of #GP when not executed in ring 0. 404 */ 372 405 else if (Cpu.pCurInstr->opcode == OP_MONITOR) 373 406 { … … 377 410 pRegFrame->eip += Cpu.opsize; 378 411 } 379 /* Speed up dtrace and don't entrust invalid lock sequences to the recompiler. */380 else if (Cpu.prefix & PREFIX_LOCK)381 {382 Log(("TRPMGCTrap06Handler: pc=%RGv op=%d\n", pRegFrame->eip, Cpu.pCurInstr->opcode));383 /** @todo Clear this with PATM - it gets upset when returning VINF_EM_RAW_GUEST_TRAP on a patch address. */384 #ifdef DTRACE_EXPERIMENT385 rc = TRPMForwardTrap(pVM, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP);386 Assert(rc == VINF_EM_RAW_GUEST_TRAP);387 #else388 rc = VINF_EM_RAW_EMULATE_INSTR;389 #endif390 }391 412 /* Never generate a raw trap here; it might be an instruction, that requires emulation. */ 392 413 else … … 395 416 else 396 417 { 397 rc = TRPMForwardTrap(pVM, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP );418 rc = TRPMForwardTrap(pVM, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP, 0x6); 398 419 Assert(rc == VINF_EM_RAW_GUEST_TRAP); 399 420 } … … 560 581 } 561 582 } 562 rc = TRPMForwardTrap(pVM, pRegFrame, (uint32_t)pCpu->param1.parval, pCpu->opsize, TRPM_TRAP_NO_ERRORCODE, TRPM_SOFTWARE_INT );583 rc = TRPMForwardTrap(pVM, pRegFrame, (uint32_t)pCpu->param1.parval, pCpu->opsize, TRPM_TRAP_NO_ERRORCODE, TRPM_SOFTWARE_INT, 0xd); 563 584 if (VBOX_SUCCESS(rc) && rc != VINF_EM_RAW_GUEST_TRAP) 564 585 return trpmGCExitTrap(pVM, VINF_SUCCESS, pRegFrame); … … 651 672 { 652 673 Assert(pCpu->param1.flags & USE_IMMEDIATE8); 653 rc = TRPMForwardTrap(pVM, pRegFrame, (uint32_t)pCpu->param1.parval, pCpu->opsize, TRPM_TRAP_NO_ERRORCODE, TRPM_SOFTWARE_INT );674 rc = TRPMForwardTrap(pVM, pRegFrame, (uint32_t)pCpu->param1.parval, pCpu->opsize, TRPM_TRAP_NO_ERRORCODE, TRPM_SOFTWARE_INT, 0xd); 654 675 if (VBOX_SUCCESS(rc) && rc != VINF_EM_RAW_GUEST_TRAP) 655 676 return trpmGCExitTrap(pVM, VINF_SUCCESS, pRegFrame); … … 834 855 Assert(eflags.Bits.u2IOPL == 0); 835 856 836 int rc = TRPMForwardTrap(pVM, pRegFrame, 0xD, 0, TRPM_TRAP_HAS_ERRORCODE, TRPM_TRAP );857 int rc = TRPMForwardTrap(pVM, pRegFrame, 0xD, 0, TRPM_TRAP_HAS_ERRORCODE, TRPM_TRAP, 0xd); 837 858 Assert(rc == VINF_EM_RAW_GUEST_TRAP); 838 859 return trpmGCExitTrap(pVM, rc, pRegFrame); … … 932 953 return VINF_PATM_PATCH_TRAP_PF; 933 954 934 rc = TRPMForwardTrap(pVM, pRegFrame, 0xE, 0, TRPM_TRAP_HAS_ERRORCODE, TRPM_TRAP );955 rc = TRPMForwardTrap(pVM, pRegFrame, 0xE, 0, TRPM_TRAP_HAS_ERRORCODE, TRPM_TRAP, 0xe); 935 956 Assert(rc == VINF_EM_RAW_GUEST_TRAP); 936 957 break;
Note:
See TracChangeset
for help on using the changeset viewer.