VirtualBox

Changeset 91987 in vbox for trunk/src


Ignore:
Timestamp:
Oct 22, 2021 3:22:15 AM (3 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:10092 Update VMLAUNCH/VMRESUME and VM-exit to update EPT pointer with PGM.

File:
1 edited

Legend:

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

    r91974 r91987  
    14931493     * we zero them for consistency.
    14941494     */
    1495     if (    (pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_EPT)
    1496         && !(pVmcs->u32EntryCtls & VMX_ENTRY_CTLS_IA32E_MODE_GUEST)
    1497         &&  (pVCpu->cpum.GstCtx.cr4 & X86_CR4_PAE)
    1498         &&  (pVCpu->cpum.GstCtx.cr0 & X86_CR0_PG))
    1499     {
    1500         pVmcs->u64GuestPdpte0.u = pVCpu->cpum.GstCtx.aPaePdpes[0].u;
    1501         pVmcs->u64GuestPdpte1.u = pVCpu->cpum.GstCtx.aPaePdpes[1].u;
    1502         pVmcs->u64GuestPdpte2.u = pVCpu->cpum.GstCtx.aPaePdpes[2].u;
    1503         pVmcs->u64GuestPdpte3.u = pVCpu->cpum.GstCtx.aPaePdpes[3].u;
     1495    if (pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_EPT)
     1496    {
     1497        if (   !(pVmcs->u32EntryCtls & VMX_ENTRY_CTLS_IA32E_MODE_GUEST)
     1498            &&  (pVCpu->cpum.GstCtx.cr4 & X86_CR4_PAE)
     1499            &&  (pVCpu->cpum.GstCtx.cr0 & X86_CR0_PG))
     1500        {
     1501            pVmcs->u64GuestPdpte0.u = pVCpu->cpum.GstCtx.aPaePdpes[0].u;
     1502            pVmcs->u64GuestPdpte1.u = pVCpu->cpum.GstCtx.aPaePdpes[1].u;
     1503            pVmcs->u64GuestPdpte2.u = pVCpu->cpum.GstCtx.aPaePdpes[2].u;
     1504            pVmcs->u64GuestPdpte3.u = pVCpu->cpum.GstCtx.aPaePdpes[3].u;
     1505        }
     1506        else
     1507        {
     1508            pVmcs->u64GuestPdpte0.u = 0;
     1509            pVmcs->u64GuestPdpte1.u = 0;
     1510            pVmcs->u64GuestPdpte2.u = 0;
     1511            pVmcs->u64GuestPdpte3.u = 0;
     1512        }
     1513
     1514        /* Clear PGM's copy of the EPT pointer for added safety. */
     1515        PGMSetGuestEptPtr(pVCpu, 0 /* uEptPtr */);
    15041516    }
    15051517    else
     
    61536165
    61546166#ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
    6155         /* Extended Page Tables Pointer (EPTP). */
     6167        /* Extended-Page-Table Pointer (EPTP). */
    61566168        if (pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_EPT)
    61576169        {
    61586170            VMXVDIAG enmVmxDiag;
    6159             rc = iemVmxVmentryCheckEptPtr(pVCpu, &enmVmxDiag);
     6171            int const rc = iemVmxVmentryCheckEptPtr(pVCpu, &enmVmxDiag);
    61606172            if (RT_SUCCESS(rc))
    61616173            { /* likely */ }
     
    66616673    /* SMI blocking is irrelevant. We don't support SMIs yet. */
    66626674
    6663     /* Loading PDPTEs will be taken care when we switch modes. We don't support EPT yet. */
    6664     Assert(!(pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_EPT));
     6675    /*
     6676     * Load the PAE PDPTEs from the VMCS when using EPT with PAE paging.
     6677     */
     6678    if (pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_EPT)
     6679    {
     6680        if (   !(pVmcs->u32EntryCtls & VMX_ENTRY_CTLS_IA32E_MODE_GUEST)
     6681            &&  (pVCpu->cpum.GstCtx.cr4 & X86_CR4_PAE)
     6682            &&  (pVCpu->cpum.GstCtx.cr0 & X86_CR0_PG))
     6683        {
     6684            X86PDPE aPaePdptes[X86_PG_PAE_PDPE_ENTRIES];
     6685            aPaePdptes[0].u = pVmcs->u64GuestPdpte0.u;
     6686            aPaePdptes[1].u = pVmcs->u64GuestPdpte1.u;
     6687            aPaePdptes[2].u = pVmcs->u64GuestPdpte2.u;
     6688            aPaePdptes[3].u = pVmcs->u64GuestPdpte3.u;
     6689            AssertCompile(RT_ELEMENTS(aPaePdptes) == RT_ELEMENTS(pVCpu->cpum.GstCtx.aPaePdpes));
     6690            for (unsigned i = 0; i < RT_ELEMENTS(pVCpu->cpum.GstCtx.aPaePdpes); i++)
     6691                pVCpu->cpum.GstCtx.aPaePdpes[i].u = aPaePdptes[i].u;
     6692        }
     6693
     6694        /*
     6695         * Set PGM's copy of the EPT pointer.
     6696         * The EPTP has already been validated while checking guest state.
     6697         */
     6698        PGMSetGuestEptPtr(pVCpu, pVmcs->u64EptPtr.u);
     6699    }
    66656700
    66666701    /* VPID is irrelevant. We don't support VPID yet. */
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