Changeset 61605 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jun 9, 2016 8:18:20 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r61544 r61605 4235 4235 } 4236 4236 4237 4238 /** 4239 * Advances the guest RIP in the if the NRIP_SAVE feature is supported by the 4240 * CPU, otherwise advances the RIP by @a cb bytes. 4237 /** 4238 * Updates interrupt shadow for the current RIP. 4239 */ 4240 #define HMSVM_UPDATE_INTR_SHADOW(pVCpu, pCtx) \ 4241 do { \ 4242 /* Update interrupt shadow. */ \ 4243 if ( VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS) \ 4244 && pCtx->rip != EMGetInhibitInterruptsPC(pVCpu)) \ 4245 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); \ 4246 } while (0) 4247 4248 /** 4249 * Advances the guest RIP making use of the CPU's NRIP_SAVE feature if 4250 * supported, otherwise advances the RIP by the number of bytes specified in 4251 * @a cb. 4241 4252 * 4242 4253 * @param pVCpu The cross context virtual CPU structure. … … 4245 4256 * 4246 4257 * @remarks Use this function only from \#VMEXIT's where the NRIP value is valid 4247 * when NRIP_SAVE is supported by the CPU! 4248 */ 4249 DECLINLINE(void) hmR0SvmUpdateRip(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t cb) 4258 * when NRIP_SAVE is supported by the CPU, otherwise use 4259 * hmR0SvmAdvanceRipDumb! 4260 */ 4261 DECLINLINE(void) hmR0SvmAdvanceRipHwAssist(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t cb) 4250 4262 { 4251 4263 if (pVCpu->CTX_SUFF(pVM)->hm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_NRIP_SAVE) 4252 4264 { 4253 4265 PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb; 4266 Assert(pVmcb->ctrl.u64NextRIP); 4254 4267 Assert(pVmcb->ctrl.u64NextRIP - pCtx->rip == cb); 4255 4268 pCtx->rip = pVmcb->ctrl.u64NextRIP; … … 4258 4271 pCtx->rip += cb; 4259 4272 4260 /* Update interrupt shadow. */ 4261 if ( VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS) 4262 && pCtx->rip != EMGetInhibitInterruptsPC(pVCpu)) 4263 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); 4264 } 4273 HMSVM_UPDATE_INTR_SHADOW(pVCpu, pCtx); 4274 } 4275 4276 4277 /** 4278 * Advances the guest RIP by the number of bytes specified in @a cb. This does 4279 * not make use of any hardware features to determine the instruction length. 4280 * 4281 * @param pVCpu The cross context virtual CPU structure. 4282 * @param pCtx Pointer to the guest-CPU context. 4283 * @param cb RIP increment value in bytes. 4284 */ 4285 DECLINLINE(void) hmR0SvmAdvanceRipDumb(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t cb) 4286 { 4287 pCtx->rip += cb; 4288 HMSVM_UPDATE_INTR_SHADOW(pVCpu, pCtx); 4289 } 4290 #undef HMSVM_UPDATE_INTR_SHADOW 4265 4291 4266 4292 … … 4305 4331 HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(); 4306 4332 4307 hmR0Svm UpdateRip(pVCpu, pCtx, 2);4333 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2); 4308 4334 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitWbinvd); 4309 4335 int rc = VINF_SUCCESS; … … 4320 4346 HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(); 4321 4347 4322 hmR0Svm UpdateRip(pVCpu, pCtx, 2);4348 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2); 4323 4349 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitInvd); 4324 4350 int rc = VINF_SUCCESS; … … 4338 4364 if (RT_LIKELY(rc == VINF_SUCCESS)) 4339 4365 { 4340 hmR0Svm UpdateRip(pVCpu, pCtx, 2);4366 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2); 4341 4367 HMSVM_CHECK_SINGLE_STEP(pVCpu, rc); 4342 4368 } … … 4361 4387 if (RT_LIKELY(rc == VINF_SUCCESS)) 4362 4388 { 4363 hmR0Svm UpdateRip(pVCpu, pCtx, 2);4389 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2); 4364 4390 pSvmTransient->fUpdateTscOffsetting = true; 4365 4391 … … 4386 4412 if (RT_LIKELY(rc == VINF_SUCCESS)) 4387 4413 { 4388 hmR0Svm UpdateRip(pVCpu, pCtx, 3);4414 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 3); 4389 4415 pSvmTransient->fUpdateTscOffsetting = true; 4390 4416 HMSVM_CHECK_SINGLE_STEP(pVCpu, rc); … … 4409 4435 if (RT_LIKELY(rc == VINF_SUCCESS)) 4410 4436 { 4411 hmR0Svm UpdateRip(pVCpu, pCtx, 2);4437 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2); 4412 4438 HMSVM_CHECK_SINGLE_STEP(pVCpu, rc); 4413 4439 } … … 4447 4473 HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(); 4448 4474 4449 hmR0Svm UpdateRip(pVCpu, pCtx, 1);4475 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 1); 4450 4476 int rc = EMShouldContinueAfterHalt(pVCpu, pCtx) ? VINF_SUCCESS : VINF_EM_HALT; 4451 4477 HMSVM_CHECK_SINGLE_STEP(pVCpu, rc); … … 4466 4492 if (RT_LIKELY(rc == VINF_SUCCESS)) 4467 4493 { 4468 hmR0Svm UpdateRip(pVCpu, pCtx, 3);4494 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 3); 4469 4495 HMSVM_CHECK_SINGLE_STEP(pVCpu, rc); 4470 4496 } … … 4490 4516 || rc == VINF_SUCCESS) 4491 4517 { 4492 hmR0Svm UpdateRip(pVCpu, pCtx, 3);4518 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 3); 4493 4519 4494 4520 if ( rc == VINF_EM_HALT … … 4629 4655 HMCPU_CF_SET(pVCpu, HM_CHANGED_SVM_GUEST_APIC_STATE); 4630 4656 } 4631 hmR0Svm UpdateRip(pVCpu, pCtx, 2);4657 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2); 4632 4658 rc = VINF_SUCCESS; 4633 4659 HMSVM_CHECK_SINGLE_STEP(pVCpu, rc); … … 5207 5233 { 5208 5234 if (rcStrict == VINF_SUCCESS) 5209 hmR0Svm UpdateRip(pVCpu, pCtx, 3 /* cbInstr */);5235 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 3 /* cbInstr */); 5210 5236 else 5211 5237 Assert( rcStrict == VINF_GIM_HYPERCALL_CONTINUING … … 5451 5477 if (rcStrict == VINF_SUCCESS) 5452 5478 { 5453 hmR0SvmUpdateRip(pVCpu, pCtx, cbInstr); 5479 /* #UD #VMEXIT does not have valid NRIP information, manually advance RIP. See @bugref{7270#c170}. */ 5480 hmR0SvmAdvanceRipDumb(pVCpu, pCtx, cbInstr); 5454 5481 rc = VINF_SUCCESS; 5455 5482 }
Note:
See TracChangeset
for help on using the changeset viewer.