VirtualBox

Changeset 77747 in vbox


Ignore:
Timestamp:
Mar 18, 2019 9:20:19 AM (6 years ago)
Author:
vboxsync
Message:

cpum.h: Nested VMX: bugref:9180 Added missing CPUMIsGuestVmxEntryCtlsSet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/cpum.h

    r77713 r77747  
    20222022
    20232023/**
    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     else
    2068         CPUMSetGuestVmxVmFailInvalid(pCtx);
    2069 }
    2070 
    2071 /**
    20722024 * Checks whether one of the given VM-exit controls are set when executing a
    20732025 * nested-guest.
     
    20902042}
    20912043
     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 */
     2056DECLINLINE(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 */
     2070DECLINLINE(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 */
     2080DECLINLINE(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 */
     2092DECLINLINE(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 */
     2105DECLINLINE(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}
    20922112
    20932113/**
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette