VirtualBox

Changeset 86464 in vbox for trunk


Ignore:
Timestamp:
Oct 7, 2020 8:09:22 AM (4 years ago)
Author:
vboxsync
Message:

VMM/PGMAll.h: No EPT bitfields. bugref:9841 bugref:9746

Location:
trunk
Files:
4 edited

Legend:

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

    r86457 r86464  
    445445/** @} */
    446446
    447 /** @name VMX EPT paging structures
    448  * @{
    449  */
    450 
    451 /** @name Common bits
     447/** @name VMX Extended Page Tables (EPT) Common Bits
    452448 * @{ */
    453449/** Bit 0 - Readable (we often think of it as present). */
     
    484480/** Bits 3-5 - Memory type: WB. */
    485481#define EPT_E_TYPE_WB           (UINT64_C(6) << EPT_E_TYPE_SHIFT)
     482/** Bits 3-5 - Memory type: Invalid (7). */
     483#define EPT_E_TYPE_INVALID_7    (UINT64_C(7) << EPT_E_TYPE_SHIFT)
    486484
    487485/** Bit 6 - Ignore page attribute table (leaf, MBZ). */
     
    526524/** @} */
    527525
     526
     527/** @name VMX Extended Page Tables (EPT) Structures
     528 * @{
     529 */
     530
    528531/**
    529532 * Number of page table entries in the EPT. (PDPTE/PDE/PTE)
     
    570573typedef union EPTPML4E
    571574{
     575#ifndef VBOX_WITHOUT_PAGING_BIT_FIELDS
    572576    /** Normal view. */
    573577    EPTPML4EBITS    n;
     578#endif
    574579    /** Unsigned integer view. */
    575580    X86PGPAEUINT    u;
     
    635640typedef union EPTPDPTE
    636641{
     642#ifndef VBOX_WITHOUT_PAGING_BIT_FIELDS
    637643    /** Normal view. */
    638644    EPTPDPTEBITS    n;
     645#endif
    639646    /** Unsigned integer view. */
    640647    X86PGPAEUINT    u;
     
    734741typedef union EPTPDE
    735742{
     743#ifndef VBOX_WITHOUT_PAGING_BIT_FIELDS
    736744    /** Normal view. */
    737745    EPTPDEBITS      n;
    738746    /** 2MB view (big). */
    739747    EPTPDE2MBITS    b;
     748#endif
    740749    /** Unsigned integer view. */
    741750    X86PGPAEUINT    u;
     
    808817typedef union EPTPTE
    809818{
     819#ifndef VBOX_WITHOUT_PAGING_BIT_FIELDS
    810820    /** Normal view. */
    811821    EPTPTEBITS      n;
     822#endif
    812823    /** Unsigned integer view. */
    813824    X86PGPAEUINT    u;
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r86455 r86464  
    2121*********************************************************************************************************************************/
    2222#define LOG_GROUP LOG_GROUP_PGM
     23#define VBOX_WITHOUT_PAGING_BIT_FIELDS /* 64-bit bitfields are just asking for trouble. See @bugref{9841} and others. */
    2324#include <VBox/vmm/pgm.h>
    2425#include <VBox/vmm/cpum.h>
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r86462 r86464  
    632632#  endif
    633633    if (    !(uErr & X86_TRAP_PF_P) /* not set means page not present instead of page protection violation */
    634         &&  !pPDDst->a[iPDDst].n.u1Present)
     634        &&  !SHW_PDE_IS_P(pPDDst->a[iPDDst]))
    635635    {
    636636        STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2SyncPT; });
     
    14671467        LogFlow(("SyncHandlerPte: monitored page (%R[pgmpage]) -> mark read-only\n", pPage));
    14681468# if PGM_SHW_TYPE == PGM_TYPE_EPT
    1469         pPteDst->u             = PGM_PAGE_GET_HCPHYS(pPage);
    1470         pPteDst->n.u1Present   = 1;
    1471         pPteDst->n.u1Execute   = 1;
    1472         pPteDst->n.u1IgnorePAT = 1;
    1473         pPteDst->n.u3EMT       = VMX_EPT_MEMTYPE_WB;
    1474         /* PteDst.n.u1Write = 0 && PteDst.n.u1Size = 0 */
     1469        pPteDst->u = PGM_PAGE_GET_HCPHYS(pPage) | EPT_E_READ | EPT_E_EXECUTE | EPT_E_TYPE_WB | EPT_E_IGNORE_PAT;
    14751470# else
    14761471        if (fPteSrc & X86_PTE_A)
     
    14961491#   if PGM_SHW_TYPE == PGM_TYPE_EPT
    14971492        /* 25.2.3.1: Reserved physical address bit -> EPT Misconfiguration (exit 49) */
    1498         pPteDst->u = pVM->pgm.s.HCPhysInvMmioPg;
     1493        pPteDst->u = pVM->pgm.s.HCPhysInvMmioPg
    14991494        /* 25.2.3.1: bits 2:0 = 010b -> EPT Misconfiguration (exit 49) */
    1500         pPteDst->n.u1Present = 0;
    1501         pPteDst->n.u1Write   = 1;
    1502         pPteDst->n.u1Execute = 0;
     1495                   | EPT_E_WRITE
    15031496        /* 25.2.3.1: leaf && 2:0 != 0 && u3Emt in {2, 3, 7} -> EPT Misconfiguration */
    1504         pPteDst->n.u3EMT     = 7;
     1497                   | EPT_E_TYPE_INVALID_3;
    15051498#   else
    15061499        /* Set high page frame bits that MBZ (bankers on PAE, CPU dependent on AMD64).  */
     
    16581651                    STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,DirtyPageSkipped));
    16591652# if PGM_SHW_TYPE == PGM_TYPE_EPT
    1660                     PteDst.u             = PGM_PAGE_GET_HCPHYS(pPage);
    1661                     PteDst.n.u1Present   = 1;
    1662                     PteDst.n.u1Write     = 1;
    1663                     PteDst.n.u1Execute   = 1;
    1664                     PteDst.n.u1IgnorePAT = 1;
    1665                     PteDst.n.u3EMT       = VMX_EPT_MEMTYPE_WB;
    1666                     /* PteDst.n.u1Size = 0 */
     1653                    PteDst.u = PGM_PAGE_GET_HCPHYS(pPage)
     1654                             | EPT_E_READ | EPT_E_WRITE | EPT_E_EXECUTE | EPT_E_TYPE_WB | EPT_E_IGNORE_PAT;
    16671655# else
    16681656                    SHW_PTE_SET(PteDst, fGstShwPteFlags | PGM_PAGE_GET_HCPHYS(pPage));
     
    21282116#   endif
    21292117    /* In the guest SMP case we could have blocked while another VCPU reused this page table. */
    2130     if (!PdeDst.n.u1Present)
     2118    if (!SHW_PDE_IS_P(PdeDst))
    21312119    {
    21322120        AssertMsg(pVM->cCpus > 1, ("Unexpected missing PDE %RX64\n", (uint64_t)PdeDst.u));
     
    21362124
    21372125    /* Can happen in the guest SMP case; other VCPU activated this PDE while we were blocking to handle the page fault. */
    2138     if (PdeDst.n.u1Size)
     2126    if (SHW_PDE_IS_BIG(PdeDst))
    21392127    {
    21402128        Assert(pVM->pgm.s.fNestedPaging);
     
    29932981    Assert(!(PdeDst.u & PGM_PDFLAGS_MAPPING));
    29942982# endif
    2995     Assert(!PdeDst.n.u1Present); /* We're only supposed to call SyncPT on PDE!P and conflicts.*/
     2983    Assert(!SHW_PDE_IS_P(PdeDst)); /* We're only supposed to call SyncPT on PDE!P and conflicts.*/
    29962984
    29972985# if defined(PGM_WITH_LARGE_PAGES) && PGM_SHW_TYPE != PGM_TYPE_32BIT && PGM_SHW_TYPE != PGM_TYPE_PAE
  • trunk/src/VBox/VMM/VMMAll/PGMAllShw.h

    r86463 r86464  
    3333#undef SHW_PDE_ATOMIC_SET
    3434#undef SHW_PDE_ATOMIC_SET2
     35#undef SHW_PDE_IS_P
    3536#undef SHW_PDE_IS_BIG
    3637#undef SHW_PTE_PG_MASK
     
    7071# define SHW_PD_MASK                    X86_PD_MASK
    7172# define SHW_TOTAL_PD_ENTRIES           X86_PG_ENTRIES
     73# define SHW_PDE_IS_P(Pde)              ( (Pde).n.u1Present )
    7274# define SHW_PDE_IS_BIG(Pde)            ( (Pde).b.u1Size )
    7375# define SHW_PDE_ATOMIC_SET(Pde, uNew)  do { ASMAtomicWriteU32(&(Pde).u, (uNew)); } while (0)
     
    104106# define SHW_PD_SHIFT                   EPT_PD_SHIFT
    105107# define SHW_PD_MASK                    EPT_PD_MASK
     108# define SHW_PDE_IS_P(Pde)              ( (Pde).u & EPT_E_READ /* always set*/ )
    106109# define SHW_PDE_IS_BIG(Pde)            ( (Pde).u & EPT_E_LEAF )
    107110# define SHW_PDE_ATOMIC_SET(Pde, uNew)  do { ASMAtomicWriteU64(&(Pde).u, (uNew)); } while (0)
     
    142145# define SHW_PD_SHIFT                   X86_PD_PAE_SHIFT
    143146# define SHW_PD_MASK                    X86_PD_PAE_MASK
     147# define SHW_PDE_IS_P(Pde)              ( (Pde).u & X86_PDE_P )
    144148# define SHW_PDE_IS_BIG(Pde)            ( (Pde).u & X86_PDE_PS )
    145149# define SHW_PDE_ATOMIC_SET(Pde, uNew)  do { ASMAtomicWriteU64(&(Pde).u, (uNew)); } while (0)
     
    368372#  error "Misconfigured PGM_SHW_TYPE or something..."
    369373# endif
    370     if (!Pde.n.u1Present)
     374    if (!SHW_PDE_IS_P(Pde))
    371375        return VERR_PAGE_TABLE_NOT_PRESENT;
    372376
     
    545549        X86PDE          Pde = pgmShwGet32BitPDE(pVCpu, GCPtr);
    546550# endif
    547         if (!Pde.n.u1Present)
     551        if (!SHW_PDE_IS_P(Pde))
    548552            return VERR_PAGE_TABLE_NOT_PRESENT;
    549553
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