Changeset 74605 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Oct 4, 2018 8:38:26 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
r74603 r74605 5784 5784 5785 5785 IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CR0); 5786 5787 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX 5788 /* Check nested-guest VMX intercept. */ 5789 if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu)) 5790 { 5791 VBOXSTRICTRC rcStrict = iemVmxVmexitInstrClts(pVCpu, cbInstr); 5792 if (rcStrict == VINF_PERMISSION_DENIED) 5793 { 5794 iemRegAddToRipAndClearRF(pVCpu, cbInstr); 5795 return VINF_SUCCESS; 5796 } 5797 else if (rcStrict != VINF_VMX_INTERCEPT_NOT_ACTIVE) 5798 return rcStrict; 5799 } 5800 #endif 5801 5786 5802 uint64_t uNewCr0 = pVCpu->cpum.GstCtx.cr0; 5787 5803 uNewCr0 &= ~X86_CR0_TS; -
trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h
r74603 r74605 2540 2540 * 2541 2541 * @returns Strict VBox status code. 2542 * @retval VINF_VMX_VMEXIT when the VM-exit is successful. 2543 * @retval VINF_EM_TRIPLE_FAULT when VM-exit is unsuccessful and leads to a 2544 * triple-fault. 2545 * 2542 2546 * @param pVCpu The cross context virtual CPU structure. 2543 2547 * @param uExitReason The VM-exit reason. … … 2593 2597 * VM-exit information. 2594 2598 * 2599 * @returns Strict VBox status code. 2595 2600 * @param pVCpu The cross context virtual CPU structure. 2596 2601 * @param pExitInfo Pointer to the VM-exit instruction information struct. … … 2844 2849 *pu16NewMsw = (uGuestCr0 & fGstHostLmswMask) | (*pu16NewMsw & ~fGstHostLmswMask); 2845 2850 2851 return VINF_VMX_INTERCEPT_NOT_ACTIVE; 2852 } 2853 2854 2855 /** 2856 * VMX VM-exit handler for VM-exits due to CLTS. 2857 * 2858 * @returns Strict VBox status code. 2859 * @retval VINF_PERMISSION_DENIED if the CLTS instruction did not cause a VM-exit 2860 * but must not modify the guest CR0.TS bit. 2861 * @retval VINF_VMX_INTERCEPT_NOT_ACTIVE if the CLTS instruction did not cause a 2862 * VM-exit but modification to the guest CR0.TS bit is allowed (subject to 2863 * CR0 fixed bits in VMX operation). 2864 * 2865 * @param pVCpu The cross context virtual CPU structure. 2866 * @param cbInstr The instruction length (in bytes). 2867 */ 2868 IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstrClts(PVMCPU pVCpu, uint8_t cbInstr) 2869 { 2870 PCVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs); 2871 Assert(pVmcs); 2872 2873 uint32_t const fGstHostMask = pVmcs->u64Cr0Mask.u; 2874 uint32_t const fReadShadow = pVmcs->u64Cr0ReadShadow.u; 2875 2876 /* 2877 * If CR0.TS is owned by the host: 2878 * - If CR0.TS is set in the read-shadow, we must cause a VM-exit. 2879 * - If CR0.TS is cleared in the read-shadow, no VM-exit is triggered, however 2880 * the CLTS instruction is not allowed to modify CR0.TS. 2881 * 2882 * See Intel spec. 25.1.3 "Instructions That Cause VM Exits Conditionally". 2883 */ 2884 if (fGstHostMask & X86_CR0_TS) 2885 { 2886 if (fReadShadow & X86_CR0_TS) 2887 { 2888 Log2(("clts: Guest intercept -> VM-exit\n")); 2889 2890 VMXVEXITINFO ExitInfo; 2891 RT_ZERO(ExitInfo); 2892 ExitInfo.uReason = VMX_EXIT_MOV_CRX; 2893 ExitInfo.cbInstr = cbInstr; 2894 2895 ExitInfo.u64Qual = RT_BF_MAKE(VMX_BF_EXIT_QUAL_CRX_REGISTER, 0) /* CR0 */ 2896 | RT_BF_MAKE(VMX_BF_EXIT_QUAL_CRX_ACCESS, VMX_EXIT_QUAL_CRX_ACCESS_CLTS); 2897 return iemVmxVmexitInstrWithInfo(pVCpu, &ExitInfo); 2898 } 2899 2900 return VINF_PERMISSION_DENIED; 2901 } 2902 2903 /* 2904 * If CR0.TS is not owned by the host, the CLTS instructions operates normally 2905 * and may modify CR0.TS (subject to CR0 fixed bits in VMX operation). 2906 */ 2846 2907 return VINF_VMX_INTERCEPT_NOT_ACTIVE; 2847 2908 }
Note:
See TracChangeset
for help on using the changeset viewer.