VirtualBox

Changeset 74834 in vbox for trunk


Ignore:
Timestamp:
Oct 15, 2018 7:48:17 AM (6 years ago)
Author:
vboxsync
Message:

VMM/CPUM, TRPM: Nested VMX: bugref:9180 VM-exit bits; Acknowledge interrupt on exit intercept.

Location:
trunk
Files:
4 edited

Legend:

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

    r74648 r74834  
    18771877
    18781878/**
    1879  * Checks whether the given Pin-based VM-execution controls are set when executing a
    1880  * nested-guest.
     1879 * Checks whether one of the given Pin-based VM-execution controls are set when
     1880 * executing a nested-guest.
    18811881 *
    18821882 * @returns @c true if set, @c false otherwise.
    18831883 * @param   pVCpu       The cross context virtual CPU structure of the calling EMT.
    18841884 * @param   pCtx        Pointer to the context.
    1885  * @param   uPinCtl     The Pin-based VM-execution controls to check.
     1885 * @param   uPinCtls    The Pin-based VM-execution controls to check.
    18861886 *
    18871887 * @remarks This does not check if all given controls are set if more than one
    18881888 *          control is passed in @a uPinCtl.
    18891889 */
    1890 DECLINLINE(bool) CPUMIsGuestVmxPinCtlsSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uPinCtl)
     1890DECLINLINE(bool) CPUMIsGuestVmxPinCtlsSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uPinCtls)
    18911891{
    18921892    RT_NOREF(pVCpu);
     
    18941894    Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode);
    18951895    Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs));
    1896     return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32PinCtls & uPinCtl);
    1897 }
    1898 
    1899 /**
    1900  * Checks whether the given Processor-based VM-execution controls are set when
    1901  * executing a nested-guest.
     1896    return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32PinCtls & uPinCtls);
     1897}
     1898
     1899/**
     1900 * Checks whether one of the given Processor-based VM-execution controls are set
     1901 * when executing a nested-guest.
    19021902 *
    19031903 * @returns @c true if set, @c false otherwise.
    19041904 * @param   pVCpu       The cross context virtual CPU structure of the calling EMT.
    19051905 * @param   pCtx        Pointer to the context.
    1906  * @param   uProcCtl    The Processor-based VM-execution controls to check.
     1906 * @param   uProcCtls   The Processor-based VM-execution controls to check.
    19071907 *
    19081908 * @remarks This does not check if all given controls are set if more than one
    19091909 *          control is passed in @a uProcCtls.
    19101910 */
    1911 DECLINLINE(bool) CPUMIsGuestVmxProcCtlsSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uProcCtl)
     1911DECLINLINE(bool) CPUMIsGuestVmxProcCtlsSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uProcCtls)
    19121912{
    19131913    RT_NOREF(pVCpu);
     
    19151915    Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode);
    19161916    Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs));
    1917     return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ProcCtls & uProcCtl);
    1918 }
    1919 
    1920 /**
    1921  * Checks whether the given Secondary Processor-based VM-execution controls are set
    1922  * when executing a nested-guest.
     1917    return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ProcCtls & uProcCtls);
     1918}
     1919
     1920/**
     1921 * Checks whether one of the given Secondary Processor-based VM-execution controls
     1922 * are set when executing a nested-guest.
    19231923 *
    19241924 * @returns @c true if set, @c false otherwise.
    19251925 * @param   pVCpu       The cross context virtual CPU structure of the calling EMT.
    19261926 * @param   pCtx        Pointer to the context.
    1927  * @param   uProcCtl2   The Secondary Processor-based VM-execution controls to
     1927 * @param   uProcCtls2  The Secondary Processor-based VM-execution controls to
    19281928 *                      check.
    19291929 *
    19301930 * @remarks This does not check if all given controls are set if more than one
    1931  *          control is passed in @a uProcCtl2.
    1932  *
    1933  */
    1934 DECLINLINE(bool) CPUMIsGuestVmxProcCtls2Set(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uProcCtl2)
     1931 *          control is passed in @a uProcCtls2.
     1932 */
     1933DECLINLINE(bool) CPUMIsGuestVmxProcCtls2Set(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uProcCtls2)
    19351934{
    19361935    RT_NOREF(pVCpu);
     
    19381937    Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode);
    19391938    Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs));
    1940     return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ProcCtls2 & uProcCtl2);
     1939    return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ProcCtls2 & uProcCtls2);
     1940}
     1941
     1942
     1943/**
     1944 * Checks whether one of the given VM-exit controls are set when executing a
     1945 * nested-guest.
     1946 *
     1947 * @returns @c true if set, @c false otherwise.
     1948 * @param   pVCpu       The cross context virtual CPU structure of the calling EMT.
     1949 * @param   pCtx        Pointer to the context.
     1950 * @param   uExitCtls   The VM-exit controls to check.
     1951 *
     1952 * @remarks This does not check if all given controls are set if more than one
     1953 *          control is passed in @a uExitCtls.
     1954 */
     1955DECLINLINE(bool) CPUMIsGuestVmxExitCtlsSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uExitCtls)
     1956{
     1957    RT_NOREF(pVCpu);
     1958    Assert(pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_VMX);
     1959    Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode);
     1960    Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs));
     1961    return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ExitCtls & uExitCtls);
    19411962}
    19421963
  • trunk/include/VBox/vmm/iem.h

    r74661 r74834  
    323323
    324324#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     325VMM_INT_DECL(VBOXSTRICTRC)  IEMExecVmxVmexitExtInt(PVMCPU pVCpu, uint8_t uVector, bool fIntPending);
    325326VMM_INT_DECL(VBOXSTRICTRC)  IEMExecDecodedVmread(PVMCPU pVCpu, PCVMXVEXITINFO pExitInfo);
    326327VMM_INT_DECL(VBOXSTRICTRC)  IEMExecDecodedVmwrite(PVMCPU pVCpu, PCVMXVEXITINFO pExitInfo);
  • trunk/src/VBox/VMM/VMMAll/IEMAll.cpp

    r74798 r74834  
    978978                                              uint8_t cbInstr);
    979979IEM_STATIC VBOXSTRICTRC     iemVmxVmexitTripleFault(PVMCPU pVCpu);
     980IEM_STATIC VBOXSTRICTRC     iemVmxVmexitExtInt(PVMCPU pVCpu, uint8_t uVector, bool fIntPending);
    980981#endif
    981982
     
    1389213893            int32_t const rcPassUp = pVCpu->iem.s.rcPassUp;
    1389313894#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
     13895            if (   rcStrict == VINF_VMX_VMEXIT
     13896                && rcPassUp == VINF_SUCCESS)
     13897                rcStrict = VINF_SUCCESS;
     13898            else
     13899#endif
     13900#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    1389413901            if (   rcStrict == VINF_SVM_VMEXIT
    1389513902                && rcPassUp == VINF_SUCCESS)
     
    1563215639
    1563315640/**
     15641 * Interface for HM and EM to emulate VM-exit due to external interrupts.
     15642 *
     15643 * @returns Strict VBox status code.
     15644 * @param   pVCpu           The cross context virtual CPU structure of the calling EMT.
     15645 * @param   uVector         The external interrupt vector.
     15646 * @param   fIntPending     Whether the external interrupt is pending or
     15647 *                          acknowdledged in the interrupt controller.
     15648 * @thread  EMT(pVCpu)
     15649 */
     15650VMM_INT_DECL(VBOXSTRICTRC) IEMExecVmxVmexitExtInt(PVMCPU pVCpu, uint8_t uVector, bool fIntPending)
     15651{
     15652    /* IEM_CTX_ASSERT(pVCpu, IEM_CPUMCTX_EXTRN_SVM_VMEXIT_MASK); */ /** @todo NSTVMX: VMX_EXIT_MASK */
     15653    VBOXSTRICTRC rcStrict = iemVmxVmexitExtInt(pVCpu, uVector, fIntPending);
     15654    if (pVCpu->iem.s.cActiveMappings)
     15655        iemMemRollback(pVCpu);
     15656    return iemExecStatusCodeFiddling(pVCpu, rcStrict);
     15657}
     15658
     15659
     15660/**
    1563415661 * Interface for HM and EM to emulate the VMREAD instruction.
    1563515662 *
  • trunk/src/VBox/VMM/VMMR3/TRPM.cpp

    r74789 r74834  
    15191519    if (RT_SUCCESS(rc))
    15201520    {
     1521#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     1522        /* Handle the "acknowledge interrupt on exit" VM-exit intercept. */
     1523        if (CPUMIsGuestInVmxNonRootMode(pCtx))
     1524        {
     1525            if (   CPUMIsGuestVmxExitCtlsSet(pVCpu, pCtx, VMX_EXIT_CTLS_ACK_EXT_INT)
     1526                && CPUMIsGuestVmxPinCtlsSet(pVCpu, pCtx, VMX_PIN_CTLS_EXT_INT_EXIT))
     1527            {
     1528                VBOXSTRICTRC rcStrict = IEMExecVmxVmexitExtInt(pVCpu, u8Interrupt, false /* fIntPending */);
     1529                if (rcStrict != VINF_VMX_INTERCEPT_NOT_ACTIVE)
     1530                    return rcStrict;
     1531            }
     1532        }
     1533#endif
    15211534        if (EMIsSupervisorCodeRecompiled(pVM) || !VM_IS_RAW_MODE_ENABLED(pVM))
    15221535        {
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