VirtualBox

Changeset 68851 in vbox for trunk/include/VBox/vmm


Ignore:
Timestamp:
Sep 25, 2017 12:38:46 PM (7 years ago)
Author:
vboxsync
Message:

vm.h: Renamed the VM_IS_RUNNING macro to something indicating that it obviously only suitable for assertions. (variable is volatile, we don't read stuff three times in release builds since we may get three different values.)

File:
1 edited

Legend:

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

    r66227 r68851  
    825825# define VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu) \
    826826    Assert(    VMCPU_IS_EMT(pVCpu) \
    827            || !VM_IS_RUNNING((pVCpu)->CTX_SUFF(pVM)) )
     827           || !VM_IS_RUNNING_FOR_ASSERTIONS_ONLY((pVCpu)->CTX_SUFF(pVM)) )
    828828#else
    829829# define VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu) \
    830830    AssertMsg(    VMCPU_IS_EMT(pVCpu) \
    831               || !VM_IS_RUNNING((pVCpu)->CTX_SUFF(pVM)), \
     831              || !VM_IS_RUNNING_FOR_ASSERTIONS_ONLY((pVCpu)->CTX_SUFF(pVM)), \
    832832              ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd idCpu=%#x\n", \
    833833               RTThreadNativeSelf(), (pVCpu)->hNativeThread, (pVCpu)->idCpu))
    834834#endif
    835835
    836 /** @def VM_IS_RUNNING
     836/** @def VM_IS_RUNNING_FOR_ASSERTIONS_ONLY
    837837 * Checks if the the VM is running.
    838  */
    839 #define VM_IS_RUNNING(pVM)                  (   (pVM)->enmVMState == VMSTATE_RUNNING    \
    840                                              || (pVM)->enmVMState == VMSTATE_RUNNING_LS \
    841                                              || (pVM)->enmVMState == VMSTATE_RUNNING_FT)
     838 * @note Thie is only for pure debug assertions.  No AssertReturn or similar!
     839 */
     840#define VM_IS_RUNNING_FOR_ASSERTIONS_ONLY(pVM) \
     841    (   (pVM)->enmVMState == VMSTATE_RUNNING \
     842     || (pVM)->enmVMState == VMSTATE_RUNNING_LS \
     843     || (pVM)->enmVMState == VMSTATE_RUNNING_FT )
    842844
    843845/** @def VM_ASSERT_IS_NOT_RUNNING
     
    845847 */
    846848#if defined(IN_RC) || defined(IN_RING0)
    847 #define VM_ASSERT_IS_NOT_RUNNING(pVM)       Assert(!VM_IS_RUNNING(pVM))
    848 #else
    849 #define VM_ASSERT_IS_NOT_RUNNING(pVM)       AssertMsg(!VM_IS_RUNNING(pVM), ("VM is running. enmVMState=%d\n", \
    850                                                       (pVM)->enmVMState))
     849#define VM_ASSERT_IS_NOT_RUNNING(pVM)       Assert(!VM_IS_RUNNING_FOR_ASSERTIONS_ONLY(pVM))
     850#else
     851#define VM_ASSERT_IS_NOT_RUNNING(pVM)       AssertMsg(!VM_IS_RUNNING_FOR_ASSERTIONS_ONLY(pVM), \
     852                                                      ("VM is running. enmVMState=%d\n", (pVM)->enmVMState))
    851853#endif
    852854
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