Changeset 100149 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Jun 10, 2023 8:49:28 PM (21 months ago)
- svn:sync-xref-src-repo-rev:
- 157844
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllThreadedFunctions.cpp
r100148 r100149 595 595 596 596 597 /** 598 * Built-in function that compares the fExec mask against uParam0. 599 */ 600 static IEM_DECL_IMPL_DEF(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckMode, 601 (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2)) 602 { 603 uint32_t const fExpectedExec = (uint32_t)uParam0; 604 if (pVCpu->iem.s.fExec == fExpectedExec) 605 return VINF_SUCCESS; 606 Log12(("Mode changed at %04x:%08RX64: %#x -> %#x (xor: %#x)\n", pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip, 607 fExpectedExec, pVCpu->iem.s.fExec, fExpectedExec ^ pVCpu->iem.s.fExec)); 608 RT_NOREF(uParam1, uParam2); 609 return VINF_IEM_REEXEC_MODE_CHANGED; 610 } 611 597 612 /* 598 613 * The threaded functions. -
trunk/src/VBox/VMM/VMMAll/IEMAllThreadedPython.py
r100148 r100149 196 196 ## @} 197 197 198 ## IEM_CIMPL_F_XXX flags that we know. 199 kdCImplFlags = { 200 'IEM_CIMPL_F_MODE': True, 201 'IEM_CIMPL_F_BRANCH': False, 202 'IEM_CIMPL_F_RFLAGS': False, 203 'IEM_CIMPL_F_STATUS_FLAGS': False, 204 'IEM_CIMPL_F_VMEXIT': False, 205 'IEM_CIMPL_F_FPU': False, 206 'IEM_CIMPL_F_REP': False, 207 'IEM_CIMPL_F_END_TB': False, 208 'IEM_CIMPL_F_XCPT': True, 209 }; 210 198 211 def __init__(self, oThreadedFunction, sVariation = ksVariation_Default): 199 212 self.oParent = oThreadedFunction # type: ThreadedFunction … … 210 223 ## List/tree of statements for the threaded function. 211 224 self.aoStmtsForThreadedFunction = [] # type: list(McStmt) 225 226 ## Dictionary with any IEM_CIMPL_F_XXX flags associated to the code block. 227 self.dsCImplFlags = { } # type: dict(str, bool) 212 228 213 229 ## Function enum number, for verification. Set by generateThreadedFunctionsHeader. … … 464 480 return (aoThreadedStmts, iParamRef); 465 481 482 def analyzeCodeOperation(self, aoStmts): 483 """ 484 Analyzes the code looking clues as to additional side-effects. 485 486 Currently this is simply looking for any IEM_IMPL_C_F_XXX flags and 487 collecting these in self.dsCImplFlags. 488 """ 489 for oStmt in aoStmts: 490 if oStmt.sName.startswith('IEM_MC_CALL_CIMPL_') or oStmt.sName.startswith('IEM_MC_DEFER_TO_CIMPL_'): 491 sFlagsSansComments = iai.McBlock.stripComments(oStmt.asParams[0]); 492 for sFlag in sFlagsSansComments.split('|'): 493 sFlag = sFlag.strip(); 494 if sFlag != '0': 495 if sFlag in self.kdCImplFlags: 496 self.dsCImplFlags[sFlag] = True; 497 else: 498 self.raiseProblem('Unknown CIMPL flag value: %s' % (sFlag,)); 499 500 # Process branches of conditionals recursively. 501 if isinstance(oStmt, iai.McStmtCond): 502 self.analyzeCodeOperation(oStmt.aoIfBranch); 503 if oStmt.aoElseBranch: 504 self.analyzeCodeOperation(oStmt.aoElseBranch); 505 506 return True; 507 508 466 509 def analyzeConsolidateThreadedParamRefs(self): 467 510 """ … … 543 586 ksHexDigits = '0123456789abcdefABCDEF'; 544 587 545 def analyzeFindThreadedParamRefs(self, aoStmts): 588 def analyzeFindThreadedParamRefs(self, aoStmts): # pylint: disable=too-many-statements 546 589 """ 547 590 Scans the statements for things that have to passed on to the threaded … … 777 820 self.analyzeConsolidateThreadedParamRefs(); 778 821 822 # Scan the code for IEM_CIMPL_F_ and other clues. 823 self.analyzeCodeOperation(aoStmts); 824 779 825 # Morph the statement stream for the block into what we'll be using in the threaded function. 780 826 (self.aoStmtsForThreadedFunction, iParamRef) = self.analyzeMorphStmtForThreaded(aoStmts); … … 786 832 def emitThreadedCallStmts(self, cchIndent): 787 833 """ 788 Produces a generic C++ statment that emits a call to the thread function variation. 789 """ 834 Produces generic C++ statments that emits a call to the thread function 835 variation and any subsequent checks that may be necessary after that. 836 """ 837 # The call to the threaded function. 790 838 sCode = 'IEM_MC2_EMIT_CALL_%s(%s' % (self.cMinParams, self.getIndexName(), ); 791 839 for iParam in range(self.cMinParams): … … 801 849 sCode += ', ' + ' | '.join(asFrags); 802 850 sCode += ');'; 803 return [iai.McCppGeneric(sCode, cchIndent = cchIndent),]; 851 aoStmts = [ iai.McCppGeneric(sCode, cchIndent = cchIndent), ]; 852 853 # For CIMPL stuff, we need to consult the associated IEM_CIMPL_F_XXX 854 # mask and maybe emit additional checks. 855 if 'IEM_CIMPL_F_MODE' in self.dsCImplFlags or 'IEM_CIMPL_F_XCPT' in self.dsCImplFlags: 856 aoStmts.append(iai.McCppGeneric('IEM_MC2_EMIT_CALL_1(kIemThreadedFunc_CheckMode, pVCpu->iem.s.fExec);', 857 cchIndent = cchIndent)); 858 859 return aoStmts; 804 860 805 861 … … 1139 1195 '{', 1140 1196 ' kIemThreadedFunc_Invalid = 0,', 1197 '', 1198 ' /*' 1199 ' * Predefined' 1200 ' */' 1201 ' kIemThreadedFunc_CheckMode,', 1141 1202 ]; 1142 iThreadedFunction = 0;1203 iThreadedFunction = 1; 1143 1204 for sVariation in ThreadedFunctionVariation.kasVariationsEmitOrder: 1144 1205 asLines += [ … … 1288 1349 + 'const PFNIEMTHREADEDFUNC g_apfnIemThreadedFunctions[kIemThreadedFunc_End] =\n' 1289 1350 + '{\n' 1290 + ' /*Invalid*/ NULL, \n'); 1291 iThreadedFunction = 0; 1351 + ' /*Invalid*/ NULL,\n' 1352 + '\n' 1353 + ' /*\n' 1354 + ' * Predefined.\n' 1355 + ' */' 1356 + ' iemThreadedFunc_BltIn_CheckMode,\n' 1357 ); 1358 iThreadedFunction = 1; 1292 1359 for sVariation in ThreadedFunctionVariation.kasVariationsEmitOrder: 1293 1360 oOut.write( '\n'
Note:
See TracChangeset
for help on using the changeset viewer.