- Timestamp:
- Oct 4, 2018 10:11:44 AM (6 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r74605 r74607 5719 5719 * 5720 5720 * @param iCrReg The CRx register to write (valid). 5721 * @param iGReg The general register to load the DRx value from.5721 * @param iGReg The general register to load the CRx value from. 5722 5722 */ 5723 5723 IEM_CIMPL_DEF_2(iemCImpl_mov_Cd_Rd, uint8_t, iCrReg, uint8_t, iGReg) … … 5735 5735 else 5736 5736 uNewCrX = iemGRegFetchU32(pVCpu, iGReg); 5737 5738 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX 5739 if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu)) 5740 { 5741 if (iCrReg == 0) 5742 { 5743 IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CR0); 5744 VBOXSTRICTRC rcStrict = iemVmxVmexitInstrMovCr0Write(pVCpu, pVCpu->cpum.GstCtx.cr0, &uNewCrX, iGReg, cbInstr); 5745 if (rcStrict != VINF_VMX_INTERCEPT_NOT_ACTIVE) 5746 return rcStrict; 5747 } 5748 } 5749 #endif 5750 5737 5751 return IEM_CIMPL_CALL_4(iemCImpl_load_CrX, iCrReg, uNewCrX, IEMACCESSCRX_MOV_CRX, iGReg); 5738 5752 } -
trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h
r74605 r74607 1300 1300 * 1301 1301 * @param pVCpu The cross context virtual CPU structure. 1302 * @param cbInstr The VM-exit instruction length (in bytes).1302 * @param cbInstr The VM-exit instruction length in bytes. 1303 1303 */ 1304 1304 DECL_FORCE_INLINE(void) iemVmxVmcsSetExitInstrLen(PVMCPU pVCpu, uint32_t cbInstr) … … 2645 2645 * @param pVCpu The cross context virtual CPU structure. 2646 2646 * @param uExitReason The VM-exit reason. 2647 * @param cbInstr The instruction length (in bytes).2647 * @param cbInstr The instruction length in bytes. 2648 2648 */ 2649 2649 IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstr(PVMCPU pVCpu, uint32_t uExitReason, uint8_t cbInstr) … … 2691 2691 * @param uExitReason The VM-exit reason. 2692 2692 * @param uInstrid The instruction identity (VMXINSTRID_XXX). 2693 * @param cbInstr The instruction length (in bytes).2693 * @param cbInstr The instruction length in bytes. 2694 2694 * 2695 2695 * @remarks Do not use this for INS/OUTS instruction. … … 2749 2749 * @param pVCpu The cross context virtual CPU structure. 2750 2750 * @param GCPtrPage The guest-linear address of the page being invalidated. 2751 * @param cbInstr The instruction length (in bytes).2751 * @param cbInstr The instruction length in bytes. 2752 2752 */ 2753 2753 IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstrInvlpg(PVMCPU pVCpu, RTGCPTR GCPtrPage, uint8_t cbInstr) … … 2776 2776 * of a memory operand. For register operand, pass 2777 2777 * NIL_RTGCPTR. 2778 * @param cbInstr The instruction length (in bytes).2778 * @param cbInstr The instruction length in bytes. 2779 2779 */ 2780 2780 IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstrLmsw(PVMCPU pVCpu, uint32_t uGuestCr0, uint16_t *pu16NewMsw, RTGCPTR GCPtrEffDst, … … 2864 2864 * 2865 2865 * @param pVCpu The cross context virtual CPU structure. 2866 * @param cbInstr The instruction length (in bytes).2866 * @param cbInstr The instruction length in bytes. 2867 2867 */ 2868 2868 IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstrClts(PVMCPU pVCpu, uint8_t cbInstr) … … 2905 2905 * and may modify CR0.TS (subject to CR0 fixed bits in VMX operation). 2906 2906 */ 2907 return VINF_VMX_INTERCEPT_NOT_ACTIVE; 2908 } 2909 2910 2911 /** 2912 * VMX VM-exit handler for VM-exits due to 'Mov CR0, GReg' (CR0 write). 2913 * 2914 * @returns Strict VBox status code. 2915 * @param pVCpu The cross context virtual CPU structure. 2916 * @param puNewCr0 Pointer to the new CR0 value. Will be updated if no 2917 * VM-exit is triggered. 2918 * @param iGReg The general register to load the CR0 value from. 2919 * @param cbInstr The instruction length in bytes. 2920 */ 2921 IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstrMovCr0Write(PVMCPU pVCpu, uint64_t uGuestCr0, uint64_t *puNewCr0, uint8_t iGReg, 2922 uint8_t cbInstr) 2923 { 2924 PCVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs); 2925 Assert(pVmcs); 2926 Assert(puNewCr0); 2927 2928 uint32_t const fGstHostMask = pVmcs->u64Cr0Mask.u; 2929 uint32_t const fReadShadow = pVmcs->u64Cr0ReadShadow.u; 2930 2931 /* 2932 * For any CR0 bit owned by the host (in the CR0 guest/host mask), if the 2933 * corresponding bits differ between the source operand and the read-shadow, 2934 * we must cause a VM-exit. 2935 * 2936 * See Intel spec. 25.1.3 "Instructions That Cause VM Exits Conditionally". 2937 */ 2938 if ((fReadShadow & fGstHostMask) != (*puNewCr0 & fGstHostMask)) 2939 { 2940 Log2(("mov_Cr_Rd: Guest intercept -> VM-exit\n")); 2941 2942 VMXVEXITINFO ExitInfo; 2943 RT_ZERO(ExitInfo); 2944 ExitInfo.uReason = VMX_EXIT_MOV_CRX; 2945 ExitInfo.cbInstr = cbInstr; 2946 2947 ExitInfo.u64Qual = RT_BF_MAKE(VMX_BF_EXIT_QUAL_CRX_REGISTER, 0) /* CR0 */ 2948 | RT_BF_MAKE(VMX_BF_EXIT_QUAL_CRX_ACCESS, VMX_EXIT_QUAL_CRX_ACCESS_WRITE) 2949 | RT_BF_MAKE(VMX_BF_EXIT_QUAL_CRX_GENREG, iGReg); 2950 return iemVmxVmexitInstrWithInfo(pVCpu, &ExitInfo); 2951 } 2952 2953 /* 2954 * If Mov-to-CR0 did not cause a VM-exit, any bits owned by the host must not 2955 * be modified the instruction. 2956 * 2957 * See Intel Spec. 25.3 "Changes To Instruction Behavior In VMX Non-root Operation". 2958 */ 2959 *puNewCr0 = (uGuestCr0 & fGstHostMask) | (*puNewCr0 & ~fGstHostMask); 2960 2907 2961 return VINF_VMX_INTERCEPT_NOT_ACTIVE; 2908 2962 } … … 4862 4916 * @returns Strict VBox status code. 4863 4917 * @param pVCpu The cross context virtual CPU structure. 4864 * @param cbInstr The instruction length .4918 * @param cbInstr The instruction length in bytes. 4865 4919 * @param uInstrId The instruction identity (VMXINSTRID_VMLAUNCH or 4866 4920 * VMXINSTRID_VMRESUME). … … 5139 5193 * @returns Strict VBox status code. 5140 5194 * @param pVCpu The cross context virtual CPU structure. 5141 * @param cbInstr The instruction length .5195 * @param cbInstr The instruction length in bytes. 5142 5196 * @param pu64Dst Where to write the VMCS value (only updated when 5143 5197 * VINF_SUCCESS is returned). … … 5245 5299 * @returns Strict VBox status code. 5246 5300 * @param pVCpu The cross context virtual CPU structure. 5247 * @param cbInstr The instruction length .5301 * @param cbInstr The instruction length in bytes. 5248 5302 * @param pu64Dst Where to store the VMCS field's value. 5249 5303 * @param u64FieldEnc The VMCS field encoding. … … 5271 5325 * @returns Strict VBox status code. 5272 5326 * @param pVCpu The cross context virtual CPU structure. 5273 * @param cbInstr The instruction length .5327 * @param cbInstr The instruction length in bytes. 5274 5328 * @param pu32Dst Where to store the VMCS field's value. 5275 5329 * @param u32FieldEnc The VMCS field encoding. … … 5299 5353 * @returns Strict VBox status code. 5300 5354 * @param pVCpu The cross context virtual CPU structure. 5301 * @param cbInstr The instruction length .5355 * @param cbInstr The instruction length in bytes. 5302 5356 * @param iEffSeg The effective segment register to use with @a u64Val. 5303 5357 * Pass UINT8_MAX if it is a register access. … … 5352 5406 * @returns Strict VBox status code. 5353 5407 * @param pVCpu The cross context virtual CPU structure. 5354 * @param cbInstr The instruction length .5408 * @param cbInstr The instruction length in bytes. 5355 5409 * @param iEffSeg The effective segment register to use with @a u64Val. 5356 5410 * Pass UINT8_MAX if it is a register access. … … 5502 5556 * @returns Strict VBox status code. 5503 5557 * @param pVCpu The cross context virtual CPU structure. 5504 * @param cbInstr The instruction length .5558 * @param cbInstr The instruction length in bytes. 5505 5559 * @param iEffSeg The effective segment register to use with @a GCPtrVmcs. 5506 5560 * @param GCPtrVmcs The linear address of the VMCS pointer. … … 5616 5670 * @returns Strict VBox status code. 5617 5671 * @param pVCpu The cross context virtual CPU structure. 5618 * @param cbInstr The instruction length .5672 * @param cbInstr The instruction length in bytes. 5619 5673 * @param iEffSeg The effective segment register to use with @a GCPtrVmcs. 5620 5674 * @param GCPtrVmcs The linear address of where to store the current VMCS … … 5668 5722 * @returns Strict VBox status code. 5669 5723 * @param pVCpu The cross context virtual CPU structure. 5670 * @param cbInstr The instruction length .5724 * @param cbInstr The instruction length in bytes. 5671 5725 * @param GCPtrVmcs The linear address of the current VMCS pointer. 5672 5726 * @param pExitInfo Pointer to the VM-exit information struct. Optional, can … … 5803 5857 * @returns Strict VBox status code. 5804 5858 * @param pVCpu The cross context virtual CPU structure. 5805 * @param cbInstr The instruction length .5859 * @param cbInstr The instruction length in bytes. 5806 5860 * @param iEffSeg The effective segment register to use with @a 5807 5861 * GCPtrVmxon.
Note:
See TracChangeset
for help on using the changeset viewer.