Changeset 99296 in vbox for trunk/src/VBox/VMM/VMMAll/IEMAllThreadedPython.py
- Timestamp:
- Apr 5, 2023 10:15:47 AM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllThreadedPython.py
r99291 r99296 50 50 51 51 ## Number of generic parameters for the thread functions. 52 g_kcThreadedParams = 3;52 g_kcThreadedParams = 4; ## @todo 3 53 53 54 54 g_kdTypeInfo = { … … 101 101 """ 102 102 103 def __init__(self, sOrgRef, sType, oStmt, iParam = None, offParam = 0): 104 self.sOrgRef = sOrgRef; ##< The name / reference in the original code. 105 self.sStdRef = ''.join(sOrgRef.split()); ##< Normalized name to deal with spaces in macro invocations and such. 106 self.sType = sType; ##< The type (typically derived). 107 self.oStmt = oStmt; ##< The statement making the reference. 108 self.iParam = iParam; ##< The parameter containing the references. None if implicit. 109 self.offParam = offParam; ##< The offset in the parameter of the reference. 110 111 self.sNewName = 'x'; ##< The variable name in the threaded function. 112 self.iNewParam = 99; ##< The this is packed into. 113 self.offNewParam = 1024 ##< The bit offset in iNewParam. 103 def __init__(self, sOrgRef, sType, oStmt, iParam = None, offParam = 0, sStdRef = None): 104 ## The name / reference in the original code. 105 self.sOrgRef = sOrgRef; 106 ## Normalized name to deal with spaces in macro invocations and such. 107 self.sStdRef = sStdRef if sStdRef else ''.join(sOrgRef.split()); 108 ## Indicates that sOrgRef may not match the parameter. 109 self.fCustomRef = sStdRef is not None; 110 ## The type (typically derived). 111 self.sType = sType; 112 ## The statement making the reference. 113 self.oStmt = oStmt; 114 ## The parameter containing the references. None if implicit. 115 self.iParam = iParam; 116 ## The offset in the parameter of the reference. 117 self.offParam = offParam; 118 119 ## The variable name in the threaded function. 120 self.sNewName = 'x'; 121 ## The this is packed into. 122 self.iNewParam = 99; 123 ## The bit offset in iNewParam. 124 self.offNewParam = 1024 114 125 115 126 … … 258 269 sBaseType = self.analyzeCallToType('pImpl'); 259 270 offBits = sMember.rfind('U') + 1; 260 if sBaseType == 'PCIEMOPBINSIZES': return 'PFNIEMAIMPLBIN '+ sMember[offBits:];261 if sBaseType == 'PCIEMOPUNARYSIZES': return 'PFNIEMAIMPLBIN '+ sMember[offBits:];262 if sBaseType == 'PCIEMOPSHIFTSIZES': return 'PFNIEMAIMPLSHIFT '+ sMember[offBits:];271 if sBaseType == 'PCIEMOPBINSIZES': return 'PFNIEMAIMPLBINU' + sMember[offBits:]; 272 if sBaseType == 'PCIEMOPUNARYSIZES': return 'PFNIEMAIMPLBINU' + sMember[offBits:]; 273 if sBaseType == 'PCIEMOPSHIFTSIZES': return 'PFNIEMAIMPLSHIFTU' + sMember[offBits:]; 263 274 if sBaseType == 'PCIEMOPSHIFTDBLSIZES': return 'PFNIEMAIMPLSHIFTDBLU' + sMember[offBits:]; 264 275 if sBaseType == 'PCIEMOPMULDIVSIZES': return 'PFNIEMAIMPLMULDIVU' + sMember[offBits:]; … … 273 284 self.raiseProblem('Unknown call reference: %s' % (sFnRef,)); 274 285 return None; # Shut up pylint 2.16.2. 286 287 def analyze8BitGRegStmt(self, oStmt): 288 """ 289 Gets the 8-bit general purpose register access details of the given statement. 290 ASSUMES the statement is one accessing an 8-bit GREG. 291 """ 292 idxReg = 0; 293 if ( oStmt.sName.find('_STORE_') > 0 294 or oStmt.sName.find('_REF_') > 0 295 or oStmt.sName.find('_TO_LOCAL') > 0): 296 idxReg = 1; 297 298 sRegRef = oStmt.asParams[idxReg]; 299 sOrgExpr = '((%s) < 4 || (pVCpu->iem.s.fPrefixes & IEM_OP_PRF_REX) ? (%s) : (%s) | 16)' % (sRegRef, sRegRef, sRegRef); 300 301 if sRegRef.find('IEM_GET_MODRM_RM') > 0: sStdRef = 'bRmRm8Ex'; 302 elif sRegRef.find('IEM_GET_MODRM_REG') > 0: sStdRef = 'bRmReg8Ex'; 303 else: sStdRef = 'bOther8Ex'; 304 305 return (idxReg, sOrgExpr, sStdRef); 306 275 307 276 308 def analyzeMorphStmtForThreaded(self, aoStmts, iParamRef = 0): … … 312 344 #print('iCurRef=%s iParam=%s sOrgRef=%s' % (iCurRef, oCurRef.iParam, oCurRef.sOrgRef)); 313 345 sSrcParam = oNewStmt.asParams[oCurRef.iParam]; 314 assert sSrcParam[oCurRef.offParam : oCurRef.offParam + len(oCurRef.sOrgRef)] == oCurRef.sOrgRef, \ 346 assert ( sSrcParam[oCurRef.offParam : oCurRef.offParam + len(oCurRef.sOrgRef)] == oCurRef.sOrgRef 347 or oCurRef.fCustomRef), \ 315 348 'offParam=%s sOrgRef=%s sSrcParam=%s<eos>' % (oCurRef.offParam, oCurRef.sOrgRef, sSrcParam); 316 349 oNewStmt.asParams[oCurRef.iParam] = sSrcParam[0 : oCurRef.offParam] \ … … 345 378 oNewStmt.sName += '_THREADED'; 346 379 380 # ... and IEM_MC_*_GREG_U8 into *_THREADED w/ reworked index taking REX into account 381 elif oNewStmt.sName.startswith('IEM_MC_') and oNewStmt.sName.find('_GREG_U8') > 0: 382 (idxReg, sOrgRef, sStdRef) = self.analyze8BitGRegStmt(oNewStmt); 383 oNewStmt.asParams[idxReg] = self.dParamRefs[sStdRef][0].sNewName; 384 oNewStmt.sName += '_THREADED'; 385 347 386 # ... and IEM_MC_CALL_CIMPL_[0-5] into *_THREADED ... 348 387 elif oNewStmt.sName.startswith('IEM_MC_CALL_CIMPL_'): … … 483 522 self.aoParamRefs.append(ThreadedParamRef('u32Disp', 'uint32_t', oStmt)); 484 523 self.aoParamRefs.append(ThreadedParamRef('cbInstr', 'uint4_t', oStmt)); 524 525 # 8-bit register accesses needs to have their index argument reworked to take REX into account. 526 # ... and IEM_MC_*_GREG_U8 into *_THREADED w/ reworked index taking REX into account 527 if oStmt.sName.startswith('IEM_MC_') and oStmt.sName.find('_GREG_U8') > 0: 528 (idxReg, sOrgRef, sStdRef) = self.analyze8BitGRegStmt(oStmt); 529 self.aoParamRefs.append(ThreadedParamRef(sOrgRef, 'uint4_t', oStmt, idxReg, sStdRef = sStdRef)); 485 530 486 531 # Inspect the target of calls to see if we need to pass down a
Note:
See TracChangeset
for help on using the changeset viewer.