VirtualBox

Changeset 73440 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Aug 2, 2018 8:45:43 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124067
Message:

VMM/IEM: Nested VMX: bugref:9180 VMX instruction common macros.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAll.cpp

    r73438 r73440  
    324324
    325325/**
     326 * Check if we're currently executing in a 64-bit code segment.
     327 *
     328 * @returns @c true if it is, @c false if not.
     329 * @param   a_pVCpu         The cross context virtual CPU structure of the calling thread.
     330 */
     331#define IEM_IS_64BIT_CODE(a_pVCpu)          (CPUMIsGuestIn64BitCodeEx(IEM_GET_CTX(a_pVCpu)))
     332
     333/**
    326334 * Check if we're currently executing in real mode.
    327335 *
     
    374382#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) || defined(DOXYGEN_RUNNING)
    375383# define IEM_USE_UNALIGNED_DATA_ACCESS
     384#endif
     385
     386#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     387/**
     388 * Check the common VMX instruction preconditions.
     389 */
     390#define IEM_VMX_INSTR_COMMON_CHECKS(a_pVCpu, a_Instr) \
     391    do { \
     392    { \
     393        if (!IEM_IS_VMX_ENABLED(a_pVCpu)) \
     394        { \
     395            Log((RT_STR(a_Instr) ": CR4.VMXE not enabled -> #UD\n")); \
     396            return iemRaiseUndefinedOpcode(a_pVCpu); \
     397        } \
     398        if (IEM_IS_REAL_OR_V86_MODE(a_pVCpu)) \
     399        { \
     400            Log((RT_STR(a_Instr) ": Real or v8086 mode -> #UD\n")); \
     401            return iemRaiseUndefinedOpcode(a_pVCpu); \
     402        } \
     403        if (IEM_IS_LONG_MODE(a_pVCpu) && !IEM_IS_64BIT_CODE(a_pVCpu)) \
     404        { \
     405            Log((RT_STR(a_Instr) ": Long mode without 64-bit code segment -> #UD\n")); \
     406            return iemRaiseUndefinedOpcode(a_pVCpu); \
     407        } \
     408} while (0)
     409
     410/**
     411 * Check if VMX is enabled.
     412 */
     413# define IEM_IS_VMX_ENABLED(a_pVCpu)                         (CPUMIsGuestVmxEnabled(IEM_GET_CTX(a_pVCpu)))
     414
     415#else
     416# define IEM_VMX_INSTR_COMMON_CHECKS(a_pVCpu, a_Instr)       do { } while (0)
     417# define IEM_IS_VMX_ENABLED(a_pVCpu)                         (false)
     418
    376419#endif
    377420
     
    409452
    410453/**
    411  * Check if an SVM is enabled.
     454 * Check if SVM is enabled.
    412455 */
    413456# define IEM_IS_SVM_ENABLED(a_pVCpu)                         (CPUMIsGuestSvmEnabled(IEM_GET_CTX(a_pVCpu)))
     
    484527# define IEM_RETURN_SVM_CRX_VMEXIT(a_pVCpu, a_uExitCode, a_enmAccessCrX, a_iGReg)         do { return VERR_SVM_IPE_1; } while (0)
    485528
    486 #endif /* VBOX_WITH_NESTED_HWVIRT_SVM */
     529#endif
    487530
    488531
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