Changeset 46744 in vbox for trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
- Timestamp:
- Jun 23, 2013 5:54:29 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
r46733 r46744 45 45 """ 64-bit one bit mask. """ 46 46 return 1 << iBit; 47 ## @}48 49 50 ## @name Misc51 ## @{52 53 def convU32ToSigned(u32):54 """ Converts a 32-bit unsigned value to 32-bit signed. """55 if u32 < 0x80000000:56 return u32;57 return u32 - UINT32_MAX - 1;58 59 47 ## @} 60 48 … … 114 102 g_asGRegs16 = ('ax', 'cx', 'dx', 'bx', 'sp', 'bp', 'si', 'di', 115 103 'r8w', 'r9w', 'r10w', 'r11w', 'r12w', 'r13w', 'r14w', 'r15w'); 116 g_asGRegs8 _86= ('al', 'cl', 'dl', 'bl', 'ah', 'ah', 'dh', 'bh');117 g_asGRegs8 _64 = ('al', 'cl', 'dl', 'bl', 'spl', 'bpl', 'sil', 'dil', # pylint: disable=C0103104 g_asGRegs8 = ('al', 'cl', 'dl', 'bl', 'ah', 'ah', 'dh', 'bh'); 105 g_asGRegs8Rex = ('al', 'cl', 'dl', 'bl', 'spl', 'bpl', 'sil', 'dil', 118 106 'r8b', 'r9b', 'r10b', 'r11b', 'r12b', 'r13b', 'r14b', 'r15b'); 119 107 ## @} … … 174 162 | (iRm & X86_MODRM_RM_MASK); 175 163 return [bRm,]; 164 165 ## @} 166 167 168 ## @name Misc 169 ## @{ 170 171 def convU32ToSigned(u32): 172 """ Converts a 32-bit unsigned value to 32-bit signed. """ 173 if u32 < 0x80000000: 174 return u32; 175 return u32 - UINT32_MAX - 1; 176 177 def gregName(iReg, cBits, fRexByteRegs = True): 178 """ Gets the name of a general register by index and width. """ 179 if cBits == 64: 180 return g_asGRegs64[iReg]; 181 if cBits == 32: 182 return g_asGRegs32[iReg]; 183 if cBits == 16: 184 return g_asGRegs16[iReg]; 185 assert cBits == 8; 186 if fRexByteRegs: 187 return g_asGRegs8Rex[iReg]; 188 return g_asGRegs8[iReg]; 176 189 177 190 ## @} … … 268 281 if self.sInstrSet == self.ksInstrSet_32: 269 282 return [32, 16]; 270 return [64, 64];283 return [64, 32]; 271 284 272 285 … … 372 385 oGen.write(' %s %s, %s\n' % (self.sInstr, g_asGRegs16[iOp1], g_asGRegs16[iOp2])); 373 386 elif cbEffOp == 1: 374 oGen.write(' %s %s, %s\n' % (self.sInstr, g_asGRegs8 _64[iOp1], g_asGRegs8_64[iOp2]));387 oGen.write(' %s %s, %s\n' % (self.sInstr, g_asGRegs8Rex[iOp1], g_asGRegs8Rex[iOp2])); 375 388 else: 376 389 assert False; … … 386 399 oGen.write(' %s %s, [' % (self.sInstr, g_asGRegs16[iOp1],)); 387 400 elif cbEffOp == 1: 388 oGen.write(' %s %s, [' % (self.sInstr, g_asGRegs8 _64[iOp1],));401 oGen.write(' %s %s, [' % (self.sInstr, g_asGRegs8Rex[iOp1],)); 389 402 else: 390 403 assert False; … … 524 537 else: 525 538 pass; # SIB 526 break; ## remove me!527 #break; ## remove me!528 #break; ## remove me!529 539 530 540 return True; … … 696 706 Records the need for a given register checker function, returning its label. 697 707 """ 698 sName = '%ubit_U%u_%s' % (cAddrBits, cbEffOp * 8, self.oTarget.asGRegs[iReg1]);708 sName = '%ubit_U%u_%s' % (cAddrBits, cbEffOp * 8, gregName(iReg1, cAddrBits),); 699 709 if offDisp is not None: 700 710 sName += '_%#010x' % (offDisp & UINT32_MAX, ); … … 847 857 elif cAddrBits == 32: asAddrGRegs = g_asGRegs32; 848 858 else: asAddrGRegs = g_asGRegs16; 849 iBaseReg = asAddrGRegs.index(sBaseReg); 859 try: 860 iBaseReg = asAddrGRegs.index(sBaseReg); 861 except ValueError: 862 assert False, 'sBaseReg=%s' % (sBaseReg,); 863 raise; 850 864 851 865 i = 3; … … 891 905 else: 892 906 assert cEffOpBits == 8; 893 sTmpReg1 = g_asGRegs8 _64[iTmpReg1];907 sTmpReg1 = g_asGRegs8Rex[iTmpReg1]; 894 908 sDataVar = 'VBINSTST_NAME(g_u8Data)'; 895 909
Note:
See TracChangeset
for help on using the changeset viewer.