VirtualBox

Ignore:
Timestamp:
Jun 23, 2013 7:45:11 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86672
Message:

REX.B rip encoding (half of them, anyways).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py

    r46744 r46746  
    102102g_asGRegs16     = ('ax',  'cx',  'dx',  'bx',  'sp',  'bp',  'si',  'di',
    103103                   'r8w', 'r9w', 'r10w', 'r11w', 'r12w', 'r13w', 'r14w', 'r15w');
    104 g_asGRegs8      = ('al',  'cl',  'dl',  'bl',  'ah',  'ah',  'dh',  'bh');
     104g_asGRegs8      = ('al',  'cl',  'dl',  'bl',  'ah',  'ch',  'dh',  'bh');
    105105g_asGRegs8Rex   = ('al',  'cl',  'dl',  'bl',  'spl', 'bpl', 'sil',  'dil',
    106106                   'r8b', 'r9b', 'r10b', 'r11b', 'r12b', 'r13b', 'r14b', 'r15b');
     
    146146    bRex = bOtherRexPrefixes;
    147147    if iReg >= 8:
    148         bRex = bRex | X86_OP_REX_R;
     148        bRex |= X86_OP_REX_R;
    149149    if iRm >= 8:
    150         bRex = bRex | X86_OP_REX_B;
     150        bRex |= X86_OP_REX_B;
    151151    if bRex == 0:
    152152        return [];
     
    364364
    365365
    366 
    367366class InstrTest_MemOrGreg_2_Greg(InstrTestBase):
    368367    """
     
    374373        InstrTestBase.__init__(self, sName, sInstr);
    375374        self.fnCalcResult = fnCalcResult;
    376         self.acbOpVars = [ 1, 2, 4, 8 ] if not acbOpVars else list(acbOpVars);
     375        self.acbOpVars    = [ 1, 2, 4, 8 ] if not acbOpVars else list(acbOpVars);
    377376
    378377    def writeInstrGregGreg(self, cbEffOp, iOp1, iOp2, oGen):
     
    390389        return True;
    391390
     391
    392392    def writeInstrGregPureRM(self, cbEffOp, iOp1, cAddrBits, iOp2, iMod, offDisp, oGen):
    393393        """ Writes the instruction with two general registers as operands. """
    394         if cbEffOp == 8:
     394        if iOp2 == 13 and iMod == 0 and cAddrBits == 64: # Alt rip encoding, yasm isn't helping, do what we can.
     395            if cbEffOp == 2:
     396                oGen.write('        db %#04x\n' % (X86_OP_PRF_SIZE_OP,));
     397            bRex = X86_OP_REX_B;
     398            if iOp1 >= 8:
     399                bRex |= X86_OP_REX_R;
     400            if cbEffOp == 8:
     401                bRex |= X86_OP_REX_W;
     402            oGen.write('        db %#04x\n' % (bRex,));
     403            if cbEffOp == 1:
     404                oGen.write('        %s %s, [' % (self.sInstr, g_asGRegs8[iOp1 & 0x7],));
     405            else:
     406                oGen.write('        %s %s, [' % (self.sInstr, g_asGRegs32[iOp1 & 0x7],));
     407        elif cbEffOp == 8:
    395408            oGen.write('        %s %s, [' % (self.sInstr, g_asGRegs64[iOp1],));
    396409        elif cbEffOp == 4:
     
    446459                       % (oGen.needGRegMemSetup(cAddrBits, cbEffOp, iOp2, offDisp),));
    447460        else:
    448             ## @todo generate REX.B=1 variant.
    449461            oGen.write('        call    VBINSTST_NAME(Common_SetupMemReadU%u)\n' % (cbEffOp*8,));
    450462        oGen.write('        push    %s\n' % (oGen.oTarget.asGRegs[iOp2],));
     
    501513
    502514        # Register tests
    503         if False:
     515        if True:
    504516            for cbEffOp in self.acbOpVars:
    505517                if cbEffOp > cbMaxOp:
     
    518530
    519531        # Memory test.
    520         for cbEffOp in self.acbOpVars:
    521             if cbEffOp > cbMaxOp:
    522                 continue;
    523             for iOp1 in oOp1MemRange:
    524                 if oGen.oTarget.asGRegsNoSp[iOp1] is None:
     532        if True:
     533            for cbEffOp in self.acbOpVars:
     534                if cbEffOp > cbMaxOp:
    525535                    continue;
    526                 for cAddrBits in oGen.oTarget.getAddrModes():
    527                     for iOp2 in range(len(oGen.oTarget.asGRegs)):
    528                         if iOp2 != 4:
    529 
    530                             for uInput in (auLongInputs if iOp1 == iLongOp1 and False else auShortInputs):
    531                                 oGen.newSubTest();
    532                                 if iOp1 == iOp2 and iOp2 != 5 and iOp2 != 13 and cbEffOp != cbMaxOp:
    533                                     continue; # Don't know the high bit of the address ending up the result - skip it.
    534                                 uResult = self.fnCalcResult(cbEffOp, uInput, oGen.auRegValues[iOp1], oGen);
    535                                 self.generateOneStdTestGregMemNoSib(oGen, cAddrBits, cbEffOp, cbMaxOp,
    536                                                                     iOp1, iOp2, uInput, uResult);
    537                         else:
    538                             pass; # SIB
     536                for iOp1 in oOp1MemRange:
     537                    if oGen.oTarget.asGRegsNoSp[iOp1] is None:
     538                        continue;
     539                    for cAddrBits in oGen.oTarget.getAddrModes():
     540                        for iOp2 in range(len(oGen.oTarget.asGRegs)):
     541                            if iOp2 != 4:
     542
     543                                for uInput in (auLongInputs if iOp1 == iLongOp1 and False else auShortInputs):
     544                                    oGen.newSubTest();
     545                                    if iOp1 == iOp2 and iOp2 != 5 and iOp2 != 13 and cbEffOp != cbMaxOp:
     546                                        continue; # Don't know the high bit of the address ending up the result - skip it.
     547                                    uResult = self.fnCalcResult(cbEffOp, uInput, oGen.auRegValues[iOp1], oGen);
     548                                    self.generateOneStdTestGregMemNoSib(oGen, cAddrBits, cbEffOp, cbMaxOp,
     549                                                                        iOp1, iOp2, uInput, uResult);
     550                            else:
     551                                pass; # SIB
    539552
    540553        return True;
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