Changeset 78687 in vbox for trunk/include/VBox
- Timestamp:
- May 23, 2019 10:34:31 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 130763
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/cpum.h
r78632 r78687 2144 2144 } 2145 2145 2146 /** 2147 * Gets the nested-guest CR0 subject to the guest/host mask and the read-shadow. 2148 * 2149 * @returns The nested-guest CR0. 2150 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 2151 * @param pCtx Pointer to the context. 2152 */ 2153 DECLINLINE(uint64_t) CPUMGetGuestVmxMaskedCr0(PVMCPU pVCpu, PCCPUMCTX pCtx) 2154 { 2155 /* 2156 * For each CR0 bit owned by the host, the corresponding bit is loaded from the 2157 * CR0 read shadow. For each CR0 bit that is not owned by the host, the 2158 * corresponding bit from the guest CR0 is loaded. 2159 * 2160 * See Intel Spec. 25.3 "Changes To Instruction Behavior In VMX Non-root Operation". 2161 */ 2162 RT_NOREF(pVCpu); 2163 PCVMXVVMCS pVmcs = pCtx->hwvirt.vmx.CTX_SUFF(pVmcs); 2164 Assert(pVmcs); 2165 Assert(CPUMIsGuestInVmxRootMode(pCtx)); 2166 uint64_t const uGstCr0 = pCtx->cr0; 2167 uint64_t const fGstHostMask = pVmcs->u64Cr0Mask.u; 2168 uint64_t const fReadShadow = pVmcs->u64Cr0ReadShadow.u; 2169 return (fReadShadow & fGstHostMask) | (uGstCr0 & ~fGstHostMask); 2170 } 2171 2172 /** 2173 * Gets the nested-guest CR4 subject to the guest/host mask and the read-shadow. 2174 * 2175 * @returns The nested-guest CR4. 2176 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 2177 * @param pCtx Pointer to the context. 2178 */ 2179 DECLINLINE(uint64_t) CPUMGetGuestVmxMaskedCr4(PVMCPU pVCpu, PCCPUMCTX pCtx) 2180 { 2181 /* 2182 * For each CR4 bit owned by the host, the corresponding bit is loaded from the 2183 * CR4 read shadow. For each CR4 bit that is not owned by the host, the 2184 * corresponding bit from the guest CR4 is loaded. 2185 * 2186 * See Intel Spec. 25.3 "Changes To Instruction Behavior In VMX Non-root Operation". 2187 */ 2188 RT_NOREF(pVCpu); 2189 PCVMXVVMCS pVmcs = pCtx->hwvirt.vmx.CTX_SUFF(pVmcs); 2190 Assert(pVmcs); 2191 Assert(CPUMIsGuestInVmxRootMode(pCtx)); 2192 uint64_t const uGstCr4 = pCtx->cr4; 2193 uint64_t const fGstHostMask = pVmcs->u64Cr4Mask.u; 2194 uint64_t const fReadShadow = pVmcs->u64Cr4ReadShadow.u; 2195 return (fReadShadow & fGstHostMask) | (uGstCr4 & ~fGstHostMask); 2196 } 2197 2146 2198 # endif /* !IN_RC */ 2147 2199
Note:
See TracChangeset
for help on using the changeset viewer.