Changeset 92528 in vbox
- Timestamp:
- Nov 21, 2021 2:40:17 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 148403
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VMMDevTesting.h
r92523 r92528 132 132 /** Print string, sending a string including newline. (RTTestPrintf) */ 133 133 #define VMMDEV_TESTING_CMD_PRINT UINT32_C(0xcab1e008) 134 /** Query a config value, sending a 16-bit word (VMMDEV_TESTING_CFG_XXX) to the 135 * DATA port and reading back the result. */ 136 #define VMMDEV_TESTING_CMD_QUERY_CFG UINT32_C(0xcab1e009) 134 137 135 138 /** The magic part of the command. */ … … 216 219 /** @} */ 217 220 221 /** @name VMMDEV_TESTING_CFG_XXX - Configuration values that can be queried. 222 * @{ */ 223 /** Generic 32-bit value \#0 - testcase defined meaning. */ 224 #define VMMDEV_TESTING_CFG_DWORD0 UINT16_C(0x0000) 225 /** Generic 32-bit value \#1 - testcase defined meaning. */ 226 #define VMMDEV_TESTING_CFG_DWORD1 UINT16_C(0x0001) 227 /** Generic 32-bit value \#2 - testcase defined meaning. */ 228 #define VMMDEV_TESTING_CFG_DWORD2 UINT16_C(0x0002) 229 /** Generic 32-bit value \#3 - testcase defined meaning. */ 230 #define VMMDEV_TESTING_CFG_DWORD3 UINT16_C(0x0003) 231 /** Generic 32-bit value \#4 - testcase defined meaning. */ 232 #define VMMDEV_TESTING_CFG_DWORD4 UINT16_C(0x0004) 233 /** Generic 32-bit value \#5 - testcase defined meaning. */ 234 #define VMMDEV_TESTING_CFG_DWORD5 UINT16_C(0x0005) 235 /** Generic 32-bit value \#6 - testcase defined meaning. */ 236 #define VMMDEV_TESTING_CFG_DWORD6 UINT16_C(0x0006) 237 /** Generic 32-bit value \#7 - testcase defined meaning. */ 238 #define VMMDEV_TESTING_CFG_DWORD7 UINT16_C(0x0007) 239 /** Generic 32-bit value \#8 - testcase defined meaning. */ 240 #define VMMDEV_TESTING_CFG_DWORD8 UINT16_C(0x0008) 241 /** Generic 32-bit value \#9 - testcase defined meaning. */ 242 #define VMMDEV_TESTING_CFG_DWORD9 UINT16_C(0x0009) 243 244 /** Boolean (8-bit): Running in NEM on Linux? */ 245 #define VMMDEV_TESTING_CFG_IS_NEM_LINUX UINT16_C(0x0100) 246 /** Boolean (8-bit): Running in NEM on Windows? */ 247 #define VMMDEV_TESTING_CFG_IS_NEM_WINDOWS UINT16_C(0x0101) 248 /** Boolean (8-bit): Running in NEM on Darwin? */ 249 #define VMMDEV_TESTING_CFG_IS_NEM_DARWIN UINT16_C(0x0102) 250 /** @} */ 251 218 252 /** @} */ 219 253 -
trunk/include/VBox/VMMDevTesting.mac
r92523 r92528 60 60 %define VMMDEV_TESTING_CMD_VALUE_REG 0xcab1e007 61 61 %define VMMDEV_TESTING_CMD_PRINT 0xcab1e008 62 %define VMMDEV_TESTING_CMD_QUERY_CFG 0xcab1e009 62 63 %define VMMDEV_TESTING_CMD_MAGIC 0xcab1e000 63 64 %define VMMDEV_TESTING_CMD_MAGIC_MASK 0xffffff00 -
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r92388 r92528 4590 4590 "TestingEnabled|" 4591 4591 "TestingMMIO|" 4592 "TestintXmlOutputFile|" 4592 "TestingXmlOutputFile|" 4593 "TestingCfgDword0|" 4594 "TestingCfgDword1|" 4595 "TestingCfgDword2|" 4596 "TestingCfgDword3|" 4597 "TestingCfgDword4|" 4598 "TestingCfgDword5|" 4599 "TestingCfgDword6|" 4600 "TestingCfgDword7|" 4601 "TestingCfgDword8|" 4602 "TestingCfgDword9|" 4593 4603 "HGCMHeapBudgetDefault|" 4594 4604 "HGCMHeapBudgetLegacy|" … … 4671 4681 if (RT_FAILURE(rc)) 4672 4682 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Failed querying \"TestingMMIO\" as a boolean")); 4673 rc = pHlp->pfnCFGMQueryStringAllocDef(pCfg, "Testin tXmlOutputFile", &pThisCC->pszTestingXmlOutput, NULL);4683 rc = pHlp->pfnCFGMQueryStringAllocDef(pCfg, "TestingXmlOutputFile", &pThisCC->pszTestingXmlOutput, NULL); 4674 4684 if (RT_FAILURE(rc)) 4675 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Failed querying \"TestintXmlOutputFile\" as a string")); 4685 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Failed querying \"TestingXmlOutputFile\" as a string")); 4686 4687 for (unsigned i = 0; i < RT_ELEMENTS(pThis->au32TestingCfgDwords); i++) 4688 { 4689 char szName[32]; 4690 RTStrPrintf(szName, sizeof(szName), "TestingCfgDword%u", i); 4691 rc = pHlp->pfnCFGMQueryU32Def(pCfg, szName, &pThis->au32TestingCfgDwords[i], 0); 4692 if (RT_FAILURE(rc)) 4693 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 4694 N_("Configuration error: Failed querying \"%s\" as a string"), szName); 4695 } 4696 4676 4697 4677 4698 /** @todo image-to-load-filename? */ -
trunk/src/VBox/Devices/VMMDev/VMMDevState.h
r90639 r92528 292 292 /** Set if testing the MMIO testing range is enabled. */ 293 293 bool fTestingMMIO; 294 #if defined(VBOX_WITHOUT_TESTING_FEATURES) && !defined(DOXYGEN_RUNNING) 294 295 /** Alignment padding. */ 295 296 bool afPadding9[2]; 296 #if !defined(VBOX_WITHOUT_TESTING_FEATURES) || defined(DOXYGEN_RUNNING) 297 #else 298 /** The amount of readable testing data (for query response). */ 299 uint16_t cbReadableTestingData; 297 300 /** The high timestamp value. */ 298 301 uint32_t u32TestingHighTimestamp; … … 304 307 union 305 308 { 306 char padding[1024]; 309 /** Plain byte view. */ 310 uint8_t ab[1024]; 307 311 308 312 /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW, … … 326 330 char szName[1024 - 8 - 4]; 327 331 } Value; 332 333 /** A 8-bit VMMDEV_TESTING_QUERY_CFG response. */ 334 uint8_t b; 335 /** A 32-bit VMMDEV_TESTING_QUERY_CFG response. */ 336 uint32_t u32; 328 337 329 338 /** The read back register (VMMDEV_TESTING_MMIO_OFF_READBACK, … … 371 380 /** Handle for the MMIO region used by the testing component. */ 372 381 IOMMMIOHANDLE hMmioTesting; 382 /** User defined configuration dwords. */ 383 uint32_t au32TestingCfgDwords[10]; 373 384 #endif /* !VBOX_WITHOUT_TESTING_FEATURES || DOXYGEN_RUNNING */ 374 385 /** @} */ -
trunk/src/VBox/Devices/VMMDev/VMMDevTesting.cpp
r91944 r92528 355 355 if (cb == 4) 356 356 { 357 pThis->u32TestingCmd = u32; 358 pThis->offTestingData = 0; 357 pThis->u32TestingCmd = u32; 358 pThis->offTestingData = 0; 359 pThis->cbReadableTestingData = 0; 359 360 RT_ZERO(pThis->TestingData); 360 361 return VINF_SUCCESS; … … 581 582 } 582 583 584 /* 585 * Query configuration. 586 */ 587 case VMMDEV_TESTING_CMD_QUERY_CFG: 588 { 589 switch (u32) 590 { 591 case VMMDEV_TESTING_CFG_DWORD0: 592 case VMMDEV_TESTING_CFG_DWORD1: 593 case VMMDEV_TESTING_CFG_DWORD2: 594 case VMMDEV_TESTING_CFG_DWORD3: 595 case VMMDEV_TESTING_CFG_DWORD4: 596 case VMMDEV_TESTING_CFG_DWORD5: 597 case VMMDEV_TESTING_CFG_DWORD6: 598 case VMMDEV_TESTING_CFG_DWORD7: 599 case VMMDEV_TESTING_CFG_DWORD8: 600 case VMMDEV_TESTING_CFG_DWORD9: 601 pThis->cbReadableTestingData = sizeof(pThis->TestingData.u32); 602 pThis->TestingData.u32 = pThis->au32TestingCfgDwords[u32 - VMMDEV_TESTING_CFG_DWORD0]; 603 break; 604 605 case VMMDEV_TESTING_CFG_IS_NEM_LINUX: 606 case VMMDEV_TESTING_CFG_IS_NEM_WINDOWS: 607 case VMMDEV_TESTING_CFG_IS_NEM_DARWIN: 608 { 609 pThis->cbReadableTestingData = sizeof(pThis->TestingData.b); 610 #if defined(RT_OS_DARWIN) 611 pThis->TestingData.b = u32 == VMMDEV_TESTING_CFG_IS_NEM_DARWIN 612 && PDMDevHlpGetMainExecutionEngine(pDevIns) == VM_EXEC_ENGINE_NATIVE_API; 613 #elif defined(RT_OS_LINUX) 614 pThis->TestingData.b = u32 == VMMDEV_TESTING_CFG_IS_NEM_LINUX 615 && PDMDevHlpGetMainExecutionEngine(pDevIns) == VM_EXEC_ENGINE_NATIVE_API; 616 #elif defined(RT_OS_WINDOWS) 617 pThis->TestingData.b = u32 == VMMDEV_TESTING_CFG_IS_NEM_WINDOWS 618 && PDMDevHlpGetMainExecutionEngine(pDevIns) == VM_EXEC_ENGINE_NATIVE_API; 619 #else 620 pThis->TestingData.b = false; 621 #endif 622 break; 623 } 624 } 625 break; 626 } 627 583 628 default: 584 629 break; … … 809 854 810 855 /* 811 * The command and data registers arewrite-only.856 * The command registers is write-only. 812 857 */ 813 858 case VMMDEV_TESTING_IOPORT_CMD - VMMDEV_TESTING_IOPORT_BASE: 859 break; 860 861 /* 862 * The data register is only readable after a query command, otherwise it 863 * behaves as an undefined port. Return zeros if the guest reads too much. 864 */ 814 865 case VMMDEV_TESTING_IOPORT_DATA - VMMDEV_TESTING_IOPORT_BASE: 866 if (pThis->cbReadableTestingData > 0) 867 { 868 if (pThis->offTestingData < pThis->cbReadableTestingData) 869 { 870 switch (RT_MIN(cb, pThis->cbReadableTestingData - pThis->offTestingData)) 871 { 872 case 1: 873 *pu32 = pThis->TestingData.ab[pThis->offTestingData++]; 874 break; 875 case 2: 876 *pu32 = pThis->TestingData.ab[pThis->offTestingData] 877 | ((uint32_t)pThis->TestingData.ab[pThis->offTestingData + 1] << 8); 878 pThis->offTestingData += 2; 879 break; 880 case 3: 881 *pu32 = pThis->TestingData.ab[pThis->offTestingData] 882 | ((uint32_t)pThis->TestingData.ab[pThis->offTestingData + 1] << 8) 883 | ((uint32_t)pThis->TestingData.ab[pThis->offTestingData + 2] << 16); 884 pThis->offTestingData += 3; 885 break; 886 case 4: 887 *pu32 = pThis->TestingData.ab[pThis->offTestingData] 888 | ((uint32_t)pThis->TestingData.ab[pThis->offTestingData + 1] << 8) 889 | ((uint32_t)pThis->TestingData.ab[pThis->offTestingData + 2] << 16) 890 | ((uint32_t)pThis->TestingData.ab[pThis->offTestingData + 3] << 24); 891 pThis->offTestingData += 4; 892 break; 893 } 894 } 895 else 896 *pu32 = 0; 897 return VINF_SUCCESS; 898 } 815 899 break; 816 900
Note:
See TracChangeset
for help on using the changeset viewer.