Changeset 13898 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Nov 6, 2008 9:44:29 AM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCM.cpp
r13883 r13898 104 104 pVM->hwaccm.s.fNestedPaging = false; 105 105 106 /*107 * Statistics.108 */109 STAM_REG(pVM, &pVM->hwaccm.s.StatEntry, STAMTYPE_PROFILE, "/PROF/HWACCM/SwitchToGC", STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode entry");110 STAM_REG(pVM, &pVM->hwaccm.s.StatExit, STAMTYPE_PROFILE, "/PROF/HWACCM/SwitchFromGC", STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode exit");111 STAM_REG(pVM, &pVM->hwaccm.s.StatInGC, STAMTYPE_PROFILE, "/PROF/HWACCM/InGC", STAMUNIT_TICKS_PER_CALL, "Profiling of vmlaunch");112 113 STAM_REG(pVM, &pVM->hwaccm.s.StatExitShadowNM, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Shadow/#NM", STAMUNIT_OCCURENCES, "Nr of occurances");114 STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestNM, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#NM", STAMUNIT_OCCURENCES, "Nr of occurances");115 STAM_REG(pVM, &pVM->hwaccm.s.StatExitShadowPF, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Shadow/#PF", STAMUNIT_OCCURENCES, "Nr of occurances");116 STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestPF, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#PF", STAMUNIT_OCCURENCES, "Nr of occurances");117 STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestUD, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#UD", STAMUNIT_OCCURENCES, "Nr of occurances");118 STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestSS, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#SS", STAMUNIT_OCCURENCES, "Nr of occurances");119 STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestNP, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#NP", STAMUNIT_OCCURENCES, "Nr of occurances");120 STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestGP, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#GP", STAMUNIT_OCCURENCES, "Nr of occurances");121 STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestMF, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#MF", STAMUNIT_OCCURENCES, "Nr of occurances");122 STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestDE, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#DE", STAMUNIT_OCCURENCES, "Nr of occurances");123 STAM_REG(pVM, &pVM->hwaccm.s.StatExitGuestDB, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#DB", STAMUNIT_OCCURENCES, "Nr of occurances");124 STAM_REG(pVM, &pVM->hwaccm.s.StatExitInvpg, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Invlpg", STAMUNIT_OCCURENCES, "Nr of occurances");125 STAM_REG(pVM, &pVM->hwaccm.s.StatExitInvd, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Invd", STAMUNIT_OCCURENCES, "Nr of occurances");126 STAM_REG(pVM, &pVM->hwaccm.s.StatExitCpuid, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Cpuid", STAMUNIT_OCCURENCES, "Nr of occurances");127 STAM_REG(pVM, &pVM->hwaccm.s.StatExitRdtsc, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Rdtsc", STAMUNIT_OCCURENCES, "Nr of occurances");128 STAM_REG(pVM, &pVM->hwaccm.s.StatExitCRxWrite, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CRx/Write", STAMUNIT_OCCURENCES, "Nr of occurances");129 STAM_REG(pVM, &pVM->hwaccm.s.StatExitCRxRead, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CRx/Read", STAMUNIT_OCCURENCES, "Nr of occurances");130 STAM_REG(pVM, &pVM->hwaccm.s.StatExitDRxWrite, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/DRx/Write", STAMUNIT_OCCURENCES, "Nr of occurances");131 STAM_REG(pVM, &pVM->hwaccm.s.StatExitDRxRead, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/DRx/Read", STAMUNIT_OCCURENCES, "Nr of occurances");132 STAM_REG(pVM, &pVM->hwaccm.s.StatExitCLTS, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CLTS", STAMUNIT_OCCURENCES, "Nr of occurances");133 STAM_REG(pVM, &pVM->hwaccm.s.StatExitLMSW, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/LMSW", STAMUNIT_OCCURENCES, "Nr of occurances");134 STAM_REG(pVM, &pVM->hwaccm.s.StatExitIOWrite, STAMTYPE_COUNTER, "/HWACCM/Exit/IO/Write", STAMUNIT_OCCURENCES, "Nr of occurances");135 STAM_REG(pVM, &pVM->hwaccm.s.StatExitIORead, STAMTYPE_COUNTER, "/HWACCM/Exit/IO/Read", STAMUNIT_OCCURENCES, "Nr of occurances");136 STAM_REG(pVM, &pVM->hwaccm.s.StatExitIOStringWrite, STAMTYPE_COUNTER, "/HWACCM/Exit/IO/WriteString", STAMUNIT_OCCURENCES, "Nr of occurances");137 STAM_REG(pVM, &pVM->hwaccm.s.StatExitIOStringRead, STAMTYPE_COUNTER, "/HWACCM/Exit/IO/ReadString", STAMUNIT_OCCURENCES, "Nr of occurances");138 STAM_REG(pVM, &pVM->hwaccm.s.StatExitIrqWindow, STAMTYPE_COUNTER, "/HWACCM/Exit/GuestIrq/Pending", STAMUNIT_OCCURENCES, "Nr of occurances");139 STAM_REG(pVM, &pVM->hwaccm.s.StatExitMaxResume, STAMTYPE_COUNTER, "/HWACCM/Exit/Safety/MaxResume", STAMUNIT_OCCURENCES, "Nr of occurances");140 141 STAM_REG(pVM, &pVM->hwaccm.s.StatSwitchGuestIrq,STAMTYPE_COUNTER, "/HWACCM/Switch/IrqPending", STAMUNIT_OCCURENCES, "Nr of occurances");142 STAM_REG(pVM, &pVM->hwaccm.s.StatSwitchToR3, STAMTYPE_COUNTER, "/HWACCM/Switch/ToR3", STAMUNIT_OCCURENCES, "Nr of occurances");143 144 STAM_REG(pVM, &pVM->hwaccm.s.StatIntInject, STAMTYPE_COUNTER, "/HWACCM/Irq/Inject", STAMUNIT_OCCURENCES, "Nr of occurances");145 STAM_REG(pVM, &pVM->hwaccm.s.StatIntReinject, STAMTYPE_COUNTER, "/HWACCM/Irq/Reinject", STAMUNIT_OCCURENCES, "Nr of occurances");146 STAM_REG(pVM, &pVM->hwaccm.s.StatPendingHostIrq,STAMTYPE_COUNTER, "/HWACCM/Irq/PendingOnHost", STAMUNIT_OCCURENCES, "Nr of occurances");147 148 STAM_REG(pVM, &pVM->hwaccm.s.StatFlushPageManual, STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Virt/Manual", STAMUNIT_OCCURENCES, "Nr of occurances");149 STAM_REG(pVM, &pVM->hwaccm.s.StatFlushPhysPageManual, STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Phys/Manual", STAMUNIT_OCCURENCES, "Nr of occurances");150 STAM_REG(pVM, &pVM->hwaccm.s.StatFlushTLBManual, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Manual", STAMUNIT_OCCURENCES, "Nr of occurances");151 STAM_REG(pVM, &pVM->hwaccm.s.StatFlushTLBCRxChange, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/CRx", STAMUNIT_OCCURENCES, "Nr of occurances");152 STAM_REG(pVM, &pVM->hwaccm.s.StatFlushPageInvlpg, STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Invlpg", STAMUNIT_OCCURENCES, "Nr of occurances");153 STAM_REG(pVM, &pVM->hwaccm.s.StatFlushTLBWorldSwitch, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Switch", STAMUNIT_OCCURENCES, "Nr of occurances");154 STAM_REG(pVM, &pVM->hwaccm.s.StatNoFlushTLBWorldSwitch, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Skipped", STAMUNIT_OCCURENCES, "Nr of occurances");155 STAM_REG(pVM, &pVM->hwaccm.s.StatFlushASID, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/ASID", STAMUNIT_OCCURENCES, "Nr of occurances");156 STAM_REG(pVM, &pVM->hwaccm.s.StatFlushTLBInvlpga, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/PhysInvlpg", STAMUNIT_OCCURENCES, "Nr of occurances");157 158 STAM_REG(pVM, &pVM->hwaccm.s.StatTSCOffset, STAMTYPE_COUNTER, "/HWACCM/TSC/Offset", STAMUNIT_OCCURENCES, "Nr of occurances");159 STAM_REG(pVM, &pVM->hwaccm.s.StatTSCIntercept, STAMTYPE_COUNTER, "/HWACCM/TSC/Intercept", STAMUNIT_OCCURENCES, "Nr of occurances");160 161 STAM_REG(pVM, &pVM->hwaccm.s.StatDRxArmed, STAMTYPE_COUNTER, "/HWACCM/Debug/Armed", STAMUNIT_OCCURENCES, "Nr of occurances");162 STAM_REG(pVM, &pVM->hwaccm.s.StatDRxContextSwitch, STAMTYPE_COUNTER, "/HWACCM/Debug/ContextSwitch", STAMUNIT_OCCURENCES, "Nr of occurances");163 STAM_REG(pVM, &pVM->hwaccm.s.StatDRxIOCheck, STAMTYPE_COUNTER, "/HWACCM/Debug/IOCheck", STAMUNIT_OCCURENCES, "Nr of occurances");164 165 pVM->hwaccm.s.paStatExitReason = NULL;166 167 #ifdef VBOX_WITH_STATISTICS168 rc = MMHyperAlloc(pVM, MAX_EXITREASON_STAT*sizeof(*pVM->hwaccm.s.paStatExitReason), 0, MM_TAG_HWACCM, (void **)&pVM->hwaccm.s.paStatExitReason);169 AssertRC(rc);170 if (RT_SUCCESS(rc))171 {172 for (int i=0;i<MAX_EXITREASON_STAT;i++)173 {174 int rc = STAMR3RegisterF(pVM, &pVM->hwaccm.s.paStatExitReason[i], STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, "Exit reason",175 "/HWACCM/Exit/Reason/%02x", i);176 AssertRC(rc);177 }178 int rc = STAMR3Register(pVM, &pVM->hwaccm.s.StatExitReasonNPF, STAMTYPE_COUNTER, STAMVISIBILITY_USED, "/HWACCM/Exit/Reason/#NPF", STAMUNIT_OCCURENCES, "Exit reason");179 AssertRC(rc);180 }181 pVM->hwaccm.s.paStatExitReasonR0 = MMHyperR3ToR0(pVM, pVM->hwaccm.s.paStatExitReason);182 Assert(pVM->hwaccm.s.paStatExitReasonR0);183 #endif184 185 106 /* Disabled by default. */ 186 107 pVM->fHWACCMEnabled = false; … … 194 115 195 116 /* VT-x VPID: disabled by default. */ 196 rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnableVPID", &pVM->hwaccm.s. fAllowVPID, false);117 rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnableVPID", &pVM->hwaccm.s.vmx.fAllowVPID, false); 197 118 AssertRC(rc); 198 119 … … 213 134 { 214 135 LogFlow(("HWACCMR3InitCPU\n")); 136 137 /* 138 * Statistics. 139 */ 140 for (unsigned i=0;i<pVM->cCPUs;i++) 141 { 142 PVMCPU pVCpu = &pVM->aCpus[i]; 143 144 STAM_REG(pVM, &pVCpu->hwaccm.s.StatEntry, STAMTYPE_PROFILE, "/PROF/HWACCM/SwitchToGC", STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode entry"); 145 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExit, STAMTYPE_PROFILE, "/PROF/HWACCM/SwitchFromGC", STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode exit"); 146 STAM_REG(pVM, &pVCpu->hwaccm.s.StatInGC, STAMTYPE_PROFILE, "/PROF/HWACCM/InGC", STAMUNIT_TICKS_PER_CALL, "Profiling of vmlaunch"); 147 148 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitShadowNM, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Shadow/#NM", STAMUNIT_OCCURENCES, "Nr of occurances"); 149 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestNM, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#NM", STAMUNIT_OCCURENCES, "Nr of occurances"); 150 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitShadowPF, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Shadow/#PF", STAMUNIT_OCCURENCES, "Nr of occurances"); 151 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestPF, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#PF", STAMUNIT_OCCURENCES, "Nr of occurances"); 152 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestUD, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#UD", STAMUNIT_OCCURENCES, "Nr of occurances"); 153 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestSS, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#SS", STAMUNIT_OCCURENCES, "Nr of occurances"); 154 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestNP, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#NP", STAMUNIT_OCCURENCES, "Nr of occurances"); 155 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestGP, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#GP", STAMUNIT_OCCURENCES, "Nr of occurances"); 156 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestMF, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#MF", STAMUNIT_OCCURENCES, "Nr of occurances"); 157 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestDE, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#DE", STAMUNIT_OCCURENCES, "Nr of occurances"); 158 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitGuestDB, STAMTYPE_COUNTER, "/HWACCM/Exit/Trap/Guest/#DB", STAMUNIT_OCCURENCES, "Nr of occurances"); 159 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitInvpg, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Invlpg", STAMUNIT_OCCURENCES, "Nr of occurances"); 160 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitInvd, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Invd", STAMUNIT_OCCURENCES, "Nr of occurances"); 161 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitCpuid, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Cpuid", STAMUNIT_OCCURENCES, "Nr of occurances"); 162 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitRdtsc, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Rdtsc", STAMUNIT_OCCURENCES, "Nr of occurances"); 163 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitCRxWrite, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CRx/Write", STAMUNIT_OCCURENCES, "Nr of occurances"); 164 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitCRxRead, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CRx/Read", STAMUNIT_OCCURENCES, "Nr of occurances"); 165 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitDRxWrite, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/DRx/Write", STAMUNIT_OCCURENCES, "Nr of occurances"); 166 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitDRxRead, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/DRx/Read", STAMUNIT_OCCURENCES, "Nr of occurances"); 167 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitCLTS, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CLTS", STAMUNIT_OCCURENCES, "Nr of occurances"); 168 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitLMSW, STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/LMSW", STAMUNIT_OCCURENCES, "Nr of occurances"); 169 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitIOWrite, STAMTYPE_COUNTER, "/HWACCM/Exit/IO/Write", STAMUNIT_OCCURENCES, "Nr of occurances"); 170 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitIORead, STAMTYPE_COUNTER, "/HWACCM/Exit/IO/Read", STAMUNIT_OCCURENCES, "Nr of occurances"); 171 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitIOStringWrite, STAMTYPE_COUNTER, "/HWACCM/Exit/IO/WriteString", STAMUNIT_OCCURENCES, "Nr of occurances"); 172 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitIOStringRead, STAMTYPE_COUNTER, "/HWACCM/Exit/IO/ReadString", STAMUNIT_OCCURENCES, "Nr of occurances"); 173 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitIrqWindow, STAMTYPE_COUNTER, "/HWACCM/Exit/GuestIrq/Pending", STAMUNIT_OCCURENCES, "Nr of occurances"); 174 STAM_REG(pVM, &pVCpu->hwaccm.s.StatExitMaxResume, STAMTYPE_COUNTER, "/HWACCM/Exit/Safety/MaxResume", STAMUNIT_OCCURENCES, "Nr of occurances"); 175 176 STAM_REG(pVM, &pVCpu->hwaccm.s.StatSwitchGuestIrq,STAMTYPE_COUNTER, "/HWACCM/Switch/IrqPending", STAMUNIT_OCCURENCES, "Nr of occurances"); 177 STAM_REG(pVM, &pVCpu->hwaccm.s.StatSwitchToR3, STAMTYPE_COUNTER, "/HWACCM/Switch/ToR3", STAMUNIT_OCCURENCES, "Nr of occurances"); 178 179 STAM_REG(pVM, &pVCpu->hwaccm.s.StatIntInject, STAMTYPE_COUNTER, "/HWACCM/Irq/Inject", STAMUNIT_OCCURENCES, "Nr of occurances"); 180 STAM_REG(pVM, &pVCpu->hwaccm.s.StatIntReinject, STAMTYPE_COUNTER, "/HWACCM/Irq/Reinject", STAMUNIT_OCCURENCES, "Nr of occurances"); 181 STAM_REG(pVM, &pVCpu->hwaccm.s.StatPendingHostIrq,STAMTYPE_COUNTER, "/HWACCM/Irq/PendingOnHost", STAMUNIT_OCCURENCES, "Nr of occurances"); 182 183 STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushPageManual, STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Virt/Manual", STAMUNIT_OCCURENCES, "Nr of occurances"); 184 STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushPhysPageManual, STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Phys/Manual", STAMUNIT_OCCURENCES, "Nr of occurances"); 185 STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushTLBManual, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Manual", STAMUNIT_OCCURENCES, "Nr of occurances"); 186 STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushTLBCRxChange, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/CRx", STAMUNIT_OCCURENCES, "Nr of occurances"); 187 STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushPageInvlpg, STAMTYPE_COUNTER, "/HWACCM/Flush/Page/Invlpg", STAMUNIT_OCCURENCES, "Nr of occurances"); 188 STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushTLBWorldSwitch, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Switch", STAMUNIT_OCCURENCES, "Nr of occurances"); 189 STAM_REG(pVM, &pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/Skipped", STAMUNIT_OCCURENCES, "Nr of occurances"); 190 STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushASID, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/ASID", STAMUNIT_OCCURENCES, "Nr of occurances"); 191 STAM_REG(pVM, &pVCpu->hwaccm.s.StatFlushTLBInvlpga, STAMTYPE_COUNTER, "/HWACCM/Flush/TLB/PhysInvlpg", STAMUNIT_OCCURENCES, "Nr of occurances"); 192 193 STAM_REG(pVM, &pVCpu->hwaccm.s.StatTSCOffset, STAMTYPE_COUNTER, "/HWACCM/TSC/Offset", STAMUNIT_OCCURENCES, "Nr of occurances"); 194 STAM_REG(pVM, &pVCpu->hwaccm.s.StatTSCIntercept, STAMTYPE_COUNTER, "/HWACCM/TSC/Intercept", STAMUNIT_OCCURENCES, "Nr of occurances"); 195 196 STAM_REG(pVM, &pVCpu->hwaccm.s.StatDRxArmed, STAMTYPE_COUNTER, "/HWACCM/Debug/Armed", STAMUNIT_OCCURENCES, "Nr of occurances"); 197 STAM_REG(pVM, &pVCpu->hwaccm.s.StatDRxContextSwitch, STAMTYPE_COUNTER, "/HWACCM/Debug/ContextSwitch", STAMUNIT_OCCURENCES, "Nr of occurances"); 198 STAM_REG(pVM, &pVCpu->hwaccm.s.StatDRxIOCheck, STAMTYPE_COUNTER, "/HWACCM/Debug/IOCheck", STAMUNIT_OCCURENCES, "Nr of occurances"); 199 200 pVCpu->hwaccm.s.paStatExitReason = NULL; 201 202 #ifdef VBOX_WITH_STATISTICS 203 int rc = MMHyperAlloc(pVM, MAX_EXITREASON_STAT*sizeof(*pVCpu->hwaccm.s.paStatExitReason), 0, MM_TAG_HWACCM, (void **)&pVCpu->hwaccm.s.paStatExitReason); 204 AssertRC(rc); 205 if (RT_SUCCESS(rc)) 206 { 207 for (int i=0;i<MAX_EXITREASON_STAT;i++) 208 { 209 rc = STAMR3RegisterF(pVM, &pVCpu->hwaccm.s.paStatExitReason[i], STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, "Exit reason", 210 "/HWACCM/Exit/Reason/%02x", i); 211 AssertRC(rc); 212 } 213 rc = STAMR3Register(pVM, &pVCpu->hwaccm.s.StatExitReasonNPF, STAMTYPE_COUNTER, STAMVISIBILITY_USED, "/HWACCM/Exit/Reason/#NPF", STAMUNIT_OCCURENCES, "Exit reason"); 214 AssertRC(rc); 215 } 216 pVCpu->hwaccm.s.paStatExitReasonR0 = MMHyperR3ToR0(pVM, pVCpu->hwaccm.s.paStatExitReason); 217 Assert(pVCpu->hwaccm.s.paStatExitReasonR0); 218 #endif 219 } 215 220 return VINF_SUCCESS; 216 221 } … … 593 598 if ( (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_VPID) 594 599 && !pVM->hwaccm.s.fNestedPaging) /* VPID and EPT are mutually exclusive. */ 595 pVM->hwaccm.s.vmx.fVPID = pVM->hwaccm.s. fAllowVPID;600 pVM->hwaccm.s.vmx.fVPID = pVM->hwaccm.s.vmx.fAllowVPID; 596 601 #endif /* HWACCM_VTX_WITH_VPID */ 597 602 … … 833 838 pVM->hwaccm.s.vmx.pRealModeTSS = 0; 834 839 } 835 836 if (pVM->hwaccm.s.paStatExitReason)837 {838 MMHyperFree(pVM, pVM->hwaccm.s.paStatExitReason);839 pVM->hwaccm.s.paStatExitReason = NULL;840 }841 840 return 0; 842 841 } … … 853 852 VMMR3DECL(int) HWACCMR3TermCPU(PVM pVM) 854 853 { 854 for (unsigned i=0;i<pVM->cCPUs;i++) 855 { 856 PVMCPU pVCpu = &pVM->aCpus[i]; 857 858 if (pVCpu->hwaccm.s.paStatExitReason) 859 { 860 MMHyperFree(pVM, pVCpu->hwaccm.s.paStatExitReason); 861 pVCpu->hwaccm.s.paStatExitReason = NULL; 862 pVCpu->hwaccm.s.paStatExitReasonR0 = NULL; 863 } 864 } 855 865 return 0; 856 866 } -
trunk/src/VBox/VMM/HWACCMInternal.h
r13885 r13898 185 185 /** Set if nested paging is allowed. */ 186 186 bool fAllowNestedPaging; 187 /** Set if VT-x VPID is allowed. */188 bool fAllowVPID;189 187 190 188 /** Explicit alignment padding to make 32-bit gcc align u64RegisterMask 191 189 * naturally. */ 192 bool padding[ 1];190 bool padding[2]; 193 191 194 192 /** And mask for copying register contents. */ … … 212 210 /** Set if VPID is supported. */ 213 211 bool fVPID; 212 213 /** Set if VT-x VPID is allowed. */ 214 bool fAllowVPID; 214 215 215 216 /** Virtual address of the TSS page used for real mode emulation. */ … … 344 345 /** Currenty shadow paging mode. */ 345 346 PGMMODE enmShadowMode; 346 347 /** Explicit alignment padding of StatEntry (32-bit g++ again). */ 348 int32_t padding2; 347 } HWACCM; 348 /** Pointer to HWACCM VM instance data. */ 349 typedef HWACCM *PHWACCM; 350 351 /** 352 * HWACCM VMCPU Instance data. 353 */ 354 typedef struct HWACCMCPU 355 { 356 /** Old style FPU reporting trap mask override performed (optimization) */ 357 bool fFPUOldStyleOverride; 358 359 /** Set if we don't have to flush the TLB on VM entry. */ 360 bool fResumeVM; 361 362 /** Set if we need to flush the TLB during the world switch. */ 363 bool fForceTLBFlush; 364 365 /** Explicit alignment padding to make 32-bit gcc align u64RegisterMask 366 * naturally. */ 367 bool padding[1]; 368 369 /** HWACCM_CHANGED_* flags. */ 370 RTUINT fContextUseFlags; 371 372 /* Id of the last cpu we were executing code on (NIL_RTCPUID for the first time) */ 373 RTCPUID idLastCpu; 374 375 /* TLB flush count */ 376 RTUINT cTLBFlushes; 377 378 /* Current ASID in use by the VM */ 379 RTUINT uCurrentASID; 380 381 struct 382 { 383 /** R0 memory object for the VM control structure (VMCS). */ 384 RTR0MEMOBJ pMemObjVMCS; 385 /** Physical address of the VM control structure (VMCS). */ 386 RTHCPHYS pVMCSPhys; 387 /** Virtual address of the VM control structure (VMCS). */ 388 R0PTRTYPE(void *) pVMCS; 389 390 /** Ring 0 handlers for VT-x. */ 391 DECLR0CALLBACKMEMBER(int, pfnStartVM,(RTHCUINT fResume, PCPUMCTX pCtx)); 392 393 /** Current VMX_VMCS_CTRL_PROC_EXEC_CONTROLS. */ 394 uint64_t proc_ctls; 395 396 /** Current CR0 mask. */ 397 uint64_t cr0_mask; 398 /** Current CR4 mask. */ 399 uint64_t cr4_mask; 400 401 /** Current EPTP. */ 402 RTHCPHYS GCPhysEPTP; 403 404 /** Real-mode emulation state. */ 405 struct 406 { 407 X86EFLAGS eflags; 408 uint32_t fValid; 409 } RealMode; 410 411 struct 412 { 413 uint64_t u64VMCSPhys; 414 uint32_t ulVMCSRevision; 415 uint32_t ulLastInstrError; 416 uint32_t ulLastExitReason; 417 uint32_t padding; 418 } lasterror; 419 420 } vmx; 421 422 struct 423 { 424 /** R0 memory object for the VM control block (VMCB). */ 425 RTR0MEMOBJ pMemObjVMCB; 426 /** Physical address of the VM control block (VMCB). */ 427 RTHCPHYS pVMCBPhys; 428 /** Virtual address of the VM control block (VMCB). */ 429 R0PTRTYPE(void *) pVMCB; 430 431 /** Ring 0 handlers for VT-x. */ 432 DECLR0CALLBACKMEMBER(int, pfnVMRun,(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx)); 433 434 } svm; 435 436 #if HC_ARCH_BITS == 32 437 uint32_t Alignment; 438 #endif 439 440 /** Event injection state. */ 441 struct 442 { 443 uint32_t fPending; 444 uint32_t errCode; 445 uint64_t intInfo; 446 } Event; 349 447 350 448 #ifdef VBOX_STRICT … … 418 516 R3PTRTYPE(PSTAMCOUNTER) paStatExitReason; 419 517 R0PTRTYPE(PSTAMCOUNTER) paStatExitReasonR0; 420 } HWACCM;421 /** Pointer to HWACCM VM instance data. */422 typedef HWACCM *PHWACCM;423 424 /**425 * HWACCM VMCPU Instance data.426 */427 typedef struct HWACCMCPU428 {429 /** Old style FPU reporting trap mask override performed (optimization) */430 bool fFPUOldStyleOverride;431 432 /** Set if we don't have to flush the TLB on VM entry. */433 bool fResumeVM;434 435 /** Set if we need to flush the TLB during the world switch. */436 bool fForceTLBFlush;437 438 /** Explicit alignment padding to make 32-bit gcc align u64RegisterMask439 * naturally. */440 bool padding[1];441 442 /** HWACCM_CHANGED_* flags. */443 RTUINT fContextUseFlags;444 445 /* Id of the last cpu we were executing code on (NIL_RTCPUID for the first time) */446 RTCPUID idLastCpu;447 448 /* TLB flush count */449 RTUINT cTLBFlushes;450 451 /* Current ASID in use by the VM */452 RTUINT uCurrentASID;453 454 struct455 {456 /** R0 memory object for the VM control structure (VMCS). */457 RTR0MEMOBJ pMemObjVMCS;458 /** Physical address of the VM control structure (VMCS). */459 RTHCPHYS pVMCSPhys;460 /** Virtual address of the VM control structure (VMCS). */461 R0PTRTYPE(void *) pVMCS;462 463 /** Ring 0 handlers for VT-x. */464 DECLR0CALLBACKMEMBER(int, pfnStartVM,(RTHCUINT fResume, PCPUMCTX pCtx));465 466 /** Current VMX_VMCS_CTRL_PROC_EXEC_CONTROLS. */467 uint64_t proc_ctls;468 469 /** Current CR0 mask. */470 uint64_t cr0_mask;471 /** Current CR4 mask. */472 uint64_t cr4_mask;473 474 /** Current EPTP. */475 RTHCPHYS GCPhysEPTP;476 477 /** Real-mode emulation state. */478 struct479 {480 X86EFLAGS eflags;481 uint32_t fValid;482 } RealMode;483 484 struct485 {486 uint64_t u64VMCSPhys;487 uint32_t ulVMCSRevision;488 uint32_t ulLastInstrError;489 uint32_t ulLastExitReason;490 uint32_t padding;491 } lasterror;492 493 } vmx;494 495 struct496 {497 /** R0 memory object for the VM control block (VMCB). */498 RTR0MEMOBJ pMemObjVMCB;499 /** Physical address of the VM control block (VMCB). */500 RTHCPHYS pVMCBPhys;501 /** Virtual address of the VM control block (VMCB). */502 R0PTRTYPE(void *) pVMCB;503 504 /** Ring 0 handlers for VT-x. */505 DECLR0CALLBACKMEMBER(int, pfnVMRun,(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx));506 507 } svm;508 509 #if HC_ARCH_BITS == 32510 uint32_t Alignment;511 #endif512 513 /** Event injection state. */514 struct515 {516 uint32_t fPending;517 uint32_t errCode;518 uint64_t intInfo;519 } Event;520 521 518 } HWACCMCPU; 522 519 /** Pointer to HWACCM VM instance data. */ -
trunk/src/VBox/VMM/VMMAll/HWACCMAll.cpp
r13883 r13898 54 54 { 55 55 #ifdef IN_RING0 56 PVMCPU pVCpu = &pVM->aCpus[HWACCMGetVMCPUId(pVM)];56 PVMCPU pVCpu = VMMGetCpu(pVM); 57 57 if (pVM->hwaccm.s.vmx.fSupported) 58 58 return VMXR0InvalidatePage(pVM, pVCpu, GCVirt); … … 73 73 VMMDECL(int) HWACCMFlushTLB(PVM pVM) 74 74 { 75 PVMCPU pVCpu = VMMGetCpu(pVM); 76 75 77 LogFlow(("HWACCMFlushTLB\n")); 76 78 77 pV M->aCpus[HWACCMGetVMCPUId(pVM)].hwaccm.s.fForceTLBFlush = true;78 STAM_COUNTER_INC(&pV M->hwaccm.s.StatFlushTLBManual);79 pVCpu->hwaccm.s.fForceTLBFlush = true; 80 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBManual); 79 81 return VINF_SUCCESS; 80 82 } … … 121 123 122 124 #ifdef IN_RING0 123 PVMCPU pVCpu = &pVM->aCpus[HWACCMGetVMCPUId(pVM)];125 PVMCPU pVCpu = VMMGetCpu(pVM); 124 126 if (pVM->hwaccm.s.vmx.fSupported) 125 127 return VMXR0InvalidatePhysPage(pVM, pVCpu, GCPhys); … … 141 143 VMMDECL(bool) HWACCMHasPendingIrq(PVM pVM) 142 144 { 143 /* @todo SMP */144 return !!pV M->aCpus[0].hwaccm.s.Event.fPending;145 PVMCPU pVCpu = VMMGetCpu(pVM); 146 return !!pVCpu->hwaccm.s.Event.fPending; 145 147 } 146 148 -
trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp
r13818 r13898 67 67 PVM pVM = pCritSect->s.CTX_SUFF(pVM); 68 68 Assert(pVM); 69 70 RTCPUID idCPU = VM_GET_VMCPUID(pVM); 69 PVMCPU pVCpu = VMMGetCpu(pVM); 71 70 72 71 /* … … 76 75 { 77 76 pCritSect->s.Core.cNestings = 1; 78 Assert(pV M->aCpus[idCPU].hNativeThread);79 ASMAtomicXchgSize(&pCritSect->s.Core.NativeThreadOwner, pV M->aCpus[idCPU].hNativeThread);77 Assert(pVCpu->hNativeThread); 78 ASMAtomicXchgSize(&pCritSect->s.Core.NativeThreadOwner, pVCpu->hNativeThread); 80 79 STAM_PROFILE_ADV_START(&pCritSect->s.StatLocked, l); 81 80 return VINF_SUCCESS; … … 85 84 * Nested? 86 85 */ 87 if (pCritSect->s.Core.NativeThreadOwner == pV M->aCpus[idCPU].hNativeThread)86 if (pCritSect->s.Core.NativeThreadOwner == pVCpu->hNativeThread) 88 87 { 89 88 pCritSect->s.Core.cNestings++; … … 163 162 PVM pVM = pCritSect->s.CTX_SUFF(pVM); 164 163 Assert(pVM); 165 AssertMsg(pCritSect->s.Core.NativeThreadOwner == pVM->aCpus[VM_GET_VMCPUID(pVM)].hNativeThread, ("Owner %RX64 emt=%RX64\n", pCritSect->s.Core.NativeThreadOwner, pVM->aCpus[VM_GET_VMCPUID(pVM)].hNativeThread)); 164 PVMCPU pVCpu = VMMGetCpu(pVM); 165 Assert(pVCpu); 166 AssertMsg(pCritSect->s.Core.NativeThreadOwner == pVCpu->hNativeThread, ("Owner %RX64 emt=%RX64\n", pCritSect->s.Core.NativeThreadOwner, pVCpu->hNativeThread)); 166 167 167 168 /* … … 187 188 188 189 /* darn, someone raced in on us. */ 189 Assert(pV M->aCpus[VM_GET_VMCPUID(pVM)].hNativeThread);190 ASMAtomicXchgSize(&pCritSect->s.Core.NativeThreadOwner, pV M->aCpus[VM_GET_VMCPUID(pVM)].hNativeThread);190 Assert(pVCpu->hNativeThread); 191 ASMAtomicXchgSize(&pCritSect->s.Core.NativeThreadOwner, pVCpu->hNativeThread); 191 192 STAM_PROFILE_ADV_START(&pCritSect->s.StatLocked, l); 192 193 } … … 222 223 PVM pVM = pCritSect->s.CTX_SUFF(pVM); 223 224 Assert(pVM); 224 return pCritSect->s.Core.NativeThreadOwner == pVM->aCpus[VM_GET_VMCPUID(pVM)].hNativeThread;225 return pCritSect->s.Core.NativeThreadOwner == VMMGetCpu(pVM)->hNativeThread; 225 226 #endif 226 227 } -
trunk/src/VBox/VMM/VMMAll/VMMAll.cpp
r13832 r13898 29 29 #include <VBox/vm.h> 30 30 #include <VBox/param.h> 31 #include <VBox/hwaccm.h> 31 32 32 33 … … 57 58 VMCPUID VMMGetCpuId(PVM pVM) 58 59 { 59 #ifdef VBOX_WITH_SMP_GUESTS60 60 /* Only emulation thread(s) allowed to ask for CPU id */ 61 61 VM_ASSERT_EMT(pVM); 62 62 63 # 63 #if defined(IN_RC) 64 64 /* There is only one CPU if we're in GC. */ 65 65 return 0; 66 66 67 # 67 #elif defined(IN_RING3) 68 68 return VMR3GetVMCPUId(pVM); 69 69 70 # else /* IN_RING0 */ 71 /** @todo SMP: Get the real CPU ID and use a table in the VM structure to 72 * translate it. */ 73 return 0; 74 # endif /* IN_RING0 */ 75 76 #else 77 VM_ASSERT_EMT(pVM); 78 return 0; 79 #endif 70 #else /* IN_RING0 */ 71 return HWACCMGetVMCPUId(pVM); 72 #endif /* IN_RING0 */ 80 73 } 81 74 75 /** 76 * Returns the VMCPU of the current EMT thread. 77 * 78 * @returns The VMCPU pointer. 79 * @param pVM The VM to operate on. 80 */ 81 PVMCPU VMMGetCpu(PVM pVM) 82 { 83 /* Only emulation thread(s) allowed to ask for CPU id */ 84 VM_ASSERT_EMT(pVM); 85 86 #if defined(IN_RC) 87 /* There is only one CPU if we're in GC. */ 88 return &pVM->aCpus[0]; 89 90 #elif defined(IN_RING3) 91 return &pVM->aCpus[VMR3GetVMCPUId(pVM)]; 92 93 #else /* IN_RING0 */ 94 return &pVM->aCpus[HWACCMGetVMCPUId(pVM)]; 95 #endif /* IN_RING0 */ 96 } 82 97 83 98 /** -
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r13883 r13898 774 774 pVM->hwaccm.s.cpuid.u32AMDFeatureEDX = HWACCMR0Globals.cpuid.u32AMDFeatureEDX; 775 775 pVM->hwaccm.s.lLastError = HWACCMR0Globals.lLastError; 776 777 pVM->hwaccm.s.uMaxASID = HWACCMR0Globals.uMaxASID; 778 779 for (unsigned i=0;i<pVM->cCPUs;i++) 780 { 781 PVMCPU pVCpu = &pVM->aCpus[i]; 782 776 783 #ifdef VBOX_STRICT 777 pVM->hwaccm.s.idEnteredCpu = NIL_RTCPUID;784 pVCpu->hwaccm.s.idEnteredCpu = NIL_RTCPUID; 778 785 #endif 779 780 pVM->hwaccm.s.uMaxASID = HWACCMR0Globals.uMaxASID;781 782 for (unsigned i=0;i<pVM->cCPUs;i++)783 {784 786 /* Invalidate the last cpu we were running on. */ 785 pV M->aCpus[i].hwaccm.s.idLastCpu = NIL_RTCPUID;787 pVCpu->hwaccm.s.idLastCpu = NIL_RTCPUID; 786 788 787 789 /* we'll aways increment this the first time (host uses ASID 0) */ 788 pV M->aCpus[i].hwaccm.s.uCurrentASID = 0;790 pVCpu->hwaccm.s.uCurrentASID = 0; 789 791 } 790 792 … … 916 918 if (RT_SUCCESS(rc)) 917 919 { 918 AssertMsg(pV M->hwaccm.s.idEnteredCpu == NIL_RTCPUID, ("%d", (int)pVM->hwaccm.s.idEnteredCpu));919 pV M->hwaccm.s.idEnteredCpu = idCpu;920 AssertMsg(pVCpu->hwaccm.s.idEnteredCpu == NIL_RTCPUID, ("%d", (int)pVCpu->hwaccm.s.idEnteredCpu)); 921 pVCpu->hwaccm.s.idEnteredCpu = idCpu; 920 922 } 921 923 #endif … … 959 961 #ifdef VBOX_STRICT 960 962 /* keep track of the CPU owning the VMCS for debugging scheduling weirdness and ring-3 calls. */ 961 AssertMsg(pV M->hwaccm.s.idEnteredCpu == idCpu, ("owner is %d, I'm %d", (int)pVM->hwaccm.s.idEnteredCpu, (int)idCpu));962 pV M->hwaccm.s.idEnteredCpu = NIL_RTCPUID;963 AssertMsg(pVCpu->hwaccm.s.idEnteredCpu == idCpu, ("owner is %d, I'm %d", (int)pVCpu->hwaccm.s.idEnteredCpu, (int)idCpu)); 964 pVCpu->hwaccm.s.idEnteredCpu = NIL_RTCPUID; 963 965 #endif 964 966 -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r13883 r13898 405 405 406 406 Log(("Reinjecting event %08x %08x at %RGv\n", pVCpu->hwaccm.s.Event.intInfo, pVCpu->hwaccm.s.Event.errCode, (RTGCPTR)pCtx->rip)); 407 STAM_COUNTER_INC(&pV M->hwaccm.s.StatIntReinject);407 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatIntReinject); 408 408 Event.au64[0] = pVCpu->hwaccm.s.Event.intInfo; 409 409 SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event); … … 448 448 /* Can only happen in rare cases where a pending interrupt is cleared behind our back */ 449 449 Assert(!VM_FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC))); 450 STAM_COUNTER_INC(&pV M->hwaccm.s.StatSwitchGuestIrq);450 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchGuestIrq); 451 451 /* Just continue */ 452 452 } … … 514 514 Event.n.u3Type = SVM_EVENT_EXTERNAL_IRQ; 515 515 516 STAM_COUNTER_INC(&pV M->hwaccm.s.StatIntInject);516 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatIntInject); 517 517 SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event); 518 518 } /* if (interrupts can be dispatched) */ … … 716 716 && !DBGFIsStepping(pVM)) 717 717 { 718 STAM_COUNTER_INC(&pV M->hwaccm.s.StatDRxArmed);718 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxArmed); 719 719 720 720 /* Disable drx move intercepts. */ … … 766 766 { 767 767 pVMCB->ctrl.u32InterceptCtrl1 &= ~SVM_CTRL1_INTERCEPT_RDTSC; 768 STAM_COUNTER_INC(&pV M->hwaccm.s.StatTSCOffset);768 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatTSCOffset); 769 769 } 770 770 else 771 771 { 772 772 pVMCB->ctrl.u32InterceptCtrl1 |= SVM_CTRL1_INTERCEPT_RDTSC; 773 STAM_COUNTER_INC(&pV M->hwaccm.s.StatTSCIntercept);773 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatTSCIntercept); 774 774 } 775 775 … … 817 817 #endif 818 818 819 STAM_PROFILE_ADV_START(&pV M->hwaccm.s.StatEntry, x);819 STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatEntry, x); 820 820 821 821 pVMCB = (SVM_VMCB *)pVCpu->hwaccm.s.svm.pVMCB; … … 830 830 if (++cResume > HWACCM_MAX_RESUME_LOOPS) 831 831 { 832 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitMaxResume);832 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitMaxResume); 833 833 rc = VINF_EM_RAW_INTERRUPT; 834 834 goto end; … … 866 866 { 867 867 VM_FF_CLEAR(pVM, VM_FF_TO_R3); 868 STAM_COUNTER_INC(&pV M->hwaccm.s.StatSwitchToR3);869 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatEntry, x);868 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3); 869 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); 870 870 rc = VINF_EM_RAW_TO_R3; 871 871 goto end; … … 876 876 if (VM_FF_ISPENDING(pVM, VM_FF_REQUEST)) 877 877 { 878 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatEntry, x);878 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); 879 879 rc = VINF_EM_PENDING_REQUEST; 880 880 goto end; … … 886 886 if (RT_FAILURE(rc)) 887 887 { 888 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatEntry, x);888 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); 889 889 goto end; 890 890 } … … 917 917 918 918 /* All done! Let's start VM execution. */ 919 STAM_PROFILE_ADV_START(&pV M->hwaccm.s.StatInGC, x);919 STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatInGC, x); 920 920 921 921 /* Enable nested paging if necessary (disabled each time after #VMEXIT). */ … … 949 949 if (rc != VINF_SUCCESS) 950 950 { 951 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatEntry, x);951 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); 952 952 goto end; 953 953 } … … 981 981 } 982 982 else 983 STAM_COUNTER_INC(&pV M->hwaccm.s.StatFlushASID);983 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushASID); 984 984 985 985 pVCpu->hwaccm.s.cTLBFlushes = pCpu->cTLBFlushes; … … 1004 1004 #ifdef VBOX_WITH_STATISTICS 1005 1005 if (pVMCB->ctrl.TLBCtrl.n.u1TLBFlush) 1006 STAM_COUNTER_INC(&pV M->hwaccm.s.StatFlushTLBWorldSwitch);1006 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBWorldSwitch); 1007 1007 else 1008 STAM_COUNTER_INC(&pV M->hwaccm.s.StatNoFlushTLBWorldSwitch);1008 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch); 1009 1009 #endif 1010 1010 … … 1036 1036 pVCpu->hwaccm.s.svm.pfnVMRun(pVM->hwaccm.s.svm.pVMCBHostPhys, pVCpu->hwaccm.s.svm.pVMCBPhys, pCtx); 1037 1037 TMNotifyEndOfExecution(pVM); 1038 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatInGC, x);1038 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatInGC, x); 1039 1039 1040 1040 /* … … 1044 1044 */ 1045 1045 1046 STAM_PROFILE_ADV_START(&pV M->hwaccm.s.StatExit, x);1046 STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatExit, x); 1047 1047 1048 1048 /* Reason for the VM exit */ … … 1266 1266 #ifdef VBOX_WITH_STATISTICS 1267 1267 if (exitCode == SVM_EXIT_NPF) 1268 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitReasonNPF);1268 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitReasonNPF); 1269 1269 else 1270 STAM_COUNTER_INC(&pV M->hwaccm.s.paStatExitReasonR0[exitCode & MASK_EXITREASON_STAT]);1270 STAM_COUNTER_INC(&pVCpu->hwaccm.s.paStatExitReasonR0[exitCode & MASK_EXITREASON_STAT]); 1271 1271 #endif 1272 1272 … … 1298 1298 case X86_XCPT_DB: 1299 1299 { 1300 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestDB);1300 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestDB); 1301 1301 1302 1302 /* Note that we don't support guest and host-initiated debugging at the same time. */ … … 1316 1316 SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event); 1317 1317 1318 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1318 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1319 1319 goto ResumeExecution; 1320 1320 } … … 1333 1333 { 1334 1334 Assert(CPUMIsGuestFPUStateActive(pVM)); 1335 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitShadowNM);1335 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowNM); 1336 1336 1337 1337 /* Continue execution. */ 1338 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1338 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1339 1339 pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR0; 1340 1340 … … 1343 1343 1344 1344 Log(("Forward #NM fault to the guest\n")); 1345 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestNM);1345 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestNM); 1346 1346 1347 1347 Event.au64[0] = 0; … … 1351 1351 1352 1352 SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event); 1353 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1353 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1354 1354 goto ResumeExecution; 1355 1355 } … … 1366 1366 */ 1367 1367 Log(("Guest page fault at %RGv cr2=%RGv error code %x rsp=%RGv\n", (RTGCPTR)pCtx->rip, uFaultAddress, errCode, (RTGCPTR)pCtx->rsp)); 1368 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestPF);1368 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestPF); 1369 1369 1370 1370 /* Now we must update CR2. */ … … 1380 1380 SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event); 1381 1381 1382 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1382 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1383 1383 goto ResumeExecution; 1384 1384 } … … 1398 1398 { /* We've successfully synced our shadow pages, so let's just continue execution. */ 1399 1399 Log2(("Shadow page fault at %RGv cr2=%RGv error code %x\n", (RTGCPTR)pCtx->rip, uFaultAddress, errCode)); 1400 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitShadowPF);1400 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF); 1401 1401 1402 1402 TRPMResetTrap(pVM); 1403 1403 1404 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1404 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1405 1405 goto ResumeExecution; 1406 1406 } … … 1411 1411 */ 1412 1412 Log2(("Forward page fault to the guest\n")); 1413 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestPF);1413 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestPF); 1414 1414 /* The error code might have been changed. */ 1415 1415 errCode = TRPMGetErrorCode(pVM); … … 1429 1429 SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event); 1430 1430 1431 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1431 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1432 1432 goto ResumeExecution; 1433 1433 } … … 1443 1443 case X86_XCPT_MF: /* Floating point exception. */ 1444 1444 { 1445 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestMF);1445 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestMF); 1446 1446 if (!(pCtx->cr0 & X86_CR0_NE)) 1447 1447 { … … 1460 1460 SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event); 1461 1461 1462 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1462 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1463 1463 goto ResumeExecution; 1464 1464 } … … 1479 1479 { 1480 1480 case X86_XCPT_GP: 1481 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestGP);1481 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestGP); 1482 1482 Event.n.u1ErrorCodeValid = 1; 1483 1483 Event.n.u32ErrorCode = pVMCB->ctrl.u64ExitInfo1; /* EXITINFO1 = error code */ 1484 1484 break; 1485 1485 case X86_XCPT_DE: 1486 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestDE);1486 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestDE); 1487 1487 break; 1488 1488 case X86_XCPT_UD: 1489 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestUD);1489 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestUD); 1490 1490 break; 1491 1491 case X86_XCPT_SS: 1492 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestSS);1492 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestSS); 1493 1493 Event.n.u1ErrorCodeValid = 1; 1494 1494 Event.n.u32ErrorCode = pVMCB->ctrl.u64ExitInfo1; /* EXITINFO1 = error code */ 1495 1495 break; 1496 1496 case X86_XCPT_NP: 1497 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestNP);1497 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestNP); 1498 1498 Event.n.u1ErrorCodeValid = 1; 1499 1499 Event.n.u32ErrorCode = pVMCB->ctrl.u64ExitInfo1; /* EXITINFO1 = error code */ … … 1503 1503 SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event); 1504 1504 1505 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1505 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1506 1506 goto ResumeExecution; 1507 1507 } … … 1535 1535 { /* We've successfully synced our shadow pages, so let's just continue execution. */ 1536 1536 Log2(("Shadow page fault at %RGv cr2=%RGp error code %x\n", (RTGCPTR)pCtx->rip, uFaultAddress, errCode)); 1537 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitShadowPF);1537 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF); 1538 1538 1539 1539 TRPMResetTrap(pVM); 1540 1540 1541 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1541 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1542 1542 goto ResumeExecution; 1543 1543 } … … 1570 1570 case SVM_EXIT_WBINVD: 1571 1571 case SVM_EXIT_INVD: /* Guest software attempted to execute INVD. */ 1572 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitInvd);1572 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInvd); 1573 1573 /* Skip instruction and continue directly. */ 1574 1574 pCtx->rip += 2; /* Note! hardcoded opcode size! */ 1575 1575 /* Continue execution.*/ 1576 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1576 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1577 1577 goto ResumeExecution; 1578 1578 … … 1580 1580 { 1581 1581 Log2(("SVM: Cpuid at %RGv for %x\n", (RTGCPTR)pCtx->rip, pCtx->eax)); 1582 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitCpuid);1582 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCpuid); 1583 1583 rc = EMInterpretCpuId(pVM, CPUMCTX2CORE(pCtx)); 1584 1584 if (rc == VINF_SUCCESS) … … 1586 1586 /* Update EIP and continue execution. */ 1587 1587 pCtx->rip += 2; /* Note! hardcoded opcode size! */ 1588 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1588 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1589 1589 goto ResumeExecution; 1590 1590 } … … 1597 1597 { 1598 1598 Log2(("SVM: Rdtsc\n")); 1599 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitRdtsc);1599 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitRdtsc); 1600 1600 rc = EMInterpretRdtsc(pVM, CPUMCTX2CORE(pCtx)); 1601 1601 if (rc == VINF_SUCCESS) … … 1603 1603 /* Update EIP and continue execution. */ 1604 1604 pCtx->rip += 2; /* Note! hardcoded opcode size! */ 1605 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1605 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1606 1606 goto ResumeExecution; 1607 1607 } … … 1614 1614 { 1615 1615 Log2(("SVM: invlpg\n")); 1616 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitInvpg);1616 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInvpg); 1617 1617 1618 1618 Assert(!pVM->hwaccm.s.fNestedPaging); … … 1622 1622 if (rc == VINF_SUCCESS) 1623 1623 { 1624 STAM_COUNTER_INC(&pV M->hwaccm.s.StatFlushPageInvlpg);1624 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushPageInvlpg); 1625 1625 goto ResumeExecution; /* eip already updated */ 1626 1626 } … … 1636 1636 1637 1637 Log2(("SVM: %RGv mov cr%d, \n", (RTGCPTR)pCtx->rip, exitCode - SVM_EXIT_WRITE_CR0)); 1638 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitCRxWrite);1638 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCRxWrite); 1639 1639 rc = EMInterpretInstruction(pVM, CPUMCTX2CORE(pCtx), 0, &cbSize); 1640 1640 … … 1665 1665 AssertRC(rc); 1666 1666 1667 STAM_COUNTER_INC(&pV M->hwaccm.s.StatFlushTLBCRxChange);1667 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBCRxChange); 1668 1668 1669 1669 /* Must be set by PGMSyncCR3 */ … … 1675 1675 1676 1676 /* Only resume if successful. */ 1677 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1677 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1678 1678 goto ResumeExecution; 1679 1679 } … … 1690 1690 1691 1691 Log2(("SVM: %RGv mov x, cr%d\n", (RTGCPTR)pCtx->rip, exitCode - SVM_EXIT_READ_CR0)); 1692 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitCRxRead);1692 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCRxRead); 1693 1693 rc = EMInterpretInstruction(pVM, CPUMCTX2CORE(pCtx), 0, &cbSize); 1694 1694 if (rc == VINF_SUCCESS) … … 1697 1697 1698 1698 /* Only resume if successful. */ 1699 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1699 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1700 1700 goto ResumeExecution; 1701 1701 } … … 1712 1712 1713 1713 Log2(("SVM: %RGv mov dr%d, x\n", (RTGCPTR)pCtx->rip, exitCode - SVM_EXIT_WRITE_DR0)); 1714 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitDRxRead);1714 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxRead); 1715 1715 1716 1716 if (!DBGFIsStepping(pVM)) 1717 1717 { 1718 STAM_COUNTER_INC(&pV M->hwaccm.s.StatDRxContextSwitch);1718 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxContextSwitch); 1719 1719 1720 1720 /* Disable drx move intercepts. */ … … 1726 1726 AssertRC(rc); 1727 1727 1728 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1728 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1729 1729 goto ResumeExecution; 1730 1730 } … … 1737 1737 1738 1738 /* Only resume if successful. */ 1739 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1739 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1740 1740 goto ResumeExecution; 1741 1741 } … … 1752 1752 1753 1753 Log2(("SVM: %RGv mov dr%d, x\n", (RTGCPTR)pCtx->rip, exitCode - SVM_EXIT_READ_DR0)); 1754 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitDRxRead);1754 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxRead); 1755 1755 1756 1756 if (!DBGFIsStepping(pVM)) 1757 1757 { 1758 STAM_COUNTER_INC(&pV M->hwaccm.s.StatDRxContextSwitch);1758 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxContextSwitch); 1759 1759 1760 1760 /* Disable drx move intercepts. */ … … 1766 1766 AssertRC(rc); 1767 1767 1768 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1768 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1769 1769 goto ResumeExecution; 1770 1770 } … … 1776 1776 1777 1777 /* Only resume if successful. */ 1778 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1778 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1779 1779 goto ResumeExecution; 1780 1780 } … … 1826 1826 { 1827 1827 Log2(("IOMInterpretOUTSEx %RGv %x size=%d\n", (RTGCPTR)pCtx->rip, IoExitInfo.n.u16Port, uIOSize)); 1828 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitIOStringWrite);1828 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOStringWrite); 1829 1829 rc = IOMInterpretOUTSEx(pVM, CPUMCTX2CORE(pCtx), IoExitInfo.n.u16Port, prefix, uIOSize); 1830 1830 } … … 1832 1832 { 1833 1833 Log2(("IOMInterpretINSEx %RGv %x size=%d\n", (RTGCPTR)pCtx->rip, IoExitInfo.n.u16Port, uIOSize)); 1834 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitIOStringRead);1834 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOStringRead); 1835 1835 rc = IOMInterpretINSEx(pVM, CPUMCTX2CORE(pCtx), IoExitInfo.n.u16Port, prefix, uIOSize); 1836 1836 } … … 1844 1844 { 1845 1845 Log2(("IOMIOPortWrite %RGv %x %x size=%d\n", (RTGCPTR)pCtx->rip, IoExitInfo.n.u16Port, pCtx->eax & uAndVal, uIOSize)); 1846 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitIOWrite);1846 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOWrite); 1847 1847 rc = IOMIOPortWrite(pVM, IoExitInfo.n.u16Port, pCtx->eax & uAndVal, uIOSize); 1848 1848 } … … 1851 1851 uint32_t u32Val = 0; 1852 1852 1853 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitIORead);1853 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIORead); 1854 1854 rc = IOMIOPortRead(pVM, IoExitInfo.n.u16Port, &u32Val, uIOSize); 1855 1855 if (IOM_SUCCESS(rc)) … … 1874 1874 if (pCtx->dr[7] & X86_DR7_ENABLED_MASK) 1875 1875 { 1876 STAM_COUNTER_INC(&pV M->hwaccm.s.StatDRxIOCheck);1876 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxIOCheck); 1877 1877 for (unsigned i=0;i<4;i++) 1878 1878 { … … 1917 1917 SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event); 1918 1918 1919 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1919 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1920 1920 goto ResumeExecution; 1921 1921 } … … 1923 1923 } 1924 1924 1925 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1925 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1926 1926 goto ResumeExecution; 1927 1927 } … … 1974 1974 SVMR0InjectEvent(pVM, pVMCB, pCtx, &Event); 1975 1975 1976 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1976 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1977 1977 goto ResumeExecution; 1978 1978 } … … 1991 1991 1992 1992 /* Only resume if successful. */ 1993 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);1993 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 1994 1994 goto ResumeExecution; 1995 1995 } … … 2035 2035 if (exitCode == SVM_EXIT_INTR) 2036 2036 { 2037 STAM_COUNTER_INC(&pV M->hwaccm.s.StatPendingHostIrq);2037 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatPendingHostIrq); 2038 2038 /* On the next entry we'll only sync the host context. */ 2039 2039 pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_HOST_CONTEXT; … … 2051 2051 rc = VINF_EM_RAW_EMULATE_INSTR; 2052 2052 2053 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2053 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2054 2054 return rc; 2055 2055 } … … 2220 2220 AssertMsgReturn(pVMCB, ("Invalid pVMCB\n"), VERR_EM_INTERNAL_ERROR); 2221 2221 2222 STAM_COUNTER_INC(&pV M->hwaccm.s.StatFlushPageManual);2222 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushPageManual); 2223 2223 SVMInvlpgA(GCVirt, pVMCB->ctrl.TLBCtrl.n.u32ASID); 2224 2224 } … … 2240 2240 /* invlpga only invalidates TLB entries for guest virtual addresses; we have no choice but to force a TLB flush here. */ 2241 2241 pVCpu->hwaccm.s.fForceTLBFlush = true; 2242 STAM_COUNTER_INC(&pV M->hwaccm.s.StatFlushTLBInvlpga);2242 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBInvlpga); 2243 2243 return VINF_SUCCESS; 2244 2244 } -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r13883 r13898 655 655 { 656 656 Log(("Reinjecting event %RX64 %08x at %RGv cr2=%RX64\n", pVCpu->hwaccm.s.Event.intInfo, pVCpu->hwaccm.s.Event.errCode, (RTGCPTR)pCtx->rip, pCtx->cr2)); 657 STAM_COUNTER_INC(&pV M->hwaccm.s.StatIntReinject);657 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatIntReinject); 658 658 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, pVCpu->hwaccm.s.Event.intInfo, 0, pVCpu->hwaccm.s.Event.errCode); 659 659 AssertRC(rc); … … 694 694 /* Can only happen in rare cases where a pending interrupt is cleared behind our back */ 695 695 Assert(!VM_FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC))); 696 STAM_COUNTER_INC(&pV M->hwaccm.s.StatSwitchGuestIrq);696 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchGuestIrq); 697 697 /* Just continue */ 698 698 } … … 759 759 intInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 760 760 761 STAM_COUNTER_INC(&pV M->hwaccm.s.StatIntInject);761 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatIntInject); 762 762 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo, 0, errCode); 763 763 AssertRC(rc); … … 1329 1329 && !DBGFIsStepping(pVM)) 1330 1330 { 1331 STAM_COUNTER_INC(&pV M->hwaccm.s.StatDRxArmed);1331 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxArmed); 1332 1332 1333 1333 /* Disable drx move intercepts. */ … … 1389 1389 rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls); 1390 1390 AssertRC(rc); 1391 STAM_COUNTER_INC(&pV M->hwaccm.s.StatTSCOffset);1391 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatTSCOffset); 1392 1392 } 1393 1393 else … … 1396 1396 rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls); 1397 1397 AssertRC(rc); 1398 STAM_COUNTER_INC(&pV M->hwaccm.s.StatTSCIntercept);1398 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatTSCIntercept); 1399 1399 } 1400 1400 … … 1614 1614 #ifdef VBOX_WITH_STATISTICS 1615 1615 if (pVCpu->hwaccm.s.fForceTLBFlush) 1616 STAM_COUNTER_INC(&pV M->hwaccm.s.StatFlushTLBWorldSwitch);1616 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBWorldSwitch); 1617 1617 else 1618 STAM_COUNTER_INC(&pV M->hwaccm.s.StatNoFlushTLBWorldSwitch);1618 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch); 1619 1619 #endif 1620 1620 } … … 1663 1663 else 1664 1664 { 1665 STAM_COUNTER_INC(&pV M->hwaccm.s.StatFlushASID);1665 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushASID); 1666 1666 pVCpu->hwaccm.s.fForceTLBFlush = false; 1667 1667 } … … 1689 1689 #ifdef VBOX_WITH_STATISTICS 1690 1690 if (pVCpu->hwaccm.s.fForceTLBFlush) 1691 STAM_COUNTER_INC(&pV M->hwaccm.s.StatFlushTLBWorldSwitch);1691 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBWorldSwitch); 1692 1692 else 1693 STAM_COUNTER_INC(&pV M->hwaccm.s.StatNoFlushTLBWorldSwitch);1693 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch); 1694 1694 #endif 1695 1695 } … … 1721 1721 Log2(("\nE")); 1722 1722 1723 STAM_PROFILE_ADV_START(&pV M->hwaccm.s.StatEntry, x);1723 STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatEntry, x); 1724 1724 1725 1725 #ifdef VBOX_STRICT … … 1782 1782 */ 1783 1783 ResumeExecution: 1784 AssertMsg(pV M->hwaccm.s.idEnteredCpu == RTMpCpuId(),1784 AssertMsg(pVCpu->hwaccm.s.idEnteredCpu == RTMpCpuId(), 1785 1785 ("Expected %d, I'm %d; cResume=%d exitReason=%RTreg exitQualification=%RTreg\n", 1786 (int)pV M->hwaccm.s.idEnteredCpu, (int)RTMpCpuId(), cResume, exitReason, exitQualification));1786 (int)pVCpu->hwaccm.s.idEnteredCpu, (int)RTMpCpuId(), cResume, exitReason, exitQualification)); 1787 1787 Assert(!HWACCMR0SuspendPending()); 1788 1788 … … 1790 1790 if (++cResume > HWACCM_MAX_RESUME_LOOPS) 1791 1791 { 1792 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitMaxResume);1792 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitMaxResume); 1793 1793 rc = VINF_EM_RAW_INTERRUPT; 1794 1794 goto end; … … 1823 1823 { 1824 1824 VM_FF_CLEAR(pVM, VM_FF_TO_R3); 1825 STAM_COUNTER_INC(&pV M->hwaccm.s.StatSwitchToR3);1826 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatEntry, x);1825 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3); 1826 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); 1827 1827 rc = VINF_EM_RAW_TO_R3; 1828 1828 goto end; … … 1831 1831 if (VM_FF_ISPENDING(pVM, VM_FF_REQUEST)) 1832 1832 { 1833 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatEntry, x);1833 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); 1834 1834 rc = VINF_EM_PENDING_REQUEST; 1835 1835 goto end; … … 1841 1841 if (RT_FAILURE(rc)) 1842 1842 { 1843 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatEntry, x);1843 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); 1844 1844 goto end; 1845 1845 } … … 1913 1913 if (rc != VINF_SUCCESS) 1914 1914 { 1915 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatEntry, x);1915 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); 1916 1916 goto end; 1917 1917 } … … 1920 1920 if (rc != VINF_SUCCESS) 1921 1921 { 1922 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatEntry, x);1922 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); 1923 1923 goto end; 1924 1924 } … … 1932 1932 AssertRC(rc); 1933 1933 1934 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatEntry, x);1934 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); 1935 1935 1936 1936 /* Manual save and restore: … … 1947 1947 1948 1948 /* All done! Let's start VM execution. */ 1949 STAM_PROFILE_ADV_START(&pV M->hwaccm.s.StatInGC, x);1949 STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatInGC, x); 1950 1950 #ifdef VBOX_STRICT 1951 1951 Assert(idCpuCheck == RTMpCpuId()); … … 1965 1965 */ 1966 1966 1967 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatInGC, x);1968 STAM_PROFILE_ADV_START(&pV M->hwaccm.s.StatExit, x);1967 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatInGC, x); 1968 STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatExit, x); 1969 1969 1970 1970 if (rc != VINF_SUCCESS) … … 1977 1977 /* Investigate why there was a VM-exit. */ 1978 1978 rc = VMXReadVMCS(VMX_VMCS_RO_EXIT_REASON, &exitReason); 1979 STAM_COUNTER_INC(&pV M->hwaccm.s.paStatExitReasonR0[exitReason & MASK_EXITREASON_STAT]);1979 STAM_COUNTER_INC(&pVCpu->hwaccm.s.paStatExitReasonR0[exitReason & MASK_EXITREASON_STAT]); 1980 1980 1981 1981 exitReason &= 0xffff; /* bit 0-15 contain the exit code. */ … … 2084 2084 Assert(CPUMIsGuestFPUStateActive(pVM)); 2085 2085 2086 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitShadowNM);2086 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowNM); 2087 2087 2088 2088 /* Continue execution. */ 2089 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2089 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2090 2090 pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR0; 2091 2091 … … 2094 2094 2095 2095 Log(("Forward #NM fault to the guest\n")); 2096 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestNM);2096 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestNM); 2097 2097 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, 0); 2098 2098 AssertRC(rc); 2099 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2099 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2100 2100 goto ResumeExecution; 2101 2101 } … … 2112 2112 Assert(CPUMIsGuestInPagedProtectedModeEx(pCtx)); 2113 2113 2114 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestPF);2114 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestPF); 2115 2115 2116 2116 /* Now we must update CR2. */ … … 2119 2119 AssertRC(rc); 2120 2120 2121 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2121 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2122 2122 goto ResumeExecution; 2123 2123 } … … 2137 2137 { /* We've successfully synced our shadow pages, so let's just continue execution. */ 2138 2138 Log2(("Shadow page fault at %RGv cr2=%RGv error code %x\n", (RTGCPTR)pCtx->rip, exitQualification ,errCode)); 2139 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitShadowPF);2139 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF); 2140 2140 2141 2141 TRPMResetTrap(pVM); 2142 2142 2143 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2143 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2144 2144 goto ResumeExecution; 2145 2145 } … … 2151 2151 Log2(("Forward page fault to the guest\n")); 2152 2152 2153 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestPF);2153 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestPF); 2154 2154 /* The error code might have been changed. */ 2155 2155 errCode = TRPMGetErrorCode(pVM); … … 2162 2162 AssertRC(rc); 2163 2163 2164 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2164 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2165 2165 goto ResumeExecution; 2166 2166 } … … 2176 2176 case X86_XCPT_MF: /* Floating point exception. */ 2177 2177 { 2178 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestMF);2178 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestMF); 2179 2179 if (!(pCtx->cr0 & X86_CR0_NE)) 2180 2180 { … … 2188 2188 AssertRC(rc); 2189 2189 2190 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2190 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2191 2191 goto ResumeExecution; 2192 2192 } … … 2205 2205 * 63:15 Reserved (0) 2206 2206 */ 2207 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestDB);2207 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestDB); 2208 2208 2209 2209 /* Note that we don't support guest and host-initiated debugging at the same time. */ … … 2236 2236 AssertRC(rc); 2237 2237 2238 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2238 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2239 2239 goto ResumeExecution; 2240 2240 } … … 2247 2247 uint32_t cbSize; 2248 2248 2249 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestGP);2249 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestGP); 2250 2250 #ifdef VBOX_STRICT 2251 2251 if (!CPUMIsGuestInRealModeEx(pCtx)) … … 2254 2254 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode); 2255 2255 AssertRC(rc); 2256 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2256 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2257 2257 goto ResumeExecution; 2258 2258 } … … 2270 2270 2271 2271 /* Only resume if successful. */ 2272 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2272 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2273 2273 goto ResumeExecution; 2274 2274 } … … 2286 2286 { 2287 2287 case X86_XCPT_DE: 2288 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestDE);2288 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestDE); 2289 2289 break; 2290 2290 case X86_XCPT_UD: 2291 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestUD);2291 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestUD); 2292 2292 break; 2293 2293 case X86_XCPT_SS: 2294 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestSS);2294 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestSS); 2295 2295 break; 2296 2296 case X86_XCPT_NP: 2297 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitGuestNP);2297 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestNP); 2298 2298 break; 2299 2299 } … … 2303 2303 AssertRC(rc); 2304 2304 2305 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2305 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2306 2306 goto ResumeExecution; 2307 2307 } … … 2320 2320 break; 2321 2321 2322 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2322 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2323 2323 goto ResumeExecution; 2324 2324 } … … 2385 2385 { /* We've successfully synced our shadow pages, so let's just continue execution. */ 2386 2386 Log2(("Shadow page fault at %RGv cr2=%RGp error code %x\n", (RTGCPTR)pCtx->rip, exitQualification , errCode)); 2387 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitShadowPF);2387 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF); 2388 2388 2389 2389 TRPMResetTrap(pVM); 2390 2390 2391 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2391 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2392 2392 goto ResumeExecution; 2393 2393 } … … 2408 2408 rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls); 2409 2409 AssertRC(rc); 2410 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitIrqWindow);2410 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIrqWindow); 2411 2411 goto ResumeExecution; /* we check for pending guest interrupts there */ 2412 2412 2413 2413 case VMX_EXIT_WBINVD: /* 54 Guest software attempted to execute WBINVD. (conditional) */ 2414 2414 case VMX_EXIT_INVD: /* 13 Guest software attempted to execute INVD. (unconditional) */ 2415 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitInvd);2415 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInvd); 2416 2416 /* Skip instruction and continue directly. */ 2417 2417 pCtx->rip += cbInstr; 2418 2418 /* Continue execution.*/ 2419 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2419 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2420 2420 goto ResumeExecution; 2421 2421 … … 2423 2423 { 2424 2424 Log2(("VMX: Cpuid %x\n", pCtx->eax)); 2425 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitCpuid);2425 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCpuid); 2426 2426 rc = EMInterpretCpuId(pVM, CPUMCTX2CORE(pCtx)); 2427 2427 if (rc == VINF_SUCCESS) … … 2430 2430 Assert(cbInstr == 2); 2431 2431 pCtx->rip += cbInstr; 2432 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2432 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2433 2433 goto ResumeExecution; 2434 2434 } … … 2441 2441 { 2442 2442 Log2(("VMX: Rdtsc\n")); 2443 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitRdtsc);2443 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitRdtsc); 2444 2444 rc = EMInterpretRdtsc(pVM, CPUMCTX2CORE(pCtx)); 2445 2445 if (rc == VINF_SUCCESS) … … 2448 2448 Assert(cbInstr == 2); 2449 2449 pCtx->rip += cbInstr; 2450 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2450 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2451 2451 goto ResumeExecution; 2452 2452 } … … 2461 2461 Assert(!pVM->hwaccm.s.fNestedPaging); 2462 2462 2463 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitInvpg);2463 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitInvpg); 2464 2464 rc = EMInterpretInvlpg(pVM, CPUMCTX2CORE(pCtx), exitQualification); 2465 2465 if (rc == VINF_SUCCESS) … … 2467 2467 /* Update EIP and continue execution. */ 2468 2468 pCtx->rip += cbInstr; 2469 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2469 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2470 2470 goto ResumeExecution; 2471 2471 } … … 2487 2487 2488 2488 /* Only resume if successful. */ 2489 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2489 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2490 2490 goto ResumeExecution; 2491 2491 } … … 2500 2500 case VMX_EXIT_QUALIFICATION_CRX_ACCESS_WRITE: 2501 2501 Log2(("VMX: %RGv mov cr%d, x\n", (RTGCPTR)pCtx->rip, VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification))); 2502 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitCRxWrite);2502 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCRxWrite); 2503 2503 rc = EMInterpretCRxWrite(pVM, CPUMCTX2CORE(pCtx), 2504 2504 VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification), … … 2539 2539 case VMX_EXIT_QUALIFICATION_CRX_ACCESS_READ: 2540 2540 Log2(("VMX: mov x, crx\n")); 2541 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitCRxRead);2541 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCRxRead); 2542 2542 2543 2543 Assert(!pVM->hwaccm.s.fNestedPaging || !CPUMIsGuestInPagedProtectedModeEx(pCtx) || VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification) != USE_REG_CR3); … … 2553 2553 case VMX_EXIT_QUALIFICATION_CRX_ACCESS_CLTS: 2554 2554 Log2(("VMX: clts\n")); 2555 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitCLTS);2555 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitCLTS); 2556 2556 rc = EMInterpretCLTS(pVM); 2557 2557 pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR0; … … 2560 2560 case VMX_EXIT_QUALIFICATION_CRX_ACCESS_LMSW: 2561 2561 Log2(("VMX: lmsw %x\n", VMX_EXIT_QUALIFICATION_CRX_LMSW_DATA(exitQualification))); 2562 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitLMSW);2562 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitLMSW); 2563 2563 rc = EMInterpretLMSW(pVM, CPUMCTX2CORE(pCtx), VMX_EXIT_QUALIFICATION_CRX_LMSW_DATA(exitQualification)); 2564 2564 pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR0; … … 2573 2573 { 2574 2574 /* Only resume if successful. */ 2575 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2575 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2576 2576 goto ResumeExecution; 2577 2577 } … … 2594 2594 2595 2595 #ifdef VBOX_WITH_STATISTICS 2596 STAM_COUNTER_INC(&pV M->hwaccm.s.StatDRxContextSwitch);2596 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxContextSwitch); 2597 2597 if (VMX_EXIT_QUALIFICATION_DRX_DIRECTION(exitQualification) == VMX_EXIT_QUALIFICATION_DRX_DIRECTION_WRITE) 2598 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitDRxWrite);2598 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxWrite); 2599 2599 else 2600 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitDRxRead);2601 #endif 2602 2603 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2600 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxRead); 2601 #endif 2602 2603 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2604 2604 goto ResumeExecution; 2605 2605 } … … 2609 2609 { 2610 2610 Log2(("VMX: mov drx%d, genreg%d\n", VMX_EXIT_QUALIFICATION_DRX_REGISTER(exitQualification), VMX_EXIT_QUALIFICATION_DRX_GENREG(exitQualification))); 2611 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitDRxWrite);2611 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxWrite); 2612 2612 rc = EMInterpretDRxWrite(pVM, CPUMCTX2CORE(pCtx), 2613 2613 VMX_EXIT_QUALIFICATION_DRX_REGISTER(exitQualification), … … 2619 2619 { 2620 2620 Log2(("VMX: mov x, drx\n")); 2621 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitDRxRead);2621 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitDRxRead); 2622 2622 rc = EMInterpretDRxRead(pVM, CPUMCTX2CORE(pCtx), 2623 2623 VMX_EXIT_QUALIFICATION_DRX_GENREG(exitQualification), … … 2631 2631 { 2632 2632 /* Only resume if successful. */ 2633 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2633 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2634 2634 goto ResumeExecution; 2635 2635 } … … 2672 2672 { 2673 2673 Log2(("IOMInterpretOUTSEx %RGv %x size=%d\n", (RTGCPTR)pCtx->rip, uPort, cbSize)); 2674 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitIOStringWrite);2674 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOStringWrite); 2675 2675 rc = IOMInterpretOUTSEx(pVM, CPUMCTX2CORE(pCtx), uPort, prefix, cbSize); 2676 2676 } … … 2678 2678 { 2679 2679 Log2(("IOMInterpretINSEx %RGv %x size=%d\n", (RTGCPTR)pCtx->rip, uPort, cbSize)); 2680 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitIOStringRead);2680 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOStringRead); 2681 2681 rc = IOMInterpretINSEx(pVM, CPUMCTX2CORE(pCtx), uPort, prefix, cbSize); 2682 2682 } … … 2691 2691 if (fIOWrite) 2692 2692 { 2693 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitIOWrite);2693 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOWrite); 2694 2694 rc = IOMIOPortWrite(pVM, uPort, pCtx->eax & uAndVal, cbSize); 2695 2695 } … … 2698 2698 uint32_t u32Val = 0; 2699 2699 2700 STAM_COUNTER_INC(&pV M->hwaccm.s.StatExitIORead);2700 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIORead); 2701 2701 rc = IOMIOPortRead(pVM, uPort, &u32Val, cbSize); 2702 2702 if (IOM_SUCCESS(rc)) … … 2720 2720 if (pCtx->dr[7] & X86_DR7_ENABLED_MASK) 2721 2721 { 2722 STAM_COUNTER_INC(&pV M->hwaccm.s.StatDRxIOCheck);2722 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatDRxIOCheck); 2723 2723 for (unsigned i=0;i<4;i++) 2724 2724 { … … 2766 2766 AssertRC(rc); 2767 2767 2768 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2768 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2769 2769 goto ResumeExecution; 2770 2770 } … … 2772 2772 } 2773 2773 2774 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2774 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2775 2775 goto ResumeExecution; 2776 2776 } … … 2952 2952 && !VMX_EXIT_INTERRUPTION_INFO_VALID(intInfo)) 2953 2953 { 2954 STAM_COUNTER_INC(&pV M->hwaccm.s.StatPendingHostIrq);2954 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatPendingHostIrq); 2955 2955 /* On the next entry we'll only sync the host context. */ 2956 2956 pVCpu->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_HOST_CONTEXT; … … 2975 2975 } 2976 2976 2977 STAM_PROFILE_ADV_STOP(&pV M->hwaccm.s.StatExit, x);2977 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit, x); 2978 2978 2979 2979 Log2(("X")); -
trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp
r13885 r13898 265 265 CHECK_MEMBER_ALIGNMENT(HWACCM, vmx.hostCR4, 8); 266 266 CHECK_MEMBER_ALIGNMENT(HWACCM, vmx.msr.feature_ctrl, 8); 267 CHECK_MEMBER_ALIGNMENT(HWACCM , StatEntry, 8);267 CHECK_MEMBER_ALIGNMENT(HWACCMCPU, StatEntry, 8); 268 268 CHECK_MEMBER_ALIGNMENT(HWACCMCPU, vmx.proc_ctls, 8); 269 269 CHECK_MEMBER_ALIGNMENT(HWACCMCPU, Event.intInfo, 8);
Note:
See TracChangeset
for help on using the changeset viewer.