VirtualBox

Changeset 98951 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Mar 14, 2023 10:34:58 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156300
Message:

VMM/IEM: More work on processing MC blocks and generating functions from them. bugref:10369

Location:
trunk/src/VBox/VMM/VMMAll
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllThreadedPython.py

    r98948 r98951  
    5252
    5353g_kdTypeInfo = {
    54     # type name:    (cBits, fSigned,)
    55     'int8_t':       (    8,    True, ),
    56     'int16_t':      (   16,    True, ),
    57     'int32_t':      (   32,    True, ),
    58     'int64_t':      (   64,    True, ),
    59     'uint8_t':      (    8,   False, ),
    60     'uint16_t':     (   16,   False, ),
    61     'uint32_t':     (   32,   False, ),
    62     'uint64_t':     (   64,   False, ),
    63     'uintptr_t':    (   64,   False, ), # ASSUMES 64-bit host pointer size.
    64     'bool':         (    1,   False, ),
    65     'IEMMODE':      (    2,   False, ),
     54    # type name:    (cBits, fSigned, C-type       )
     55    'int8_t':       (    8,    True, 'uint8_t',   ),
     56    'int16_t':      (   16,    True, 'int16_t',   ),
     57    'int32_t':      (   32,    True, 'int32_t',   ),
     58    'int64_t':      (   64,    True, 'int64_t',   ),
     59    'uint4_t':      (    4,   False, 'uint8_t',   ),
     60    'uint8_t':      (    8,   False, 'uint8_t',   ),
     61    'uint16_t':     (   16,   False, 'uint16_t',  ),
     62    'uint32_t':     (   32,   False, 'uint32_t',  ),
     63    'uint64_t':     (   64,   False, 'uint64_t',  ),
     64    'uintptr_t':    (   64,   False, 'uintptr_t', ), # ASSUMES 64-bit host pointer size.
     65    'bool':         (    1,   False, 'bool',      ),
     66    'IEMMODE':      (    2,   False, 'IEMMODE',   ),
    6667};
    6768
     
    99100    """
    100101
    101     def __init__(self, sOrgRef, sType, oStmt, iParam, offParam = 0):
     102    def __init__(self, sOrgRef, sType, oStmt, iParam = None, offParam = 0):
    102103        self.sOrgRef  = sOrgRef;                    ##< The name / reference in the original code.
    103104        self.sStdRef  = ''.join(sOrgRef.split());   ##< Normalized name to deal with spaces in macro invocations and such.
    104105        self.sType    = sType;                      ##< The type (typically derived).
    105106        self.oStmt    = oStmt;                      ##< The statement making the reference.
    106         self.iParam   = iParam;                     ##< The parameter containing the references.
     107        self.iParam   = iParam;                     ##< The parameter containing the references. None if implicit.
    107108        self.offParam = offParam;                   ##< The offset in the parameter of the reference.
    108109
     
    234235                    for iCurRef in range(iParamRef - 1, iParamRefFirst - 1, -1):
    235236                        oCurRef = self.aoParamRefs[iCurRef];
    236                         assert oCurRef.oStmt == oStmt;
    237                         #print('iCurRef=%s iParam=%s sOrgRef=%s' % (iCurRef, oCurRef.iParam, oCurRef.sOrgRef));
    238                         sSrcParam = oNewStmt.asParams[oCurRef.iParam];
    239                         assert sSrcParam[oCurRef.offParam : oCurRef.offParam + len(oCurRef.sOrgRef)] == oCurRef.sOrgRef, \
    240                                'offParam=%s sOrgRef=%s sSrcParam=%s<eos>' % (oCurRef.offParam, oCurRef.sOrgRef, sSrcParam);
    241                         oNewStmt.asParams[oCurRef.iParam] = sSrcParam[0 : oCurRef.offParam] \
    242                                                           + oCurRef.sNewName \
    243                                                           + sSrcParam[oCurRef.offParam + len(oCurRef.sOrgRef) : ];
     237                        if oCurRef.iParam is not None:
     238                            assert oCurRef.oStmt == oStmt;
     239                            #print('iCurRef=%s iParam=%s sOrgRef=%s' % (iCurRef, oCurRef.iParam, oCurRef.sOrgRef));
     240                            sSrcParam = oNewStmt.asParams[oCurRef.iParam];
     241                            assert sSrcParam[oCurRef.offParam : oCurRef.offParam + len(oCurRef.sOrgRef)] == oCurRef.sOrgRef, \
     242                                   'offParam=%s sOrgRef=%s sSrcParam=%s<eos>' % (oCurRef.offParam, oCurRef.sOrgRef, sSrcParam);
     243                            oNewStmt.asParams[oCurRef.iParam] = sSrcParam[0 : oCurRef.offParam] \
     244                                                              + oCurRef.sNewName \
     245                                                              + sSrcParam[oCurRef.offParam + len(oCurRef.sOrgRef) : ];
    244246
    245247                # Process branches of conditionals recursively.
     
    338340            if isinstance(oStmt, (iai.McStmtVar, iai.McCppPreProc)):
    339341                continue;
     342            if oStmt.isCppStmt() and oStmt.fDecode:
     343                continue;
     344
     345            # Several statements have implicit parameters.
     346            if oStmt.sName in ('IEM_MC_ADVANCE_RIP_AND_FINISH', 'IEM_MC_REL_JMP_S8_AND_FINISH', 'IEM_MC_REL_JMP_S16_AND_FINISH',
     347                               'IEM_MC_REL_JMP_S32_AND_FINISH', 'IEM_MC_CALL_CIMPL_0', 'IEM_MC_CALL_CIMPL_1',
     348                               'IEM_MC_CALL_CIMPL_2', 'IEM_MC_CALL_CIMPL_3', 'IEM_MC_CALL_CIMPL_4', 'IEM_MC_CALL_CIMPL_5'):
     349                self.aoParamRefs.append(ThreadedParamRef('cbInstr', 'uint4_t', oStmt));
     350
     351            # We can skip the rest for statements w/o parameters.
    340352            if not oStmt.asParams:
    341                 continue;
    342             if oStmt.isCppStmt() and oStmt.fDecode:
    343353                continue;
    344354
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette