- Timestamp:
- Jun 14, 2013 11:32:24 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asmdefs.mac
r46548 r46550 138 138 %define IMP2(name) dword [IMPNAME(name)] 139 139 %endif 140 %elifdef ASM_FORMAT_ELF 141 %ifdef RT_ARCH_AMD64 142 %define IMP2(name) qword [rel IMPNAME(name) wrt ..got] 143 %else 144 %define IMP2(name) IMPNAME(name) wrt ..plt 145 %endif 146 %elifdef ASM_FORMAT_MACHO 147 %ifdef RT_ARCH_AMD64 148 %define IMP2(name) qword [IMPNAME(name) wrt rip] 149 %else 150 %define IMP2(name) IMPNAME(name) 151 %endif 140 152 %else 141 153 %ifdef RT_ARCH_AMD64 -
trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
r46543 r46550 103 103 'r8w', 'r9w', 'r10w', 'r11w', 'r12w', 'r13w', 'r14w', 'r15w'); 104 104 g_asGRegs8 = ('al', 'cl', 'dl', 'bl', 'ah', 'ah', 'dh', 'bh'); 105 g_asGRegs8_64 = ('al', 'cl', 'dl', 'bl', 'spl', 'bpl', 'sil', 'dil', 105 g_asGRegs8_64 = ('al', 'cl', 'dl', 'bl', 'spl', 'bpl', 'sil', 'dil', # pylint: disable=C0103 106 106 'r8b', 'r9b', 'r10b', 'r11b', 'r12b', 'r13b', 'r14b', 'r15b'); 107 107 ## @} … … 250 250 self.sInstr = sInstr if sInstr else sName.split()[0]; 251 251 252 def isApplicable(self, oGen): 253 """ 254 Tests if the instruction test is applicable to the selected environment. 255 """ 256 _ = oGen; 257 return True; 252 258 253 259 def generateTest(self, oGen, sTestFnName): 254 """ Emits the test assembly code. """ 260 """ 261 Emits the test assembly code. 262 """ 255 263 oGen.write(';; @todo not implemented. This is for the linter: %s, %s\n' % (oGen, sTestFnName)); 256 264 return True; … … 302 310 return True; 303 311 312 def generateOneStdTest(self, oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult): 313 """ Generate one standard test. """ 314 oGen.write(' call VBINSTST_NAME(Common_LoadKnownValues)\n'); 315 oGen.write(' mov %s, 0x%x\n' % (oGen.oTarget.asGRegs[iOp2], uInput,)); 316 oGen.write(' push %s\n' % (oGen.oTarget.asGRegs[iOp2],)); 317 self.writeInstrGregGreg(cbEffOp, iOp1, iOp2, oGen); 318 oGen.pushConst(uResult, cbMaxOp); 319 oGen.write(' call VBINSTST_NAME(%s)\n' % (oGen.needGRegChecker(iOp1, iOp2),)); 320 return True; 321 304 322 def generateStandardTests(self, oGen): 305 323 """ Generate standard tests. """ … … 311 329 312 330 for cbEffOp in self.acbOpVars: 331 if cbEffOp > cbMaxOp: 332 continue; 313 333 for iOp1 in range(oGen.oTarget.getGRegCount()): 314 334 if oGen.oTarget.asGRegsNoSp[iOp1] is None: … … 318 338 continue; 319 339 for uInput in auInputs: 320 uResult = self.fnCalcResult(cbEffOp, uInput, oGen.au 64Regs[iOp1] if iOp1 != iOp2 else uInput, oGen);340 uResult = self.fnCalcResult(cbEffOp, uInput, oGen.auRegValues[iOp1] if iOp1 != iOp2 else uInput, oGen); 321 341 oGen.newSubTest(); 322 oGen.write(' call VBINSTST_NAME(Common_LoadKnownValues)\n'); 323 oGen.write(' mov %s, 0x%x\n' % (oGen.oTarget.asGRegs[iOp2], uInput,)); 324 oGen.write(' push %s\n' % (oGen.oTarget.asGRegs[iOp2],)); 325 self.writeInstrGregGreg(cbEffOp, iOp1, iOp2, oGen); 326 oGen.pushConst(uResult, cbMaxOp); 327 oGen.write(' call VBINSTST_NAME(%s)\n' % (oGen.needGRegChecker(iOp1, iOp2),)); 342 self.generateOneStdTest(oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult); 343 return True; 328 344 329 345 def generateTest(self, oGen, sTestFnName): … … 362 378 return True; 363 379 380 def isApplicable(self, oGen): 381 return oGen.oTarget.is64Bit(); 382 364 383 @staticmethod 365 384 def calc_movsxd(cbEffOp, uInput, uCur, oGen): … … 403 422 self.au32Regs = [(self.au64Regs[i] & UINT32_MAX) for i in range(8)]; 404 423 self.au16Regs = [(self.au64Regs[i] & UINT16_MAX) for i in range(8)]; 424 self.auRegValues = self.au64Regs if self.oTarget.is64Bit() else self.au32Regs; 405 425 406 426 # Declare state variables used while generating. … … 688 708 for iInstrTest in range(iInstrTestStart, iInstrTestEnd): 689 709 oInstrTest = g_aoInstructionTests[iInstrTest]; 690 self.write('%%ifdef ASM_CALL64_GCC\n' 691 ' lea rdi, [.szInstr%03u wrt rip]\n' 692 '%%elifdef ASM_CALL64_MSC\n' 693 ' lea rcx, [.szInstr%03u wrt rip]\n' 694 '%%else\n' 695 ' mov xAX, .szInstr%03u\n' 696 ' mov [xSP], xAX\n' 697 '%%endif\n' 698 ' VBINSTST_CALL_FN_SUB_TEST\n' 699 ' call VBINSTST_NAME(%s)\n' 700 % ( iInstrTest, iInstrTest, iInstrTest, self._calcTestFunctionName(oInstrTest, iInstrTest))); 710 if oInstrTest.isApplicable(self): 711 self.write('%%ifdef ASM_CALL64_GCC\n' 712 ' lea rdi, [.szInstr%03u wrt rip]\n' 713 '%%elifdef ASM_CALL64_MSC\n' 714 ' lea rcx, [.szInstr%03u wrt rip]\n' 715 '%%else\n' 716 ' mov xAX, .szInstr%03u\n' 717 ' mov [xSP], xAX\n' 718 '%%endif\n' 719 ' VBINSTST_CALL_FN_SUB_TEST\n' 720 ' call VBINSTST_NAME(%s)\n' 721 % ( iInstrTest, iInstrTest, iInstrTest, self._calcTestFunctionName(oInstrTest, iInstrTest))); 701 722 702 723 self.write('\n'
Note:
See TracChangeset
for help on using the changeset viewer.