Changeset 102695 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Dec 22, 2023 10:15:28 PM (14 months ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompBltIn.cpp
r102685 r102695 31 31 *********************************************************************************************************************************/ 32 32 #define LOG_GROUP LOG_GROUP_IEM_RE_NATIVE 33 #define IEM_WITH_OPAQUE_DECODER_STATE 33 //#define IEM_WITH_OPAQUE_DECODER_STATE - need offCurInstrStart access for iemNativeHlpMemCodeNewPageTlbMiss and friends. 34 34 #define VMCPU_INCL_CPUM_GST_CTX 35 35 #define VMM_INCLUDED_SRC_include_IEMMc_h /* block IEMMc.h inclusion. */ … … 65 65 #endif 66 66 67 68 /** 69 * Used by TB code to deal with a TLB miss for a new page. 70 */ 71 IEM_DECL_NATIVE_HLP_DEF(RTGCPHYS, iemNativeHlpMemCodeNewPageTlbMiss,(PVMCPUCC pVCpu, uint8_t offInstr)) 72 { 73 pVCpu->iem.s.pbInstrBuf = NULL; 74 pVCpu->iem.s.offCurInstrStart = GUEST_PAGE_SIZE - offInstr; 75 pVCpu->iem.s.offInstrNextByte = GUEST_PAGE_SIZE; 76 iemOpcodeFetchBytesJmp(pVCpu, 0, NULL); 77 return pVCpu->iem.s.pbInstrBuf ? pVCpu->iem.s.GCPhysInstrBuf : NIL_RTGCPHYS; 78 } 67 79 68 80 … … 247 259 248 260 /** 249 * Sets idxTbCurInstr in preparation of raising an exception .261 * Sets idxTbCurInstr in preparation of raising an exception or aborting the TB. 250 262 */ 251 263 /** @todo Optimize this, so we don't set the same value more than once. Just … … 257 269 # define BODY_SET_CUR_INSTR() ((void)0) 258 270 #endif 271 272 /** 273 * Flushes pending writes in preparation of raising an exception or aborting the TB. 274 */ 275 #define BODY_FLUSH_PENDING_WRITES() \ 276 off = iemNativeRegFlushPendingWrites(pReNative, off); 259 277 260 278 … … 1131 1149 1132 1150 1151 /** 1152 * Macro that implements TLB loading and updating pbInstrBuf updating for an 1153 * instruction crossing into a new page. 1154 * 1155 * This may long jump if we're raising a \#PF, \#GP or similar trouble. 1156 */ 1157 #define BODY_LOAD_TLB_FOR_NEW_PAGE(a_pTb, a_offInstr, a_idxRange, a_cbInstr) \ 1158 RT_NOREF(a_cbInstr); \ 1159 off = iemNativeEmitBltLoadTlbForNewPage(pReNative, off, pTb, a_idxRange, a_offInstr) 1160 1161 DECL_FORCE_INLINE(uint32_t) 1162 iemNativeEmitBltLoadTlbForNewPage(PIEMRECOMPILERSTATE pReNative, uint32_t off, PCIEMTB pTb, uint8_t idxRange, uint8_t offInstr) 1163 { 1164 #ifdef VBOX_STRICT 1165 off = iemNativeEmitMarker(pReNative, off, 0x80000005); 1166 #endif 1167 1168 /* 1169 * Move/spill/flush stuff out of call-volatile registers. 1170 * This is the easy way out. We could contain this to the tlb-miss branch 1171 * by saving and restoring active stuff here. 1172 */ 1173 /** @todo save+restore active registers and maybe guest shadows in tlb-miss. */ 1174 off = iemNativeRegMoveAndFreeAndFlushAtCall(pReNative, off, 0 /* vacate all non-volatile regs */); 1175 1176 /* 1177 * Define labels and allocate the register for holding the GCPhys of the new page. 1178 */ 1179 uint16_t const uTlbSeqNo = pReNative->uTlbSeqNo++; 1180 uint32_t const idxLabelTlbMiss = iemNativeLabelCreate(pReNative, kIemNativeLabelType_TlbMiss, UINT32_MAX, uTlbSeqNo); 1181 uint32_t const idxLabelTlbDone = iemNativeLabelCreate(pReNative, kIemNativeLabelType_TlbDone, UINT32_MAX, uTlbSeqNo); 1182 uint32_t const idxRegGCPhys = iemNativeRegAllocTmp(pReNative, &off); 1183 1184 /* 1185 * First we try to go via the TLB. 1186 */ 1187 /** @todo */ 1188 1189 /* 1190 * TLB miss: Call iemNativeHlpMemCodeNewPageTlbMiss to do the work. 1191 */ 1192 iemNativeLabelDefine(pReNative, idxLabelTlbMiss, off); 1193 1194 /* IEMNATIVE_CALL_ARG1_GREG = offInstr */ 1195 off = iemNativeEmitLoadGpr8Imm(pReNative, off, IEMNATIVE_CALL_ARG1_GREG, offInstr); 1196 1197 /* IEMNATIVE_CALL_ARG0_GREG = pVCpu */ 1198 off = iemNativeEmitLoadGprFromGpr(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, IEMNATIVE_REG_FIXED_PVMCPU); 1199 1200 /* Done setting up parameters, make the call. */ 1201 off = iemNativeEmitCallImm(pReNative, off, (uintptr_t)iemNativeHlpMemCodeNewPageTlbMiss); 1202 1203 /* Move the result to the right register. */ 1204 if (idxRegGCPhys != IEMNATIVE_CALL_RET_GREG) 1205 off = iemNativeEmitLoadGprFromGpr(pReNative, off, idxRegGCPhys, IEMNATIVE_CALL_RET_GREG); 1206 1207 iemNativeLabelDefine(pReNative, idxLabelTlbDone, off); 1208 1209 /* 1210 * Now check the physical address of the page matches the expected one. 1211 */ 1212 RTGCPHYS const GCPhysNewPage = iemTbGetRangePhysPageAddr(pTb, idxRange); 1213 off = iemNativeEmitTestIfGprNotEqualImmAndJmpToNewLabel(pReNative, off, idxRegGCPhys, GCPhysNewPage, 1214 kIemNativeLabelType_ObsoleteTb); 1215 1216 iemNativeRegFreeTmp(pReNative, idxRegGCPhys); 1217 return off; 1218 } 1219 1220 1133 1221 #ifdef BODY_CHECK_CS_LIM 1134 1222 /** … … 1140 1228 uint32_t const cbInstr = (uint32_t)pCallEntry->auParams[0]; 1141 1229 BODY_SET_CUR_INSTR(); 1230 BODY_FLUSH_PENDING_WRITES(); 1142 1231 BODY_CHECK_CS_LIM(cbInstr); 1143 1232 return off; … … 1158 1247 uint32_t const offRange = (uint32_t)pCallEntry->auParams[2]; 1159 1248 BODY_SET_CUR_INSTR(); 1249 BODY_FLUSH_PENDING_WRITES(); 1160 1250 BODY_CHECK_CS_LIM(cbInstr); 1161 1251 BODY_CHECK_OPCODES(pTb, idxRange, offRange, cbInstr); … … 1177 1267 uint32_t const offRange = (uint32_t)pCallEntry->auParams[2]; 1178 1268 BODY_SET_CUR_INSTR(); 1269 BODY_FLUSH_PENDING_WRITES(); 1179 1270 BODY_CHECK_OPCODES(pTb, idxRange, offRange, cbInstr); 1180 1271 return off; … … 1195 1286 uint32_t const offRange = (uint32_t)pCallEntry->auParams[2]; 1196 1287 BODY_SET_CUR_INSTR(); 1288 BODY_FLUSH_PENDING_WRITES(); 1197 1289 BODY_CONSIDER_CS_LIM_CHECKING(pTb, cbInstr); 1198 1290 BODY_CHECK_OPCODES(pTb, idxRange, offRange, cbInstr); … … 1221 1313 //LogFunc(("idxRange=%u @ %#x LB %#x: offPhysPage=%#x LB %#x\n", idxRange, offRange, cbInstr, pTb->aRanges[idxRange].offPhysPage, pTb->aRanges[idxRange].cbOpcodes)); 1222 1314 BODY_SET_CUR_INSTR(); 1315 BODY_FLUSH_PENDING_WRITES(); 1223 1316 BODY_CHECK_CS_LIM(cbInstr); 1224 1317 BODY_CHECK_PC_AFTER_BRANCH(pTb, idxRange, offRange, cbInstr); … … 1245 1338 //LogFunc(("idxRange=%u @ %#x LB %#x: offPhysPage=%#x LB %#x\n", idxRange, offRange, cbInstr, pTb->aRanges[idxRange].offPhysPage, pTb->aRanges[idxRange].cbOpcodes)); 1246 1339 BODY_SET_CUR_INSTR(); 1340 BODY_FLUSH_PENDING_WRITES(); 1247 1341 BODY_CHECK_PC_AFTER_BRANCH(pTb, idxRange, offRange, cbInstr); 1248 1342 BODY_CHECK_OPCODES(pTb, idxRange, offRange, cbInstr); … … 1269 1363 //LogFunc(("idxRange=%u @ %#x LB %#x: offPhysPage=%#x LB %#x\n", idxRange, offRange, cbInstr, pTb->aRanges[idxRange].offPhysPage, pTb->aRanges[idxRange].cbOpcodes)); 1270 1364 BODY_SET_CUR_INSTR(); 1365 BODY_FLUSH_PENDING_WRITES(); 1271 1366 BODY_CONSIDER_CS_LIM_CHECKING(pTb, cbInstr); 1272 1367 BODY_CHECK_PC_AFTER_BRANCH(pTb, idxRange, offRange, cbInstr); … … 1296 1391 //LogFunc(("idxRange=%u @ %#x LB %#x: offPhysPage=%#x LB %#x\n", idxRange, offRange, cbInstr, pTb->aRanges[idxRange].offPhysPage, pTb->aRanges[idxRange].cbOpcodes)); 1297 1392 BODY_SET_CUR_INSTR(); 1393 BODY_FLUSH_PENDING_WRITES(); 1298 1394 BODY_CHECK_CS_LIM(cbInstr); 1299 1395 BODY_LOAD_TLB_AFTER_BRANCH(pTb, idxRange, cbInstr); … … 1323 1419 //LogFunc(("idxRange=%u @ %#x LB %#x: offPhysPage=%#x LB %#x\n", idxRange, offRange, cbInstr, pTb->aRanges[idxRange].offPhysPage, pTb->aRanges[idxRange].cbOpcodes)); 1324 1420 BODY_SET_CUR_INSTR(); 1421 BODY_FLUSH_PENDING_WRITES(); 1325 1422 BODY_LOAD_TLB_AFTER_BRANCH(pTb, idxRange, cbInstr); 1326 1423 BODY_CHECK_OPCODES(pTb, idxRange, offRange, cbInstr); … … 1349 1446 //LogFunc(("idxRange=%u @ %#x LB %#x: offPhysPage=%#x LB %#x\n", idxRange, offRange, cbInstr, pTb->aRanges[idxRange].offPhysPage, pTb->aRanges[idxRange].cbOpcodes)); 1350 1447 BODY_SET_CUR_INSTR(); 1448 BODY_FLUSH_PENDING_WRITES(); 1351 1449 BODY_CONSIDER_CS_LIM_CHECKING(pTb, cbInstr); 1352 1450 BODY_LOAD_TLB_AFTER_BRANCH(pTb, idxRange, cbInstr); … … 1383 1481 uint32_t const idxRange2 = idxRange1 + 1; 1384 1482 BODY_SET_CUR_INSTR(); 1483 BODY_FLUSH_PENDING_WRITES(); 1385 1484 BODY_CHECK_CS_LIM(cbInstr); 1386 1485 BODY_CHECK_OPCODES(pTb, idxRange1, offRange1, cbInstr); … … 1412 1511 uint32_t const idxRange2 = idxRange1 + 1; 1413 1512 BODY_SET_CUR_INSTR(); 1513 BODY_FLUSH_PENDING_WRITES(); 1414 1514 BODY_CHECK_OPCODES(pTb, idxRange1, offRange1, cbInstr); 1415 1515 BODY_LOAD_TLB_FOR_NEW_PAGE(pTb, cbStartPage, idxRange2, cbInstr); … … 1441 1541 uint32_t const idxRange2 = idxRange1 + 1; 1442 1542 BODY_SET_CUR_INSTR(); 1543 BODY_FLUSH_PENDING_WRITES(); 1443 1544 BODY_CONSIDER_CS_LIM_CHECKING(pTb, cbInstr); 1444 1545 BODY_CHECK_OPCODES(pTb, idxRange1, offRange1, cbInstr); … … 1468 1569 uint32_t const idxRange2 = idxRange1 + 1; 1469 1570 BODY_SET_CUR_INSTR(); 1571 BODY_FLUSH_PENDING_WRITES(); 1470 1572 BODY_CHECK_CS_LIM(cbInstr); 1471 1573 BODY_LOAD_TLB_FOR_NEW_PAGE(pTb, cbStartPage, idxRange2, cbInstr); … … 1494 1596 uint32_t const idxRange2 = idxRange1 + 1; 1495 1597 BODY_SET_CUR_INSTR(); 1598 BODY_FLUSH_PENDING_WRITES(); 1496 1599 BODY_LOAD_TLB_FOR_NEW_PAGE(pTb, cbStartPage, idxRange2, cbInstr); 1497 1600 BODY_CHECK_OPCODES(pTb, idxRange2, 0, cbInstr); … … 1519 1622 uint32_t const idxRange2 = idxRange1 + 1; 1520 1623 BODY_SET_CUR_INSTR(); 1624 BODY_FLUSH_PENDING_WRITES(); 1521 1625 BODY_CONSIDER_CS_LIM_CHECKING(pTb, cbInstr); 1522 1626 BODY_LOAD_TLB_FOR_NEW_PAGE(pTb, cbStartPage, idxRange2, cbInstr); … … 1540 1644 uint32_t const idxRange = (uint32_t)pCallEntry->auParams[1]; 1541 1645 BODY_SET_CUR_INSTR(); 1646 BODY_FLUSH_PENDING_WRITES(); 1542 1647 BODY_CHECK_CS_LIM(cbInstr); 1543 1648 BODY_LOAD_TLB_FOR_NEW_PAGE(pTb, 0, idxRange, cbInstr); … … 1562 1667 uint32_t const idxRange = (uint32_t)pCallEntry->auParams[1]; 1563 1668 BODY_SET_CUR_INSTR(); 1669 BODY_FLUSH_PENDING_WRITES(); 1564 1670 BODY_LOAD_TLB_FOR_NEW_PAGE(pTb, 0, idxRange, cbInstr); 1565 1671 //Assert(pVCpu->iem.s.offCurInstrStart == 0); … … 1584 1690 uint32_t const idxRange = (uint32_t)pCallEntry->auParams[1]; 1585 1691 BODY_SET_CUR_INSTR(); 1692 BODY_FLUSH_PENDING_WRITES(); 1586 1693 BODY_CONSIDER_CS_LIM_CHECKING(pTb, cbInstr); 1587 1694 BODY_LOAD_TLB_FOR_NEW_PAGE(pTb, 0, idxRange, cbInstr); -
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
r102687 r102695 11210 11210 static const char * const a_apszMarkers[] = 11211 11211 { 11212 "unknown0", "CheckCsLim", "ConsiderLimChecking", "CheckOpcodes", "PcAfterBranch", 11212 "unknown0", "CheckCsLim", "ConsiderLimChecking", "CheckOpcodes", "PcAfterBranch", "LoadTlbForNewPage" 11213 11213 }; 11214 11214 #endif -
trunk/src/VBox/VMM/VMMAll/IEMAllThrdPython.py
r102663 r102695 1977 1977 ( 'CheckPcAndOpcodesConsiderCsLim', 3, True ), 1978 1978 1979 ( 'CheckCsLimAndOpcodesAcrossPageLoadingTlb', 3, False),1980 ( 'CheckOpcodesAcrossPageLoadingTlb', 3, False),1981 ( 'CheckOpcodesAcrossPageLoadingTlbConsiderCsLim', 2, False),1979 ( 'CheckCsLimAndOpcodesAcrossPageLoadingTlb', 3, True ), 1980 ( 'CheckOpcodesAcrossPageLoadingTlb', 3, True ), 1981 ( 'CheckOpcodesAcrossPageLoadingTlbConsiderCsLim', 2, True ), 1982 1982 1983 1983 ( 'CheckCsLimAndOpcodesLoadingTlb', 3, False ), … … 1985 1985 ( 'CheckOpcodesLoadingTlbConsiderCsLim', 3, False ), 1986 1986 1987 ( 'CheckCsLimAndOpcodesOnNextPageLoadingTlb', 2, False),1988 ( 'CheckOpcodesOnNextPageLoadingTlb', 2, False),1989 ( 'CheckOpcodesOnNextPageLoadingTlbConsiderCsLim', 2, False),1990 1991 ( 'CheckCsLimAndOpcodesOnNewPageLoadingTlb', 2, False),1992 ( 'CheckOpcodesOnNewPageLoadingTlb', 2, False),1993 ( 'CheckOpcodesOnNewPageLoadingTlbConsiderCsLim', 2, False),1987 ( 'CheckCsLimAndOpcodesOnNextPageLoadingTlb', 2, True ), 1988 ( 'CheckOpcodesOnNextPageLoadingTlb', 2, True ), 1989 ( 'CheckOpcodesOnNextPageLoadingTlbConsiderCsLim', 2, True ), 1990 1991 ( 'CheckCsLimAndOpcodesOnNewPageLoadingTlb', 2, True ), 1992 ( 'CheckOpcodesOnNewPageLoadingTlb', 2, True ), 1993 ( 'CheckOpcodesOnNewPageLoadingTlbConsiderCsLim', 2, True ), 1994 1994 ); 1995 1995
Note:
See TracChangeset
for help on using the changeset viewer.