Changeset 78716 in vbox
- Timestamp:
- May 24, 2019 11:17:08 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 130795
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h
r78689 r78716 3050 3050 uint8_t cbInstr) 3051 3051 { 3052 /* 3053 * LMSW VM-exits are subject to the CR0 guest/host mask and the CR0 read shadow. 3054 * 3055 * See Intel spec. 24.6.6 "Guest/Host Masks and Read Shadows for CR0 and CR4". 3056 * See Intel spec. 25.1.3 "Instructions That Cause VM Exits Conditionally". 3057 */ 3058 PCVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs); 3059 Assert(pVmcs); 3060 Assert(pu16NewMsw); 3061 3062 bool fIntercept = false; 3063 uint32_t const fGstHostMask = pVmcs->u64Cr0Mask.u; 3064 uint32_t const fReadShadow = pVmcs->u64Cr0ReadShadow.u; 3065 3066 /* 3067 * LMSW can never clear CR0.PE but it may set it. Hence, we handle the 3068 * CR0.PE case first, before the rest of the bits in the MSW. 3069 * 3070 * If CR0.PE is owned by the host and CR0.PE differs between the 3071 * MSW (source operand) and the read-shadow, we must cause a VM-exit. 3072 */ 3073 if ( (fGstHostMask & X86_CR0_PE) 3074 && (*pu16NewMsw & X86_CR0_PE) 3075 && !(fReadShadow & X86_CR0_PE)) 3076 fIntercept = true; 3077 3078 /* 3079 * If CR0.MP, CR0.EM or CR0.TS is owned by the host, and the corresponding 3080 * bits differ between the MSW (source operand) and the read-shadow, we must 3081 * cause a VM-exit. 3082 */ 3083 uint32_t fGstHostLmswMask = fGstHostMask & (X86_CR0_MP | X86_CR0_EM | X86_CR0_TS); 3084 if ((fReadShadow & fGstHostLmswMask) != (*pu16NewMsw & fGstHostLmswMask)) 3085 fIntercept = true; 3086 3087 if (fIntercept) 3052 if (CPUMIsGuestVmxLmswInterceptSet(pVCpu, &pVCpu->cpum.GstCtx, *pu16NewMsw)) 3088 3053 { 3089 3054 Log2(("lmsw: Guest intercept -> VM-exit\n")); … … 3115 3080 * See Intel Spec. 25.3 "Changes To Instruction Behavior In VMX Non-root Operation". 3116 3081 */ 3117 fGstHostLmswMask = fGstHostMask & (X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS); 3118 *pu16NewMsw = (uGuestCr0 & fGstHostLmswMask) | (*pu16NewMsw & ~fGstHostLmswMask); 3082 PCVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs); 3083 Assert(pVmcs); 3084 uint32_t const fGstHostMask = pVmcs->u64Cr0Mask.u; 3085 uint32_t const fGstHostLmswMask = fGstHostMask & (X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS); 3086 3087 *pu16NewMsw = (uGuestCr0 & fGstHostLmswMask) | (*pu16NewMsw & ~fGstHostLmswMask); 3119 3088 3120 3089 return VINF_VMX_INTERCEPT_NOT_ACTIVE;
Note:
See TracChangeset
for help on using the changeset viewer.