VirtualBox

Changeset 74792 in vbox for trunk


Ignore:
Timestamp:
Oct 12, 2018 10:53:00 AM (6 years ago)
Author:
vboxsync
Message:

vm.h,VMM: Made VM_FF_SET and VMCPU_FF_SET both work on a single flag, with compile time assertions check this. Introduced VMCPU_FF_SET_MASK for the one place where a mask is used. bugref:9180

Location:
trunk
Files:
2 edited

Legend:

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

    r74791 r74792  
    620620
    621621/** @def VM_FF_SET
    622  * Sets a force action flag.
     622 * Sets a single force action flag.
    623623 *
    624624 * @param   pVM     The cross context VM structure.
     
    626626 */
    627627#if 1
    628 # define VM_FF_SET(pVM, fFlag)              ASMAtomicOrU32(&(pVM)->fGlobalForcedActions, (fFlag))
     628# if !defined(VBOX_STRICT) || !defined(RT_COMPILER_SUPPORTS_LAMBDA)
     629#  define VM_FF_SET(pVM, fFlag)              ASMAtomicOrU32(&(pVM)->fGlobalForcedActions, (fFlag))
     630# else
     631#  define VM_FF_SET(pVM, fFlag) \
     632    ([](PVM a_pVM) -> void \
     633    { \
     634        AssertCompile(RT_IS_POWER_OF_TWO(fFlag)); \
     635        ASMAtomicOrU32(&a_pVM->fGlobalForcedActions, (fFlag)); \
     636    }(pVM))
     637# endif
    629638#else
    630639# define VM_FF_SET(pVM, fFlag) \
     
    635644
    636645/** @def VMCPU_FF_SET
    637  * Sets a force action flag for the given VCPU.
     646 * Sets a single force action flag for the given VCPU.
    638647 *
    639648 * @param   pVCpu   The cross context virtual CPU structure.
    640649 * @param   fFlag   The flag to set.
    641  */
    642 #define VMCPU_FF_SET(pVCpu, fFlag)          ASMAtomicOrU32(&(pVCpu)->fLocalForcedActions, (fFlag))
     650 * @sa      VMCPU_FF_SET_MASK
     651 */
     652#if !defined(VBOX_STRICT) || !defined(RT_COMPILER_SUPPORTS_LAMBDA)
     653# define VMCPU_FF_SET(pVCpu, fFlag)          ASMAtomicOrU32(&(pVCpu)->fLocalForcedActions, (fFlag))
     654#else
     655# define VMCPU_FF_SET(pVCpu, fFlag) \
     656    ([](PVMCPU a_pVCpu) -> void \
     657    { \
     658        AssertCompile(RT_IS_POWER_OF_TWO(fFlag)); \
     659        ASMAtomicOrU32(&a_pVCpu->fLocalForcedActions, (fFlag)); \
     660    }(pVCpu))
     661#endif
     662
     663/** @def VMCPU_FF_SET
     664 * Sets a two or more force action flag for the given VCPU.
     665 *
     666 * @param   pVCpu   The cross context virtual CPU structure.
     667 * @param   fFlags  The flags to set.
     668 * @sa      VMCPU_FF_SET
     669 */
     670#define VMCPU_FF_SET_MASK(a_pVCpu, fFlags)  ASMAtomicOrU32(&a_pVCpu->fLocalForcedActions, (fFlags))
    643671
    644672/** @def VM_FF_CLEAR
     
    732760 * @param   pVM     The cross context VM structure.
    733761 * @param   fFlags  The flags to check for.
     762 * @sa      VM_FF_IS_SET
    734763 */
    735764#define VM_FF_IS_ANY_SET(pVM, fFlags)       RT_BOOL((pVM)->fGlobalForcedActions & (fFlags))
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp.h

    r74785 r74792  
    294294        if (pVCpu->cpum.GstCtx.hwvirt.fLocalForcedActions)
    295295        {
    296             VMCPU_FF_SET(pVCpu, pVCpu->cpum.GstCtx.hwvirt.fLocalForcedActions);
     296            VMCPU_FF_SET_MASK(pVCpu, pVCpu->cpum.GstCtx.hwvirt.fLocalForcedActions);
    297297            pVCpu->cpum.GstCtx.hwvirt.fLocalForcedActions = 0;
    298298        }
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