VirtualBox

Changeset 45501 in vbox for trunk


Ignore:
Timestamp:
Apr 11, 2013 11:20:33 PM (12 years ago)
Author:
vboxsync
Message:

VMM/VMMR0: HM bits.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r45498 r45501  
    5050#endif
    5151
    52 #define VMX_SEL_UNUSABLE            RT_BIT(16)
     52#define VMX_SEL_UNUSABLE                       RT_BIT(16)
     53#define VMX_FLUSH_TAGGED_TLB_EPT_VPID          0
     54#define VMX_FLUSH_TAGGED_TLB_EPT               1
     55#define VMX_FLUSH_TAGGED_TLB_VPID              2
     56#define VMX_FLUSH_TAGGED_TLB_NONE              3
    5357
    5458/**
     
    14241428
    14251429/**
     1430 * Flushes the guest TLB entry based on CPU capabilities.
     1431 *
     1432 * @param pVCpu     Pointer to the VMCPU.
     1433 */
     1434DECLINLINE(void) hmR0VmxFlushTaggedTlb(PVMCPU pVCpu)
     1435{
     1436    PVM pVM = pVCpu->CTX_SUFF(pVM);
     1437    switch (pVM->hm.s.vmx.uFlushTaggedTlb)
     1438    {
     1439        case VMX_FLUSH_TAGGED_TLB_EPT_VPID: hmR0VmxFlushTaggedTlbBoth(pVM, pVCpu); break;
     1440        case VMX_FLUSH_TAGGED_TLB_EPT:      hmR0VmxFlushTaggedTlbEpt(pVM, pVCpu);  break;
     1441        case VMX_FLUSH_TAGGED_TLB_VPID:     hmR0VmxFlushTaggedTlbVpid(pVM, pVCpu); break;
     1442        case VMX_FLUSH_TAGGED_TLB_NONE:     hmR0VmxFlushTaggedTlbNone(pVM, pVCpu); break;
     1443        default:
     1444            AssertMsgFailed(("Invalid flush-tag function identifier\n"));
     1445            break;
     1446    }
     1447}
     1448
     1449
     1450/**
    14261451 * Sets up the appropriate tagged TLB-flush level and handler for flushing guest
    14271452 * TLB entries from the host TLB before VM-entry.
     
    15031528     */
    15041529    if (pVM->hm.s.fNestedPaging && pVM->hm.s.vmx.fVpid)
    1505         pVM->hm.s.vmx.pfnFlushTaggedTlb = hmR0VmxFlushTaggedTlbBoth;
     1530        pVM->hm.s.vmx.uFlushTaggedTlb = VMX_FLUSH_TAGGED_TLB_EPT_VPID;
    15061531    else if (pVM->hm.s.fNestedPaging)
    1507         pVM->hm.s.vmx.pfnFlushTaggedTlb = hmR0VmxFlushTaggedTlbEpt;
     1532        pVM->hm.s.vmx.uFlushTaggedTlb = VMX_FLUSH_TAGGED_TLB_EPT;
    15081533    else if (pVM->hm.s.vmx.fVpid)
    1509         pVM->hm.s.vmx.pfnFlushTaggedTlb = hmR0VmxFlushTaggedTlbVpid;
     1534        pVM->hm.s.vmx.uFlushTaggedTlb = VMX_FLUSH_TAGGED_TLB_VPID;
    15101535    else
    1511         pVM->hm.s.vmx.pfnFlushTaggedTlb = hmR0VmxFlushTaggedTlbNone;
     1536        pVM->hm.s.vmx.uFlushTaggedTlb = VMX_FLUSH_TAGGED_TLB_NONE;
    15121537    return VINF_SUCCESS;
    15131538}
     
    55495574    }
    55505575
    5551     /* Clear the VT-x state bits to prevent any stale injection. */
     5576    /* Clear the VT-x state bits to prevent any stale injection. This can happen when InjectEventVmcs() */
    55525577    int rc2 = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_INTERRUPTION_INFO, 0);
    55535578    AssertRC(rc2);
     
    64576482        pVmxTransient->u8GuestTpr = pVCpu->hm.s.vmx.pbVirtApic[0x80];
    64586483
    6459     Assert(pVM->hm.s.vmx.pfnFlushTaggedTlb);
    64606484    ASMAtomicWriteBool(&pVCpu->hm.s.fCheckedTLBFlush, true);    /* Used for TLB-shootdowns, set this across the world switch. */
    6461     pVM->hm.s.vmx.pfnFlushTaggedTlb(pVM, pVCpu);                /* Flush the TLB of guest entries as necessary. */
     6485    hmR0VmxFlushTaggedTlb(pVCpu);                               /* Invalidate the appropriate guest entries from the TLB. */
    64626486
    64636487    /* Setup TSC-offsetting or intercept RDTSC(P)s and update the preemption timer. */
  • trunk/src/VBox/VMM/include/HMInternal.h

    r45410 r45501  
    383383        R0PTRTYPE(uint8_t *)        pbScratch;
    384384#endif
     385
     386#ifndef VBOX_WITH_OLD_VTX_CODE
     387        unsigned                    uFlushTaggedTlb;
     388#else
    385389        /** Ring 0 handlers for VT-x. */
    386390        DECLR0CALLBACKMEMBER(void, pfnFlushTaggedTlb, (PVM pVM, PVMCPU pVCpu));
     391#endif
    387392
    388393#if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS)
     
    453458    AVLOU32TREE                     PatchTree;
    454459    uint32_t                        cPatches;
    455     HMTPRPATCH                  aPatches[64];
     460    HMTPRPATCH                      aPatches[64];
    456461
    457462    struct
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