VirtualBox

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


Ignore:
Timestamp:
Jun 30, 2008 11:39:41 AM (16 years ago)
Author:
vboxsync
Message:

AMD64 shadow & real or protected mode without paging combo.
Flush TLB when the EFER msr changes certain bits.

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

Legend:

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

    r9989 r10013  
    23562356    {
    23572357        uint64_t uMask = 0;
     2358        uint64_t oldval = pCtx->msrEFER;
    23582359
    23592360        /* Filter out those bits the guest is allowed to change. (e.g. LMA is read-only) */
     
    23772378        AssertMsg(!(val & ~(MSR_K6_EFER_NXE|MSR_K6_EFER_LME|MSR_K6_EFER_LMA /* ignored anyway */ |MSR_K6_EFER_SCE)), ("Unexpected value %RX64\n", val));
    23782379        pCtx->msrEFER = (pCtx->msrEFER & ~uMask) | (val & uMask);
     2380
     2381        /* AMD64 Achitecture Programmer's Manual: 15.15 TLB Control; flush the TLB if MSR_K6_EFER_NXE, MSR_K6_EFER_LME or MSR_K6_EFER_LMA are changed. */
     2382        if ((oldval & (MSR_K6_EFER_NXE|MSR_K6_EFER_LME|MSR_K6_EFER_LMA)) != (pCtx->msrEFER & (MSR_K6_EFER_NXE|MSR_K6_EFER_LME|MSR_K6_EFER_LMA)))
     2383            HWACCMFlushTLB(pVM);
     2384
    23792385        break;
    23802386    }
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r10012 r10013  
    17701770     * Get the shadow PDE, find the shadow page table in the pool.
    17711771     */
    1772     const unsigned iPDDst = GCPtrPage >> SHW_PD_SHIFT;
    17731772# if PGM_SHW_TYPE == PGM_TYPE_32BIT
     1773    const unsigned  iPDDst = GCPtrPage >> SHW_PD_SHIFT;
    17741774    X86PDE          PdeDst = pVM->pgm.s.CTXMID(p,32BitPD)->a[iPDDst];
    1775 # else /* PAE */
     1775# elif PGM_SHW_TYPE == PGM_TYPE_PAE
     1776    const unsigned  iPDDst = GCPtrPage >> SHW_PD_SHIFT;                     /* no mask; flat index into the 2048 entry array. */
    17761777    X86PDEPAE       PdeDst = pVM->pgm.s.CTXMID(ap,PaePDs)[0]->a[iPDDst];
     1778# elif PGM_SHW_TYPE == PGM_TYPE_AMD64
     1779    const unsigned  iPDDst   = ((GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK);
     1780    const unsigned  iPdpte   = (GCPtrPage >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
     1781    PX86PDPAE       pPDDst;
     1782    X86PDEPAE       PdeDst;
     1783    PX86PDPT        pPdptDst;
     1784
     1785    int rc = PGMShwGetLongModePDPtr(pVM, GCPtrPage, &pPdptDst, &pPDDst);
     1786    AssertRCReturn(rc, rc);
     1787    Assert(pPDDst && pPdptDst);
     1788    PdeDst = pPDDst->a[iPDDst];
    17771789# endif
    17781790    Assert(PdeDst.n.u1Present);
     
    22162228    PX86PD          pPDDst   = pVM->pgm.s.CTXMID(p,32BitPD);
    22172229# elif PGM_SHW_TYPE == PGM_TYPE_PAE
    2218     const unsigned  iPDDst   = GCPtrPage >> SHW_PD_SHIFT;               /* 0 - 2047 */
     2230    const unsigned  iPDDst   = GCPtrPage >> SHW_PD_SHIFT;               /* no mask; flat index into the 2048 entry array. */
    22192231    const unsigned  iPdpte   = (GCPtrPage >> X86_PDPT_SHIFT);
    22202232    PX86PDPT        pPdptDst = pVM->pgm.s.CTXMID(p,PaePDPT);
    22212233    PX86PDPAE       pPDDst   = pVM->pgm.s.CTXMID(ap,PaePDs)[0];
    22222234# elif PGM_SHW_TYPE == PGM_TYPE_AMD64
    2223     const unsigned  iPml4e   = (GCPtrPage >> X86_PML4_SHIFT) & X86_PML4_MASK;
    22242235    const unsigned  iPdpte   = (GCPtrPage >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
    22252236    const unsigned  iPDDst   = (GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK;
     
    26032614     */
    26042615# if PGM_SHW_TYPE == PGM_TYPE_32BIT
     2616    const unsigned  iPDDst = GCPtrPage >> SHW_PD_SHIFT;
    26052617    PX86PD          pPDDst = pVM->pgm.s.CTXMID(p,32BitPD);
    2606 # else
     2618# elif PGM_SHW_TYPE == PGM_TYPE_PAE
     2619    const unsigned  iPDDst = GCPtrPage >> SHW_PD_SHIFT;             /* no mask; flat index into the 2048 entry array. */
    26072620    PX86PDPAE       pPDDst = pVM->pgm.s.CTXMID(ap,PaePDs)[0];
    2608 # endif
    2609     const unsigned  iPDDst = GCPtrPage >> SHW_PD_SHIFT;
     2621# elif PGM_SHW_TYPE == PGM_TYPE_AMD64
     2622    const unsigned  iPdpte   = (GCPtrPage >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64;
     2623    const unsigned  iPDDst   = (GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK;
     2624    PX86PDPAE       pPDDst;
     2625    PX86PDPT        pPdptDst;
     2626    rc = PGMShwGetLongModePDPtr(pVM, GCPtrPage, &pPdptDst, &pPDDst);
     2627    if (rc != VINF_SUCCESS)
     2628    {
     2629        AssertMsg(rc == VINF_PGM_SYNC_CR3, ("Unexpected rc=%Vrc\n", rc));
     2630        return rc;
     2631    }
     2632    Assert(pPDDst);
     2633
     2634    /* Fetch the pgm pool shadow descriptor. */
     2635    PPGMPOOLPAGE pShwPde = pgmPoolGetPageByHCPhys(pVM, pPdptDst->a[iPdpte].u & X86_PDPE_PG_MASK);
     2636    Assert(pShwPde);
     2637# endif
    26102638    PSHWPDE         pPdeDst = &pPDDst->a[iPDDst];
    26112639    SHWPDE          PdeDst = *pPdeDst;
     
    26302658    /* Virtual address = physical address */
    26312659    GCPhys = GCPtrPage & X86_PAGE_4K_BASE_MASK_32;
     2660# if PGM_SHW_TYPE == PGM_TYPE_AMD64
     2661    rc = pgmPoolAlloc(pVM, GCPhys, BTH_PGMPOOLKIND_PT_FOR_PT, pShwPde->idx,    iPDDst, &pShwPage);
     2662# else
    26322663    rc = pgmPoolAlloc(pVM, GCPhys, BTH_PGMPOOLKIND_PT_FOR_PT, SHW_POOL_ROOT_IDX, iPDDst, &pShwPage);
     2664# endif
    26332665
    26342666    if (    rc == 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