VirtualBox

Changeset 100059 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Jun 3, 2023 12:17:25 AM (20 months ago)
Author:
vboxsync
Message:

VMM/IEM: Use fExec for more tests. bugref:10369

Location:
trunk/src/VBox/VMM/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/IEMInline.h

    r100052 r100059  
    406406    Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->cpum.GstCtx.tr));
    407407
    408     pVCpu->iem.s.fExec = iemCalcExecFlags(pVCpu) | fExecOpts;
     408    pVCpu->iem.s.rcPassUp           = VINF_SUCCESS;
     409    pVCpu->iem.s.fExec              = iemCalcExecFlags(pVCpu) | fExecOpts;
     410    pVCpu->iem.s.cActiveMappings    = 0;
     411    pVCpu->iem.s.iNextMapping       = 0;
     412
    409413#  ifdef VBOX_STRICT
    410414    pVCpu->iem.s.enmDefAddrMode     = (IEMMODE)0xfe;
     
    435439#   endif
    436440#  endif /* VBOX_STRICT */
    437 
    438     pVCpu->iem.s.cActiveMappings    = 0;
    439     pVCpu->iem.s.iNextMapping       = 0;
    440     pVCpu->iem.s.rcPassUp           = VINF_SUCCESS;
    441441}
    442442# endif /* VBOX_INCLUDED_vmm_dbgf_h */
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r100052 r100059  
    559559 * 32-bit mode (for simplifying most memory accesses). */
    560560#define IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK UINT32_C(0x00000004)
    561 /** X86 Mode: Bit indicating protected mode. */
     561/** X86 Mode: Bit indicating protected mode, real mode (or SMM) when not set. */
    562562#define IEM_F_MODE_X86_PROT_MASK            UINT32_C(0x00000008)
    563563/** X86 Mode: Bit used to indicate virtual 8086 mode (only 16-bit). */
     
    36823682 * @param   a_pVCpu         The cross context virtual CPU structure of the calling thread.
    36833683 */
    3684 #define IEM_IS_REAL_OR_V86_MODE(a_pVCpu)    (CPUMIsGuestInRealOrV86ModeEx(IEM_GET_CTX(a_pVCpu)))
     3684#define IEM_IS_REAL_OR_V86_MODE(a_pVCpu)    ((  ((a_pVCpu)->iem.s.fExec  ^ IEM_F_MODE_X86_PROT_MASK) \
     3685                                              & (IEM_F_MODE_X86_V86_MASK | IEM_F_MODE_X86_PROT_MASK)) != 0)
    36853686
    36863687/**
     
    36903691 * @param   a_pVCpu         The cross context virtual CPU structure of the calling thread.
    36913692 */
    3692 #define IEM_IS_V86_MODE(a_pVCpu)            (CPUMIsGuestInV86ModeEx(IEM_GET_CTX(a_pVCpu)))
     3693#define IEM_IS_V86_MODE(a_pVCpu)            (((a_pVCpu)->iem.s.fExec & IEM_F_MODE_X86_V86_MASK) != 0)
    36933694
    36943695/**
     
    37303731 * @param   a_pVCpu         The cross context virtual CPU structure of the calling thread.
    37313732 */
    3732 #define IEM_IS_REAL_MODE(a_pVCpu)           (CPUMIsGuestInRealModeEx(IEM_GET_CTX(a_pVCpu)))
     3733#define IEM_IS_REAL_MODE(a_pVCpu)           (!((a_pVCpu)->iem.s.fExec & IEM_F_MODE_X86_PROT_MASK))
    37333734
    37343735/**
     
    38453846 * Check if the guest has entered VMX non-root operation.
    38463847 */
    3847 # define IEM_VMX_IS_NON_ROOT_MODE(a_pVCpu)  (CPUMIsGuestInVmxNonRootMode(IEM_GET_CTX(a_pVCpu)))
     3848# define IEM_VMX_IS_NON_ROOT_MODE(a_pVCpu)  (   ((a_pVCpu)->iem.s.fExec & (IEM_F_X86_CTX_VMX | IEM_F_X86_CTX_IN_GUEST)) \
     3849                                             ==                           (IEM_F_X86_CTX_VMX | IEM_F_X86_CTX_IN_GUEST) )
    38483850
    38493851/**
    38503852 * Check if the nested-guest has the given Pin-based VM-execution control set.
    38513853 */
    3852 # define IEM_VMX_IS_PINCTLS_SET(a_pVCpu, a_PinCtl) \
    3853     (CPUMIsGuestVmxPinCtlsSet(IEM_GET_CTX(a_pVCpu), (a_PinCtl)))
     3854# define IEM_VMX_IS_PINCTLS_SET(a_pVCpu, a_PinCtl)  (CPUMIsGuestVmxPinCtlsSet(IEM_GET_CTX(a_pVCpu), (a_PinCtl)))
    38543855
    38553856/**
    38563857 * Check if the nested-guest has the given Processor-based VM-execution control set.
    38573858 */
    3858 # define IEM_VMX_IS_PROCCTLS_SET(a_pVCpu, a_ProcCtl) \
    3859     (CPUMIsGuestVmxProcCtlsSet(IEM_GET_CTX(a_pVCpu), (a_ProcCtl)))
     3859# define IEM_VMX_IS_PROCCTLS_SET(a_pVCpu, a_ProcCtl) (CPUMIsGuestVmxProcCtlsSet(IEM_GET_CTX(a_pVCpu), (a_ProcCtl)))
    38603860
    38613861/**
     
    38633863 * control set.
    38643864 */
    3865 # define IEM_VMX_IS_PROCCTLS2_SET(a_pVCpu, a_ProcCtl2) \
    3866     (CPUMIsGuestVmxProcCtls2Set(IEM_GET_CTX(a_pVCpu), (a_ProcCtl2)))
     3865# define IEM_VMX_IS_PROCCTLS2_SET(a_pVCpu, a_ProcCtl2) (CPUMIsGuestVmxProcCtls2Set(IEM_GET_CTX(a_pVCpu), (a_ProcCtl2)))
    38673866
    38683867/** Gets the guest-physical address of the shadows VMCS for the given VCPU. */
     
    39503949#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    39513950/**
     3951 * Checks if we're executing a guest using AMD-V.
     3952 */
     3953# define IEM_SVM_IS_IN_GUEST(a_pVCpu) (   (a_pVCpu->iem.s.fExec & (IEM_F_X86_CTX_SVM | IEM_F_X86_CTX_IN_GUEST)) \
     3954                                       ==                         (IEM_F_X86_CTX_SVM | IEM_F_X86_CTX_IN_GUEST))
     3955/**
    39523956 * Check if an SVM control/instruction intercept is set.
    39533957 */
    39543958# define IEM_SVM_IS_CTRL_INTERCEPT_SET(a_pVCpu, a_Intercept) \
    3955     (CPUMIsGuestSvmCtrlInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_Intercept)))
     3959    (IEM_SVM_IS_IN_GUEST(a_pVCpu) && CPUMIsGuestSvmCtrlInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_Intercept)))
    39563960
    39573961/**
     
    39593963 */
    39603964# define IEM_SVM_IS_READ_CR_INTERCEPT_SET(a_pVCpu, a_uCr) \
    3961     (CPUMIsGuestSvmReadCRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uCr)))
     3965    (IEM_SVM_IS_IN_GUEST(a_pVCpu) && CPUMIsGuestSvmReadCRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uCr)))
    39623966
    39633967/**
     
    39653969 */
    39663970# define IEM_SVM_IS_WRITE_CR_INTERCEPT_SET(a_pVCpu, a_uCr) \
    3967     (CPUMIsGuestSvmWriteCRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uCr)))
     3971    (IEM_SVM_IS_IN_GUEST(a_pVCpu) && CPUMIsGuestSvmWriteCRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uCr)))
    39683972
    39693973/**
     
    39713975 */
    39723976# define IEM_SVM_IS_READ_DR_INTERCEPT_SET(a_pVCpu, a_uDr) \
    3973     (CPUMIsGuestSvmReadDRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uDr)))
     3977    (IEM_SVM_IS_IN_GUEST(a_pVCpu) && CPUMIsGuestSvmReadDRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uDr)))
    39743978
    39753979/**
     
    39773981 */
    39783982# define IEM_SVM_IS_WRITE_DR_INTERCEPT_SET(a_pVCpu, a_uDr) \
    3979     (CPUMIsGuestSvmWriteDRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uDr)))
     3983    (IEM_SVM_IS_IN_GUEST(a_pVCpu) && CPUMIsGuestSvmWriteDRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uDr)))
    39803984
    39813985/**
     
    39833987 */
    39843988# define IEM_SVM_IS_XCPT_INTERCEPT_SET(a_pVCpu, a_uVector) \
    3985     (CPUMIsGuestSvmXcptInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uVector)))
     3989    (IEM_SVM_IS_IN_GUEST(a_pVCpu) && CPUMIsGuestSvmXcptInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uVector)))
    39863990
    39873991/**
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