VirtualBox

Changeset 70948 in vbox for trunk/include


Ignore:
Timestamp:
Feb 10, 2018 3:38:12 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120791
Message:

VMM: Added a bMainExecutionEngine member to the VM structure for use instead of fHMEnabled and fNEMEnabled. Changed a lot of HMIsEnabled invocations to use the new macros VM_IS_RAW_MODE_ENABLED and VM_IS_HM_OR_NEM_ENABLED. Eliminated fHMEnabledFixed. Fixed inverted test for raw-mode debug register sanity checking. Some other minor cleanups.

Location:
trunk/include/VBox/vmm
Files:
4 edited

Legend:

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

    r70913 r70948  
    16951695VMMR3DECL(void)         CPUMR3ResetCpu(PVM pVM, PVMCPU pVCpu);
    16961696VMMDECL(bool)           CPUMR3IsStateRestorePending(PVM pVM);
    1697 VMMR3DECL(void)         CPUMR3SetHWVirtEx(PVM pVM, bool fHWVirtExEnabled);
    16981697VMMR3DECL(int)          CPUMR3SetCR4Feature(PVM pVM, RTHCUINTREG fOr, RTHCUINTREG fAnd);
    16991698
  • trunk/include/VBox/vmm/hm.h

    r70782 r70948  
    4646 *
    4747 * @retval  true if used.
    48  * @retval  false if software virtualization (raw-mode) is used.
     48 * @retval  false if software virtualization (raw-mode) or NEM is used.
    4949 *
    5050 * @param   a_pVM       The cross context VM structure.
    51  * @sa      HMIsEnabledNotMacro, HMR3IsEnabled
     51 * @sa      VM_IS_HM_OR_NEM_ENABLED, VM_IS_RAW_MODE_ENABLED,
     52 *          HMIsEnabledNotMacro, HMR3IsEnabled
    5253 * @internal
    5354 */
  • trunk/include/VBox/vmm/vm.h

    r70918 r70948  
    931931
    932932
     933/** @name VM_EXEC_ENGINE_XXX - VM::bMainExecutionEngine values.
     934 * @{ */
     935/** Has not yet been set. */
     936#define VM_EXEC_ENGINE_NOT_SET              UINT8_C(0)
     937/** Raw-mode. */
     938#define VM_EXEC_ENGINE_RAW_MODE             UINT8_C(1)
     939/** Hardware assisted virtualization thru HM. */
     940#define VM_EXEC_ENGINE_HW_VIRT              UINT8_C(2)
     941/** Hardware assisted virtualization thru native API (NEM). */
     942#define VM_EXEC_ENGINE_NATIVE_API           UINT8_C(3)
     943/** @} */
     944
     945/**
     946 * Helper that HM and NEM uses for safely modifying VM::bMainExecutionEngine.
     947 *
     948 * ONLY HM and NEM MAY USE THIS!
     949 *
     950 * @param   a_pVM       The cross context VM structure.
     951 * @param   a_bValue    The new value.
     952 * @internal
     953 */
     954#define VM_SET_MAIN_EXECUTION_ENGINE(a_pVM, a_bValue) \
     955    do { \
     956        *const_cast<uint8_t *>(&(a_pVM)->bMainExecutionEngine) = (a_bValue); \
     957        ASMCompilerBarrier(); /* just to be on the safe side */ \
     958    } while (0)
     959
     960/**
     961 * Checks whether raw-mode is used.
     962 *
     963 * @retval  true if either is used.
     964 * @retval  false if software virtualization (raw-mode) is used.
     965 *
     966 * @param   a_pVM       The cross context VM structure.
     967 * @sa      HMR3IsEnabled, HMIsEnabled
     968 * @internal
     969 */
     970#ifdef VBOX_WITH_RAW_MODE
     971# define VM_IS_RAW_MODE_ENABLED(a_pVM)      ((a_pVM)->bMainExecutionEngine == VM_EXEC_ENGINE_RAW_MODE)
     972#else
     973# define VM_IS_RAW_MODE_ENABLED(a_pVM)      (false)
     974#endif
     975
     976/**
     977 * Checks whether HM (VT-x/AMD-V) or NEM is being used by this VM.
     978 *
     979 * @retval  true if either is used.
     980 * @retval  false if software virtualization (raw-mode) is used.
     981 *
     982 * @param   a_pVM       The cross context VM structure.
     983 * @sa      VM_IS_RAW_MODE_ENABLED, HMIsEnabled, HMR3IsEnabled
     984 * @internal
     985 */
     986#define VM_IS_HM_OR_NEM_ENABLED(a_pVM)      ((a_pVM)->bMainExecutionEngine != VM_EXEC_ENGINE_RAW_MODE)
     987
    933988
    934989/**
     
    10101065    /** @name Various items that are frequently accessed.
    10111066     * @{ */
     1067    /** The main execution engine, VM_EXEC_ENGINE_XXX.
     1068     * This is set early during vmR3InitRing3 by HM or NEM.  */
     1069    uint8_t const               bMainExecutionEngine;
     1070
    10121071    /** Whether to recompile user mode code or run it raw/hm. */
    10131072    bool                        fRecompileUser;
     
    10241083    /** Hardware VM support is available and enabled.
    10251084     * Determined very early during init.
    1026      * This is placed here for performance reasons. */
     1085     * This is placed here for performance reasons.
     1086     * @todo obsoleted by bMainExecutionEngine, eliminate. */
    10271087    bool                        fHMEnabled;
    1028     /** For asserting on fHMEnable usage. */
    1029     bool                        fHMEnabledFixed;
    10301088    /** Hardware VM support requires a minimal raw-mode context.
    10311089     * This is never set on 64-bit hosts, only 32-bit hosts requires it. */
    10321090    bool                        fHMNeedRawModeCtx;
    1033     /** NEM (native execution manager) active flag.
    1034      * This means we'll use NEM instead of HM when running guest code.  */
    1035     bool                        fNEMActive;
    10361091    /** Set when this VM is the master FT node.
    10371092     * @todo This doesn't need to be here, FTM should store it in it's own
     
    10451100
    10461101    /** Alignment padding. */
    1047     uint8_t                     uPadding1[1];
     1102    uint8_t                     uPadding1[2];
    10481103
    10491104    /** @name Debugging
  • trunk/include/VBox/vmm/vm.mac

    r70918 r70948  
    104104    .pfnVMMRCToHostAsm      resd 1
    105105    .pfnVMMRCToHostAsmNoReturn resd 1
     106    .bMainExecutionEngine   resb 1
    106107    .fRecompileUser         resb 1
    107108    .fRecompileSupervisor   resb 1
     
    110111    .fCSAMEnabled           resb 1
    111112    .fHMEnabled             resb 1
    112     .fHMEnabledFixed        resb 1
    113113    .fHMNeedRawModeCtx      resb 1
    114     .fNEMActive             resb 1
    115114    .fFaultTolerantMaster   resb 1
    116115    .fUseLargePages         resb 1
    117116
    118     .uPadding1              resb 1
     117    .uPadding1              resb 2
    119118
    120119    .hTraceBufRC            RTRCPTR_RES 1
Note: See TracChangeset for help on using the changeset viewer.

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