VirtualBox

Ignore:
Timestamp:
Nov 3, 2023 12:36:45 AM (13 months ago)
Author:
vboxsync
Message:

VMM/IEM: Identify the different styles IEM_MC_CALL_XXX and mark these using new IEM_CIMPL_F_CALLS_XXX flags in the python scripts. This is necessary as IEM_MC_CALL_CIMPL_X, IEM_MC_CALL_FPU_AIMPL_X, IEM_MC_CALL_MMX_AIMPL_X, and IEM_MC_CALL_SSE_AIMPL_X all have hidden parameters that need to be accounted for when recompiling to native code (for more perfect register allocations for variables). Split up the different cmpxchg16b AIMPL/CIMPL variations into separate MC blocks, as we can't mix AIMPL and CIMPL calls in the same block (also, in the CIMPL case, there would be unused tail code after the call). bugref:10371

File:
1 edited

Legend:

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

    r101694 r101722  
    19731973    'IEM_CIMPL_F_XCPT':                 ('IEM_CIMPL_F_BRANCH_INDIRECT', 'IEM_CIMPL_F_BRANCH_FAR',
    19741974                                         'IEM_CIMPL_F_MODE', 'IEM_CIMPL_F_RFLAGS', 'IEM_CIMPL_F_VMEXIT', ),
     1975    'IEM_CIMPL_F_CALLS_CIMPL':              (),
     1976    'IEM_CIMPL_F_CALLS_AIMPL':              (),
     1977    'IEM_CIMPL_F_CALLS_AIMPL_WITH_FXSTATE': (),
    19751978};
    19761979class McBlock(object):
     
    19781981    Microcode block (IEM_MC_BEGIN ... IEM_MC_END, IEM_MC_DEFER_TO_CIMPL_x_RET).
    19791982    """
     1983
     1984    ## @name Macro expansion types.
     1985    ## @{
     1986    kMacroExp_None    = 0;
     1987    kMacroExp_Entire  = 1; ##< Entire block (iBeginLine == iEndLine), original line may contain multiple blocks.
     1988    kMacroExp_Partial = 2; ##< Partial/mixed (cmpxchg16b), safe to assume single block.
     1989    ## @}
    19801990
    19811991    def __init__(self, sSrcFile, iBeginLine, offBeginLine, oFunction, iInFunction, cchIndent = None):
     
    20012011        ##< The raw lines the block is made up of.
    20022012        self.asLines      = []              # type: List[str]
     2013        ## Indicates whether the block includes macro expansion parts (kMacroExp_None,
     2014        ## kMacroExp_Entrie, kMacroExp_Partial).
     2015        self.iMacroExp    = self.kMacroExp_None;
    20032016        ## IEM_MC_BEGIN: Argument count.
    20042017        self.cArgs        = -1;
     
    48704883
    48714884        #
    4872         # HACK ALERT! For blocks orginating from macro expansion the start and
     4885        # HACK ALERT! For blocks originating from macro expansion the start and
    48734886        #             end line will be the same, but the line has multiple
    48744887        #             newlines inside it.  So, we have to do some extra tricks
     
    48804893            if not asLines[0].strip().startswith('IEM_MC_BEGIN'):
    48814894                self.raiseError('IEM_MC_BEGIN is not the first word on the line');
     4895
     4896            # Hack alert! Detect mixed tail/head macros a la cmpxchg16b and split up the lines
     4897            #             so we can deal correctly with IEM_MC_END below and everything else.
     4898            for sLine in asLines:
     4899                cNewLines = sLine.count('\n');
     4900                assert cNewLines > 0;
     4901                if cNewLines > 1:
     4902                    asLines = self.extractLinesFromMacroExpansionLine(''.join(asLines),
     4903                                                                      self.oCurMcBlock.offBeginLine,
     4904                                                                        offEndStatementInLine
     4905                                                                      + sum(len(s) for s in asLines)
     4906                                                                      - len(asLines[-1]));
     4907                    self.oCurMcBlock.iMacroExp = McBlock.kMacroExp_Partial;
     4908                    break;
    48824909        else:
     4910            self.oCurMcBlock.iMacroExp = McBlock.kMacroExp_Entire;
    48834911            asLines = self.extractLinesFromMacroExpansionLine(self.asLines[self.iLine - 1],
    48844912                                                              self.oCurMcBlock.offBeginLine, offEndStatementInLine);
     
    52075235        # nested macro expansion, just to avoid lots of extra work.
    52085236        #
     5237        # There is only limited support for macros expanding to partial MC blocks.
     5238        #
    52095239        # Note! IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX and other macros someone making
    52105240        #       use of IEMOP_RAISE_INVALID_LOCK_PREFIX_RET() will be ignored here and
     
    52145244        #       Also, this way we don't produce lots of unnecessary threaded functions.
    52155245        #
    5216         if sBody.find("IEM_MC_BEGIN") < 0:
     5246        if sBody.find("IEM_MC_BEGIN") < 0 and sBody.find("IEM_MC_END") < 0:
    52175247            #self.debug('workerPreProcessDefine: irrelevant (%s: %s)' % (sName, sBody));
    52185248            return True;
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