VirtualBox

Changeset 98951 in vbox


Ignore:
Timestamp:
Mar 14, 2023 10:34:58 AM (19 months ago)
Author:
vboxsync
Message:

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

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/Makefile.kmk

    r98873 r98951  
    248248 VBoxVMM_SOURCES += \
    249249        VMMAll/IEMAllInstructionsThreadedRecompiler.cpp \
    250         $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp
     250        VMMAll/IEMThreadedFunctions.cpp
    251251endif
    252252
     
    400400        $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.h.ts \
    401401        $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.h \
    402         $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp \
     402        $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.h \
    403403        $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedInstructions.cpp.h
    404404 $(call KB_FN_AUTO_CMD_DEPS,$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.h.ts)
    405405 $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.h.ts \
    406406 +| $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.h \
    407  +| $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp \
     407 +| $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.h \
    408408 +| $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedInstructions.cpp.h: \
    409409                $(PATH_SUB_CURRENT)/VMMAll/IEMAllThreadedPython.py \
     
    422422        $(QUIET)$(RM) -f -- \
    423423                "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedInstructions.cpp.h.ts" \
    424                 "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.ts" \
     424                "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.h.ts" \
    425425                "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.h.ts"
    426426        $(QUIET)$(MKDIR) -p -- "$(dir $@)"
     
    428428        $(REDIRECT) -0 /dev/null -- $(VBOX_BLD_PYTHON) $< $(filter %.cpp.h,$^) \
    429429        --out-funcs-hdr "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.h.ts" \
    430         --out-funcs-cpp "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.ts" \
     430        --out-funcs-cpp "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.h.ts" \
    431431        --out-mod-input "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedInstructions.cpp.h.ts"
    432432        $(QUIET)$(CP) -v -f --changed -- \
     
    434434                "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedInstructions.cpp.h"
    435435        $(QUIET)$(CP) -v -f --changed -- \
    436                 "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.ts" \
    437                 "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp"
     436                "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.h.ts" \
     437                "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.h"
    438438        $(QUIET)$(CP) -v -f --changed -- \
    439439                "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.h.ts" \
     
    441441        $(QUIET)$(RM) -f -- \
    442442                "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedInstructions.cpp.h.ts" \
    443                 "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.ts"
     443                "$(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.cpp.h.ts"
    444444
    445445 foobared: $(VBoxVMM_0_OUTDIR)/CommonGenIncs/IEMThreadedFunctions.h.ts
  • 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.

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