- Timestamp:
- Apr 6, 2009 3:00:15 PM (16 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/EM.cpp
r18655 r18770 210 210 STAM_REG_USED(pVM, &pStats->StatRZRdtsc, STAMTYPE_COUNTER, "/EM/RZ/Interpret/Success/Rdtsc", STAMUNIT_OCCURENCES, "The number of times RDTSC was successfully interpreted."); 211 211 STAM_REG_USED(pVM, &pStats->StatR3Rdtsc, STAMTYPE_COUNTER, "/EM/R3/Interpret/Success/Rdtsc", STAMUNIT_OCCURENCES, "The number of times RDTSC was successfully interpreted."); 212 STAM_REG_USED(pVM, &pStats->StatRZRdpmc, STAMTYPE_COUNTER, "/EM/RZ/Interpret/Success/Rdpmc", STAMUNIT_OCCURENCES, "The number of times RDPMC was successfully interpreted."); 213 STAM_REG_USED(pVM, &pStats->StatR3Rdpmc, STAMTYPE_COUNTER, "/EM/R3/Interpret/Success/Rdpmc", STAMUNIT_OCCURENCES, "The number of times RDPMC was successfully interpreted."); 212 214 STAM_REG_USED(pVM, &pStats->StatRZSti, STAMTYPE_COUNTER, "/EM/RZ/Interpret/Success/Sti", STAMUNIT_OCCURENCES, "The number of times STI was successfully interpreted."); 213 215 STAM_REG_USED(pVM, &pStats->StatR3Sti, STAMTYPE_COUNTER, "/EM/R3/Interpret/Success/Sti", STAMUNIT_OCCURENCES, "The number of times STI was successfully interpreted."); … … 288 290 STAM_REG_USED(pVM, &pStats->StatRZFailedRdtsc, STAMTYPE_COUNTER, "/EM/RZ/Interpret/Failed/Rdtsc", STAMUNIT_OCCURENCES, "The number of times RDTSC was not interpreted."); 289 291 STAM_REG_USED(pVM, &pStats->StatR3FailedRdtsc, STAMTYPE_COUNTER, "/EM/R3/Interpret/Failed/Rdtsc", STAMUNIT_OCCURENCES, "The number of times RDTSC was not interpreted."); 292 STAM_REG_USED(pVM, &pStats->StatRZFailedRdpmc, STAMTYPE_COUNTER, "/EM/RZ/Interpret/Failed/Rdpmc", STAMUNIT_OCCURENCES, "The number of times RDPMC was not interpreted."); 293 STAM_REG_USED(pVM, &pStats->StatR3FailedRdpmc, STAMTYPE_COUNTER, "/EM/R3/Interpret/Failed/Rdpmc", STAMUNIT_OCCURENCES, "The number of times RDPMC was not interpreted."); 290 294 STAM_REG_USED(pVM, &pStats->StatRZFailedRdmsr, STAMTYPE_COUNTER, "/EM/RZ/Interpret/Failed/Rdmsr", STAMUNIT_OCCURENCES, "The number of times RDMSR was not interpreted."); 291 295 STAM_REG_USED(pVM, &pStats->StatR3FailedRdmsr, STAMTYPE_COUNTER, "/EM/R3/Interpret/Failed/Rdmsr", STAMUNIT_OCCURENCES, "The number of times RDMSR was not interpreted."); -
trunk/src/VBox/VMM/EMInternal.h
r15633 r18770 124 124 STAMCOUNTER StatRZRdtsc; 125 125 STAMCOUNTER StatR3Rdtsc; 126 STAMCOUNTER StatRZRdpmc; 127 STAMCOUNTER StatR3Rdpmc; 126 128 STAMCOUNTER StatRZBtr; 127 129 STAMCOUNTER StatR3Btr; … … 233 235 STAMCOUNTER StatRZFailedRdtsc; 234 236 STAMCOUNTER StatR3FailedRdtsc; 237 STAMCOUNTER StatRZFailedRdpmc; 238 STAMCOUNTER StatR3FailedRdpmc; 235 239 STAMCOUNTER StatRZFailedClts; 236 240 STAMCOUNTER StatR3FailedClts; -
trunk/src/VBox/VMM/HWACCM.cpp
r18284 r18770 307 307 HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatExitCpuid, "/HWACCM/CPU%d/Exit/Instr/Cpuid"); 308 308 HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatExitRdtsc, "/HWACCM/CPU%d/Exit/Instr/Rdtsc"); 309 HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatExitRdpmc, "/HWACCM/CPU%d/Exit/Instr/Rdpmc"); 309 310 HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatExitDRxWrite, "/HWACCM/CPU%d/Exit/Instr/DR/Write"); 310 311 HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatExitDRxRead, "/HWACCM/CPU%d/Exit/Instr/DR/Read"); -
trunk/src/VBox/VMM/HWACCMInternal.h
r17909 r18770 600 600 STAMCOUNTER StatExitCpuid; 601 601 STAMCOUNTER StatExitRdtsc; 602 STAMCOUNTER StatExitRdpmc; 602 603 STAMCOUNTER StatExitCli; 603 604 STAMCOUNTER StatExitSti; -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r18764 r18770 2559 2559 } 2560 2560 2561 /** 2562 * Interpret RDPMC 2563 * 2564 * @returns VBox status code. 2565 * @param pVM The VM handle. 2566 * @param pRegFrame The register frame. 2567 * 2568 */ 2569 VMMDECL(int) EMInterpretRdpmc(PVM pVM, PCPUMCTXCORE pRegFrame) 2570 { 2571 unsigned uCR4 = CPUMGetGuestCR4(pVM); 2572 2573 /* If X86_CR4_PCE is not set, then CPL must be zero. */ 2574 if ( !(uCR4 & X86_CR4_PCE) 2575 || CPUMGetGuestCPL(pVM, pRegFrame) != 0) 2576 { 2577 Assert(CPUMGetGuestCR0(pVM) & X86_CR0_PE); 2578 return VERR_EM_INTERPRETER; /* genuine #GP */ 2579 } 2580 2581 /* Just return zero here; rather tricky to properly emulate this, especially as the specs are a mess. */ 2582 pRegFrame->rax = 0; 2583 pRegFrame->rdx = 0; 2584 /* @todo We should trigger a #GP here if the cpu doesn't support the index in ecx. */ 2585 return VINF_SUCCESS; 2586 } 2587 2588 /** 2589 * RDPMC Emulation 2590 */ 2591 static int emInterpretRdpmc(PVM pVM, PDISCPUSTATE pCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 2592 { 2593 return EMInterpretRdpmc(pVM, pRegFrame); 2594 } 2561 2595 2562 2596 /** … … 3188 3222 INTERPRET_CASE_EX_PARAM2(OP_BTS,Bts, BitTest, EMEmulateBts); 3189 3223 INTERPRET_CASE_EX_PARAM2(OP_BTC,Btc, BitTest, EMEmulateBtc); 3224 INTERPRET_CASE(OP_RDPMC,Rdpmc); 3190 3225 INTERPRET_CASE(OP_RDTSC,Rdtsc); 3191 3226 INTERPRET_CASE(OP_CMPXCHG, CmpXchg); -
trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp
r18723 r18770 653 653 case OP_STI: 654 654 case OP_RDTSC: /* just in case */ 655 case OP_RDPMC: 655 656 case OP_CLTS: 656 657 case OP_WBINVD: /* nop */ … … 732 733 733 734 /* 734 * Handle virtualized TSC reads, just in case.735 * Handle virtualized TSC & PMC reads, just in case. 735 736 */ 736 737 case OP_RDTSC: 738 case OP_RDPMC: 737 739 { 738 740 uint32_t cbIgnored; -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r18617 r18770 1639 1639 } 1640 1640 1641 case SVM_EXIT_RDPMC: /* Guest software attempted to execute RDPMC. */ 1642 { 1643 Log2(("SVM: Rdpmc %x\n", pCtx->ecx)); 1644 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitRdpmc); 1645 rc = EMInterpretRdpmc(pVM, CPUMCTX2CORE(pCtx)); 1646 if (rc == VINF_SUCCESS) 1647 { 1648 /* Update EIP and continue execution. */ 1649 pCtx->rip += 2; /* Note! hardcoded opcode size! */ 1650 goto ResumeExecution; 1651 } 1652 AssertMsgFailed(("EMU: rdpmc failed with %Rrc\n", rc)); 1653 rc = VINF_EM_RAW_EMULATE_INSTR; 1654 break; 1655 } 1656 1641 1657 case SVM_EXIT_RDTSCP: /* Guest software attempted to execute RDTSCP. */ 1642 1658 { … … 2048 2064 2049 2065 case SVM_EXIT_MONITOR: 2050 case SVM_EXIT_RDPMC:2051 2066 case SVM_EXIT_PAUSE: 2052 2067 case SVM_EXIT_MWAIT_UNCOND: -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r18666 r18770 2921 2921 } 2922 2922 2923 case VMX_EXIT_RDPMC: /* 15 Guest software attempted to execute RDPMC. */ 2924 { 2925 Log2(("VMX: Rdpmc %x\n", pCtx->ecx)); 2926 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitRdpmc); 2927 rc = EMInterpretRdpmc(pVM, CPUMCTX2CORE(pCtx)); 2928 if (rc == VINF_SUCCESS) 2929 { 2930 /* Update EIP and continue execution. */ 2931 Assert(cbInstr == 2); 2932 pCtx->rip += cbInstr; 2933 goto ResumeExecution; 2934 } 2935 AssertMsgFailed(("EMU: rdpmc failed with %Rrc\n", rc)); 2936 rc = VINF_EM_RAW_EMULATE_INSTR; 2937 break; 2938 } 2939 2923 2940 case VMX_EXIT_RDTSC: /* 16 Guest software attempted to execute RDTSC. */ 2924 2941 { … … 3361 3378 case VMX_EXIT_DRX_MOVE: /* 29 Debug-register accesses. */ 3362 3379 case VMX_EXIT_PORT_IO: /* 30 I/O instruction. */ 3380 case VMX_EXIT_RDPMC: /* 15 Guest software attempted to execute RDPMC. */ 3363 3381 /* already handled above */ 3364 3382 AssertMsg( rc == VINF_PGM_CHANGE_MODE … … 3382 3400 break; 3383 3401 3384 case VMX_EXIT_RDPMC: /* 15 Guest software attempted to execute RDPMC. */3385 3402 case VMX_EXIT_MWAIT: /* 36 Guest software executed MWAIT. */ 3386 3403 case VMX_EXIT_MONITOR: /* 39 Guest software attempted to execute MONITOR. */ -
trunk/src/recompiler_new/target-i386/op_helper.c
r18475 r18770 3700 3700 void helper_rdpmc(void) 3701 3701 { 3702 #ifdef VBOX 3703 /* If X86_CR4_PCE is *not* set, then CPL must be zero. */ 3704 if (!(env->cr[4] & CR4_PCE_MASK) && ((env->hflags & HF_CPL_MASK) != 0)) { 3705 raise_exception(EXCP0D_GPF); 3706 } 3707 /* Just return zero here; rather tricky to properly emulate this, especially as the specs are a mess. */ 3708 EAX = 0; 3709 EDX = 0; 3710 #else 3702 3711 if ((env->cr[4] & CR4_PCE_MASK) && ((env->hflags & HF_CPL_MASK) != 0)) { 3703 3712 raise_exception(EXCP0D_GPF); … … 3707 3716 /* currently unimplemented */ 3708 3717 raise_exception_err(EXCP06_ILLOP, 0); 3718 #endif 3709 3719 } 3710 3720
Note:
See TracChangeset
for help on using the changeset viewer.