VirtualBox

Ignore:
Timestamp:
Sep 9, 2011 2:10:18 PM (13 years ago)
Author:
vboxsync
Message:

VMM/VT-x: Fix for PAE guests running on 32-bit hosts or 64-bit hosts where VBoxInternal/PGM/MaxRing3Chunks is used.

File:
1 edited

Legend:

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

    r38684 r38707  
    12361236
    12371237/**
    1238  * Prefetch the 4 PDPT pointers (PAE and nested paging only)
     1238 * Loads the 4 PDPEs into the guest state when nested paging is used and the
     1239 * guest operates in PAE mode.
    12391240 *
    12401241 * @returns VINF_SUCCESS or fatal error.
    1241  * @param   pVM         The VM to operate on.
    12421242 * @param   pVCpu       The VMCPU to operate on.
    12431243 * @param   pCtx        Guest context
    12441244 */
    1245 static int hmR0VmxPrefetchPAEPdptrs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
     1245static int hmR0VmxLoadPaePdpes(PVMCPU pVCpu, PCPUMCTX pCtx)
    12461246{
    12471247    if (CPUMIsGuestInPAEModeEx(pCtx))
    12481248    {
    1249         for (unsigned i=0;i<4;i++)
    1250         {
    1251             X86PDPE Pdpe;
    1252             int rc = PGMGstQueryPaePDPtr(pVCpu, i, &Pdpe);
    1253             AssertRCReturn(rc, rc);
    1254 
    1255             rc = VMXWriteVMCS64(VMX_VMCS_GUEST_PDPTR0_FULL + i*2, Pdpe.u);
    1256             AssertRC(rc);
    1257         }
     1249        X86PDPE aPdpes[4];
     1250        int rc = PGMGstGetPaePdpes(pVCpu, &aPdpes[0]);
     1251        AssertRCReturn(rc, rc);
     1252
     1253        rc = VMXWriteVMCS64(VMX_VMCS_GUEST_PDPTR0_FULL, aPdpes[0].u); AssertRCReturn(rc, rc);
     1254        rc = VMXWriteVMCS64(VMX_VMCS_GUEST_PDPTR1_FULL, aPdpes[1].u); AssertRCReturn(rc, rc);
     1255        rc = VMXWriteVMCS64(VMX_VMCS_GUEST_PDPTR2_FULL, aPdpes[2].u); AssertRCReturn(rc, rc);
     1256        rc = VMXWriteVMCS64(VMX_VMCS_GUEST_PDPTR3_FULL, aPdpes[3].u); AssertRCReturn(rc, rc);
    12581257    }
    12591258    return VINF_SUCCESS;
    12601259}
     1260
     1261/**
     1262 * Saves the 4 PDPEs into the guest state when nested paging is used and the
     1263 * guest operates in PAE mode.
     1264 *
     1265 * @returns VINF_SUCCESS or fatal error.
     1266 * @param   pVCpu       The VMCPU to operate on.
     1267 * @param   pCtx        Guest context
     1268 *
     1269 * @remarks Tell PGM about CR3 changes before calling this helper.
     1270 */
     1271static int hmR0VmxSavePaePdpes(PVMCPU pVCpu, PCPUMCTX pCtx)
     1272{
     1273    if (CPUMIsGuestInPAEModeEx(pCtx))
     1274    {
     1275        int rc;
     1276        X86PDPE aPdpes[4];
     1277        rc = VMXReadVMCS64(VMX_VMCS_GUEST_PDPTR0_FULL, &aPdpes[0].u); AssertRCReturn(rc, rc);
     1278        rc = VMXReadVMCS64(VMX_VMCS_GUEST_PDPTR1_FULL, &aPdpes[1].u); AssertRCReturn(rc, rc);
     1279        rc = VMXReadVMCS64(VMX_VMCS_GUEST_PDPTR2_FULL, &aPdpes[2].u); AssertRCReturn(rc, rc);
     1280        rc = VMXReadVMCS64(VMX_VMCS_GUEST_PDPTR3_FULL, &aPdpes[3].u); AssertRCReturn(rc, rc);
     1281
     1282        rc = PGMGstUpdatePaePdpes(pVCpu, &aPdpes[0]);
     1283        AssertRCReturn(rc, rc);
     1284    }
     1285    return VINF_SUCCESS;
     1286}
     1287
    12611288
    12621289/**
     
    17531780                /* Save the real guest CR3 in VMX_VMCS_GUEST_CR3 */
    17541781                val = pCtx->cr3;
    1755                 /* Prefetch the four PDPT entries in PAE mode. */
    1756                 rc = hmR0VmxPrefetchPAEPdptrs(pVM, pVCpu, pCtx);
     1782                rc = hmR0VmxLoadPaePdpes(pVCpu, pCtx);
    17571783                AssertRCReturn(rc, rc);
    17581784            }
     
    20282054            PGMUpdateCR3(pVCpu, val);
    20292055        }
    2030         /* Prefetch the four PDPT entries in PAE mode. */
    2031         rc = hmR0VmxPrefetchPAEPdptrs(pVM, pVCpu, pCtx);
     2056        rc = hmR0VmxSavePaePdpes(pVCpu, pCtx);
    20322057        AssertRCReturn(rc, rc);
    20332058    }
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