VirtualBox

Changeset 46125 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
May 16, 2013 1:59:37 PM (12 years ago)
Author:
vboxsync
Message:

PGM: Optimized virtual memory searching by skipping empty tables.

File:
1 edited

Legend:

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

    r45826 r46125  
    14151415
    14161416/**
     1417 * Performs a guest page table walk.
     1418 *
     1419 * The guest should be in paged protect mode or long mode when making a call to
     1420 * this function.
     1421 *
     1422 * @returns VBox status code.
     1423 * @retval  VINF_SUCCESS on success.
     1424 * @retval  VERR_PAGE_TABLE_NOT_PRESENT on failure.  Check pWalk for details.
     1425 * @retval  VERR_PGM_NOT_USED_IN_MODE if not paging isn't enabled. @a pWalk is
     1426 *          not valid, except enmType is PGMPTWALKGSTTYPE_INVALID.
     1427 *
     1428 * @param   pVCpu       The current CPU.
     1429 * @param   GCPtr       The guest virtual address to walk by.
     1430 * @param   pWalk       Where to return the walk result. This is valid on some
     1431 *                      error codes as well.
     1432 */
     1433int pgmGstPtWalk(PVMCPU pVCpu, RTGCPTR GCPtr, PPGMPTWALKGST pWalk)
     1434{
     1435    VMCPU_ASSERT_EMT(pVCpu);
     1436    switch (pVCpu->pgm.s.enmGuestMode)
     1437    {
     1438        case PGMMODE_32_BIT:
     1439            pWalk->enmType = PGMPTWALKGSTTYPE_32BIT;
     1440            return PGM_GST_NAME_32BIT(Walk)(pVCpu, GCPtr, &pWalk->u.Legacy);
     1441
     1442        case PGMMODE_PAE:
     1443        case PGMMODE_PAE_NX:
     1444            pWalk->enmType = PGMPTWALKGSTTYPE_PAE;
     1445            return PGM_GST_NAME_PAE(Walk)(pVCpu, GCPtr, &pWalk->u.Pae);
     1446
     1447#if !defined(IN_RC)
     1448        case PGMMODE_AMD64:
     1449        case PGMMODE_AMD64_NX:
     1450            pWalk->enmType = PGMPTWALKGSTTYPE_AMD64;
     1451            return PGM_GST_NAME_AMD64(Walk)(pVCpu, GCPtr, &pWalk->u.Amd64);
     1452#endif
     1453
     1454        case PGMMODE_REAL:
     1455        case PGMMODE_PROTECTED:
     1456            pWalk->enmType = PGMPTWALKGSTTYPE_INVALID;
     1457            return VERR_PGM_NOT_USED_IN_MODE;
     1458
     1459#if defined(IN_RC)
     1460        case PGMMODE_AMD64:
     1461        case PGMMODE_AMD64_NX:
     1462#endif
     1463        case PGMMODE_NESTED:
     1464        case PGMMODE_EPT:
     1465        default:
     1466            AssertFailed();
     1467            pWalk->enmType = PGMPTWALKGSTTYPE_INVALID;
     1468            return VERR_PGM_NOT_USED_IN_MODE;
     1469    }
     1470}
     1471
     1472
     1473/**
    14171474 * Checks if the page is present.
    14181475 *
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