- Timestamp:
- Sep 19, 2023 11:14:45 PM (15 months ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
r101172 r101181 1405 1405 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1406 1406 #endif 1407 uint8_t const cParams = g_acIemThreadedFunctionUsedArgs[pCallEntry->enmFunction]; 1407 1408 1408 1409 #ifdef RT_ARCH_AMD64 … … 1412 1413 off = iemNativeEmitLoadGprFromGpr(pVCpu, off, X86_GREG_xCX, X86_GREG_xBX); 1413 1414 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1414 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_xDX, pCallEntry->auParams[0]); 1415 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1416 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_x8, pCallEntry->auParams[1]); 1417 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1418 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_x9, pCallEntry->auParams[2]); 1419 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1415 if (cParams > 0) 1416 { 1417 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_xDX, pCallEntry->auParams[0]); 1418 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1419 } 1420 if (cParams > 1) 1421 { 1422 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_x8, pCallEntry->auParams[1]); 1423 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1424 } 1425 if (cParams > 2) 1426 { 1427 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_x9, pCallEntry->auParams[2]); 1428 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1429 } 1420 1430 # else /* VBOXSTRICTRC: Returned via hidden parameter. Sigh. */ 1421 1431 off = iemNativeEmitLoadGprFromGpr(pVCpu, off, X86_GREG_xDX, X86_GREG_xBX); 1422 1432 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1423 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_x8, pCallEntry->auParams[0]); 1424 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1425 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_x9, pCallEntry->auParams[1]); 1426 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1427 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_x10, pCallEntry->auParams[2]); 1428 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1433 if (cParams > 0) 1434 { 1435 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_x8, pCallEntry->auParams[0]); 1436 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1437 } 1438 if (cParams > 1) 1439 { 1440 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_x9, pCallEntry->auParams[1]); 1441 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1442 } 1443 if (cParams > 2) 1444 { 1445 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_x10, pCallEntry->auParams[2]); 1446 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1447 } 1429 1448 off = iemNativeEmitStoreGprByBp(pVCpu, off, IEMNATIVE_FP_OFF_STACK_ARG0, X86_GREG_x10); 1430 1449 AssertReturn(off != UINT32_MAX, UINT32_MAX); … … 1435 1454 off = iemNativeEmitLoadGprFromGpr(pVCpu, off, X86_GREG_xDI, X86_GREG_xBX); 1436 1455 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1437 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_xSI, pCallEntry->auParams[0]); 1438 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1439 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_xDX, pCallEntry->auParams[1]); 1440 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1441 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_xCX, pCallEntry->auParams[2]); 1442 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1456 if (cParams > 0) 1457 { 1458 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_xSI, pCallEntry->auParams[0]); 1459 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1460 } 1461 if (cParams > 1) 1462 { 1463 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_xDX, pCallEntry->auParams[1]); 1464 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1465 } 1466 if (cParams > 2) 1467 { 1468 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_xCX, pCallEntry->auParams[2]); 1469 AssertReturn(off != UINT32_MAX, UINT32_MAX); 1470 } 1443 1471 # endif 1444 1472 off = iemNativeEmitLoadGprImm64(pVCpu, off, X86_GREG_xAX, (uintptr_t)g_apfnIemThreadedFunctions[pCallEntry->enmFunction]); -
trunk/src/VBox/VMM/VMMAll/IEMAllThrdPython.py
r100859 r101181 1582 1582 ]; 1583 1583 1584 ## List of built-in threaded functions .1585 ka sBltIns = (1586 'DeferToCImpl0',1587 'CheckIrq',1588 'CheckMode',1589 'CheckHwInstrBps',1590 'CheckCsLim',1591 1592 'CheckCsLimAndOpcodes',1593 'CheckOpcodes',1594 'CheckOpcodesConsiderCsLim',1595 1596 'CheckCsLimAndPcAndOpcodes',1597 'CheckPcAndOpcodes',1598 'CheckPcAndOpcodesConsiderCsLim',1599 1600 'CheckCsLimAndOpcodesAcrossPageLoadingTlb',1601 'CheckOpcodesAcrossPageLoadingTlb',1602 'CheckOpcodesAcrossPageLoadingTlbConsiderCsLim',1603 1604 'CheckCsLimAndOpcodesLoadingTlb',1605 'CheckOpcodesLoadingTlb',1606 'CheckOpcodesLoadingTlbConsiderCsLim',1607 1608 'CheckCsLimAndOpcodesOnNextPageLoadingTlb',1609 'CheckOpcodesOnNextPageLoadingTlb',1610 'CheckOpcodesOnNextPageLoadingTlbConsiderCsLim',1611 1612 'CheckCsLimAndOpcodesOnNewPageLoadingTlb',1613 'CheckOpcodesOnNewPageLoadingTlb',1614 'CheckOpcodesOnNewPageLoadingTlbConsiderCsLim',1584 ## List of built-in threaded functions with user argument counts. 1585 katBltIns = ( 1586 ( 'DeferToCImpl0', 2 ), 1587 ( 'CheckIrq', 0 ), 1588 ( 'CheckMode', 1 ), 1589 ( 'CheckHwInstrBps', 0 ), 1590 ( 'CheckCsLim', 1 ), 1591 1592 ( 'CheckCsLimAndOpcodes', 3 ), 1593 ( 'CheckOpcodes', 3 ), 1594 ( 'CheckOpcodesConsiderCsLim', 3 ), 1595 1596 ( 'CheckCsLimAndPcAndOpcodes', 3 ), 1597 ( 'CheckPcAndOpcodes', 3 ), 1598 ( 'CheckPcAndOpcodesConsiderCsLim', 3 ), 1599 1600 ( 'CheckCsLimAndOpcodesAcrossPageLoadingTlb', 3 ), 1601 ( 'CheckOpcodesAcrossPageLoadingTlb', 3 ), 1602 ( 'CheckOpcodesAcrossPageLoadingTlbConsiderCsLim', 2 ), 1603 1604 ( 'CheckCsLimAndOpcodesLoadingTlb', 3 ), 1605 ( 'CheckOpcodesLoadingTlb', 3 ), 1606 ( 'CheckOpcodesLoadingTlbConsiderCsLim', 3 ), 1607 1608 ( 'CheckCsLimAndOpcodesOnNextPageLoadingTlb', 2 ), 1609 ( 'CheckOpcodesOnNextPageLoadingTlb', 2 ), 1610 ( 'CheckOpcodesOnNextPageLoadingTlbConsiderCsLim', 2 ), 1611 1612 ( 'CheckCsLimAndOpcodesOnNewPageLoadingTlb', 3 ), # actually 2 params, but asserts uParam2 == 0. 1613 ( 'CheckOpcodesOnNewPageLoadingTlb', 3 ), # actually 2 params, but asserts uParam2 == 0. 1614 ( 'CheckOpcodesOnNewPageLoadingTlbConsiderCsLim', 3 ), # actually 2 params, but asserts uParam2 == 0. 1615 1615 ); 1616 1616 … … 1633 1633 ' */', 1634 1634 ]; 1635 asLines += [' kIemThreadedFunc_BltIn_%s,' % (sFuncNm,) for sFuncNm in self.kasBltIns];1635 asLines += [' kIemThreadedFunc_BltIn_%s,' % (sFuncNm,) for sFuncNm, _ in self.katBltIns]; 1636 1636 1637 1637 iThreadedFunction = 1; … … 1661 1661 'extern const char * const g_apszIemThreadedFunctions[kIemThreadedFunc_End];', 1662 1662 '#endif', 1663 'extern uint8_t const g_acIemThreadedFunctionUsedArgs[kIemThreadedFunc_End];', 1663 1664 ]; 1664 1665 … … 1762 1763 1763 1764 # 1764 # Emit the function table. 1765 # 1766 oOut.write( '\n' 1767 + '\n' 1768 + '/**\n' 1769 + ' * Function table.\n' 1770 + ' */\n' 1771 + 'const PFNIEMTHREADEDFUNC g_apfnIemThreadedFunctions[kIemThreadedFunc_End] =\n' 1772 + '{\n' 1773 + ' /*Invalid*/ NULL,\n' 1774 + '\n' 1775 + ' /*\n' 1776 + ' * Predefined.\n' 1777 + ' */\n'); 1778 for sFuncNm in self.kasBltIns: 1779 oOut.write(' iemThreadedFunc_BltIn_%s,\n' % (sFuncNm,)); 1765 # Generate the output tables in parallel. 1766 # 1767 asFuncTable = [ 1768 '/**', 1769 ' * Function pointer table.', 1770 ' */', 1771 'PFNIEMTHREADEDFUNC const g_apfnIemThreadedFunctions[kIemThreadedFunc_End] =', 1772 '{', 1773 ' /*Invalid*/ NULL,', 1774 ]; 1775 asNameTable = [ 1776 '/**', 1777 ' * Function name table.', 1778 ' */', 1779 'const char * const g_apszIemThreadedFunctions[kIemThreadedFunc_End] =', 1780 '{', 1781 ' "Invalid",', 1782 ]; 1783 asArgCntTab = [ 1784 '/**', 1785 ' * Argument count table.', 1786 ' */', 1787 'uint8_t const g_acIemThreadedFunctionUsedArgs[kIemThreadedFunc_End] =', 1788 '{', 1789 ' 0, /*Invalid*/', 1790 ]; 1791 aasTables = (asFuncTable, asNameTable, asArgCntTab,); 1792 1793 for asTable in aasTables: 1794 asTable.extend(( 1795 '', 1796 ' /*', 1797 ' * Predefined.', 1798 ' */', 1799 )); 1800 for sFuncNm, cArgs in self.katBltIns: 1801 asFuncTable.append(' iemThreadedFunc_BltIn_%s,' % (sFuncNm,)); 1802 asNameTable.append(' "BltIn_%s",' % (sFuncNm,)); 1803 asArgCntTab.append(' %d, /*BltIn_%s*/' % (cArgs, sFuncNm,)); 1780 1804 1781 1805 iThreadedFunction = 1; 1782 1806 for sVariation in ThreadedFunctionVariation.kasVariationsEmitOrder: 1783 oOut.write( '\n' 1784 + ' /*\n' 1785 + ' * Variation: ' + ThreadedFunctionVariation.kdVariationNames[sVariation] + '\n' 1786 + ' */\n'); 1787 for oThreadedFunction in self.aoThreadedFuncs: 1788 oVariation = oThreadedFunction.dVariations.get(sVariation, None); 1789 if oVariation: 1790 iThreadedFunction += 1; 1791 assert oVariation.iEnumValue == iThreadedFunction; 1792 oOut.write(' /*%4u*/ %s,\n' % (iThreadedFunction, oVariation.getFunctionName(),)); 1793 oOut.write('};\n'); 1794 1795 # 1796 # Emit the function name table. 1797 # 1798 oOut.write( '\n' 1799 + '\n' 1800 + '#if defined(IN_RING3) || defined(LOG_ENABLED)\n' 1801 + '/**\n' 1802 + ' * Function table.\n' 1803 + ' */\n' 1804 + 'const char * const g_apszIemThreadedFunctions[kIemThreadedFunc_End] =\n' 1805 + '{\n' 1806 + ' "Invalid",\n' 1807 + '\n' 1808 + ' /*\n' 1809 + ' * Predefined.\n' 1810 + ' */\n'); 1811 for sFuncNm in self.kasBltIns: 1812 oOut.write(' "BltIn_%s",\n' % (sFuncNm,)); 1813 1814 iThreadedFunction = 1; 1815 for sVariation in ThreadedFunctionVariation.kasVariationsEmitOrder: 1816 oOut.write( '\n' 1817 + ' /*\n' 1818 + ' * Variation: ' + ThreadedFunctionVariation.kdVariationNames[sVariation] + '\n' 1819 + ' */\n'); 1807 for asTable in aasTables: 1808 asTable.extend(( 1809 '', 1810 ' /*', 1811 ' * Variation: ' + ThreadedFunctionVariation.kdVariationNames[sVariation], 1812 ' */', 1813 )); 1820 1814 for oThreadedFunction in self.aoThreadedFuncs: 1821 1815 oVariation = oThreadedFunction.dVariations.get(sVariation, None); … … 1824 1818 assert oVariation.iEnumValue == iThreadedFunction; 1825 1819 sName = oVariation.getFunctionName(); 1826 if sName.startswith('iemThreadedFunc_'): 1827 sName = sName[len('iemThreadedFunc_'):]; 1828 oOut.write(' /*%4u*/ "%s",\n' % (iThreadedFunction, sName,)); 1829 oOut.write( '};\n' 1830 + '#endif /* IN_RING3 || LOG_ENABLED */\n'); 1820 asFuncTable.append(' /*%4u*/ %s,' % (iThreadedFunction, sName,)); 1821 asNameTable.append(' /*%4u*/ "%s",' % (iThreadedFunction, sName,)); 1822 asArgCntTab.append(' /*%4u*/ %d, /*%s*/' % (iThreadedFunction, oVariation.cMinParams, sName,)); 1823 1824 for asTable in aasTables: 1825 asTable.append('};'); 1826 1827 # 1828 # Output the tables. 1829 # 1830 oOut.write( '\n' 1831 + '\n'); 1832 oOut.write('\n'.join(asFuncTable)); 1833 oOut.write( '\n' 1834 + '\n' 1835 + '\n' 1836 + '#if defined(IN_RING3) || defined(LOG_ENABLED)\n'); 1837 oOut.write('\n'.join(asNameTable)); 1838 oOut.write( '\n' 1839 + '#endif /* IN_RING3 || LOG_ENABLED */\n' 1840 + '\n' 1841 + '\n'); 1842 oOut.write('\n'.join(asArgCntTab)); 1843 oOut.write('\n'); 1831 1844 1832 1845 return True;
Note:
See TracChangeset
for help on using the changeset viewer.