Changeset 46894 in vbox for trunk/src/VBox/VMM/testcase
- Timestamp:
- Jul 1, 2013 9:36:06 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
r46893 r46894 722 722 return True; 723 723 724 def generateStdTestGregMemSib(self, oGen, cAddrBits, cbEffOp, cbMaxOp, iOp1, auInputs , oBaseRegRange, oIndexRegRange):724 def generateStdTestGregMemSib(self, oGen, cAddrBits, cbEffOp, cbMaxOp, iOp1, auInputs): 725 725 """ Generate all SIB variations for the given iOp1 (reg) value. """ 726 726 assert cAddrBits in [32, 64]; 727 for iBaseReg in oBaseRegRange: 728 for iIndexReg in oIndexRegRange: 729 if iBaseReg == X86_GREG_xSP: # no RSP testing atm. 730 continue; 731 727 for _ in oGen.oSibBaseRange: 728 oGen.iSibBaseReg = (oGen.iSibBaseReg + 1) % oGen.oTarget.getGRegCount(cAddrBits / 8); 729 if oGen.iSibBaseReg == X86_GREG_xSP: # no RSP testing atm. 730 continue; 731 for _ in oGen.oSibIndexRange: 732 oGen.iSibIndexReg = (oGen.iSibIndexReg + 1) % oGen.oTarget.getGRegCount(cAddrBits / 8); 732 733 for iMod in [0, 1, 2]: 733 if iBaseReg == iOp1 and ((iBaseReg != 5 and iBaseReg != 13) or iMod != 0) and cAddrBits != cbMaxOp: 734 if oGen.iSibBaseReg == iOp1 and ((oGen.iSibBaseReg != 5 and oGen.iSibBaseReg != 13) or iMod != 0) \ 735 and cAddrBits != cbMaxOp: 734 736 continue; # Don't know the high bit of the address ending up the result - skip it for now. 735 if iIndexReg == iOp1 and iIndexReg != 4 and cAddrBits != cbMaxOp:737 if oGen.iSibIndexReg == iOp1 and oGen.iSibIndexReg != 4 and cAddrBits != cbMaxOp: 736 738 continue; # Don't know the high bit of the address ending up the result - skip it for now. 737 739 738 for iScale in (1, 2, 4, 8): 740 for _ in oGen.oSibScaleRange: 741 oGen.iSibScale *= 2; 742 if oGen.iSibScale > 8: 743 oGen.iSibScale = 1; 744 739 745 for uInput in auInputs: 740 746 oGen.newSubTest(); 741 747 uResult = self.fnCalcResult(cbEffOp, uInput, oGen.auRegValues[iOp1], oGen); 742 748 self.generateOneStdTestGregMemSib(oGen, cAddrBits, cbEffOp, cbMaxOp, iOp1, iMod, 743 iBaseReg, iIndexReg, iScale, uInput, uResult); 749 oGen.iSibBaseReg, oGen.iSibIndexReg, oGen.iSibScale, 750 uInput, uResult); 744 751 745 752 return True; … … 761 768 762 769 # Register tests 763 if False:770 if True: 764 771 for cbEffOp in self.acbOpVars: 765 772 if cbEffOp > cbMaxOp: … … 800 807 oOp1MemRange = range(oGen.oTarget.getGRegCount()); 801 808 oOp2MemRange = range(oGen.oTarget.getGRegCount(cAddrBits / 8)) 802 oBaseRegRange = range(oGen.oTarget.getGRegCount(cAddrBits / 8));803 oIndexRegRange = range(oGen.oTarget.getGRegCount(cAddrBits / 8));804 809 if oGen.oOptions.sTestSize == InstructionTestGen.ksTestSize_Tiny: 805 810 oOp1MemRange = [iLongOp1,]; 806 811 oOp2MemRange = [iLongOp2,]; 807 oBaseRegRange = oGen.oTarget.randGRegNoSpList(2, cAddrBits / 8);808 oIndexRegRange = oGen.oTarget.randGRegNoSpList(2, cAddrBits / 8);809 812 elif oGen.oOptions.sTestSize == InstructionTestGen.ksTestSize_Medium: 810 813 oOp1MemRange = oGen.oTarget.randGRegNoSpList(3 if oGen.oTarget.is64Bit() else 1, cbEffOp); 811 814 oOp2MemRange = oGen.oTarget.randGRegNoSpList(3 + (cAddrBits == 64) * 2, cAddrBits / 8); 812 oBaseRegRange = oGen.oTarget.randGRegNoSpList(4 + (cAddrBits == 64) * 3, cAddrBits / 8);813 oIndexRegRange = oGen.oTarget.randGRegNoSpList(4 + (cAddrBits == 64) * 3, cAddrBits / 8);814 815 if iLongOp2 not in oOp1MemRange: 815 816 oOp1MemRange.append(iLongOp2); … … 822 823 if iOp1 > 15: 823 824 continue; ## TODO AH,CH,DH,BH 824 auInputs = auLongInputs if iOp1 == iLongOp1 and Falseelse auShortInputs;825 auInputs = auLongInputs if iOp1 == iLongOp1 else auShortInputs; 825 826 826 827 for iOp2 in oOp2MemRange: … … 835 836 else: 836 837 # SIB. 837 self.generateStdTestGregMemSib(oGen, cAddrBits, cbEffOp, cbMaxOp, iOp1, auInputs, 838 oBaseRegRange, oIndexRegRange); 838 self.generateStdTestGregMemSib(oGen, cAddrBits, cbEffOp, cbMaxOp, iOp1, auInputs); 839 839 break; 840 840 break; … … 962 962 self.dMemSetupFns = dict(); 963 963 self.d64BitConsts = dict(); 964 965 # State variables used while generating test convenientely placed here (lazy bird)... 966 self.iSibBaseReg = 0; 967 self.iSibIndexReg = 0; 968 self.iSibScale = 1; 969 if self.oOptions.sTestSize == InstructionTestGen.ksTestSize_Tiny: 970 self.oSibBaseRange = range(1); 971 self.oSibIndexRange = range(2); 972 self.oSibScaleRange = range(1); 973 elif self.oOptions.sTestSize == InstructionTestGen.ksTestSize_Medium: 974 self.oSibBaseRange = range(5); 975 self.oSibIndexRange = range(4); 976 self.oSibScaleRange = range(2); 977 else: 978 self.oSibBaseRange = range(8); 979 self.oSibIndexRange = range(9); 980 self.oSibScaleRange = range(4); 964 981 965 982
Note:
See TracChangeset
for help on using the changeset viewer.