VirtualBox

Ignore:
Timestamp:
Apr 10, 2025 9:52:39 AM (4 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168433
Message:

VMM/testcase/tstPGMAllGst-armv8.cpp: Unify the testing config for the GetPage() and QueryPageFast() variants, bugref:10388

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/testcase/tstPGMAllGst-armv8.cpp

    r108924 r108926  
    748748
    749749
    750 DECLINLINE(int) tstResultQueryBoolDef(RTTEST hTest, RTJSONVAL hMemResult, const char *pszName, bool *pf, bool fDef)
    751 {
    752     int rc = RTJsonValueQueryBooleanByName(hMemResult, pszName, pf);
    753     if (rc == VERR_NOT_FOUND)
    754     {
    755         *pf = fDef;
    756         rc = VINF_SUCCESS;
    757     }
    758     else if (RT_FAILURE(rc))
    759         RTTestFailed(hTest, "Querying '%s' failed with %Rrc", pszName, rc);
    760 
    761     return rc;
    762 }
    763 
    764 
    765750DECLINLINE(int) tstResultQueryGCPhysDef(RTTEST hTest, RTJSONVAL hMemResult, const char *pszName, RTGCPHYS *pGCPhys, RTGCPHYS GCPhysDef)
    766751{
     
    794779
    795780
    796 DECLINLINE(int) tstResultQueryU8(RTTEST hTest, RTJSONVAL hMemResult, const char *pszName, uint8_t *pu8)
    797 {
    798     int64_t i64 = 0;
    799     int rc = RTJsonValueQueryIntegerByName(hMemResult, pszName, &i64);
    800     if (RT_FAILURE(rc))
    801         RTTestFailed(hTest, "Querying '%s' failed with %Rrc", pszName, rc);
    802     else if (i64 < 0 || i64 > UINT8_MAX)
    803         RTTestFailed(hTest, "Value %#RI64 for '%s' is out of bounds", i64, pszName);
    804     else
    805         *pu8 = (uint8_t)i64;
    806 
    807     return rc;
    808 }
    809 
    810 
    811 DECLINLINE(int) tstResultQueryU32(RTTEST hTest, RTJSONVAL hMemResult, const char *pszName, uint32_t *pu32)
    812 {
    813     int64_t i64 = 0;
    814     int rc = RTJsonValueQueryIntegerByName(hMemResult, pszName, &i64);
    815     if (RT_FAILURE(rc))
    816         RTTestFailed(hTest, "Querying '%s' failed with %Rrc", pszName, rc);
    817     else if (i64 < 0 || i64 > UINT32_MAX)
    818         RTTestFailed(hTest, "Value %#RI64 for '%s' is out of bounds", i64, pszName);
    819     else
    820         *pu32 = (uint32_t)i64;
    821 
    822     return rc;
    823 }
    824 
    825 
    826 static int tstResultInit(RTTEST hTest, RTJSONVAL hMemResult, PPGMPTWALK pWalkResult)
    827 {
    828     int rc = tstResultQueryBoolDef(hTest, hMemResult, "Succeeded", &pWalkResult->fSucceeded, true);
    829     if (RT_SUCCESS(rc))
    830         rc = tstResultQueryBoolDef(hTest, hMemResult, "IsSlat", &pWalkResult->fIsSlat, false);
    831     if (RT_SUCCESS(rc))
    832         rc = tstResultQueryBoolDef(hTest, hMemResult, "IsLinearAddrValid", &pWalkResult->fIsLinearAddrValid, false);
    833     if (RT_SUCCESS(rc))
    834         rc = tstResultQueryBoolDef(hTest, hMemResult, "NotPresent", &pWalkResult->fNotPresent, false);
    835     if (RT_SUCCESS(rc))
    836         rc = tstResultQueryBoolDef(hTest, hMemResult, "BadPhysAddr", &pWalkResult->fBadPhysAddr, false);
    837     if (RT_SUCCESS(rc))
    838         rc = tstResultQueryBoolDef(hTest, hMemResult, "RsvdError", &pWalkResult->fRsvdError, false);
    839     if (RT_SUCCESS(rc))
    840         rc = tstResultQueryBoolDef(hTest, hMemResult, "BigPage", &pWalkResult->fBigPage, false);
    841     if (RT_SUCCESS(rc))
    842         rc = tstResultQueryBoolDef(hTest, hMemResult, "GigantPage", &pWalkResult->fGigantPage, false);
    843     if (RT_SUCCESS(rc))
    844         rc = tstResultQueryGCPhys(hTest, hMemResult, "GCPhys", &pWalkResult->GCPhys);
    845     if (RT_SUCCESS(rc))
    846         rc = tstResultQueryGCPhysDef(hTest, hMemResult, "GCPhysNested", &pWalkResult->GCPhysNested, 0);
    847     if (RT_SUCCESS(rc))
    848         rc = tstResultQueryU8(hTest, hMemResult, "Level", &pWalkResult->uLevel);
    849     if (RT_SUCCESS(rc))
    850         rc = tstResultQueryU32(hTest, hMemResult, "fFailed", &pWalkResult->fFailed);
    851     if (RT_SUCCESS(rc))
    852     {
    853         static const TSTCFGBITFIELD s_aPtAttrs[] =
    854         {
    855 #define BITFIELD_CREATE_BOOL(a_Name) \
    856             { #a_Name, PGM_PTATTRS_##a_Name##_SHIFT, 1, NULL }
    857 
    858             BITFIELD_CREATE_BOOL(PR),
    859             BITFIELD_CREATE_BOOL(PW),
    860             BITFIELD_CREATE_BOOL(PX),
    861             BITFIELD_CREATE_BOOL(PGCS),
    862             BITFIELD_CREATE_BOOL(UR),
    863             BITFIELD_CREATE_BOOL(UW),
    864             BITFIELD_CREATE_BOOL(UX),
    865             BITFIELD_CREATE_BOOL(UGCS),
    866             { NULL,     0, 0, NULL }
    867 
    868 #undef BITFIELD_CREATE_BOOL
    869         };
    870 
    871         rc = tstMmuCfgReadU64(hTest, hMemResult, "Effective", &s_aPtAttrs[0], &pWalkResult->fEffective);
    872     }
    873 
    874     return rc;
    875 }
    876 
    877 
    878 static void tstExecute(RTTEST hTest, PVM pVM, RTGCPTR GCPtr, RTJSONVAL hMemResult)
    879 {
    880     PVMCPUCC pVCpu = pVM->apCpusR3[0];
    881 
    882     /** @todo Incorporate EL (for nested virt and EL3 later on). */
    883     uintptr_t idx =   (GCPtr & RT_BIT_64(55))
    884                     ? pVCpu->pgm.s.aidxGuestModeDataTtbr1[1]
    885                     : pVCpu->pgm.s.aidxGuestModeDataTtbr0[1];
    886 
    887     PGMPTWALK Walk; RT_ZERO(Walk);
    888     AssertReleaseReturnVoid(idx < RT_ELEMENTS(g_aPgmGuestModeData));
    889     AssertReleaseReturnVoid(g_aPgmGuestModeData[idx].pfnGetPage);
    890     int rc = g_aPgmGuestModeData[idx].pfnGetPage(pVCpu, GCPtr, &Walk);
    891     if (RT_SUCCESS(rc))
    892     {
    893         PGMPTWALK WalkResult; RT_ZERO(WalkResult);
    894         WalkResult.GCPtr = GCPtr;
    895 
    896         rc = tstResultInit(hTest, hMemResult, &WalkResult);
    897         if (RT_SUCCESS(rc))
    898         {
    899             if (memcmp(&Walk, &WalkResult, sizeof(Walk)))
    900             {
    901                 if (Walk.GCPtr != WalkResult.GCPtr)
    902                     RTTestFailed(hTest, "Result GCPtr=%RGv != Expected GCPtr=%RGv", Walk.GCPtr, WalkResult.GCPtr);
    903                 if (Walk.GCPhysNested != WalkResult.GCPhysNested)
    904                     RTTestFailed(hTest, "Result GCPhysNested=%RGp != Expected GCPhysNested=%RGp", Walk.GCPhysNested, WalkResult.GCPhysNested);
    905                 if (Walk.GCPhys != WalkResult.GCPhys)
    906                     RTTestFailed(hTest, "Result GCPhys=%RGp != Expected GCPhys=%RGp", Walk.GCPhys, WalkResult.GCPhys);
    907                 if (Walk.fSucceeded != WalkResult.fSucceeded)
    908                     RTTestFailed(hTest, "Result fSucceeded=%RTbool != Expected fSucceeded=%RTbool", Walk.fSucceeded, WalkResult.fSucceeded);
    909                 if (Walk.fIsSlat != WalkResult.fIsSlat)
    910                     RTTestFailed(hTest, "Result fIsSlat=%RTbool != Expected fIsSlat=%RTbool", Walk.fIsSlat, WalkResult.fIsSlat);
    911                 if (Walk.fIsLinearAddrValid != WalkResult.fIsLinearAddrValid)
    912                     RTTestFailed(hTest, "Result fIsLinearAddrValid=%RTbool != Expected fIsLinearAddrValid=%RTbool", Walk.fIsLinearAddrValid, WalkResult.fIsLinearAddrValid);
    913                 if (Walk.uLevel != WalkResult.uLevel)
    914                     RTTestFailed(hTest, "Result uLevel=%RU8 != Expected uLevel=%RU8", Walk.uLevel, WalkResult.uLevel);
    915                 if (Walk.fNotPresent != WalkResult.fNotPresent)
    916                     RTTestFailed(hTest, "Result fNotPresent=%RTbool != Expected fNotPresent=%RTbool", Walk.fNotPresent, WalkResult.fNotPresent);
    917                 if (Walk.fBadPhysAddr != WalkResult.fBadPhysAddr)
    918                     RTTestFailed(hTest, "Result fBadPhysAddr=%RTbool != Expected fBadPhysAddr=%RTbool", Walk.fBadPhysAddr, WalkResult.fBadPhysAddr);
    919                 if (Walk.fRsvdError != WalkResult.fRsvdError)
    920                     RTTestFailed(hTest, "Result fRsvdError=%RTbool != Expected fRsvdError=%RTbool", Walk.fRsvdError, WalkResult.fRsvdError);
    921                 if (Walk.fBigPage != WalkResult.fBigPage)
    922                     RTTestFailed(hTest, "Result fBigPage=%RTbool != Expected fBigPage=%RTbool", Walk.fBigPage, WalkResult.fBigPage);
    923                 if (Walk.fGigantPage != WalkResult.fGigantPage)
    924                     RTTestFailed(hTest, "Result fGigantPage=%RTbool != Expected fGigantPage=%RTbool", Walk.fGigantPage, WalkResult.fGigantPage);
    925                 if (Walk.fFailed != WalkResult.fFailed)
    926                     RTTestFailed(hTest, "Result fFailed=%#RX32 != Expected fFailed=%#RX32", Walk.fFailed, WalkResult.fFailed);
    927                 if (Walk.fEffective != WalkResult.fEffective)
    928                     RTTestFailed(hTest, "Result fEffective=%#RX64 != Expected fEffective=%#RX64", Walk.fEffective, WalkResult.fEffective);
    929             }
    930         }
    931     }
    932     else
    933         RTTestFailed(hTest, "Resolving virtual address %#RX64 to physical address failed with %Rrc", GCPtr, rc);
    934 }
    935 
    936 
    937 static int tstTestcaseMmuRunGetPage(RTTEST hTest, RTJSONVAL hTestcase)
    938 {
    939     RTJSONVAL hVal = NIL_RTJSONVAL;
    940     int rc = RTJsonValueQueryByName(hTestcase, "GetPage", &hVal);
    941     if (RT_SUCCESS(rc))
    942     {
    943         RTJSONIT hIt = NIL_RTJSONIT;
    944         rc = RTJsonIteratorBeginObject(hVal, &hIt);
    945         if (RT_SUCCESS(rc))
    946         {
    947             for (;;)
    948             {
    949                 RTJSONVAL hMemObj = NIL_RTJSONVAL;
    950                 const char *pszAddress = NULL;
    951                 rc = RTJsonIteratorQueryValue(hIt, &hMemObj, &pszAddress);
    952                 if (RT_SUCCESS(rc))
    953                 {
    954                     uint64_t GCPtr = 0;
    955                     rc = RTStrToUInt64Full(pszAddress, 0, &GCPtr);
    956                     if (rc == VINF_SUCCESS)
    957                         tstExecute(hTest, g_MmuCfg.pVM, GCPtr, hMemObj);
    958                     else
    959                     {
    960                         RTTestFailed(hTest, "Address '%s' is not a valid 64-bit physical address", pszAddress);
    961                         break;
    962                     }
    963 
    964                     RTJsonValueRelease(hMemObj);
    965                 }
    966                 else
    967                     RTTestFailed(hTest, "Failed to retrieve memory range with %Rrc", rc);
    968 
    969                 rc = RTJsonIteratorNext(hIt);
    970                 if (RT_FAILURE(rc))
    971                     break;
    972             }
    973             if (rc == VERR_JSON_ITERATOR_END)
    974                 rc = VINF_SUCCESS;
    975             RTJsonIteratorFree(hIt);
    976         }
    977         else
    978             RTTestFailed(hTest, "Failed to traverse JSON array with %Rrc", rc);
    979 
    980 
    981         RTJsonValueRelease(hVal);
    982     }
    983     else if (rc == VERR_NOT_FOUND)
    984         rc = VINF_SUCCESS;
    985     else
    986         RTTestFailed(hTest, "Failed to query \"Tests\" %Rrc", rc);
    987 
    988     return rc;
    989 }
    990 
    991 
    992 static int tstResultQueryPageFastInit(RTTEST hTest, RTJSONVAL hMemResult, PPGMPTWALKFAST pWalkResult, int *prc)
    993 {
    994     int rc = tstMmuCfgReadS32(hTest, hMemResult, "rc", prc);
     781static int tstResultInit(RTTEST hTest, RTJSONVAL hMemResult, PPGMPTWALKFAST pWalkResult, int *prcQueryPageFast,
     782                         int *prcGetPage)
     783{
     784    int rc = tstMmuCfgReadS32(hTest, hMemResult, "rcQueryPageFast", prcQueryPageFast);
     785    if (RT_SUCCESS(rc))
     786        rc = tstMmuCfgReadS32(hTest, hMemResult, "rcGetPage", prcGetPage);
    995787    if (RT_SUCCESS(rc))
    996788        rc = tstResultQueryGCPhys(hTest, hMemResult, "GCPhys", &pWalkResult->GCPhys);
     
    1068860
    1069861
    1070 static void tstExecuteQueryPageFast(RTTEST hTest, PVM pVM, RTGCPTR GCPtr, uint32_t fFlags, RTJSONVAL hMemResult)
    1071 {
    1072     int rcExpected = VINF_SUCCESS;
    1073     PGMPTWALKFAST WalkResult; PGMPTWALKFAST_ZERO(&WalkResult);
    1074     WalkResult.GCPtr = GCPtr;
    1075 
    1076     int rc = tstResultQueryPageFastInit(hTest, hMemResult, &WalkResult, &rcExpected);
    1077     if (RT_SUCCESS(rc))
    1078     {
    1079         PVMCPUCC pVCpu = pVM->apCpusR3[0];
    1080 
    1081         /** @todo Incorporate EL (for nested virt and EL3 later on). */
    1082         uintptr_t idx =   (GCPtr & RT_BIT_64(55))
    1083                         ? pVCpu->pgm.s.aidxGuestModeDataTtbr1[1]
    1084                         : pVCpu->pgm.s.aidxGuestModeDataTtbr0[1];
    1085 
    1086         PGMPTWALKFAST Walk; PGMPTWALKFAST_ZERO(&Walk);
    1087         AssertReleaseReturnVoid(idx < RT_ELEMENTS(g_aPgmGuestModeData));
    1088         AssertReleaseReturnVoid(g_aPgmGuestModeData[idx].pfnQueryPageFast);
    1089         rc = g_aPgmGuestModeData[idx].pfnQueryPageFast(pVCpu, GCPtr, fFlags, &Walk);
    1090         if (rc != rcExpected)
    1091             RTTestFailed(hTest, "Result rc=%Rrc != Expected rc=%Rrc", rc, rcExpected);
    1092 
    1093         if (memcmp(&Walk, &WalkResult, sizeof(Walk)))
    1094         {
    1095             if (Walk.GCPtr != WalkResult.GCPtr)
    1096                 RTTestFailed(hTest, "Result GCPtr=%RGv != Expected GCPtr=%RGv", Walk.GCPtr, WalkResult.GCPtr);
    1097             if (Walk.GCPhys != WalkResult.GCPhys)
    1098                 RTTestFailed(hTest, "Result GCPhys=%RGp != Expected GCPhys=%RGp", Walk.GCPhys, WalkResult.GCPhys);
    1099             if (Walk.GCPhysNested != WalkResult.GCPhysNested)
    1100                 RTTestFailed(hTest, "Result GCPhysNested=%RGp != Expected GCPhysNested=%RGp", Walk.GCPhysNested, WalkResult.GCPhysNested);
    1101             if (Walk.fInfo != WalkResult.fInfo)
    1102                 RTTestFailed(hTest, "Result fInfo=%#RX32 != Expected fInfo=%#RX32", Walk.fInfo, WalkResult.fInfo);
    1103             if (Walk.fFailed != WalkResult.fFailed)
    1104                 RTTestFailed(hTest, "Result fFailed=%#RX32 != Expected fFailed=%#RX32", Walk.fFailed, WalkResult.fFailed);
    1105             if (Walk.fEffective != WalkResult.fEffective)
    1106                 RTTestFailed(hTest, "Result fEffective=%#RX64 != Expected fEffective=%#RX64", Walk.fEffective, WalkResult.fEffective);
    1107         }
    1108     }
    1109 }
    1110 
    1111 
    1112 static int tstTestcaseMmuRunQueryPageFast(RTTEST hTest, RTJSONVAL hTestcase)
     862static void tstExecuteQueryPageFast(RTTEST hTest, PVM pVM, RTGCPTR GCPtr, uint32_t fFlags, int rcExpected, PPGMPTWALKFAST pWalkResult)
     863{
     864    PVMCPUCC pVCpu = pVM->apCpusR3[0];
     865
     866    /** @todo Incorporate EL (for nested virt and EL3 later on). */
     867    uintptr_t idx =   (GCPtr & RT_BIT_64(55))
     868                    ? pVCpu->pgm.s.aidxGuestModeDataTtbr1[1]
     869                    : pVCpu->pgm.s.aidxGuestModeDataTtbr0[1];
     870
     871    PGMPTWALKFAST Walk; PGMPTWALKFAST_ZERO(&Walk);
     872    AssertReleaseReturnVoid(idx < RT_ELEMENTS(g_aPgmGuestModeData));
     873    AssertReleaseReturnVoid(g_aPgmGuestModeData[idx].pfnQueryPageFast);
     874    int rc = g_aPgmGuestModeData[idx].pfnQueryPageFast(pVCpu, GCPtr, fFlags, &Walk);
     875    if (rc != rcExpected)
     876        RTTestFailed(hTest, "QueryPageFast: Result rc=%Rrc != Expected rc=%Rrc", rc, rcExpected);
     877
     878    if (memcmp(&Walk, pWalkResult, sizeof(Walk)))
     879    {
     880        if (Walk.GCPtr != pWalkResult->GCPtr)
     881            RTTestFailed(hTest, "QueryPageFast: Result GCPtr=%RGv != Expected GCPtr=%RGv", Walk.GCPtr, pWalkResult->GCPtr);
     882        if (Walk.GCPhys != pWalkResult->GCPhys)
     883            RTTestFailed(hTest, "QueryPageFast: Result GCPhys=%RGp != Expected GCPhys=%RGp", Walk.GCPhys, pWalkResult->GCPhys);
     884        if (Walk.GCPhysNested != pWalkResult->GCPhysNested)
     885            RTTestFailed(hTest, "QueryPageFast: Result GCPhysNested=%RGp != Expected GCPhysNested=%RGp", Walk.GCPhysNested, pWalkResult->GCPhysNested);
     886        if (Walk.fInfo != pWalkResult->fInfo)
     887            RTTestFailed(hTest, "QueryPageFast: Result fInfo=%#RX32 != Expected fInfo=%#RX32", Walk.fInfo, pWalkResult->fInfo);
     888        if (Walk.fFailed != pWalkResult->fFailed)
     889            RTTestFailed(hTest, "QueryPageFast: Result fFailed=%#RX32 != Expected fFailed=%#RX32", Walk.fFailed, pWalkResult->fFailed);
     890        if (Walk.fEffective != pWalkResult->fEffective)
     891            RTTestFailed(hTest, "QueryPageFast: Result fEffective=%#RX64 != Expected fEffective=%#RX64", Walk.fEffective, pWalkResult->fEffective);
     892    }
     893}
     894
     895
     896static void tstExecuteGetPage(RTTEST hTest, PVM pVM, RTGCPTR GCPtr, uint8_t bEl, int rcExpected, PPGMPTWALKFAST pWalkResult)
     897{
     898    PVMCPUCC pVCpu = pVM->apCpusR3[0];
     899
     900    g_MmuCfg.bEl = bEl;
     901
     902    /* Need to convert the expected result to the PGMPTWALK format. */
     903    PGMPTWALK WalkResult; RT_ZERO(WalkResult);
     904    WalkResult.GCPtr        = pWalkResult->GCPtr;
     905    WalkResult.GCPhysNested = pWalkResult->GCPhysNested;
     906    WalkResult.GCPhys       = pWalkResult->GCPhys;
     907    WalkResult.fFailed      = pWalkResult->fFailed;
     908    WalkResult.fEffective   = pWalkResult->fEffective;
     909    WalkResult.uLevel       = (pWalkResult->fFailed & PGM_WALKFAIL_LEVEL_MASK) >> PGM_WALKFAIL_LEVEL_SHIFT;
     910    if (pWalkResult->fInfo & PGM_WALKINFO_SUCCEEDED)
     911        WalkResult.fSucceeded = true;
     912    if (pWalkResult->fInfo & PGM_WALKINFO_IS_SLAT)
     913        WalkResult.fIsSlat = true;
     914    if (pWalkResult->fInfo & PGM_WALKINFO_BIG_PAGE)
     915        WalkResult.fBigPage = true;
     916    if (pWalkResult->fInfo & PGM_WALKINFO_GIGANTIC_PAGE)
     917        WalkResult.fGigantPage = true;
     918    if (pWalkResult->fInfo & PGM_WALKINFO_IS_LINEAR_ADDR_VALID)
     919        WalkResult.fIsLinearAddrValid = true;
     920    if (pWalkResult->fFailed & PGM_WALKFAIL_NOT_PRESENT)
     921        WalkResult.fNotPresent = true;
     922    if (pWalkResult->fFailed & PGM_WALKFAIL_RESERVED_BITS)
     923        WalkResult.fRsvdError = true;
     924    if (pWalkResult->fFailed & PGM_WALKFAIL_BAD_PHYSICAL_ADDRESS)
     925        WalkResult.fBadPhysAddr = true;
     926
     927    /** @todo Incorporate EL (for nested virt and EL3 later on). */
     928    uintptr_t idx =   (GCPtr & RT_BIT_64(55))
     929                    ? pVCpu->pgm.s.aidxGuestModeDataTtbr1[1]
     930                    : pVCpu->pgm.s.aidxGuestModeDataTtbr0[1];
     931
     932    PGMPTWALK Walk; RT_ZERO(Walk);
     933    AssertReleaseReturnVoid(idx < RT_ELEMENTS(g_aPgmGuestModeData));
     934    AssertReleaseReturnVoid(g_aPgmGuestModeData[idx].pfnGetPage);
     935    int rc = g_aPgmGuestModeData[idx].pfnGetPage(pVCpu, GCPtr, &Walk);
     936    if (rc != rcExpected)
     937        RTTestFailed(hTest, "GetPage: Result rc=%Rrc != Expected rc=%Rrc", rc, rcExpected);
     938
     939    if (memcmp(&Walk, &WalkResult, sizeof(Walk)))
     940    {
     941        if (Walk.GCPtr != WalkResult.GCPtr)
     942            RTTestFailed(hTest, "GetPage: Result GCPtr=%RGv != Expected GCPtr=%RGv", Walk.GCPtr, WalkResult.GCPtr);
     943        if (Walk.GCPhysNested != WalkResult.GCPhysNested)
     944            RTTestFailed(hTest, "GetPage: Result GCPhysNested=%RGp != Expected GCPhysNested=%RGp", Walk.GCPhysNested, WalkResult.GCPhysNested);
     945        if (Walk.GCPhys != WalkResult.GCPhys)
     946            RTTestFailed(hTest, "GetPage: Result GCPhys=%RGp != Expected GCPhys=%RGp", Walk.GCPhys, WalkResult.GCPhys);
     947        if (Walk.fSucceeded != WalkResult.fSucceeded)
     948            RTTestFailed(hTest, "GetPage: Result fSucceeded=%RTbool != Expected fSucceeded=%RTbool", Walk.fSucceeded, WalkResult.fSucceeded);
     949        if (Walk.fIsSlat != WalkResult.fIsSlat)
     950            RTTestFailed(hTest, "GetPage: Result fIsSlat=%RTbool != Expected fIsSlat=%RTbool", Walk.fIsSlat, WalkResult.fIsSlat);
     951        if (Walk.fIsLinearAddrValid != WalkResult.fIsLinearAddrValid)
     952            RTTestFailed(hTest, "GetPage: Result fIsLinearAddrValid=%RTbool != Expected fIsLinearAddrValid=%RTbool", Walk.fIsLinearAddrValid, WalkResult.fIsLinearAddrValid);
     953        if (Walk.uLevel != WalkResult.uLevel)
     954            RTTestFailed(hTest, "GetPage: Result uLevel=%RU8 != Expected uLevel=%RU8", Walk.uLevel, WalkResult.uLevel);
     955        if (Walk.fNotPresent != WalkResult.fNotPresent)
     956            RTTestFailed(hTest, "GetPage: Result fNotPresent=%RTbool != Expected fNotPresent=%RTbool", Walk.fNotPresent, WalkResult.fNotPresent);
     957        if (Walk.fBadPhysAddr != WalkResult.fBadPhysAddr)
     958            RTTestFailed(hTest, "GetPage: Result fBadPhysAddr=%RTbool != Expected fBadPhysAddr=%RTbool", Walk.fBadPhysAddr, WalkResult.fBadPhysAddr);
     959        if (Walk.fRsvdError != WalkResult.fRsvdError)
     960            RTTestFailed(hTest, "GetPage: Result fRsvdError=%RTbool != Expected fRsvdError=%RTbool", Walk.fRsvdError, WalkResult.fRsvdError);
     961        if (Walk.fBigPage != WalkResult.fBigPage)
     962            RTTestFailed(hTest, "GetPage: Result fBigPage=%RTbool != Expected fBigPage=%RTbool", Walk.fBigPage, WalkResult.fBigPage);
     963        if (Walk.fGigantPage != WalkResult.fGigantPage)
     964            RTTestFailed(hTest, "GetPage: Result fGigantPage=%RTbool != Expected fGigantPage=%RTbool", Walk.fGigantPage, WalkResult.fGigantPage);
     965        if (Walk.fFailed != WalkResult.fFailed)
     966            RTTestFailed(hTest, "GetPage: Result fFailed=%#RX32 != Expected fFailed=%#RX32", Walk.fFailed, WalkResult.fFailed);
     967        if (Walk.fEffective != WalkResult.fEffective)
     968            RTTestFailed(hTest, "GetPage: Result fEffective=%#RX64 != Expected fEffective=%#RX64", Walk.fEffective, WalkResult.fEffective);
     969    }
     970}
     971
     972
     973static int tstTestcaseMmuRun(RTTEST hTest, RTJSONVAL hTestcase)
    1113974{
    1114975    RTJSONVAL hVal = NIL_RTJSONVAL;
    1115     int rc = RTJsonValueQueryByName(hTestcase, "QueryPageFast", &hVal);
     976    int rc = RTJsonValueQueryByName(hTestcase, "Tests", &hVal);
    1116977    if (RT_SUCCESS(rc))
    1117978    {
     
    11561017                            if (RT_SUCCESS(rc))
    11571018                            {
    1158                                 tstExecuteQueryPageFast(hTest, g_MmuCfg.pVM, GCPtr, fFlags, hMemResult);
     1019                                int rcQueryPageFast = VINF_SUCCESS;
     1020                                int rcGetPage       = VINF_SUCCESS;
     1021
     1022                                PGMPTWALKFAST WalkResult; PGMPTWALKFAST_ZERO(&WalkResult);
     1023                                WalkResult.GCPtr = GCPtr;
     1024
     1025                                rc = tstResultInit(hTest, hMemResult, &WalkResult, &rcQueryPageFast, &rcGetPage);
     1026                                if (RT_SUCCESS(rc))
     1027                                {
     1028                                    tstExecuteQueryPageFast(hTest, g_MmuCfg.pVM, GCPtr, fFlags, rcQueryPageFast, &WalkResult);
     1029                                    tstExecuteGetPage(hTest, g_MmuCfg.pVM, GCPtr,
     1030                                                      (fFlags & PGMQPAGE_F_USER_MODE) ? 0 : 1,
     1031                                                      rcGetPage, &WalkResult);
     1032                                }
    11591033                                RTJsonValueRelease(hMemResult);
    11601034                            }
     
    12181092                rc = tstTestcaseMmuConfigPrepare(hTest, &g_MmuCfg, hTestcase);
    12191093            if (RT_SUCCESS(rc))
    1220                 rc = tstTestcaseMmuRunGetPage(hTest, hTestcase);
    1221             if (RT_SUCCESS(rc))
    1222                 rc = tstTestcaseMmuRunQueryPageFast(hTest, hTestcase);
     1094                rc = tstTestcaseMmuRun(hTest, hTestcase);
    12231095        }
    12241096        else
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette