VirtualBox

Changeset 80839 in vbox


Ignore:
Timestamp:
Sep 17, 2019 4:52:54 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
133409
Message:

VMM/IEM: Nested VMX: bugref:9180 Define macros CR0 ignore mask on VM-entry and VM-exit and use it.

Location:
trunk
Files:
2 edited

Legend:

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

    r80767 r80839  
    20542054/** @name VM-entry register masks.
    20552055 * @{ */
    2056 /** CR0 bits ignored on VM-entry (ET, NW, CD and reserved bits bits 6:15, bit 17,
    2057  *  bits 19:28). */
    2058 #define VMX_ENTRY_CR0_IGNORE_MASK                               UINT64_C(0x7ffaffd0)
    2059 /** DR7 bits set here are always cleared on VM-entry (bit 12, bits 14:15). */
    2060 #define VMX_ENTRY_DR7_MBZ_MASK                                  UINT64_C(0xd000)
    2061 /** DR7 bits set here are always set on VM-entry (bit 10). */
    2062 #define VMX_ENTRY_DR7_MB1_MASK                                  UINT64_C(0x400)
     2056/** CR0 bits ignored on VM-entry while loading guest CR0 (ET, CD, NW, bits 6:15,
     2057 *  bit 17 and bits 19:28). */
     2058#define VMX_ENTRY_GUEST_CR0_IGNORE_MASK                         UINT64_C(0x7ffaffd0)
     2059/** DR7 bits set here are always cleared on VM-entry while loading guest DR7 (bit
     2060 *  12, bits 14:15). */
     2061#define VMX_ENTRY_GUEST_DR7_MBZ_MASK                            UINT64_C(0xd000)
     2062/** DR7 bits set here are always set on VM-entry while loading guest DR7 (bit
     2063 *  10). */
     2064#define VMX_ENTRY_GUEST_DR7_MB1_MASK                            UINT64_C(0x400)
     2065/** @} */
     2066
     2067
     2068/** @name VM-exit register masks.
     2069 * @{ */
     2070/** CR0 bits ignored on VM-exit while loading host CR0 (ET, CD, NW, bits 6:15,
     2071 *  bit 17, bits 19:28 and bits 32:63). */
     2072#define VMX_EXIT_HOST_CR0_IGNORE_MASK                           UINT64_C(0xffffffff7ffaffd0)
    20632073/** @} */
    20642074
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r80816 r80839  
    17101710        uint64_t const uCr0Mb1       = pVCpu->cpum.GstCtx.hwvirt.vmx.Msrs.u64Cr0Fixed0;
    17111711        uint64_t const uCr0Mb0       = pVCpu->cpum.GstCtx.hwvirt.vmx.Msrs.u64Cr0Fixed1;
    1712         uint64_t const fCr0IgnMask   = UINT64_C(0xffffffff1ffaffc0) | X86_CR0_ET | X86_CR0_CD | X86_CR0_NW | uCr0Mb1 | ~uCr0Mb0;
     1712        uint64_t const fCr0IgnMask   = VMX_EXIT_HOST_CR0_IGNORE_MASK | uCr0Mb1 | ~uCr0Mb0;
    17131713        uint64_t const uHostCr0      = pVmcs->u64HostCr0.u;
    17141714        uint64_t const uGuestCr0     = pVCpu->cpum.GstCtx.cr0;
     
    65326532
    65336533    IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CR0);
    6534     uint64_t const uGstCr0 = (pVmcs->u64GuestCr0.u   & ~VMX_ENTRY_CR0_IGNORE_MASK)
    6535                            | (pVCpu->cpum.GstCtx.cr0 &  VMX_ENTRY_CR0_IGNORE_MASK);
     6534    uint64_t const uGstCr0 = (pVmcs->u64GuestCr0.u   & ~VMX_ENTRY_GUEST_CR0_IGNORE_MASK)
     6535                           | (pVCpu->cpum.GstCtx.cr0 &  VMX_ENTRY_GUEST_CR0_IGNORE_MASK);
    65366536    CPUMSetGuestCR0(pVCpu, uGstCr0);
    65376537    CPUMSetGuestCR4(pVCpu, pVmcs->u64GuestCr4.u);
     
    65396539
    65406540    if (pVmcs->u32EntryCtls & VMX_ENTRY_CTLS_LOAD_DEBUG)
    6541         pVCpu->cpum.GstCtx.dr[7] = (pVmcs->u64GuestDr7.u & ~VMX_ENTRY_DR7_MBZ_MASK) | VMX_ENTRY_DR7_MB1_MASK;
     6541        pVCpu->cpum.GstCtx.dr[7] = (pVmcs->u64GuestDr7.u & ~VMX_ENTRY_GUEST_DR7_MBZ_MASK) | VMX_ENTRY_GUEST_DR7_MB1_MASK;
    65426542
    65436543    pVCpu->cpum.GstCtx.SysEnter.eip = pVmcs->u64GuestSysenterEip.s.Lo;
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