Changeset 77747 in vbox
- Timestamp:
- Mar 18, 2019 9:20:19 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/cpum.h
r77713 r77747 2022 2022 2023 2023 /** 2024 * Implements VMSucceed for VMX instruction success.2025 *2026 * @param pVCpu The cross context virtual CPU structure.2027 */2028 DECLINLINE(void) CPUMSetGuestVmxVmSucceed(PCPUMCTX pCtx)2029 {2030 pCtx->eflags.u32 &= ~(X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF);2031 }2032 2033 /**2034 * Implements VMFailInvalid for VMX instruction failure.2035 *2036 * @param pVCpu The cross context virtual CPU structure.2037 */2038 DECLINLINE(void) CPUMSetGuestVmxVmFailInvalid(PCPUMCTX pCtx)2039 {2040 pCtx->eflags.u32 &= ~(X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF);2041 pCtx->eflags.u32 |= X86_EFL_CF;2042 }2043 2044 /**2045 * Implements VMFailValid for VMX instruction failure.2046 *2047 * @param pVCpu The cross context virtual CPU structure.2048 * @param enmInsErr The VM instruction error.2049 */2050 DECLINLINE(void) CPUMSetGuestVmxVmFailValid(PCPUMCTX pCtx, VMXINSTRERR enmInsErr)2051 {2052 pCtx->eflags.u32 &= ~(X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF);2053 pCtx->eflags.u32 |= X86_EFL_ZF;2054 pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32RoVmInstrError = enmInsErr;2055 }2056 2057 /**2058 * Implements VMFail for VMX instruction failure.2059 *2060 * @param pVCpu The cross context virtual CPU structure.2061 * @param enmInsErr The VM instruction error.2062 */2063 DECLINLINE(void) CPUMSetGuestVmxVmFail(PCPUMCTX pCtx, VMXINSTRERR enmInsErr)2064 {2065 if (pCtx->hwvirt.vmx.GCPhysVmcs != NIL_RTGCPHYS)2066 CPUMSetGuestVmxVmFailValid(pCtx, enmInsErr);2067 else2068 CPUMSetGuestVmxVmFailInvalid(pCtx);2069 }2070 2071 /**2072 2024 * Checks whether one of the given VM-exit controls are set when executing a 2073 2025 * nested-guest. … … 2090 2042 } 2091 2043 2044 /** 2045 * Checks whether one of the given VM-entry controls are set when executing a 2046 * nested-guest. 2047 * 2048 * @returns @c true if set, @c false otherwise. 2049 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 2050 * @param pCtx Pointer to the context. 2051 * @param uEntryCtls The VM-entry controls to check. 2052 * 2053 * @remarks This does not check if all given controls are set if more than one 2054 * control is passed in @a uEntryCtls. 2055 */ 2056 DECLINLINE(bool) CPUMIsGuestVmxEntryCtlsSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uEntryCtls) 2057 { 2058 RT_NOREF(pVCpu); 2059 Assert(pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_VMX); 2060 Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode); 2061 Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)); 2062 return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32EntryCtls & uEntryCtls); 2063 } 2064 2065 /** 2066 * Implements VMSucceed for VMX instruction success. 2067 * 2068 * @param pVCpu The cross context virtual CPU structure. 2069 */ 2070 DECLINLINE(void) CPUMSetGuestVmxVmSucceed(PCPUMCTX pCtx) 2071 { 2072 pCtx->eflags.u32 &= ~(X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF); 2073 } 2074 2075 /** 2076 * Implements VMFailInvalid for VMX instruction failure. 2077 * 2078 * @param pVCpu The cross context virtual CPU structure. 2079 */ 2080 DECLINLINE(void) CPUMSetGuestVmxVmFailInvalid(PCPUMCTX pCtx) 2081 { 2082 pCtx->eflags.u32 &= ~(X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF); 2083 pCtx->eflags.u32 |= X86_EFL_CF; 2084 } 2085 2086 /** 2087 * Implements VMFailValid for VMX instruction failure. 2088 * 2089 * @param pVCpu The cross context virtual CPU structure. 2090 * @param enmInsErr The VM instruction error. 2091 */ 2092 DECLINLINE(void) CPUMSetGuestVmxVmFailValid(PCPUMCTX pCtx, VMXINSTRERR enmInsErr) 2093 { 2094 pCtx->eflags.u32 &= ~(X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF); 2095 pCtx->eflags.u32 |= X86_EFL_ZF; 2096 pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32RoVmInstrError = enmInsErr; 2097 } 2098 2099 /** 2100 * Implements VMFail for VMX instruction failure. 2101 * 2102 * @param pVCpu The cross context virtual CPU structure. 2103 * @param enmInsErr The VM instruction error. 2104 */ 2105 DECLINLINE(void) CPUMSetGuestVmxVmFail(PCPUMCTX pCtx, VMXINSTRERR enmInsErr) 2106 { 2107 if (pCtx->hwvirt.vmx.GCPhysVmcs != NIL_RTGCPHYS) 2108 CPUMSetGuestVmxVmFailValid(pCtx, enmInsErr); 2109 else 2110 CPUMSetGuestVmxVmFailInvalid(pCtx); 2111 } 2092 2112 2093 2113 /**
Note:
See TracChangeset
for help on using the changeset viewer.