VirtualBox

Changeset 13198 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Oct 13, 2008 9:05:42 AM (16 years ago)
Author:
vboxsync
Message:

Recommitted 37737 & 37738 minus the dangerous changes.

File:
1 edited

Legend:

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

    r13197 r13198  
    5656#define VMXR0ReportWorldSwitchError(a, b, c)      do { } while (0);
    5757#endif /* VBOX_STRICT */
    58 static void VMXR0SetupTLBEPT(PVM pVM);
    59 static void VMXR0SetupTLBVPID(PVM pVM);
    60 static void VMXR0SetupTLBDummy(PVM pVM);
    61 static void VMXR0FlushEPT(PVM pVM, VMX_FLUSH enmFlush, RTGCPHYS GCPhys);
    62 static void VMXR0FlushVPID(PVM pVM, VMX_FLUSH enmFlush, RTGCPTR GCPtr);
     58static void vmxR0SetupTLBEPT(PVM pVM);
     59static void vmxR0SetupTLBVPID(PVM pVM);
     60static void vmxR0SetupTLBDummy(PVM pVM);
     61static void vmxR0FlushEPT(PVM pVM, VMX_FLUSH enmFlush, RTGCPHYS GCPhys);
     62static void vmxR0FlushVPID(PVM pVM, VMX_FLUSH enmFlush, RTGCPTR GCPtr);
    6363
    6464
     
    476476    if (pVM->hwaccm.s.fNestedPaging)
    477477    {
    478         pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = VMXR0SetupTLBEPT;
     478        pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = vmxR0SetupTLBEPT;
    479479
    480480        /* Default values for flushing. */
     
    496496    if (pVM->hwaccm.s.vmx.fVPID)
    497497    {
    498         pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = VMXR0SetupTLBVPID;
     498        pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = vmxR0SetupTLBVPID;
    499499
    500500        /* Default values for flushing. */
     
    514514#endif /* HWACCM_VTX_WITH_VPID */
    515515    else
    516         pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = VMXR0SetupTLBDummy;
     516        pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = vmxR0SetupTLBDummy;
    517517
    518518
     
    818818}
    819819
     820/**
     821 * Prefetch the 4 PDPT pointers (PAE and nested paging only)
     822 *
     823 * @param   pVM         The VM to operate on.
     824 * @param   pCtx        Guest context
     825 */
     826static void vmxR0PrefetchPAEPdptrs(PVM pVM, PCPUMCTX pCtx)
     827{
     828    if (CPUMIsGuestInPAEModeEx(pCtx))
     829    {
     830        X86PDPE Pdpe;
     831
     832        for (unsigned i=0;i<4;i++)
     833        {
     834            Pdpe = PGMGstGetPaePDPtr(pVM, i);
     835            int rc = VMXWriteVMCS64(VMX_VMCS_GUEST_PDPTR0_FULL + i*2, Pdpe.u);
     836            AssertRC(rc);
     837        }
     838    }
     839}
    820840
    821841/**
     
    12261246                /* Save the real guest CR3 in VMX_VMCS_GUEST_CR3 */
    12271247                val = pCtx->cr3;
     1248                /* Prefetch the four PDPT entries in PAE mode. */
     1249                vmxR0PrefetchPAEPdptrs(pVM, pCtx);
    12281250            }
    12291251        }
     
    14541476            PGMUpdateCR3(pVM, val);
    14551477        }
     1478        /* Prefetch the four PDPT entries in PAE mode. */
     1479        vmxR0PrefetchPAEPdptrs(pVM, pCtx);
    14561480    }
    14571481
     
    15161540 * @param   pVM         The VM to operate on.
    15171541 */
    1518 static void VMXR0SetupTLBDummy(PVM pVM)
     1542static void vmxR0SetupTLBDummy(PVM pVM)
    15191543{
    15201544    return;
     
    15271551 * @param   pVM         The VM to operate on.
    15281552 */
    1529 static void VMXR0SetupTLBEPT(PVM pVM)
     1553static void vmxR0SetupTLBEPT(PVM pVM)
    15301554{
    15311555    PHWACCM_CPUINFO pCpu;
     
    15521576
    15531577    if (pVM->hwaccm.s.fForceTLBFlush)
    1554         VMXR0FlushEPT(pVM, pVM->hwaccm.s.vmx.enmFlushContext, 0);
     1578        vmxR0FlushEPT(pVM, pVM->hwaccm.s.vmx.enmFlushContext, 0);
    15551579
    15561580#ifdef VBOX_WITH_STATISTICS
     
    15691593 * @param   pVM         The VM to operate on.
    15701594 */
    1571 static void VMXR0SetupTLBVPID(PVM pVM)
     1595static void vmxR0SetupTLBVPID(PVM pVM)
    15721596{
    15731597    PHWACCM_CPUINFO pCpu;
     
    16261650
    16271651    if (pVM->hwaccm.s.fForceTLBFlush)
    1628         VMXR0FlushVPID(pVM, pVM->hwaccm.s.vmx.enmFlushContext, 0);
     1652        vmxR0FlushVPID(pVM, pVM->hwaccm.s.vmx.enmFlushContext, 0);
    16291653
    16301654#ifdef VBOX_WITH_STATISTICS
     
    29863010 * @param   GCPhys      Physical address of the page to flush
    29873011 */
    2988 static void VMXR0FlushEPT(PVM pVM, VMX_FLUSH enmFlush, RTGCPHYS GCPhys)
     3012static void vmxR0FlushEPT(PVM pVM, VMX_FLUSH enmFlush, RTGCPHYS GCPhys)
    29893013{
    29903014    uint64_t descriptor[2];
    29913015
    2992     LogFlow(("VMXR0FlushEPT %d %VGv\n", enmFlush, GCPhys));
     3016    LogFlow(("vmxR0FlushEPT %d %VGv\n", enmFlush, GCPhys));
    29933017    Assert(pVM->hwaccm.s.fNestedPaging);
    29943018    descriptor[0] = pVM->hwaccm.s.vmx.GCPhysEPTP;
     
    30073031 * @param   GCPtr       Virtual address of the page to flush
    30083032 */
    3009 static void VMXR0FlushVPID(PVM pVM, VMX_FLUSH enmFlush, RTGCPTR GCPtr)
     3033static void vmxR0FlushVPID(PVM pVM, VMX_FLUSH enmFlush, RTGCPTR GCPtr)
    30103034{
    30113035    uint64_t descriptor[2];
     
    30373061    if (   !fFlushPending
    30383062        && pVM->hwaccm.s.vmx.fVPID)
    3039         VMXR0FlushVPID(pVM, pVM->hwaccm.s.vmx.enmFlushPage, GCVirt);
     3063        vmxR0FlushVPID(pVM, pVM->hwaccm.s.vmx.enmFlushPage, GCVirt);
    30403064#endif /* HWACCM_VTX_WITH_VPID */
    30413065
     
    30603084    /* Skip it if a TLB flush is already pending. */
    30613085    if (!fFlushPending)
    3062         VMXR0FlushEPT(pVM, pVM->hwaccm.s.vmx.enmFlushPage, GCPhys);
     3086        vmxR0FlushEPT(pVM, pVM->hwaccm.s.vmx.enmFlushPage, GCPhys);
    30633087
    30643088    return VINF_SUCCESS;
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