VirtualBox

Changeset 108924 in vbox for trunk/src/VBox/VMM/testcase


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

VMM/PGMAllGst-armv8.cpp.h: Some fixes and smaller updates to the testcase, bugref:10388

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

Legend:

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

    r108920 r108924  
    235235    else
    236236        RTTestIFailed("Fatal error: RTTlsSet failed, rc=%Rrc\n", rc);
     237
     238    return rc;
     239}
     240
     241
     242static int tstMmuCfgReadS64(RTTEST hTest, RTJSONVAL hObj, const char *pszName, int64_t *pi64Result)
     243{
     244    int rc = RTJsonValueQueryIntegerByName(hObj, pszName, pi64Result);
     245    if (RT_FAILURE(rc))
     246        RTTestFailed(hTest, "Failed to query \"%s\" with %Rrc", pszName, rc);
     247
     248    return rc;
     249}
     250
     251
     252static int tstMmuCfgReadS32(RTTEST hTest, RTJSONVAL hObj, const char *pszName, int32_t *pi32Result)
     253{
     254    int64_t i64 = 0;
     255    int rc = tstMmuCfgReadS64(hTest, hObj, pszName, &i64);
     256    if (RT_SUCCESS(rc))
     257    {
     258        if (i64 >= INT32_MIN && i64 <= INT32_MAX)
     259            *pi32Result = (int32_t)i64;
     260        else
     261            RTTestFailed(hTest, "%RI64 for '%s' is out of range for a 32-bit signed integer", i64, pszName);
     262    }
    237263
    238264    return rc;
     
    964990
    965991
    966 static int tstResultQueryPageFastInit(RTTEST hTest, RTJSONVAL hMemResult, PPGMPTWALKFAST pWalkResult)
    967 {
    968     int rc = tstResultQueryGCPhys(hTest, hMemResult, "GCPhys", &pWalkResult->GCPhys);
     992static int tstResultQueryPageFastInit(RTTEST hTest, RTJSONVAL hMemResult, PPGMPTWALKFAST pWalkResult, int *prc)
     993{
     994    int rc = tstMmuCfgReadS32(hTest, hMemResult, "rc", prc);
     995    if (RT_SUCCESS(rc))
     996        rc = tstResultQueryGCPhys(hTest, hMemResult, "GCPhys", &pWalkResult->GCPhys);
    969997    if (RT_SUCCESS(rc))
    970998        rc = tstResultQueryGCPhysDef(hTest, hMemResult, "GCPhysNested", &pWalkResult->GCPhysNested, 0);
     
    10421070static void tstExecuteQueryPageFast(RTTEST hTest, PVM pVM, RTGCPTR GCPtr, uint32_t fFlags, RTJSONVAL hMemResult)
    10431071{
    1044     PVMCPUCC pVCpu = pVM->apCpusR3[0];
    1045 
    1046     /** @todo Incorporate EL (for nested virt and EL3 later on). */
    1047     uintptr_t idx =   (GCPtr & RT_BIT_64(55))
    1048                     ? pVCpu->pgm.s.aidxGuestModeDataTtbr1[1]
    1049                     : pVCpu->pgm.s.aidxGuestModeDataTtbr0[1];
    1050 
    1051     PGMPTWALKFAST Walk; PGMPTWALKFAST_ZERO(&Walk);
    1052     AssertReleaseReturnVoid(idx < RT_ELEMENTS(g_aPgmGuestModeData));
    1053     AssertReleaseReturnVoid(g_aPgmGuestModeData[idx].pfnQueryPageFast);
    1054     int rc = g_aPgmGuestModeData[idx].pfnQueryPageFast(pVCpu, GCPtr, fFlags, &Walk);
    1055     if (RT_SUCCESS(rc))
    1056     {
    1057         PGMPTWALKFAST WalkResult; PGMPTWALKFAST_ZERO(&WalkResult);
    1058         WalkResult.GCPtr = GCPtr;
    1059 
    1060         rc = tstResultQueryPageFastInit(hTest, hMemResult, &WalkResult);
    1061         if (RT_SUCCESS(rc))
    1062         {
    1063             if (memcmp(&Walk, &WalkResult, sizeof(Walk)))
    1064             {
    1065                 if (Walk.GCPtr != WalkResult.GCPtr)
    1066                     RTTestFailed(hTest, "Result GCPtr=%RGv != Expected GCPtr=%RGv", Walk.GCPtr, WalkResult.GCPtr);
    1067                 if (Walk.GCPhys != WalkResult.GCPhys)
    1068                     RTTestFailed(hTest, "Result GCPhys=%RGp != Expected GCPhys=%RGp", Walk.GCPhys, WalkResult.GCPhys);
    1069                 if (Walk.GCPhysNested != WalkResult.GCPhysNested)
    1070                     RTTestFailed(hTest, "Result GCPhysNested=%RGp != Expected GCPhysNested=%RGp", Walk.GCPhysNested, WalkResult.GCPhysNested);
    1071                 if (Walk.fInfo != WalkResult.fInfo)
    1072                     RTTestFailed(hTest, "Result fInfo=%#RX32 != Expected fInfo=%#RX32", Walk.fInfo, WalkResult.fInfo);
    1073                 if (Walk.fFailed != WalkResult.fFailed)
    1074                     RTTestFailed(hTest, "Result fFailed=%#RX32 != Expected fFailed=%#RX32", Walk.fFailed, WalkResult.fFailed);
    1075                 if (Walk.fEffective != WalkResult.fEffective)
    1076                     RTTestFailed(hTest, "Result fEffective=%#RX64 != Expected fEffective=%#RX64", Walk.fEffective, WalkResult.fEffective);
    1077             }
    1078         }
    1079     }
    1080     else
    1081         RTTestFailed(hTest, "Resolving virtual address %#RX64 to physical address failed with %Rrc", GCPtr, rc);
     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    }
    10821109}
    10831110
  • trunk/src/VBox/VMM/testcase/tstPGMAllGst-armv8.json

    r108923 r108924  
    6666                GCPtr: 0x0,
    6767                Flags: { READ: 1, USER: 1 },
    68                 Result: { GCPhys: 0x0000c00000000000, Info: { Succeeded: 1, GiganticPage: 1}, Failed: 0, Effective: { PR: 1, PX: 1, UR: 1, UX: 1} },
     68                Result: { rc: 0, GCPhys: 0x0000c00000000000, Info: { Succeeded: 1, GiganticPage: 1}, Failed: 0, Effective: { PR: 1, PX: 1, UR: 1, UX: 1} },
    6969            },
    7070            {
    7171                GCPtr: 0x0,
    7272                Flags: { EXECUTE: 1, USER: 1 },
    73                 Result: { GCPhys: 0x0000c00000000000, Info: { Succeeded: 1, GiganticPage: 1}, Failed: 0, Effective: { PR: 1, PX: 1, UR: 1, UX: 1} },
     73                Result: { rc: 0, GCPhys: 0x0000c00000000000, Info: { Succeeded: 1, GiganticPage: 1}, Failed: 0, Effective: { PR: 1, PX: 1, UR: 1, UX: 1} },
    7474            }
    7575        ]
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