Changeset 46991 in vbox for trunk/src/VBox/VMM/testcase
- Timestamp:
- Jul 5, 2013 7:59:47 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
r46917 r46991 919 919 920 920 921 class InstrTest_DivIDiv(InstrTestBase): 922 """ 923 Tests IDIV and DIV instructions. 924 """ 925 926 def __init__(self, fIsIDiv): 927 if not fIsIDiv: 928 InstrTest_MemOrGreg_2_Greg.__init__(self, 'div Gv,Ev', self.calc_div, acbOpVars = [ 8, 4, 2, 1 ]); 929 else 930 InstrTest_MemOrGreg_2_Greg.__init__(self, 'idiv Gv,Ev', self.calc_idiv, acbOpVars = [ 8, 4, 2, 1 ]); 931 self.fIsIDiv = fIsIDiv; 932 933 def generateStandardTests(self, oGen): 934 """ Generates test that causes no exceptions. """ 935 936 # Parameters. 937 cbDefOp = oGen.oTarget.getDefOpBytes(); 938 cbMaxOp = oGen.oTarget.getMaxOpBytes(); 939 #auShortInputs = self.generateInputs(cbDefOp, cbMaxOp, oGen); 940 #auLongInputs = self.generateInputs(cbDefOp, cbMaxOp, oGen, fLong = True); 941 iLongOp2 = oGen.oTarget.randGRegNoSp(); 942 943 # Register tests 944 if True: 945 for cbEffOp in self.acbOpVars: 946 if cbEffOp > cbMaxOp: 947 continue; 948 oGen.write('; cbEffOp=%u\n' % (cbEffOp,)); 949 oOp2Range = range(oGen.oTarget.getGRegCount(cbEffOp)); 950 if oGen.oOptions.sTestSize == InstructionTestGen.ksTestSize_Tiny: 951 oOp2Range = [iLongOp2,]; 952 for iOp2 in oOp2Range: 953 if iOp2 == X86_GREG_xSP: 954 continue; # Cannot test xSP atm. 955 #for uInput in (auLongInputs if iOp2 == iLongOp2 else auShortInputs): 956 # oGen.newSubTest(); 957 # if not oGen.oTarget.is8BitHighGReg(cbEffOp, iOp2): 958 # uResult = self.fnCalcResult(cbEffOp, uInput, uCur, oGen); 959 # self.generateOneStdTestGregGreg(oGen, cbEffOp, cbMaxOp, iOp2, iOp2 & 15, 960 # uInput, uResult); 961 # else: 962 # self.generateOneStdTestGregGreg8BitHighPain(oGen, cbEffOp, cbMaxOp, iOp2, uInput); 963 964 ## Memory test. 965 #if False: 966 # for cAddrBits in oGen.oTarget.getAddrModes(): 967 # for cbEffOp in self.acbOpVars: 968 # if cbEffOp > cbMaxOp: 969 # continue; 970 # 971 # auInputs = auLongInputs if oGen.iModReg == iLongOp1 else auShortInputs; 972 # for _ in oGen.oModRmRange: 973 # oGen.iModRm = (oGen.iModRm + 1) % oGen.oTarget.getGRegCount(cAddrBits * 8); 974 # if oGen.iModRm != 4 or cAddrBits == 16: 975 # for uInput in auInputs: 976 # oGen.newSubTest(); 977 # if oGen.iModReg == oGen.iModRm and oGen.iModRm != 5 and oGen.iModRm != 13 and cbEffOp != cbMaxOp: 978 # continue; # Don't know the high bit of the address ending up the result - skip it for now. 979 # uResult = self.fnCalcResult(cbEffOp, uInput, oGen.auRegValues[oGen.iModReg & 15], oGen); 980 # self.generateOneStdTestGregMemNoSib(oGen, cAddrBits, cbEffOp, cbMaxOp, 981 # oGen.iModReg, oGen.iModRm, uInput, uResult); 982 # else: 983 # # SIB - currently only short list of inputs or things may get seriously out of hand. 984 # self.generateStdTestGregMemSib(oGen, cAddrBits, cbEffOp, cbMaxOp, oGen.iModReg, auShortInputs); 985 # 986 return True; 987 988 def generateTest(self, oGen, sTestFnName): 989 oGen.write('VBINSTST_BEGINPROC %s\n' % (sTestFnName,)); 990 #oGen.write(' int3\n'); 991 992 self.generateNoXcptTests(oGen); 993 994 #oGen.write(' int3\n'); 995 oGen.write(' ret\n'); 996 oGen.write('VBINSTST_ENDPROC %s\n' % (sTestFnName,)); 997 return True; 998 999 @staticmethod 1000 def calc_div(cbEffOp, uInput, uCur, oGen): 1001 """ Returns a register pair. """ 1002 return 0; 1003 1004 @staticmethod 1005 def calc_idiv(cbEffOp, uInput, uCur, oGen): 1006 """ Returns a register pair. """ 1007 return 0; 1008 1009 921 1010 ## Instruction Tests. 922 1011 g_aoInstructionTests = [ 923 InstrTest_Mov_Gv_Ev(),1012 #InstrTest_Mov_Gv_Ev(), 924 1013 #InstrTest_MovSxD_Gv_Ev(), 1014 #InstrTest_DivIDiv(fIsIDiv = False), 1015 InstrTest_DivIDiv(fIsIDiv = True), 925 1016 ]; 926 1017
Note:
See TracChangeset
for help on using the changeset viewer.