- Timestamp:
- Jul 20, 2013 4:08:07 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
r47139 r47286 496 496 fRexByteRegs = oGen.oTarget.is64Bit(); 497 497 oGen.write(' %s %s, %s\n' 498 % ( self.sInstr, gregName(iOp1, cbEffOp * 8, fRexByteRegs), gregName(iOp2, cbEffOp * 8, fRexByteRegs),));498 % ( self.sInstr, oGen.gregNameBytes(iOp1, cbEffOp), oGen.gregNameBytes(iOp2, cbEffOp),)); 499 499 return True; 500 500 … … 504 504 if iOp2 == 13 and iMod == 0 and cAddrBits == 64: 505 505 oGen.write('altrexb '); # Alternative encoding for rip relative addressing. 506 if cbEffOp == 8: 507 oGen.write('%s %s, [' % (self.sInstr, g_asGRegs64[iOp1],)); 508 elif cbEffOp == 4: 509 oGen.write('%s %s, [' % (self.sInstr, g_asGRegs32[iOp1],)); 510 elif cbEffOp == 2: 511 oGen.write('%s %s, [' % (self.sInstr, g_asGRegs16[iOp1],)); 512 elif cbEffOp == 1: 513 oGen.write('%s %s, [' % (self.sInstr, g_asGRegs8Rex[iOp1],)); 514 else: 515 assert False; 516 506 oGen.write('%s %s, [' % (self.sInstr, oGen.gregNameBytes(iOp1, cbEffOp),)); 517 507 if (iOp2 == 5 or iOp2 == 13) and iMod == 0: 518 508 oGen.write('VBINSTST_NAME(g_u%sData)' % (cbEffOp * 8,)) … … 547 537 ## @todo Enable testing this in environments where we can make assumptions (boot sector). 548 538 oGen.write(' %s %s, [VBINSTST_NAME(g_u%sData) xWrtRIP]\n' 549 % ( self.sInstr, gregName(iOp1, cbEffOp * 8), cbEffOp * 8,));539 % ( self.sInstr, oGen.gregNameBytes(iOp1, cbEffOp), cbEffOp * 8,)); 550 540 else: 551 oGen.write(' altsibx%u %s %s, [VBINSTST_NAME(g_u%sData) xWrtRIP] \n'552 % ( iScale, self.sInstr, gregName(iOp1, cbEffOp * 8), cbEffOp * 8,));541 oGen.write(' altsibx%u %s %s, [VBINSTST_NAME(g_u%sData) xWrtRIP] ; iOp1=%s cbEffOp=%s\n' 542 % ( iScale, self.sInstr, oGen.gregNameBytes(iOp1, cbEffOp), cbEffOp * 8, iOp1, cbEffOp)); 553 543 return True; 554 544 … … 559 549 # necessity for iScale=1, but doesn't hurt for the rest. 560 550 oGen.write(' altsibx%u %s %s, [%s * %#x' 561 % (iScale, self.sInstr, gregName(iOp1, cbEffOp * 8), gregName(iIndexReg, cAddrBits), iScale,));551 % (iScale, self.sInstr, oGen.gregNameBytes(iOp1, cbEffOp), oGen.gregNameBits(iIndexReg, cAddrBits), iScale,)); 562 552 if offDisp is not None: 563 553 oGen.write(' + %#x' % (offDisp,)); … … 569 559 """ Writes the instruction taking a register and base only (with reg), SIB form. """ 570 560 oGen.write(' altsibx%u %s %s, [%s' 571 % (iScale, self.sInstr, gregName(iOp1, cbEffOp * 8), gregName(iBaseReg, cAddrBits),));561 % (iScale, self.sInstr, oGen.gregNameBytes(iOp1, cbEffOp), oGen.gregNameBits(iBaseReg, cAddrBits),)); 572 562 if offDisp is not None: 573 563 oGen.write(' + %#x' % (offDisp,)); … … 584 574 # which is index and which is base. 585 575 oGen.write(' %s %s, [%s + %s * %u' 586 % ( self.sInstr, gregName(iOp1, cbEffOp * 8),587 gregName(iBaseReg, cAddrBits), gregName(iIndexReg, cAddrBits), iScale,));576 % ( self.sInstr, oGen.gregNameBytes(iOp1, cbEffOp), 577 oGen.gregNameBits(iBaseReg, cAddrBits), oGen.gregNameBits(iIndexReg, cAddrBits), iScale,)); 588 578 if offDisp is not None: 589 579 oGen.write(' + %#x' % (offDisp,)); … … 1326 1316 # 1327 1317 g_aoInstructionTests = [ 1328 #InstrTest_Mov_Gv_Ev(),1318 InstrTest_Mov_Gv_Ev(), 1329 1319 ##InstrTest_MovSxD_Gv_Ev(), 1330 1320 InstrTest_DivIDiv(fIsIDiv = False), … … 1756 1746 while iTmpReg2 in [iBaseReg, iIndexReg, iTmpReg1]: 1757 1747 iTmpReg2 += 1; 1758 sTmpReg2 = gregName(iTmpReg2, cAddrBits);1748 sTmpReg2 = self.gregNameBits(iTmpReg2, cAddrBits); 1759 1749 self.write(' push sAX\n' 1760 1750 ' push %s\n' … … 1766 1756 self.write(' mov %s, [VBINSTST_NAME(g_pvLow32Mem4K) xWrtRIP]\n' % (sTmpReg2,)); 1767 1757 self.write(' add %s, 0x200\n' % (sTmpReg2,)); 1768 self.write(' mov %s, %s\n' % ( gregName(X86_GREG_xAX, cAddrBits), sTmpReg2,));1758 self.write(' mov %s, %s\n' % (self.gregNameBits(X86_GREG_xAX, cAddrBits), sTmpReg2,)); 1769 1759 if u32Disp is not None: 1770 self.write(' sub %s, %d\n' % ( gregName(X86_GREG_xAX, cAddrBits), convU32ToSigned(u32Disp), )); 1760 self.write(' sub %s, %d\n' 1761 % ( self.gregNameBits(X86_GREG_xAX, cAddrBits), convU32ToSigned(u32Disp), )); 1771 1762 self.write(' xor edx, edx\n' 1772 1763 '%if xCB == 2\n' … … 1775 1766 self.write(' push %u\n' % (iScale + 1,)); 1776 1767 self.write(' div %s [xSP]\n' % ('qword' if cAddrBits == 64 else 'dword',)); 1777 self.write(' sub %s, %s\n' % (sTmpReg2, gregName(X86_GREG_xDX, cAddrBits),));1768 self.write(' sub %s, %s\n' % (sTmpReg2, self.gregNameBits(X86_GREG_xDX, cAddrBits),)); 1778 1769 self.write(' pop sDX\n' 1779 1770 ' pop sDX\n'); # sTmpReg2 is eff address; sAX is sIndexReg value. … … 1785 1776 self.write(' pop %s\n' % (self.oTarget.asGRegs[iTmpReg1],)); 1786 1777 else: 1787 self.write(' mov %s, %s\n' % (sBaseReg, gregName(X86_GREG_xAX, cAddrBits),));1778 self.write(' mov %s, %s\n' % (sBaseReg, self.gregNameBits(X86_GREG_xAX, cAddrBits),)); 1788 1779 self.write(' pop sAX\n'); 1789 1780
Note:
See TracChangeset
for help on using the changeset viewer.