- Timestamp:
- Oct 21, 2007 2:19:37 AM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/TRPM.cpp
r5394 r5395 519 519 520 520 STAM_REG(pVM, &pVM->trpm.s.StatTrap0dDisasm, STAMTYPE_PROFILE_ADV, "/TRPM/Trap0d/Prof/Disasm", STAMUNIT_TICKS_PER_CALL, "Profiling trpmGCTrap0dHandler."); 521 STAM_REG(pVM, &pVM->trpm.s.StatTrap0dRing0RdTsc, STAMTYPE_COUNTER, "/TRPM/Trap0d/RdTsc-R0", STAMUNIT_OCCURENCES, "Number of RDTSC #GPs from guest ring-0."); 522 STAM_REG(pVM, &pVM->trpm.s.StatTrap0dRing3RdTsc, STAMTYPE_COUNTER, "/TRPM/Trap0d/RdTsc-R3", STAMUNIT_OCCURENCES, "Number of RDTSC #GPs from guest ring-3."); 521 523 522 524 /* -
trunk/src/VBox/VMM/TRPMInternal.h
r5394 r5395 175 175 STAMPROFILEADV StatForwardProfHC; 176 176 STAMPROFILEADV StatTrap0dDisasm; 177 STAMCOUNTER StatTrap0dRing0RdTsc; /**< Number of RDTSC #GPs from guest ring-0. */ 178 STAMCOUNTER StatTrap0dRing3RdTsc; /**< Number of RDTSC #GPs from guest ring-3. */ 177 179 178 180 /* R3: Statistics for interrupt handlers (allocated on the hypervisor heap). */ -
trunk/src/VBox/VMM/TRPMInternal.mac
r5394 r5395 64 64 .StatForwardProfHC resb STAMPROFILEADV_size 65 65 .StatTrap0dDisasm resb STAMPROFILEADV_size 66 .StatTrap0dRing0RdTsc resb STAMCOUNTER_size 67 .StatTrap0dRing3RdTsc resb STAMCOUNTER_size 66 68 67 69 .paStatForwardedIRQR3 RTR3PTR_RES 1 -
trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp
r4697 r5395 525 525 switch (pCpu->pCurInstr->opcode) 526 526 { 527 /* 528 * Since we're usually trapping RDTSC there may be a high volume 529 * of these instructions. So, put it first and go straight to 530 * the emulation function to save time. 531 */ 532 case OP_RDTSC: 533 STAM_COUNTER_INC(&pVM->trpm.s.StatTrap0dRing0RdTsc); 534 rc = EMInterpretRdtsc(pVM, pRegFrame); 535 if (RT_SUCCESS(rc)) 536 pRegFrame->eip += pCpu->opsize; 537 else if (rc == VERR_EM_INTERPRETER) 538 rc = VINF_EM_RAW_EXCEPTION_PRIVILEGED; 539 return trpmGCExitTrap(pVM, rc, pRegFrame); 540 527 541 case OP_INT3: 528 542 /* … … 585 599 case OP_LLDT: 586 600 case OP_STI: 587 case OP_RDTSC:588 601 case OP_CLTS: 589 602 { … … 622 635 switch (pCpu->pCurInstr->opcode) 623 636 { 624 /*625 * STI and CLI are I/O privileged, i.e. if IOPL626 */627 case OP_STI:628 case OP_CLI:629 {630 uint32_t efl = CPUMRawGetEFlags(pVM, pRegFrame);631 if (X86_EFL_GET_IOPL(efl) >= (unsigned)(pRegFrame->ss & X86_SEL_RPL))632 {633 LogFlow(("trpmGCTrap0dHandlerRing3: CLI/STI -> REM\n"));634 return trpmGCExitTrap(pVM, VINF_EM_RESCHEDULE_REM, pRegFrame);635 }636 LogFlow(("trpmGCTrap0dHandlerRing3: CLI/STI -> #GP(0)\n"));637 break;638 }639 640 637 /* 641 638 * INT3 and INT xx are ring-switching. … … 679 676 /* 680 677 * Handle virtualized TSC reads. 678 * Call the emulation function directly to skip unnecessary overhead. 681 679 */ 682 680 case OP_RDTSC: 683 { 684 uint32_t cbIgnored; 685 rc = EMInterpretInstructionCPU(pVM, pCpu, pRegFrame, PC, &cbIgnored); 686 if (VBOX_SUCCESS(rc)) 681 STAM_COUNTER_INC(&pVM->trpm.s.StatTrap0dRing3RdTsc); 682 rc = EMInterpretRdtsc(pVM, pRegFrame); 683 if (RT_SUCCESS(rc)) 687 684 pRegFrame->eip += pCpu->opsize; 688 685 else if (rc == VERR_EM_INTERPRETER) 689 686 rc = VINF_EM_RAW_EXCEPTION_PRIVILEGED; 690 687 return trpmGCExitTrap(pVM, rc, pRegFrame); 688 689 /* 690 * STI and CLI are I/O privileged, i.e. if IOPL 691 */ 692 case OP_STI: 693 case OP_CLI: 694 { 695 uint32_t efl = CPUMRawGetEFlags(pVM, pRegFrame); 696 if (X86_EFL_GET_IOPL(efl) >= (unsigned)(pRegFrame->ss & X86_SEL_RPL)) 697 { 698 LogFlow(("trpmGCTrap0dHandlerRing3: CLI/STI -> REM\n")); 699 return trpmGCExitTrap(pVM, VINF_EM_RESCHEDULE_REM, pRegFrame); 700 } 701 LogFlow(("trpmGCTrap0dHandlerRing3: CLI/STI -> #GP(0)\n")); 702 break; 691 703 } 692 704 }
Note:
See TracChangeset
for help on using the changeset viewer.