VirtualBox

Changeset 96940 in vbox


Ignore:
Timestamp:
Sep 30, 2022 12:07:38 AM (2 years ago)
Author:
vboxsync
Message:

VMM/PGMDbg,DBGFMem: Basic EPT dumping, both guest and shadow tables. bugref:10092

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/DBGFMem.cpp

    r96407 r96940  
    636636    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
    637637    AssertReturn(idCpu < pUVM->cCpus, VERR_INVALID_CPU_ID);
    638     AssertReturn(!(fFlags & ~DBGFPGDMP_FLAGS_VALID_MASK), VERR_INVALID_PARAMETER);
    639     AssertReturn(fFlags & (DBGFPGDMP_FLAGS_SHADOW | DBGFPGDMP_FLAGS_GUEST), VERR_INVALID_PARAMETER);
    640     AssertReturn((fFlags & DBGFPGDMP_FLAGS_CURRENT_MODE) || !(fFlags & DBGFPGDMP_FLAGS_MODE_MASK), VERR_INVALID_PARAMETER);
     638    AssertReturn(!(fFlags & ~DBGFPGDMP_FLAGS_VALID_MASK), VERR_INVALID_FLAGS);
     639    AssertReturn(fFlags & (DBGFPGDMP_FLAGS_SHADOW | DBGFPGDMP_FLAGS_GUEST), VERR_INVALID_FLAGS);
     640    AssertReturn((fFlags & DBGFPGDMP_FLAGS_CURRENT_MODE) || (fFlags & DBGFPGDMP_FLAGS_MODE_MASK), VERR_INVALID_FLAGS);
    641641    AssertReturn(   !(fFlags & DBGFPGDMP_FLAGS_EPT)
    642642                 || !(fFlags & (DBGFPGDMP_FLAGS_LME | DBGFPGDMP_FLAGS_PAE | DBGFPGDMP_FLAGS_PSE | DBGFPGDMP_FLAGS_NXE))
    643                  , VERR_INVALID_PARAMETER);
     643                 , VERR_INVALID_FLAGS);
    644644    AssertReturn(cMaxDepth, VERR_INVALID_PARAMETER);
    645645
  • trunk/src/VBox/VMM/VMMR3/PGMDbg.cpp

    r96407 r96940  
    135135
    136136
     137/*********************************************************************************************************************************
     138*   Global Variables                                                                                                             *
     139*********************************************************************************************************************************/
     140static char const g_aaszEptMemType[2][8][3] =
     141{
     142    { "--", "!1", "!2", "!3", "!4", "!5", "!6", "!7" }, /* non-leaf */
     143    { "UC", "WC", "2!", "3!", "WT", "WP", "WB", "7!" }  /* leaf */
     144};
     145
     146
    137147/**
    138148 * Converts a R3 pointer to a GC physical address.
     
    11601170    pState->fEpt                = !!(fFlags & DBGFPGDMP_FLAGS_EPT);
    11611171    pState->fNxe                = !!(fFlags & DBGFPGDMP_FLAGS_NXE);
    1162     pState->cchAddress          = pState->fLme ? 16 : 8;
     1172    pState->cchAddress          = pState->fLme || pState->fEpt ? 16 : 8;
    11631173    pState->uLastRsvdBit        = pState->fNxe ? 62 : 63;
    11641174    pState->fDumpPageInfo       = !!(fFlags & DBGFPGDMP_FLAGS_PAGE_INFO);
     
    12401250    if (pPoolPage)
    12411251    {
    1242         pState->pHlp->pfnPrintf(pState->pHlp, "%0*llx error! %s at HCPhys=%RHp was not found in the page pool!\n",
    1243                                 pState->cchAddress, pState->u64Address, pszDesc, HCPhys);
    1244         return VERR_PGM_POOL_GET_PAGE_FAILED;
    1245     }
    1246     *ppv = (uint8_t *)pPoolPage->pvPageR3 + (HCPhys & GUEST_PAGE_OFFSET_MASK);
    1247     return VINF_SUCCESS;
     1252        *ppv = (uint8_t *)pPoolPage->pvPageR3 + (HCPhys & GUEST_PAGE_OFFSET_MASK);
     1253        return VINF_SUCCESS;
     1254    }
     1255    pState->pHlp->pfnPrintf(pState->pHlp, "%0*llx error! %s at HCPhys=%RHp was not found in the page pool!\n",
     1256                            pState->cchAddress, pState->u64Address, pszDesc, HCPhys);
     1257    return VERR_PGM_POOL_GET_PAGE_FAILED;
    12481258}
    12491259
     
    12991309
    13001310/**
     1311 * Dumps an EPT shadow page table.
     1312 *
     1313 * @returns VBox status code (VINF_SUCCESS).
     1314 * @param   pState              The dumper state.
     1315 * @param   HCPhys              The page table address.
     1316 */
     1317static int pgmR3DumpHierarchyShwEptPT(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys)
     1318{
     1319    PCEPTPT pPT = NULL;
     1320    int rc = pgmR3DumpHierarchyShwMapPage(pState, HCPhys, "EPT level 1", (void const **)&pPT);
     1321    if (RT_FAILURE(rc))
     1322        return rc;
     1323
     1324    PVM const pVM = pState->pVM;
     1325    uint32_t iFirst, iLast;
     1326    uint64_t u64BaseAddress = pgmR3DumpHierarchyCalcRange(pState, EPT_PT_SHIFT, EPT_PG_ENTRIES, &iFirst, &iLast);
     1327    for (uint32_t i = iFirst; i <= iLast; i++)
     1328    {
     1329        uint64_t const u = pPT->a[i].u;
     1330        if (u & EPT_PRESENT_MASK)
     1331        {
     1332            pState->u64Address = u64BaseAddress + ((uint64_t)i << EPT_PT_SHIFT);
     1333            if (      (u & (EPT_E_WRITE | EPT_E_MEMTYPE_MASK | EPT_E_READ | EPT_E_EXECUTE))
     1334                   !=      (EPT_E_WRITE | EPT_E_MEMTYPE_INVALID_3)
     1335                || (u & EPT_E_PG_MASK) != pVM->pgm.s.HCPhysInvMmioPg)
     1336            {
     1337                pState->pHlp->pfnPrintf(pState->pHlp, /* R W X MT I  L A  D  U  w  k  s  v */
     1338                                        "%016llx 1    | %c%c%c %s %c L %c %c %c %c %c %c %c 4K %016llx",
     1339                                        pState->u64Address,
     1340                                        u & EPT_E_READ         ? 'R'  : '-',
     1341                                        u & EPT_E_WRITE        ? 'W'  : '-',
     1342                                        u & EPT_E_EXECUTE      ? 'X'  : '-',
     1343                                        g_aaszEptMemType[1][(u >> EPT_E_MEMTYPE_SHIFT) & EPT_E_MEMTYPE_SMASK],
     1344                                        u & EPT_E_IGNORE_PAT   ? 'I'  : '-',
     1345                                        u & EPT_E_ACCESSED     ? 'A'  : '-',
     1346                                        u & EPT_E_DIRTY        ? 'D'  : '-',
     1347                                        u & EPT_E_USER_EXECUTE ? 'U'  : '-',
     1348                                        u & EPT_E_PAGING_WRITE ? 'w'  : '-',
     1349                                        u & EPT_E_SUPER_SHW_STACK ? 'k'  : '-',
     1350                                        u & EPT_E_SUBPAGE_WRITE_PERM ? 's'  : '-',
     1351                                        u & EPT_E_SUPPRESS_VE  ? 'v'  : '-',
     1352                                        u & EPT_E_PG_MASK);
     1353                if (pState->fDumpPageInfo)
     1354                    pgmR3DumpHierarchyShwGuestPageInfo(pState, u & EPT_E_PG_MASK, _4K);
     1355                //if ((u >> 52) & 0x7ff)
     1356                //    pState->pHlp->pfnPrintf(pState->pHlp, " 62:52=%03llx%s", (u >> 52) & 0x7ff, pState->fLme ? "" : "!");
     1357                pState->pHlp->pfnPrintf(pState->pHlp, "\n");
     1358            }
     1359            else
     1360            {
     1361                const char *pszDesc = "???";
     1362                PGM_LOCK_VOID(pVM);
     1363                PPGMPHYSHANDLER pHandler;
     1364                int rc3 = pgmHandlerPhysicalLookup(pVM, u64BaseAddress, &pHandler);
     1365                if (RT_SUCCESS(rc3))
     1366                    pszDesc = pHandler->pszDesc;
     1367                PGM_UNLOCK(pVM);
     1368
     1369                pState->pHlp->pfnPrintf(pState->pHlp, "%016llx 1    | invalid / MMIO optimization (%s)\n",
     1370                                        pState->u64Address, pszDesc);
     1371            }
     1372            pState->cLeaves++;
     1373        }
     1374    }
     1375    return VINF_SUCCESS;
     1376}
     1377
     1378
     1379/**
     1380 * Dumps an EPT shadow page directory table.
     1381 *
     1382 * @returns VBox status code (VINF_SUCCESS).
     1383 * @param   pState      The dumper state.
     1384 * @param   HCPhys      The physical address of the page directory table.
     1385 * @param   cMaxDepth   The maximum depth.
     1386 */
     1387static int  pgmR3DumpHierarchyShwEptPD(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys, unsigned cMaxDepth)
     1388{
     1389    PCEPTPD pPD = NULL;
     1390    int rc = pgmR3DumpHierarchyShwMapPage(pState, HCPhys, "EPT level 2", (void const **)&pPD);
     1391    if (RT_FAILURE(rc))
     1392        return rc;
     1393
     1394    Assert(cMaxDepth > 0);
     1395    cMaxDepth--;
     1396
     1397    uint32_t iFirst, iLast;
     1398    uint64_t u64BaseAddress = pgmR3DumpHierarchyCalcRange(pState, EPT_PD_SHIFT, EPT_PG_ENTRIES, &iFirst, &iLast);
     1399    for (uint32_t i = iFirst; i <= iLast; i++)
     1400    {
     1401        uint64_t const u = pPD->a[i].u;
     1402        if (u & EPT_PRESENT_MASK)
     1403        {
     1404            pState->u64Address = u64BaseAddress + ((uint64_t)i << EPT_PD_SHIFT);
     1405            if (u & EPT_E_LEAF)
     1406            {
     1407                pState->pHlp->pfnPrintf(pState->pHlp, /* R W X MT I  L A  D  U  w  k  s  v */
     1408                                        "%016llx 2   |  %c%c%c %s %c L %c %c %c %c %c %c %c 2M %016llx",
     1409                                        pState->u64Address,
     1410                                        u & EPT_E_READ         ? 'R'  : '-',
     1411                                        u & EPT_E_WRITE        ? 'W'  : '-',
     1412                                        u & EPT_E_EXECUTE      ? 'X'  : '-',
     1413                                        g_aaszEptMemType[1][(u >> EPT_E_MEMTYPE_SHIFT) & EPT_E_MEMTYPE_SMASK],
     1414                                        u & EPT_E_IGNORE_PAT   ? 'I'  : '-',
     1415                                        u & EPT_E_ACCESSED     ? 'A'  : '-',
     1416                                        u & EPT_E_DIRTY        ? 'D'  : '-',
     1417                                        u & EPT_E_USER_EXECUTE ? 'U'  : '-',
     1418                                        u & EPT_E_PAGING_WRITE ? 'w'  : '-',
     1419                                        u & EPT_E_SUPER_SHW_STACK ? 'k'  : '-',
     1420                                        u & EPT_E_SUBPAGE_WRITE_PERM ? 's'  : '-',
     1421                                        u & EPT_E_SUPPRESS_VE  ? 'v'  : '-',
     1422                                        u & EPT_E_PG_MASK);
     1423                if (pState->fDumpPageInfo)
     1424                    pgmR3DumpHierarchyShwGuestPageInfo(pState, u & EPT_PDE2M_PG_MASK, _2M);
     1425                //if ((u >> 52) & 0x7ff)
     1426                //    pState->pHlp->pfnPrintf(pState->pHlp, " 62:52=%03llx%s", (u >> 52) & 0x7ff, pState->fLme ? "" : "!");
     1427                if (u & EPT_PDE2M_MBZ_MASK)
     1428                    pState->pHlp->pfnPrintf(pState->pHlp, " 20:12=%02llx!", (u >> 12) & 0x1ff);
     1429                pState->pHlp->pfnPrintf(pState->pHlp, "\n");
     1430
     1431                pState->cLeaves++;
     1432            }
     1433            else
     1434            {
     1435                pState->pHlp->pfnPrintf(pState->pHlp, /* R W X MT I  L A  D  U  w  k  s  v */
     1436                                        "%016llx 2   |  %c%c%c %s %c - %c %c %c %c %c %c %c    %016llx",
     1437                                        pState->u64Address,
     1438                                        u & EPT_E_READ         ? 'R'  : '-',
     1439                                        u & EPT_E_WRITE        ? 'W'  : '-',
     1440                                        u & EPT_E_EXECUTE      ? 'X'  : '-',
     1441                                        g_aaszEptMemType[0][(u >> EPT_E_MEMTYPE_SHIFT) & EPT_E_MEMTYPE_SMASK],
     1442                                        u & EPT_E_IGNORE_PAT   ? '!'  : '-',
     1443                                        u & EPT_E_ACCESSED     ? 'A'  : '-',
     1444                                        u & EPT_E_DIRTY        ? 'D'  : '-',
     1445                                        u & EPT_E_USER_EXECUTE ? 'U'  : '-',
     1446                                        u & EPT_E_PAGING_WRITE ? 'w'  : '-',
     1447                                        u & EPT_E_SUPER_SHW_STACK ? 'k'  : '-',
     1448                                        u & EPT_E_SUBPAGE_WRITE_PERM ? 's'  : '-',
     1449                                        u & EPT_E_SUPPRESS_VE  ? 'v'  : '-',
     1450                                        u & EPT_E_PG_MASK);
     1451                if (pState->fDumpPageInfo)
     1452                    pgmR3DumpHierarchyShwTablePageInfo(pState, u & EPT_E_PG_MASK);
     1453                //if ((u >> 52) & 0x7ff)
     1454                //    pState->pHlp->pfnPrintf(pState->pHlp, " 62:52=%03llx!", (u >> 52) & 0x7ff);
     1455                pState->pHlp->pfnPrintf(pState->pHlp, "\n");
     1456
     1457                if (cMaxDepth)
     1458                {
     1459                    int rc2 = pgmR3DumpHierarchyShwEptPT(pState, u & EPT_E_PG_MASK);
     1460                    if (rc2 < rc && RT_SUCCESS(rc))
     1461                        rc = rc2;
     1462                }
     1463                else
     1464                    pState->cLeaves++;
     1465            }
     1466        }
     1467    }
     1468    return rc;
     1469}
     1470
     1471
     1472/**
     1473 * Dumps an EPT shadow page directory pointer table.
     1474 *
     1475 * @returns VBox status code (VINF_SUCCESS).
     1476 * @param   pState      The dumper state.
     1477 * @param   HCPhys      The physical address of the page directory pointer table.
     1478 * @param   cMaxDepth   The maximum depth.
     1479 */
     1480static int  pgmR3DumpHierarchyShwEptPDPT(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys, unsigned cMaxDepth)
     1481{
     1482    PCEPTPDPT pPDPT = NULL;
     1483    int rc = pgmR3DumpHierarchyShwMapPage(pState, HCPhys, "EPT level 3", (void const **)&pPDPT);
     1484    if (RT_FAILURE(rc))
     1485        return rc;
     1486
     1487    Assert(cMaxDepth > 0);
     1488    cMaxDepth--;
     1489
     1490    uint32_t iFirst, iLast;
     1491    uint64_t u64BaseAddress = pgmR3DumpHierarchyCalcRange(pState, EPT_PDPT_SHIFT, EPT_PG_ENTRIES, &iFirst, &iLast);
     1492    for (uint32_t i = iFirst; i <= iLast; i++)
     1493    {
     1494        uint64_t const u = pPDPT->a[i].u;
     1495        if (u & EPT_PRESENT_MASK)
     1496        {
     1497            pState->u64Address = u64BaseAddress + ((uint64_t)i << EPT_PDPT_SHIFT);
     1498            pState->pHlp->pfnPrintf(pState->pHlp, /* R W X MT I  L  A  D  U  w  k  s  v */
     1499                                    "%016llx 3  |   %c%c%c %s %c %c %c %c %c %c %c %c %c    %016llx",
     1500                                    pState->u64Address,
     1501                                    u & EPT_E_READ         ? 'R'  : '-',
     1502                                    u & EPT_E_WRITE        ? 'W'  : '-',
     1503                                    u & EPT_E_EXECUTE      ? 'X'  : '-',
     1504                                    g_aaszEptMemType[!!(u & EPT_E_LEAF)][(u >> EPT_E_MEMTYPE_SHIFT) & EPT_E_MEMTYPE_SMASK],
     1505                                    u & EPT_E_IGNORE_PAT   ? '!'  : '-',
     1506                                    u & EPT_E_LEAF         ? '!'  : '-',
     1507                                    u & EPT_E_ACCESSED     ? 'A'  : '-',
     1508                                    u & EPT_E_DIRTY        ? 'D'  : '-',
     1509                                    u & EPT_E_USER_EXECUTE ? 'U'  : '-',
     1510                                    u & EPT_E_PAGING_WRITE ? 'w'  : '-',
     1511                                    u & EPT_E_SUPER_SHW_STACK ? 'k'  : '-',
     1512                                    u & EPT_E_SUBPAGE_WRITE_PERM ? 's'  : '-',
     1513                                    u & EPT_E_SUPPRESS_VE  ? 'v'  : '-',
     1514                                    u & EPT_E_PG_MASK);
     1515            if (pState->fDumpPageInfo)
     1516                pgmR3DumpHierarchyShwTablePageInfo(pState, u & EPT_E_PG_MASK);
     1517            //if ((u >> 52) & 0x7ff)
     1518            //    pState->pHlp->pfnPrintf(pState->pHlp, " 62:52=%03llx", (u >> 52) & 0x7ff);
     1519            pState->pHlp->pfnPrintf(pState->pHlp, "\n");
     1520
     1521            if (cMaxDepth)
     1522            {
     1523                int rc2 = pgmR3DumpHierarchyShwEptPD(pState, u & EPT_E_PG_MASK, cMaxDepth);
     1524                if (rc2 < rc && RT_SUCCESS(rc))
     1525                    rc = rc2;
     1526            }
     1527            else
     1528                pState->cLeaves++;
     1529        }
     1530    }
     1531    return rc;
     1532}
     1533
     1534
     1535/**
     1536 * Dumps an EPT shadow PML4 table.
     1537 *
     1538 * @returns VBox status code (VINF_SUCCESS).
     1539 * @param   pState      The dumper state.
     1540 * @param   HCPhys      The physical address of the table.
     1541 * @param   cMaxDepth   The maximum depth.
     1542 */
     1543static int pgmR3DumpHierarchyShwEptPML4(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys, unsigned cMaxDepth)
     1544{
     1545    PCEPTPML4 pPML4 = NULL;
     1546    int rc = pgmR3DumpHierarchyShwMapPage(pState, HCPhys, "EPT level 4", (void const **)&pPML4);
     1547    if (RT_FAILURE(rc))
     1548        return rc;
     1549
     1550    Assert(cMaxDepth);
     1551    cMaxDepth--;
     1552
     1553    uint32_t iFirst = (pState->u64FirstAddress >> EPT_PML4_SHIFT) & EPT_PML4_MASK;
     1554    uint32_t iLast  = (pState->u64LastAddress  >> EPT_PML4_SHIFT) & EPT_PML4_MASK;
     1555    for (uint32_t i = iFirst; i <= iLast; i++)
     1556    {
     1557        uint64_t const u = pPML4->a[i].u;
     1558        if (u & EPT_PRESENT_MASK)
     1559        {
     1560            pState->u64Address = (uint64_t)i << X86_PML4_SHIFT;
     1561            pState->pHlp->pfnPrintf(pState->pHlp, /* R W X MT I  L  A  D  U  w  k  s  v */
     1562                                    "%016llx 4 |    %c%c%c %s %c %c %c %c %c %c %c %c %c    %016llx",
     1563                                    pState->u64Address,
     1564                                    u & EPT_E_READ         ? 'R'  : '-',
     1565                                    u & EPT_E_WRITE        ? 'W'  : '-',
     1566                                    u & EPT_E_EXECUTE      ? 'X'  : '-',
     1567                                    g_aaszEptMemType[!!(u & EPT_E_LEAF)][(u >> EPT_E_MEMTYPE_SHIFT) & EPT_E_MEMTYPE_SMASK],
     1568                                    u & EPT_E_IGNORE_PAT   ? '!'  : '-',
     1569                                    u & EPT_E_LEAF         ? '!'  : '-',
     1570                                    u & EPT_E_ACCESSED     ? 'A'  : '-',
     1571                                    u & EPT_E_DIRTY        ? 'D'  : '-',
     1572                                    u & EPT_E_USER_EXECUTE ? 'U'  : '-',
     1573                                    u & EPT_E_PAGING_WRITE ? 'w'  : '-',
     1574                                    u & EPT_E_SUPER_SHW_STACK ? 'k'  : '-',
     1575                                    u & EPT_E_SUBPAGE_WRITE_PERM ? 's'  : '-',
     1576                                    u & EPT_E_SUPPRESS_VE  ? 'v'  : '-',
     1577                                    u & EPT_E_PG_MASK);
     1578
     1579            if (pState->fDumpPageInfo)
     1580                pgmR3DumpHierarchyShwTablePageInfo(pState, u & EPT_E_PG_MASK);
     1581            //if ((u >> 52) & 0x7ff)
     1582            //    pState->pHlp->pfnPrintf(pState->pHlp, " 62:52=%03llx!", (u >> 52) & 0x7ff);
     1583            pState->pHlp->pfnPrintf(pState->pHlp, "\n");
     1584
     1585            if (cMaxDepth)
     1586            {
     1587                int rc2 = pgmR3DumpHierarchyShwEptPDPT(pState, u & EPT_E_PG_MASK, cMaxDepth);
     1588                if (rc2 < rc && RT_SUCCESS(rc))
     1589                    rc = rc2;
     1590            }
     1591            else
     1592                pState->cLeaves++;
     1593        }
     1594    }
     1595    return rc;
     1596}
     1597
     1598
     1599/**
    13011600 * Dumps a PAE shadow page table.
    13021601 *
     
    13241623                pState->pHlp->pfnPrintf(pState->pHlp,
    13251624                                        pState->fLme  /*P R  S  A  D  G  WT CD AT NX 4M a p ?  */
    1326                                         ? "%016llx 3    | P %c %c %c %c %c %s %s %s %s 4K %c%c%c  %016llx"
    1327                                         :  "%08llx 2   |  P %c %c %c %c %c %s %s %s %s 4K %c%c%c  %016llx",
     1625                                        ? "%016llx 1    | P %c %c %c %c %c %s %s %s %s 4K %c%c%c  %016llx"
     1626                                        :  "%08llx 1   |  P %c %c %c %c %c %s %s %s %s 4K %c%c%c  %016llx",
    13281627                                        pState->u64Address,
    13291628                                        Pte.n.u1Write       ? 'W'  : 'R',
     
    13501649                pState->pHlp->pfnPrintf(pState->pHlp,
    13511650                                        pState->fLme
    1352                                         ? "%016llx 3    | invalid / MMIO optimization\n"
    1353                                         :  "%08llx 2   |  invalid / MMIO optimization\n",
     1651                                        ? "%016llx 1    | invalid / MMIO optimization\n"
     1652                                        :  "%08llx 1   |  invalid / MMIO optimization\n",
    13541653                                        pState->u64Address);
    13551654            else
    13561655                pState->pHlp->pfnPrintf(pState->pHlp,
    13571656                                        pState->fLme
    1358                                         ? "%016llx 3    | invalid: %RX64\n"
    1359                                         :  "%08llx 2   |  invalid: %RX64\n",
     1657                                        ? "%016llx 1    | invalid: %RX64\n"
     1658                                        :  "%08llx 1   |  invalid: %RX64\n",
    13601659                                        pState->u64Address, PGMSHWPTEPAE_GET_U(pPT->a[i]));
    13611660            pState->cLeaves++;
     
    13961695                                        pState->fLme    /*P R  S  A  D  G  WT CD AT NX 2M a  p ?  phys*/
    13971696                                        ? "%016llx 2   |  P %c %c %c %c %c %s %s %s %s 2M %c%c%c  %016llx"
    1398                                         :  "%08llx 1  |   P %c %c %c %c %c %s %s %s %s 2M %c%c%c  %016llx",
     1697                                        :  "%08llx 2  |   P %c %c %c %c %c %s %s %s %s 2M %c%c%c  %016llx",
    13991698                                        pState->u64Address,
    14001699                                        Pde.b.u1Write       ? 'W'  : 'R',
     
    14261725                                        pState->fLme    /*P R  S  A  D  G  WT CD AT NX 4M a  p ?  phys */
    14271726                                        ? "%016llx 2   |  P %c %c %c %c %c %s %s .. %s .. %c%c%c  %016llx"
    1428                                         :  "%08llx 1  |   P %c %c %c %c %c %s %s .. %s .. %c%c%c  %016llx",
     1727                                        :  "%08llx 2  |   P %c %c %c %c %c %s %s .. %s .. %c%c%c  %016llx",
    14291728                                        pState->u64Address,
    14301729                                        Pde.n.u1Write       ? 'W'  : 'R',
     
    14961795            {
    14971796                pState->pHlp->pfnPrintf(pState->pHlp, /*P R  S  A  D  G  WT CD AT NX .. a p ?  */
    1498                                         "%016llx 1  |   P %c %c %c %c %c %s %s %s %s .. %c%c%c  %016llx",
     1797                                        "%016llx 3  |   P %c %c %c %c %c %s %s %s %s .. %c%c%c  %016llx",
    14991798                                        pState->u64Address,
    15001799                                        Pdpe.lm.u1Write       ? 'W'  : 'R',
     
    15191818            {
    15201819                pState->pHlp->pfnPrintf(pState->pHlp,/*P R  S  A  D  G  WT CD AT NX .. a p ?  */
    1521                                         "%08llx 0 |    P %c %c %c %c %c %s %s %s %s .. %c%c%c  %016llx",
     1820                                        "%08llx 3 |    P %c %c %c %c %c %s %s %s %s .. %c%c%c  %016llx",
    15221821                                        pState->u64Address,
    15231822                                        Pdpe.n.u2Reserved & 1? '!'  : '.', /* mbz */
     
    15561855
    15571856/**
    1558  * Dumps a 32-bit shadow page table.
     1857 * Dumps a 64-bit shadow PML4 table.
    15591858 *
    15601859 * @returns VBox status code (VINF_SUCCESS).
     
    15971896                               | (i >= RT_ELEMENTS(pPML4->a) / 2 ? UINT64_C(0xffff000000000000) : 0);
    15981897            pState->pHlp->pfnPrintf(pState->pHlp, /*P R  S  A  D  G  WT CD AT NX 4M a p ?  */
    1599                                     "%016llx 0 |    P %c %c %c %c %c %s %s %s %s .. %c%c%c  %016llx",
     1898                                    "%016llx 4 |    P %c %c %c %c %c %s %s %s %s .. %c%c%c  %016llx",
    16001899                                    pState->u64Address,
    16011900                                    Pml4e.n.u1Write       ? 'W'  : 'R',
     
    17122011                                 | (Pde.u & X86_PDE4M_PG_MASK);
    17132012                pState->pHlp->pfnPrintf(pState->pHlp,/*P R  S  A  D  G  WT CD AT NX 4M a m d   phys */
    1714                                         "%08llx 0 |    P %c %c %c %c %c %s %s %s .. 4M %c%c%c  %08llx",
     2013                                        "%08llx 2 |    P %c %c %c %c %c %s %s %s .. 4M %c%c%c  %08llx",
    17152014                                        pState->u64Address,
    17162015                                        Pde.b.u1Write       ? 'W'  : 'R',
     
    17342033            {
    17352034                pState->pHlp->pfnPrintf(pState->pHlp,/*P R  S  A  D  G  WT CD AT NX 4M a m d   phys */
    1736                                         "%08llx 0 |    P %c %c %c %c %c %s %s .. .. 4K %c%c%c  %08x",
     2035                                        "%08llx 2 |    P %c %c %c %c %c %s %s .. .. 4K %c%c%c  %08x",
    17372036                                        pState->u64Address,
    17382037                                        Pde.n.u1Write       ? 'W'  : 'R',
     
    18052104            pState->pHlp->pfnPrintf(pState->pHlp,
    18062105                                    "%-*s        R - Readable\n"
    1807                                     "%-*s        | W - Writeable\n"
    1808                                     "%-*s        | | X - Executable\n"
    1809                                     "%-*s        | | | EMT - EPT memory type\n"
    1810                                     "%-*s        | | | |   PAT - Ignored PAT?\n"
    1811                                     "%-*s        | | | |   |    AVL1 - 4 available bits\n"
    1812                                     "%-*s        | | | |   |    |   AVL2 - 12 available bits\n"
    1813                                     "%-*s Level  | | | |   |    |    |     page  \n"
    1814                                   /* xxxx n **** R W X EMT PAT AVL1 AVL2   xxxxxxxxxxxxx
    1815                                                  R W X  7   0   f   fff    0123456701234567 */
     2106                                    "%-*s        |W - Writeable\n"
     2107                                    "%-*s        ||X - Executable\n"
     2108                                    "%-*s        ||| EMT - EPT memory type\n"
     2109                                    "%-*s        ||| |  I - Ignored PAT?\n"
     2110                                    "%-*s        ||| |  | L - leaf\n"
     2111                                    "%-*s        ||| |  | | A - accessed\n"
     2112                                    "%-*s        ||| |  | | | D - dirty\n"
     2113                                    "%-*s        ||| |  | | | | U - user execute\n"
     2114                                    "%-*s        ||| |  | | | | | w - Paging writable\n"
     2115                                    "%-*s        ||| |  | | | | | | k - Supervisor shadow stack writable\n"
     2116                                    "%-*s        ||| |  | | | | | | | v - Suppress #VE\n"
     2117                                    "%-*s Level  ||| |  | | | | | | | |    page\n"
     2118                                  /* xxxx n **** RWX MT I L A D U w k v 4K xxxxxxxxxxxxx
     2119                                                 RWX  7 - - - - - - - -    0123456701234567 */
    18162120                                    ,
    1817                                     cch, "", cch, "", cch, "", cch, "", cch, "", cch, "", cch, "", cch, "Address");
    1818 
    1819         pState->pHlp->pfnPrintf(pState->pHlp, "EPT dumping is not yet implemented, sorry.\n");
    1820         /** @todo implemented EPT dumping. */
    1821         rc = VERR_NOT_IMPLEMENTED;
     2121                                    cch, "", cch, "", cch, "", cch, "", cch, "", cch, "", cch, "", cch, "",
     2122                                    cch, "", cch, "", cch, "", cch, "", cch, "Address");
     2123        /** @todo assumes 4-level EPT tables for now. */
     2124        rc = pgmR3DumpHierarchyShwEptPML4(pState, cr3 & cr3Mask, cMaxDepth);
    18222125    }
    18232126    else
     
    18822185    PGMR3DUMPHIERARCHYSTATE State;
    18832186    pgmR3DumpHierarchyInitState(&State, pVM, fFlags, u64FirstAddr, u64LastAddr, pHlp);
    1884     return pgmR3DumpHierarchyShwDoIt(&State, cr3, cMaxDepth);
     2187    PGM_LOCK_VOID(pVM);
     2188    int rc = pgmR3DumpHierarchyShwDoIt(&State, cr3, cMaxDepth);
     2189    PGM_UNLOCK(pVM);
     2190    return rc;
    18852191}
    18862192
     
    19812287
    19822288/**
    1983  * Dumps a PAE shadow page table.
     2289 * Dumps an EPT guest page table.
     2290 *
     2291 * @returns VBox status code (VINF_SUCCESS).
     2292 * @param   pState              The dumper state.
     2293 * @param   HCPhys              The page table address.
     2294 */
     2295static int pgmR3DumpHierarchyGstEptPT(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys)
     2296{
     2297    PCEPTPT        pPT = NULL;
     2298    PGMPAGEMAPLOCK Lock;
     2299    int rc = pgmR3DumpHierarchyGstMapPage(pState, HCPhys, "Guest EPT level 1", (void const **)&pPT, &Lock);
     2300    if (RT_FAILURE(rc))
     2301        return rc;
     2302
     2303    uint32_t iFirst, iLast;
     2304    uint64_t u64BaseAddress = pgmR3DumpHierarchyCalcRange(pState, EPT_PT_SHIFT, EPT_PG_ENTRIES, &iFirst, &iLast);
     2305    for (uint32_t i = iFirst; i <= iLast; i++)
     2306    {
     2307        uint64_t const u = pPT->a[i].u;
     2308        if (u & EPT_PRESENT_MASK)
     2309        {
     2310            pState->u64Address = u64BaseAddress + ((uint64_t)i << EPT_PT_SHIFT);
     2311            pState->pHlp->pfnPrintf(pState->pHlp, /* R W X MT I  L A  D  U  w  k  s  v */
     2312                                    "%016llx 1    | %c%c%c %s %c L %c %c %c %c %c %c %c 4K %016llx",
     2313                                    pState->u64Address,
     2314                                    u & EPT_E_READ         ? 'R'  : '-',
     2315                                    u & EPT_E_WRITE        ? 'W'  : '-',
     2316                                    u & EPT_E_EXECUTE      ? 'X'  : '-',
     2317                                    g_aaszEptMemType[1][(u >> EPT_E_MEMTYPE_SHIFT) & EPT_E_MEMTYPE_SMASK],
     2318                                    u & EPT_E_IGNORE_PAT   ? 'I'  : '-',
     2319                                    u & EPT_E_ACCESSED     ? 'A'  : '-',
     2320                                    u & EPT_E_DIRTY        ? 'D'  : '-',
     2321                                    u & EPT_E_USER_EXECUTE ? 'U'  : '-',
     2322                                    u & EPT_E_PAGING_WRITE ? 'w'  : '-',
     2323                                    u & EPT_E_SUPER_SHW_STACK ? 'k'  : '-',
     2324                                    u & EPT_E_SUBPAGE_WRITE_PERM ? 's'  : '-',
     2325                                    u & EPT_E_SUPPRESS_VE  ? 'v'  : '-',
     2326                                    u & EPT_E_PG_MASK);
     2327            if (pState->fDumpPageInfo)
     2328                pgmR3DumpHierarchyGstPageInfo(pState, u & EPT_E_PG_MASK, _4K);
     2329            pgmR3DumpHierarchyGstCheckReservedHighBits(pState, u);
     2330            pState->pHlp->pfnPrintf(pState->pHlp, "\n");
     2331            pState->cLeaves++;
     2332        }
     2333    }
     2334
     2335    PGMPhysReleasePageMappingLock(pState->pVM, &Lock);
     2336    return VINF_SUCCESS;
     2337}
     2338
     2339
     2340/**
     2341 * Dumps an EPT guest page directory table.
     2342 *
     2343 * @returns VBox status code (VINF_SUCCESS).
     2344 * @param   pState      The dumper state.
     2345 * @param   HCPhys      The physical address of the page directory table.
     2346 * @param   cMaxDepth   The maximum depth.
     2347 */
     2348static int  pgmR3DumpHierarchyGstEptPD(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys, unsigned cMaxDepth)
     2349{
     2350    PCEPTPD        pPD = NULL;
     2351    PGMPAGEMAPLOCK Lock;
     2352    int rc = pgmR3DumpHierarchyGstMapPage(pState, HCPhys, "Guest EPT level 2", (void const **)&pPD, &Lock);
     2353    if (RT_FAILURE(rc))
     2354        return rc;
     2355
     2356    Assert(cMaxDepth > 0);
     2357    cMaxDepth--;
     2358
     2359    uint32_t iFirst, iLast;
     2360    uint64_t u64BaseAddress = pgmR3DumpHierarchyCalcRange(pState, EPT_PD_SHIFT, EPT_PG_ENTRIES, &iFirst, &iLast);
     2361    for (uint32_t i = iFirst; i <= iLast; i++)
     2362    {
     2363        uint64_t const u = pPD->a[i].u;
     2364        if (u & EPT_PRESENT_MASK)
     2365        {
     2366            pState->u64Address = u64BaseAddress + ((uint64_t)i << EPT_PD_SHIFT);
     2367            if (u & EPT_E_LEAF)
     2368            {
     2369                pState->pHlp->pfnPrintf(pState->pHlp, /* R W X MT I  L A  D  U  w  k  s  v */
     2370                                        "%016llx 2   |  %c%c%c %s %c L %c %c %c %c %c %c %c 2M %016llx",
     2371                                        pState->u64Address,
     2372                                        u & EPT_E_READ         ? 'R'  : '-',
     2373                                        u & EPT_E_WRITE        ? 'W'  : '-',
     2374                                        u & EPT_E_EXECUTE      ? 'X'  : '-',
     2375                                        g_aaszEptMemType[1][(u >> EPT_E_MEMTYPE_SHIFT) & EPT_E_MEMTYPE_SMASK],
     2376                                        u & EPT_E_IGNORE_PAT   ? 'I'  : '-',
     2377                                        u & EPT_E_ACCESSED     ? 'A'  : '-',
     2378                                        u & EPT_E_DIRTY        ? 'D'  : '-',
     2379                                        u & EPT_E_USER_EXECUTE ? 'U'  : '-',
     2380                                        u & EPT_E_PAGING_WRITE ? 'w'  : '-',
     2381                                        u & EPT_E_SUPER_SHW_STACK ? 'k'  : '-',
     2382                                        u & EPT_E_SUBPAGE_WRITE_PERM ? 's'  : '-',
     2383                                        u & EPT_E_SUPPRESS_VE  ? 'v'  : '-',
     2384                                        u & EPT_E_PG_MASK);
     2385                if (pState->fDumpPageInfo)
     2386                    pgmR3DumpHierarchyGstPageInfo(pState, u & EPT_PDE2M_PG_MASK, _2M);
     2387                if (u & EPT_PDE2M_MBZ_MASK)
     2388                    pState->pHlp->pfnPrintf(pState->pHlp, " 20:12=%02llx!", (u >> 12) & 0x1ff);
     2389                pgmR3DumpHierarchyGstCheckReservedHighBits(pState, u);
     2390                pState->pHlp->pfnPrintf(pState->pHlp, "\n");
     2391
     2392                pState->cLeaves++;
     2393            }
     2394            else
     2395            {
     2396                pState->pHlp->pfnPrintf(pState->pHlp, /* R W X MT I  L A  D  U  w  k  s  v */
     2397                                        "%016llx 2   |  %c%c%c %s %c - %c %c %c %c %c %c %c    %016llx",
     2398                                        pState->u64Address,
     2399                                        u & EPT_E_READ         ? 'R'  : '-',
     2400                                        u & EPT_E_WRITE        ? 'W'  : '-',
     2401                                        u & EPT_E_EXECUTE      ? 'X'  : '-',
     2402                                        g_aaszEptMemType[0][(u >> EPT_E_MEMTYPE_SHIFT) & EPT_E_MEMTYPE_SMASK],
     2403                                        u & EPT_E_IGNORE_PAT   ? '!'  : '-',
     2404                                        u & EPT_E_ACCESSED     ? 'A'  : '-',
     2405                                        u & EPT_E_DIRTY        ? 'D'  : '-',
     2406                                        u & EPT_E_USER_EXECUTE ? 'U'  : '-',
     2407                                        u & EPT_E_PAGING_WRITE ? 'w'  : '-',
     2408                                        u & EPT_E_SUPER_SHW_STACK ? 'k'  : '-',
     2409                                        u & EPT_E_SUBPAGE_WRITE_PERM ? 's'  : '-',
     2410                                        u & EPT_E_SUPPRESS_VE  ? 'v'  : '-',
     2411                                        u & EPT_E_PG_MASK);
     2412                if (pState->fDumpPageInfo)
     2413                    pgmR3DumpHierarchyGstPageInfo(pState, u & EPT_E_PG_MASK, _4K);
     2414                pgmR3DumpHierarchyGstCheckReservedHighBits(pState, u);
     2415                pState->pHlp->pfnPrintf(pState->pHlp, "\n");
     2416
     2417                if (cMaxDepth)
     2418                {
     2419                    int rc2 = pgmR3DumpHierarchyGstEptPT(pState, u & EPT_E_PG_MASK);
     2420                    if (rc2 < rc && RT_SUCCESS(rc))
     2421                        rc = rc2;
     2422                }
     2423                else
     2424                    pState->cLeaves++;
     2425            }
     2426        }
     2427    }
     2428
     2429    PGMPhysReleasePageMappingLock(pState->pVM, &Lock);
     2430    return rc;
     2431}
     2432
     2433
     2434/**
     2435 * Dumps an EPT guest page directory pointer table.
     2436 *
     2437 * @returns VBox status code (VINF_SUCCESS).
     2438 * @param   pState      The dumper state.
     2439 * @param   HCPhys      The physical address of the page directory pointer table.
     2440 * @param   cMaxDepth   The maximum depth.
     2441 */
     2442static int  pgmR3DumpHierarchyGstEptPDPT(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys, unsigned cMaxDepth)
     2443{
     2444    PCEPTPDPT      pPDPT = NULL;
     2445    PGMPAGEMAPLOCK Lock;
     2446    int rc = pgmR3DumpHierarchyGstMapPage(pState, HCPhys, "Guest EPT level 3", (void const **)&pPDPT, &Lock);
     2447    if (RT_FAILURE(rc))
     2448        return rc;
     2449
     2450    Assert(cMaxDepth > 0);
     2451    cMaxDepth--;
     2452
     2453    uint32_t iFirst, iLast;
     2454    uint64_t u64BaseAddress = pgmR3DumpHierarchyCalcRange(pState, EPT_PDPT_SHIFT, EPT_PG_ENTRIES, &iFirst, &iLast);
     2455    for (uint32_t i = iFirst; i <= iLast; i++)
     2456    {
     2457        uint64_t const u = pPDPT->a[i].u;
     2458        if (u & EPT_PRESENT_MASK)
     2459        {
     2460            pState->u64Address = u64BaseAddress + ((uint64_t)i << EPT_PDPT_SHIFT);
     2461            pState->pHlp->pfnPrintf(pState->pHlp, /* R W X MT I  L  A  D  U  w  k  s  v */
     2462                                    "%016llx 3  |   %c%c%c %s %c %c %c %c %c %c %c %c %c    %016llx",
     2463                                    pState->u64Address,
     2464                                    u & EPT_E_READ         ? 'R'  : '-',
     2465                                    u & EPT_E_WRITE        ? 'W'  : '-',
     2466                                    u & EPT_E_EXECUTE      ? 'X'  : '-',
     2467                                    g_aaszEptMemType[!!(u & EPT_E_LEAF)][(u >> EPT_E_MEMTYPE_SHIFT) & EPT_E_MEMTYPE_SMASK],
     2468                                    u & EPT_E_IGNORE_PAT   ? '!'  : '-',
     2469                                    u & EPT_E_LEAF         ? '!'  : '-',
     2470                                    u & EPT_E_ACCESSED     ? 'A'  : '-',
     2471                                    u & EPT_E_DIRTY        ? 'D'  : '-',
     2472                                    u & EPT_E_USER_EXECUTE ? 'U'  : '-',
     2473                                    u & EPT_E_PAGING_WRITE ? 'w'  : '-',
     2474                                    u & EPT_E_SUPER_SHW_STACK ? 'k'  : '-',
     2475                                    u & EPT_E_SUBPAGE_WRITE_PERM ? 's'  : '-',
     2476                                    u & EPT_E_SUPPRESS_VE  ? 'v'  : '-',
     2477                                    u & EPT_E_PG_MASK);
     2478            if (pState->fDumpPageInfo)
     2479                pgmR3DumpHierarchyGstPageInfo(pState, u & EPT_E_PG_MASK, _4K);
     2480            pgmR3DumpHierarchyGstCheckReservedHighBits(pState, u);
     2481            pState->pHlp->pfnPrintf(pState->pHlp, "\n");
     2482
     2483            if (cMaxDepth)
     2484            {
     2485                int rc2 = pgmR3DumpHierarchyGstEptPD(pState, u & EPT_E_PG_MASK, cMaxDepth);
     2486                if (rc2 < rc && RT_SUCCESS(rc))
     2487                    rc = rc2;
     2488            }
     2489            else
     2490                pState->cLeaves++;
     2491        }
     2492    }
     2493
     2494    PGMPhysReleasePageMappingLock(pState->pVM, &Lock);
     2495    return rc;
     2496}
     2497
     2498
     2499/**
     2500 * Dumps an EPT guest PML4 table.
     2501 *
     2502 * @returns VBox status code (VINF_SUCCESS).
     2503 * @param   pState      The dumper state.
     2504 * @param   HCPhys      The physical address of the table.
     2505 * @param   cMaxDepth   The maximum depth.
     2506 */
     2507static int pgmR3DumpHierarchyGstEptPML4(PPGMR3DUMPHIERARCHYSTATE pState, RTHCPHYS HCPhys, unsigned cMaxDepth)
     2508{
     2509    PCEPTPML4      pPML4 = NULL;
     2510    PGMPAGEMAPLOCK Lock;
     2511    int rc = pgmR3DumpHierarchyGstMapPage(pState, HCPhys, "Guest EPT level 4", (void const **)&pPML4, &Lock);
     2512    if (RT_FAILURE(rc))
     2513        return rc;
     2514
     2515    Assert(cMaxDepth);
     2516    cMaxDepth--;
     2517
     2518    uint32_t iFirst = (pState->u64FirstAddress >> EPT_PML4_SHIFT) & EPT_PML4_MASK;
     2519    uint32_t iLast  = (pState->u64LastAddress  >> EPT_PML4_SHIFT) & EPT_PML4_MASK;
     2520    for (uint32_t i = iFirst; i <= iLast; i++)
     2521    {
     2522        uint64_t const u = pPML4->a[i].u;
     2523        if (u & EPT_PRESENT_MASK)
     2524        {
     2525            pState->u64Address = (uint64_t)i << X86_PML4_SHIFT;
     2526            pState->pHlp->pfnPrintf(pState->pHlp, /* R W X MT I  L  A  D  U  w  k  s  v */
     2527                                    "%016llx 4 |    %c%c%c %s %c %c %c %c %c %c %c %c %c    %016llx",
     2528                                    pState->u64Address,
     2529                                    u & EPT_E_READ         ? 'R'  : '-',
     2530                                    u & EPT_E_WRITE        ? 'W'  : '-',
     2531                                    u & EPT_E_EXECUTE      ? 'X'  : '-',
     2532                                    g_aaszEptMemType[!!(u & EPT_E_LEAF)][(u >> EPT_E_MEMTYPE_SHIFT) & EPT_E_MEMTYPE_SMASK],
     2533                                    u & EPT_E_IGNORE_PAT   ? '!'  : '-',
     2534                                    u & EPT_E_LEAF         ? '!'  : '-',
     2535                                    u & EPT_E_ACCESSED     ? 'A'  : '-',
     2536                                    u & EPT_E_DIRTY        ? 'D'  : '-',
     2537                                    u & EPT_E_USER_EXECUTE ? 'U'  : '-',
     2538                                    u & EPT_E_PAGING_WRITE ? 'w'  : '-',
     2539                                    u & EPT_E_SUPER_SHW_STACK ? 'k'  : '-',
     2540                                    u & EPT_E_SUBPAGE_WRITE_PERM ? 's'  : '-',
     2541                                    u & EPT_E_SUPPRESS_VE  ? 'v'  : '-',
     2542                                    u & EPT_E_PG_MASK);
     2543            if (pState->fDumpPageInfo)
     2544                pgmR3DumpHierarchyGstPageInfo(pState, u & EPT_E_PG_MASK, _4K);
     2545            pgmR3DumpHierarchyGstCheckReservedHighBits(pState, u);
     2546            pState->pHlp->pfnPrintf(pState->pHlp, "\n");
     2547
     2548            if (cMaxDepth)
     2549            {
     2550                int rc2 = pgmR3DumpHierarchyGstEptPDPT(pState, u & EPT_E_PG_MASK, cMaxDepth);
     2551                if (rc2 < rc && RT_SUCCESS(rc))
     2552                    rc = rc2;
     2553            }
     2554            else
     2555                pState->cLeaves++;
     2556        }
     2557    }
     2558
     2559    PGMPhysReleasePageMappingLock(pState->pVM, &Lock);
     2560    return rc;
     2561}
     2562
     2563
     2564/**
     2565 * Dumps a PAE guest page table.
    19842566 *
    19852567 * @returns VBox status code (VINF_SUCCESS).
     
    20352617
    20362618/**
    2037  * Dumps a PAE shadow page directory table.
     2619 * Dumps a PAE guest page directory table.
    20382620 *
    20392621 * @returns VBox status code (VINF_SUCCESS).
     
    21322714
    21332715/**
    2134  * Dumps a PAE shadow page directory pointer table.
     2716 * Dumps a PAE guest page directory pointer table.
    21352717 *
    21362718 * @returns VBox status code (VINF_SUCCESS).
     
    22282810
    22292811/**
    2230  * Dumps a 32-bit shadow page table.
     2812 * Dumps a 32-bit guest page table.
    22312813 *
    22322814 * @returns VBox status code (VINF_SUCCESS).
     
    23072889
    23082890/**
    2309  * Dumps a 32-bit shadow page table.
     2891 * Dumps a 32-bit guest page table.
    23102892 *
    23112893 * @returns VBox status code (VINF_SUCCESS).
     
    23562938
    23572939/**
    2358  * Dumps a 32-bit shadow page directory and page tables.
     2940 * Dumps a 32-bit guest page directory and page tables.
    23592941 *
    23602942 * @returns VBox status code (VINF_SUCCESS).
     
    24583040    int             rc;
    24593041    unsigned const  cch     = pState->cchAddress;
    2460     uint64_t const  cr3Mask = pState->fEpt ? X86_CR3_AMD64_PAGE_MASK    /** @todo this should be X86_CR3_EPT_PAGE_MASK */
     3042    uint64_t const  cr3Mask = pState->fEpt ? X86_CR3_AMD64_PAGE_MASK    /** @todo this should be X86_CR3_EPT_PAGE_MASK, but it is wrong */
    24613043                            : pState->fLme ? X86_CR3_AMD64_PAGE_MASK
    24623044                            : pState->fPae ? X86_CR3_PAE_PAGE_MASK
     
    24843066            pState->pHlp->pfnPrintf(pState->pHlp,
    24853067                                    "%-*s        R - Readable\n"
    2486                                     "%-*s        | W - Writeable\n"
    2487                                     "%-*s        | | X - Executable\n"
    2488                                     "%-*s        | | | EMT - EPT memory type\n"
    2489                                     "%-*s        | | | |   PAT - Ignored PAT?\n"
    2490                                     "%-*s        | | | |   |    AVL1 - 4 available bits\n"
    2491                                     "%-*s        | | | |   |    |   AVL2 - 12 available bits\n"
    2492                                     "%-*s Level  | | | |   |    |    |     page  \n"
    2493                                   /* xxxx n **** R W X EMT PAT AVL1 AVL2   xxxxxxxxxxxxx
    2494                                                  R W X  7   0   f   fff    0123456701234567 */
     3068                                    "%-*s        |W - Writeable\n"
     3069                                    "%-*s        ||X - Executable\n"
     3070                                    "%-*s        ||| EMT - EPT memory type\n"
     3071                                    "%-*s        ||| |  I - Ignored PAT?\n"
     3072                                    "%-*s        ||| |  | L - leaf\n"
     3073                                    "%-*s        ||| |  | | A - accessed\n"
     3074                                    "%-*s        ||| |  | | | D - dirty\n"
     3075                                    "%-*s        ||| |  | | | | U - user execute\n"
     3076                                    "%-*s        ||| |  | | | | | w - Paging writable\n"
     3077                                    "%-*s        ||| |  | | | | | | k - Supervisor shadow stack writable\n"
     3078                                    "%-*s        ||| |  | | | | | | | v - Suppress #VE\n"
     3079                                    "%-*s Level  ||| |  | | | | | | | |    page\n"
     3080                                  /* xxxx n **** RWX MT I L A D U w k v 4K xxxxxxxxxxxxx
     3081                                                 RWX  7 - - - - - - - -    0123456701234567 */
    24953082                                    ,
    2496                                     cch, "", cch, "", cch, "", cch, "", cch, "", cch, "", cch, "", cch, "Address");
    2497 
    2498         pState->pHlp->pfnPrintf(pState->pHlp, "EPT dumping is not yet implemented, sorry.\n");
    2499         /** @todo implemented EPT dumping. */
    2500         rc = VERR_NOT_IMPLEMENTED;
     3083                                    cch, "", cch, "", cch, "", cch, "", cch, "", cch, "", cch, "", cch, "",
     3084                                    cch, "", cch, "", cch, "", cch, "", cch, "Address");
     3085        /** @todo assumes 4-level EPT tables for now. */
     3086        rc = pgmR3DumpHierarchyGstEptPML4(pState, cr3 & cr3Mask, cMaxDepth);
    25013087    }
    25023088    else
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