- Timestamp:
- Oct 5, 2018 3:36:30 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
r74609 r74618 5210 5210 5211 5211 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX 5212 /* CR x bits are subject to masking when in VMX non-root mode. */5212 /* CR0/CR4 reads are subject to masking when in VMX non-root mode. */ 5213 5213 if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu)) 5214 5214 { 5215 if (iCrReg == 0) 5216 crX = iemVmxGetMaskedCr0(pVCpu, crX); 5215 if ( iCrReg == 0 5216 || iCrReg == 4) 5217 crX = iemVmxGetMaskedCrX(pVCpu, iCrReg, crX); 5217 5218 } 5218 5219 #endif … … 5502 5503 IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CR3); 5503 5504 5504 /* clear bit 63 from the source operand and indicateno invalidations are required. */5505 /* Bit 63 being clear in the source operand with PCIDE indicates no invalidations are required. */ 5505 5506 if ( (pVCpu->cpum.GstCtx.cr4 & X86_CR4_PCIDE) 5506 5507 && (uNewCrX & RT_BIT_64(63))) … … 5513 5514 } 5514 5515 5515 /* check / mask the value. */5516 /* Check / mask the value. */ 5516 5517 if (uNewCrX & UINT64_C(0xfff0000000000000)) 5517 5518 { -
trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h
r74608 r74618 901 901 902 902 /** 903 * Gets the nested-guest CR0 mask subjected to the CR0 guest/host mask and the CR0 903 * Gets the nested-guest CR0/CR4 mask subjected to the corresponding guest/host mask 904 * and the read-shadow. 905 * 906 * @returns The masked CR0/CR4. 907 * @param pVCpu The cross context virtual CPU structure. 908 * @param iCrReg The control register (either CR0 or CR4). 909 * @param uGuestCrX The current guest CR0 or guest CR4. 910 */ 911 IEM_STATIC uint64_t iemVmxGetMaskedCrX(PVMCPU pVCpu, uint8_t iCrReg, uint64_t uGuestCrX) 912 { 913 Assert(IEM_VMX_IS_NON_ROOT_MODE(pVCpu)); 914 Assert(iCrReg == 0 || iCrReg == 4); 915 916 PCVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs); 917 Assert(pVmcs); 918 919 /* 920 * For each CR0 or CR4 bit owned by the host, the corresponding bit is loaded from the 921 * CR0 read shadow or CR4 read shadow. For each CR0 or CR4 bit that is not owned by the 922 * host, the corresponding bit from the guest CR0 or guest CR4 is loaded. 923 * 924 * See Intel Spec. 25.3 "Changes To Instruction Behavior In VMX Non-root Operation". 925 */ 926 uint64_t fGstHostMask; 927 uint64_t fReadShadow; 928 if (iCrReg == 0) 929 { 930 fGstHostMask = pVmcs->u64Cr0Mask.u; 931 fReadShadow = pVmcs->u64Cr0ReadShadow.u; 932 } 933 else 934 { 935 fGstHostMask = pVmcs->u64Cr4Mask.u; 936 fReadShadow = pVmcs->u64Cr4ReadShadow.u; 937 } 938 939 uint64_t const fMaskedCrX = (fReadShadow & fGstHostMask) | (uGuestCrX & ~fGstHostMask); 940 return fMaskedCrX; 941 } 942 943 944 945 /** 946 * Gets the nested-guest CR4 mask subjected to the CR0 guest/host mask and the CR4 904 947 * read-shadow. 905 948 *
Note:
See TracChangeset
for help on using the changeset viewer.