Changeset 101535 in vbox for trunk/src/VBox/VMM/include
- Timestamp:
- Oct 20, 2023 9:53:15 PM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
r101523 r101535 473 473 * IEMNATIVEINSTR units. */ 474 474 uint32_t cInstrBufAlloc; 475 uint32_t uPadding; /* We don't keep track of this here... */ 475 #ifdef VBOX_STRICT 476 /** Strict: How far the last iemNativeInstrBufEnsure() checked. */ 477 uint32_t offInstrBufChecked; 478 #else 479 uint32_t uPadding; /* We don't keep track of the size here... */ 480 #endif 476 481 /** Fixed temporary code buffer for native recompilation. */ 477 482 PIEMNATIVEINSTR pInstrBuf; … … 595 600 DECL_FORCE_INLINE(PIEMNATIVEINSTR) iemNativeInstrBufEnsure(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t cInstrReq) 596 601 { 597 if (RT_LIKELY(off + (uint64_t)cInstrReq <= pReNative->cInstrBufAlloc)) 602 uint64_t const offChecked = off + (uint64_t)cInstrReq; 603 if (RT_LIKELY(offChecked <= pReNative->cInstrBufAlloc)) 604 { 605 #ifdef VBOX_STRICT 606 pReNative->offInstrBufChecked = offChecked; 607 #endif 598 608 return pReNative->pInstrBuf; 609 } 599 610 return iemNativeInstrBufEnsureSlow(pReNative, off, cInstrReq); 600 611 } 612 613 /** 614 * Checks that we didn't exceed the space requested in the last 615 * iemNativeInstrBufEnsure() call. */ 616 #define IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(a_pReNative, a_off) \ 617 AssertMsg((a_off) <= (a_pReNative)->offInstrBufChecked, \ 618 ("off=%#x offInstrBufChecked=%#x\n", (a_off), (a_pReNative)->offInstrBufChecked)) 601 619 602 620 … … 636 654 # error "port me" 637 655 #endif 656 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 638 657 return off; 639 658 } … … 663 682 # error "port me" 664 683 #endif 665 RT_NOREF(pReNative);684 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 666 685 return off; 667 686 } … … 760 779 # error "port me" 761 780 #endif 781 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 762 782 return off; 763 783 } … … 791 811 # error "port me" 792 812 #endif 813 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 793 814 return off; 794 815 } … … 853 874 pu32CodeBuf[off++] = Armv8A64MkInstrStLdRegIdx(enmOperation, iGpr, IEMNATIVE_REG_FIXED_PVMCPU, IEMNATIVE_REG_FIXED_TMP); 854 875 } 876 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 855 877 return off; 856 878 } … … 873 895 pbCodeBuf[off++] = 0x8b; 874 896 off = iemNativeEmitGprByVCpuDisp(pbCodeBuf,off,iGpr, offVCpu); 897 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 875 898 876 899 #elif RT_ARCH_ARM64 … … 898 921 pbCodeBuf[off++] = 0x8b; 899 922 off = iemNativeEmitGprByVCpuDisp(pbCodeBuf, off, iGpr, offVCpu); 923 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 900 924 901 925 #elif RT_ARCH_ARM64 … … 924 948 pbCodeBuf[off++] = 0xb7; 925 949 off = iemNativeEmitGprByVCpuDisp(pbCodeBuf, off, iGpr, offVCpu); 950 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 926 951 927 952 #elif RT_ARCH_ARM64 … … 950 975 pbCodeBuf[off++] = 0xb6; 951 976 off = iemNativeEmitGprByVCpuDisp(pbCodeBuf, off, iGpr, offVCpu); 977 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 952 978 953 979 #elif RT_ARCH_ARM64 … … 976 1002 pbCodeBuf[off++] = 0x89; 977 1003 off = iemNativeEmitGprByVCpuDisp(pbCodeBuf,off,iGpr, offVCpu); 1004 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 978 1005 979 1006 #elif RT_ARCH_ARM64 … … 1000 1027 pbCodeBuf[off++] = 0x89; 1001 1028 off = iemNativeEmitGprByVCpuDisp(pbCodeBuf, off, iGpr, offVCpu); 1029 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1002 1030 1003 1031 #elif RT_ARCH_ARM64 … … 1025 1053 pbCodeBuf[off++] = 0x89; 1026 1054 off = iemNativeEmitGprByVCpuDisp(pbCodeBuf, off, iGpr, offVCpu); 1055 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1027 1056 1028 1057 #elif RT_ARCH_ARM64 … … 1049 1078 pbCodeBuf[off++] = 0x88; 1050 1079 off = iemNativeEmitGprByVCpuDisp(pbCodeBuf, off, iGpr, offVCpu); 1080 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1051 1081 1052 1082 #elif RT_ARCH_ARM64 … … 1087 1117 # error "port me" 1088 1118 #endif 1119 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1089 1120 return off; 1090 1121 } … … 1094 1125 * Common bit of iemNativeEmitLoadGprByBp and friends. 1095 1126 */ 1096 DECL_FORCE_INLINE(uint32_t) iemNativeEmitGprByBpDisp(uint8_t *pbCodeBuf, uint32_t off, uint8_t iGprReg, int32_t offDisp) 1127 DECL_FORCE_INLINE(uint32_t) iemNativeEmitGprByBpDisp(uint8_t *pbCodeBuf, uint32_t off, uint8_t iGprReg, int32_t offDisp, 1128 PIEMRECOMPILERSTATE pReNativeAssert) 1097 1129 { 1098 1130 if (offDisp < 128 && offDisp >= -128) … … 1109 1141 pbCodeBuf[off++] = RT_BYTE4((uint32_t)offDisp); 1110 1142 } 1143 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNativeAssert, off); RT_NOREF(pReNativeAssert); 1111 1144 return off; 1112 1145 } … … 1128 1161 pbCodeBuf[off++] = X86_OP_REX_W | X86_OP_REX_R; 1129 1162 pbCodeBuf[off++] = 0x8b; 1130 return iemNativeEmitGprByBpDisp(pbCodeBuf, off, iGprDst, offDisp );1163 return iemNativeEmitGprByBpDisp(pbCodeBuf, off, iGprDst, offDisp, pReNative); 1131 1164 } 1132 1165 #endif … … 1145 1178 pbCodeBuf[off++] = X86_OP_REX_R; 1146 1179 pbCodeBuf[off++] = 0x8b; 1147 return iemNativeEmitGprByBpDisp(pbCodeBuf, off, iGprDst, offDisp );1180 return iemNativeEmitGprByBpDisp(pbCodeBuf, off, iGprDst, offDisp, pReNative); 1148 1181 } 1149 1182 #endif … … 1164 1197 pbCodeBuf[off++] = X86_OP_REX_W | X86_OP_REX_R; 1165 1198 pbCodeBuf[off++] = 0x8d; 1166 return iemNativeEmitGprByBpDisp(pbCodeBuf, off, iGprDst, offDisp );1199 return iemNativeEmitGprByBpDisp(pbCodeBuf, off, iGprDst, offDisp, pReNative); 1167 1200 } 1168 1201 #endif … … 1185 1218 pbCodeBuf[off++] = X86_OP_REX_W | X86_OP_REX_R; 1186 1219 pbCodeBuf[off++] = 0x89; 1187 return iemNativeEmitGprByBpDisp(pbCodeBuf, off, iGprSrc, offDisp );1220 return iemNativeEmitGprByBpDisp(pbCodeBuf, off, iGprSrc, offDisp, pReNative); 1188 1221 1189 1222 #elif defined(RT_ARCH_ARM64) … … 1212 1245 IEMNATIVE_REG_FIXED_TMP0, kArmv8A64InstrLdStExtend_Sxtw); 1213 1246 } 1247 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1214 1248 return off; 1215 1249 … … 1253 1287 pbCodeBuf[off++] = RT_BYTE3(uImm64); 1254 1288 pbCodeBuf[off++] = RT_BYTE4(uImm64); 1289 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1255 1290 return off; 1256 1291 } … … 1291 1326 pbCodeBuf[off++] = RT_BYTE4(iSubtrahend); 1292 1327 } 1328 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1293 1329 return off; 1294 1330 } … … 1319 1355 # error "Port me" 1320 1356 #endif 1357 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1321 1358 return off; 1322 1359 } … … 1356 1393 # error "Port me" 1357 1394 #endif 1395 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1358 1396 return off; 1359 1397 } … … 1395 1433 # error "Port me" 1396 1434 #endif 1435 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1397 1436 return off; 1398 1437 } … … 1465 1504 # error "Port me" 1466 1505 #endif 1506 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1467 1507 return off; 1468 1508 } … … 1518 1558 # error "Port me" 1519 1559 #endif 1560 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1520 1561 return off; 1521 1562 } … … 1549 1590 # error "Port me" 1550 1591 #endif 1592 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1551 1593 return off; 1552 1594 } … … 1575 1617 # error "Port me" 1576 1618 #endif 1619 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1577 1620 return off; 1578 1621 } … … 1591 1634 pu32CodeBuf[off++] = Armv8A64MkInstrAddSubReg(true /*fSub*/, ARMV8_A64_REG_XZR /*iRegResult*/, iGprLeft, iGprRight, 1592 1635 f64Bit, true /*fSetFlags*/, cShift, enmShift); 1636 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1593 1637 return off; 1594 1638 } … … 1609 1653 pbCodeBuf[off++] = 0x3b; 1610 1654 pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, iGprLeft & 7, iGprRight & 7); 1655 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1611 1656 1612 1657 #elif defined(RT_ARCH_ARM64) … … 1635 1680 pbCodeBuf[off++] = 0x3b; 1636 1681 pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, iGprLeft & 7, iGprRight & 7); 1682 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1637 1683 1638 1684 #elif defined(RT_ARCH_ARM64) … … 1700 1746 # error "Port me!" 1701 1747 #endif 1748 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1702 1749 return off; 1703 1750 } … … 1754 1801 # error "Port me!" 1755 1802 #endif 1803 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1756 1804 return off; 1757 1805 } … … 1868 1916 # error "Port me!" 1869 1917 #endif 1918 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1870 1919 return off; 1871 1920 } … … 1993 2042 # error "port me" 1994 2043 #endif 2044 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 1995 2045 return off; 1996 2046 }
Note:
See TracChangeset
for help on using the changeset viewer.