Changeset 67660 in vbox
- Timestamp:
- Jun 28, 2017 10:17:05 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/hm_svm.h
r66668 r67660 297 297 /** @} */ 298 298 299 /** @name SVMVMCB.u64ExitInfo1 for Mov CR Xaccesses.300 * @{ 301 */ 302 /** The access was via Mov CRx instruction bit number. */299 /** @name SVMVMCB.u64ExitInfo1 for Mov CRx accesses. 300 * @{ 301 */ 302 /** The mask of whether the access was via a Mov CRx instruction. */ 303 303 #define SVM_EXIT1_MOV_CRX_MASK RT_BIT_64(63) 304 /** @} */ 305 304 /** The mask for the GPR number of the Mov CRx instruction. */ 305 #define SVM_EXIT1_MOV_CRX_GPR_NUMBER 0xf 306 /** @} */ 307 308 /** @name SVMVMCB.u64ExitInfo1 for Mov DRx accesses. 309 * @{ 310 */ 311 /** The mask for the GPR number of the Mov DRx instruction. */ 312 #define SVM_EXIT1_MOV_DRX_GPR_NUMBER 0xf 313 /** @} */ 306 314 307 315 /** @name SVMVMCB.ctrl.u64InterceptCtrl -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r67529 r67660 4572 4572 PVM pVM = pVCpu->CTX_SUFF(pVM); 4573 4573 Assert(!pVM->hm.s.fNestedPaging); 4574 4575 /** @todo Decode Assist. */ 4574 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitInvlpg); 4575 4576 if (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSIST) 4577 { 4578 Assert(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE); 4579 PCSVMVMCB pVmcb = (PCSVMVMCB)pVCpu->hm.s.svm.pvVmcb; 4580 uint8_t const cbInstr = pVmcb->ctrl.u64NextRIP - pCtx->rip; 4581 RTGCPTR const GCPtrPage = pVmcb->ctrl.u64ExitInfo1; 4582 VBOXSTRICTRC rcStrict = IEMExecDecodedInvlpg(pVCpu, cbInstr, GCPtrPage); 4583 HMSVM_CHECK_SINGLE_STEP(pVCpu, rcStrict); 4584 return VBOXSTRICTRC_VAL(rcStrict); 4585 } 4586 4576 4587 int rc = hmR0SvmInterpretInvlpg(pVM, pVCpu, pCtx); /* Updates RIP if successful. */ 4577 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitInvlpg);4578 4588 Assert(rc == VINF_SUCCESS || rc == VERR_EM_INTERPRETER); 4579 4589 HMSVM_CHECK_SINGLE_STEP(pVCpu, rc); … … 4672 4682 4673 4683 Log4(("hmR0SvmExitReadCRx: CS:RIP=%04x:%#RX64\n", pCtx->cs.Sel, pCtx->rip)); 4674 4675 /** @todo Decode Assist. */ 4684 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitCRxRead[pSvmTransient->u64ExitCode - SVM_EXIT_READ_CR0]); 4685 4686 PVM pVM = pVCpu->CTX_SUFF(pVM); 4687 if (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSIST) 4688 { 4689 Assert(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE); 4690 PCSVMVMCB pVmcb = (PCSVMVMCB)pVCpu->hm.s.svm.pvVmcb; 4691 bool const fMovCRx = RT_BOOL(pVmcb->ctrl.u64ExitInfo1 & SVM_EXIT1_MOV_CRX_MASK); 4692 if (fMovCRx) 4693 { 4694 uint8_t const cbInstr = pVmcb->ctrl.u64NextRIP - pCtx->rip; 4695 uint8_t const iCrReg = pSvmTransient->u64ExitCode - SVM_EXIT_READ_CR0; 4696 uint8_t const iGReg = pVmcb->ctrl.u64ExitInfo1 & SVM_EXIT1_MOV_CRX_GPR_NUMBER; 4697 VBOXSTRICTRC rcStrict = IEMExecDecodedMovCRxRead(pVCpu, cbInstr, iGReg, iCrReg); 4698 HMSVM_CHECK_SINGLE_STEP(pVCpu, rcStrict); 4699 return VBOXSTRICTRC_VAL(rcStrict); 4700 } 4701 /* else: SMSW instruction, fall back below to IEM for this. */ 4702 } 4703 4676 4704 VBOXSTRICTRC rc2 = EMInterpretInstruction(pVCpu, CPUMCTX2CORE(pCtx), 0 /* pvFault */); 4677 4705 int rc = VBOXSTRICTRC_VAL(rc2); … … 4679 4707 ("hmR0SvmExitReadCRx: EMInterpretInstruction failed rc=%Rrc\n", rc)); 4680 4708 Assert((pSvmTransient->u64ExitCode - SVM_EXIT_READ_CR0) <= 15); 4681 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitCRxRead[pSvmTransient->u64ExitCode - SVM_EXIT_READ_CR0]);4682 4709 HMSVM_CHECK_SINGLE_STEP(pVCpu, rc); 4683 4710 return rc; … … 4692 4719 HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(); 4693 4720 4694 /** @todo Decode Assist. */ 4695 VBOXSTRICTRC rcStrict = IEMExecOneBypassEx(pVCpu, CPUMCTX2CORE(pCtx), NULL); 4696 if (RT_UNLIKELY( rcStrict == VERR_IEM_ASPECT_NOT_IMPLEMENTED 4697 || rcStrict == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 4698 rcStrict = VERR_EM_INTERPRETER; 4721 uint8_t const iCrReg = pSvmTransient->u64ExitCode - SVM_EXIT_WRITE_CR0; 4722 Assert(iCrReg <= 15); 4723 4724 VBOXSTRICTRC rcStrict; 4725 PVM pVM = pVCpu->CTX_SUFF(pVM); 4726 bool fDecodedInstr = false; 4727 if (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSIST) 4728 { 4729 Assert(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE); 4730 PCSVMVMCB pVmcb = (PCSVMVMCB)pVCpu->hm.s.svm.pvVmcb; 4731 bool const fMovCRx = RT_BOOL(pVmcb->ctrl.u64ExitInfo1 & SVM_EXIT1_MOV_CRX_MASK); 4732 if (fMovCRx) 4733 { 4734 uint8_t const cbInstr = pVmcb->ctrl.u64NextRIP - pCtx->rip; 4735 uint8_t const iGReg = pVmcb->ctrl.u64ExitInfo1 & SVM_EXIT1_MOV_CRX_GPR_NUMBER; 4736 rcStrict = IEMExecDecodedMovCRxWrite(pVCpu, cbInstr, iCrReg, iGReg); 4737 fDecodedInstr = true; 4738 } 4739 /* else: LMSW or CLTS instruction, fall back below to IEM for this. */ 4740 } 4741 4742 if (!fDecodedInstr) 4743 { 4744 rcStrict = IEMExecOneBypassEx(pVCpu, CPUMCTX2CORE(pCtx), NULL); 4745 if (RT_UNLIKELY( rcStrict == VERR_IEM_ASPECT_NOT_IMPLEMENTED 4746 || rcStrict == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 4747 rcStrict = VERR_EM_INTERPRETER; 4748 } 4749 4699 4750 if (rcStrict == VINF_SUCCESS) 4700 4751 { 4701 /* RIP has been updated by EMInterpretInstruction(). */ 4702 Assert((pSvmTransient->u64ExitCode - SVM_EXIT_WRITE_CR0) <= 15); 4703 switch (pSvmTransient->u64ExitCode - SVM_EXIT_WRITE_CR0) 4752 switch (iCrReg) 4704 4753 { 4705 4754 case 0: /* CR0. */ … … 4708 4757 4709 4758 case 3: /* CR3. */ 4710 Assert(!pV Cpu->CTX_SUFF(pVM)->hm.s.fNestedPaging);4759 Assert(!pVM->hm.s.fNestedPaging); 4711 4760 HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR3); 4712 4761 break; … … 4722 4771 default: 4723 4772 AssertMsgFailed(("hmR0SvmExitWriteCRx: Invalid/Unexpected Write-CRx exit. u64ExitCode=%#RX64 %#x\n", 4724 pSvmTransient->u64ExitCode, pSvmTransient->u64ExitCode - SVM_EXIT_WRITE_CR0));4773 pSvmTransient->u64ExitCode, iCrReg)); 4725 4774 break; 4726 4775 } -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r67529 r67660 1648 1648 1649 1649 /* 1650 * SVM R0 code assumes if the decode-assist feature exists, NRIP feature exists too. 1651 */ 1652 AssertLogRelReturn( !(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSIST) 1653 || (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE), 1654 VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO); 1655 1656 /* 1650 1657 * Nested paging is determined in HMR3Init, verify the sanity of that. 1651 1658 */
Note:
See TracChangeset
for help on using the changeset viewer.