Changeset 66124 in vbox
- Timestamp:
- Mar 16, 2017 1:34:53 PM (8 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsOneByte.cpp.h
r66116 r66124 52 52 * @opstats add_Eb_Gb 53 53 * @opgroup op_gen_arith_bin 54 * @optest op1=1 op2=1 -> op1=2 efl&|=n v,pl,nz,na,pe,nc55 * @optest efl|=cf op1=1 op2=2 -> op1=3 efl&|=n v,pl,nz,na,po,nc56 * @optest op1=254 op2=1 -> op1=255 efl&|=n v,ng,nz,na,po,nc54 * @optest op1=1 op2=1 -> op1=2 efl&|=nc,pe,na,nz,pl,nv 55 * @optest efl|=cf op1=1 op2=2 -> op1=3 efl&|=nc,po,na,nz,pl,nv 56 * @optest op1=254 op2=1 -> op1=255 efl&|=nc,po,na,nz,ng,nv 57 57 * @optest op1=128 op2=128 -> op1=0 efl&|=ov,pl,zf,na,po,cf 58 58 */ … … 68 68 * @opgroup op_gen_arith_bin 69 69 * @opflmodify of,sf,zf,af,pf,cf 70 * @optest op1=1 op2=1 -> op1=2 efl&|=nc,pe,na,nz,pl,nv 71 * @optest efl|=cf op1=2 op2=2 -> op1=4 efl&|=nc,pe,na,nz,pl,nv 72 * @optest efl&~=cf op1=-1 op2=1 -> op1=0 efl&|=cf,po,af,zf,pl,nv 73 * @optest op1=-1 op2=-1 -> op1=-2 efl&|=cf,pe,af,nz,ng,nv 70 74 */ 71 75 FNIEMOP_DEF(iemOp_add_Ev_Gv) … … 80 84 * @opgroup op_gen_arith_bin 81 85 * @opflmodify of,sf,zf,af,pf,cf 82 * @opcopytests add_Eb_Gb86 * @opcopytests iemOp_add_Eb_Gb 83 87 */ 84 88 FNIEMOP_DEF(iemOp_add_Gb_Eb) … … 93 97 * @opgroup op_gen_arith_bin 94 98 * @opflmodify of,sf,zf,af,pf,cf 99 * @opcopytests iemOp_add_Ev_Gv 95 100 */ 96 101 FNIEMOP_DEF(iemOp_add_Gv_Ev) … … 105 110 * @opgroup op_gen_arith_bin 106 111 * @opflmodify of,sf,zf,af,pf,cf 107 * @opcopytests add_Eb_Gb112 * @opcopytests iemOp_add_Eb_Gb 108 113 */ 109 114 FNIEMOP_DEF(iemOp_add_Al_Ib) … … 119 124 * @opflmodify of,sf,zf,af,pf,cf 120 125 * @optest op1=1 op2=1 -> op1=2 efl&|=nv,pl,nz,na,pe 126 * @optest efl|=cf op1=2 op2=2 -> op1=4 efl&|=nc,pe,na,nz,pl,nv 127 * @optest efl&~=cf op1=-1 op2=1 -> op1=0 efl&|=cf,po,af,zf,pl,nv 128 * @optest op1=-1 op2=-1 -> op1=-2 efl&|=cf,pe,af,nz,ng,nv 121 129 */ 122 130 FNIEMOP_DEF(iemOp_add_eAX_Iz) -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsPython.py
r66114 r66124 78 78 ## EFlags values allowed in \@opfltest, \@opflmodify, \@opflundef, \@opflset, and \@opflclear. 79 79 g_kdEFlagsMnemonics = { 80 # Debugger flag notation: 80 # Debugger flag notation (sorted by value): 81 'cf': 'X86_EFL_CF', ##< Carry Flag. 82 'nc': '!X86_EFL_CF', ##< No Carry. 83 84 'po': 'X86_EFL_PF', ##< Parity Pdd. 85 'pe': '!X86_EFL_PF', ##< Parity Even. 86 87 'af': 'X86_EFL_AF', ##< Aux Flag. 88 'na': '!X86_EFL_AF', ##< No Aux. 89 90 'zr': 'X86_EFL_ZF', ##< ZeRo. 91 'nz': '!X86_EFL_ZF', ##< No Zero. 92 93 'ng': 'X86_EFL_SF', ##< NeGative (sign). 94 'pl': '!X86_EFL_SF', ##< PLuss (sign). 95 96 'tf': 'X86_EFL_TF', ##< Trap flag. 97 98 'ei': 'X86_EFL_IF', ##< Enabled Interrupts. 99 'di': '!X86_EFL_IF', ##< Disabled Interrupts. 100 101 'dn': 'X86_EFL_DF', ##< DowN (string op direction). 102 'up': '!X86_EFL_DF', ##< UP (string op direction). 103 81 104 'ov': 'X86_EFL_OF', ##< OVerflow. 82 105 'nv': '!X86_EFL_OF', ##< No Overflow. 83 106 84 'ng': 'X86_EFL_SF', ##< NeGative (sign). 85 'pl': '!X86_EFL_SF', ##< PLuss (sign). 86 87 'zr': 'X86_EFL_ZF', ##< ZeRo. 88 'nz': '!X86_EFL_ZF', ##< No Zero. 89 90 'af': 'X86_EFL_AF', ##< Aux Flag. 91 'na': '!X86_EFL_AF', ##< No Aux. 92 93 'po': 'X86_EFL_PF', ##< Parity Pdd. 94 'pe': '!X86_EFL_PF', ##< Parity Even. 95 96 'cf': 'X86_EFL_CF', ##< Carry Flag. 97 'nc': '!X86_EFL_CF', ##< No Carry. 98 99 'ei': 'X86_EFL_IF', ##< Enabled Interrupts. 100 'di': '!X86_EFL_IF', ##< Disabled Interrupts. 101 102 'dn': 'X86_EFL_DF', ##< DowN (string op direction). 103 'up': '!X86_EFL_DF', ##< UP (string op direction). 104 107 'nt': 'X86_EFL_NT', ##< Nested Task. 108 'rf': 'X86_EFL_RF', ##< Resume Flag. 109 'vm': 'X86_EFL_VM', ##< Virtual-8086 Mode. 110 'ac': 'X86_EFL_AC', ##< Alignment Check. 111 'vif': 'X86_EFL_VIF', ##< Virtual Interrupt Flag. 105 112 'vip': 'X86_EFL_VIP', ##< Virtual Interrupt Pending. 106 'vif': 'X86_EFL_VIF', ##< Virtual Interrupt Flag. 107 'ac': 'X86_EFL_AC', ##< Alignment Check. 108 'vm': 'X86_EFL_VM', ##< Virtual-8086 Mode. 109 'rf': 'X86_EFL_RF', ##< Resume Flag. 110 'nt': 'X86_EFL_NT', ##< Nested Task. 111 'tf': 'X86_EFL_TF', ##< Trap flag. 112 113 # Reference manual notation: 114 'of': 'X86_EFL_OF', 113 114 # Reference manual notation not covered above (sorted by value): 115 'pf': 'X86_EFL_PF', 116 'zf': 'X86_EFL_ZF', 115 117 'sf': 'X86_EFL_SF', 116 'zf': 'X86_EFL_ZF',117 'pf': 'X86_EFL_PF',118 118 'if': 'X86_EFL_IF', 119 119 'df': 'X86_EFL_DF', 120 'of': 'X86_EFL_OF', 120 121 'iopl': 'X86_EFL_IOPL', 121 122 'id': 'X86_EFL_ID', … … 585 586 if cDigits <= self.acbSizes[-1] * 2: 586 587 for cb in self.acbSizes: 587 if cDigits <= cb * 2:588 cDigits = int((cDigits + cb - 1) / cb) * cb; # Seems like integer division returns a float in python.588 cNaturalDigits = cb * 2; 589 if cDigits <= cNaturalDigits: 589 590 break; 590 591 else: 591 cDigits = int((cDigits + self.acbSizes[-1] - 1) / self.acbSizes[-1]) * self.acbSizes[-1]; 592 assert isinstance(cDigits, int) 593 594 if cDigits != len(sHex): 595 cNeeded = cDigits - len(sHex); 592 cNaturalDigits = self.acbSizes[-1] * 2; 593 cNaturalDigits = int((cDigits + cNaturalDigits - 1) / cNaturalDigits) * cNaturalDigits; 594 assert isinstance(cNaturalDigits, int) 595 596 if cNaturalDigits != cDigits: 597 cNeeded = cNaturalDigits - cDigits; 596 598 if iValue >= 0: 597 599 sHex = ('0' * cNeeded) + sHex; … … 873 875 def __init__(self, oInstr): # type: (InstructionTest, Instruction) 874 876 self.oInstr = oInstr; # type: InstructionTest 875 self.aoInputs = []; # type: TestInOut876 self.aoOutputs = []; # type: TestInOut877 self.aoInputs = []; # type: list(TestInOut) 878 self.aoOutputs = []; # type: list(TestInOut) 877 879 self.aoSelectors = []; # type: list(TestSelector) 878 880 881 def toString(self, fRepr = False): 882 """ 883 Converts it to string representation. 884 """ 885 asWords = []; 886 if self.aoSelectors: 887 for oSelector in self.aoSelectors: 888 asWords.append('%s%s%s' % (oSelector.sVariable, oSelector.sOp, oSelector.sValue,)); 889 asWords.append('/'); 890 891 for oModifier in self.aoInputs: 892 asWords.append('%s%s%s:%s' % (oModifier.sField, oModifier.sOp, oModifier.sValue, oModifier.sType,)); 893 894 asWords.append('->'); 895 896 for oModifier in self.aoOutputs: 897 asWords.append('%s%s%s:%s' % (oModifier.sField, oModifier.sOp, oModifier.sValue, oModifier.sType,)); 898 899 if fRepr: 900 return '<' + ' '.join(asWords) + '>'; 901 return ' '.join(asWords); 902 903 def __str__(self): 904 """ Provide string represenation. """ 905 return self.toString(False); 906 907 def __repr__(self): 908 """ Provide unambigious string representation. """ 909 return self.toString(True); 879 910 880 911 class Operand(object): … … 1060 1091 1061 1092 ## All the instructions. 1062 g_aoAllInstructions = []; # type: Instruction1093 g_aoAllInstructions = []; # type: list(Instruction) 1063 1094 1064 1095 ## All the instructions indexed by statistics name (opstat). 1065 g_dAllInstructionsByStat = {}; # type: Instruction 1096 g_dAllInstructionsByStat = {}; # type: dict(Instruction) 1097 1098 ## All the instructions indexed by function name (opfunction). 1099 g_dAllInstructionsByFunction = {}; # type: dict(list(Instruction)) 1100 1101 ## Instructions tagged by oponlytest 1102 g_aoOnlyTestInstructions = []; # type: list(Instruction) 1066 1103 1067 1104 ## Instruction maps. … … 1194 1231 '@opinvlstyle': self.parseTagOpUnusedInvalid, 1195 1232 '@optest': self.parseTagOpTest, 1233 '@optestign': self.parseTagOpTestIgnore, 1234 '@optestignore': self.parseTagOpTestIgnore, 1196 1235 '@opcopytests': self.parseTagOpCopyTests, 1236 '@oponlytest': self.parseTagOpOnlyTest, 1197 1237 '@opstats': self.parseTagOpStats, 1198 1238 '@opfunction': self.parseTagOpFunction, … … 1359 1399 self.error('Duplicate opstat value "%s"\nnew: %s\nold: %s' 1360 1400 % (oInstr.sStats, oInstr, g_dAllInstructionsByStat[oInstr.sStats],)); 1401 1402 # 1403 # Add to function indexed dictionary. We allow multiple instructions per function. 1404 # 1405 if oInstr.sFunction: 1406 if oInstr.sFunction not in g_dAllInstructionsByFunction: 1407 g_dAllInstructionsByFunction[oInstr.sFunction] = [oInstr,]; 1408 else: 1409 g_dAllInstructionsByFunction[oInstr.sFunction].append(oInstr); 1361 1410 1362 1411 #self.debug('%d..%d: %s; %d @op tags' % (oInstr.iLineCreated, oInstr.iLineCompleted, oInstr.sFunction, oInstr.cOpTags)); … … 2075 2124 return True; 2076 2125 2126 def parseTagOpTestIgnore(self, sTag, aasSections, iTagLine, iEndLine): 2127 """ 2128 Tag: \@optestign | \@optestignore 2129 Value: <value is ignored> 2130 2131 This is a simple trick to ignore a test while debugging another. 2132 2133 See also \@oponlytest. 2134 """ 2135 _ = sTag; _ = aasSections; _ = iTagLine; _ = iEndLine; 2136 return True; 2137 2077 2138 def parseTagOpCopyTests(self, sTag, aasSections, iTagLine, iEndLine): 2078 2139 """ 2079 2140 Tag: \@opcopytests 2080 Value: <opstat value> [..]2141 Value: <opstat | function> [..] 2081 2142 Example: \@opcopytests add_Eb_Gb 2082 2143 … … 2093 2154 for sToCopy in asToCopy: 2094 2155 if sToCopy not in oInstr.asCopyTests: 2095 if self.oReStatsName.match(sToCopy) :2156 if self.oReStatsName.match(sToCopy) or self.oReFunctionName.match(sToCopy): 2096 2157 oInstr.asCopyTests.append(sToCopy); 2097 2158 else: 2098 self.errorComment(iTagLine, '%s: invalid instruction reference (opstat ) "%s" (valid:%s)'2099 % (sTag, sToCopy, self.oReStatsName.pattern ));2159 self.errorComment(iTagLine, '%s: invalid instruction reference (opstat or function) "%s" (valid: %s or %s)' 2160 % (sTag, sToCopy, self.oReStatsName.pattern, self.oReFunctionName.pattern)); 2100 2161 else: 2101 2162 self.errorComment(iTagLine, '%s: ignoring duplicate "%s"' % (sTag, sToCopy,)); 2163 2164 _ = iEndLine; 2165 return True; 2166 2167 def parseTagOpOnlyTest(self, sTag, aasSections, iTagLine, iEndLine): 2168 """ 2169 Tag: \@oponlytest 2170 Value: none 2171 2172 Only test instructions with this tag. This is a trick that is handy 2173 for singling out one or two new instructions or tests. 2174 2175 See also \@optestignore. 2176 """ 2177 oInstr = self.ensureInstructionForOpTag(iTagLine); 2178 2179 # Validate and add instruction to only test dictionary. 2180 sValue = self.flattenAllSections(aasSections).strip(); 2181 if sValue: 2182 return self.errorComment(iTagLine, '%s: does not take any value: %s' % (sTag, sValue)); 2183 2184 if oInstr not in g_aoOnlyTestInstructions: 2185 g_aoOnlyTestInstructions.append(oInstr); 2102 2186 2103 2187 _ = iEndLine; … … 2666 2750 for sSrcInstr in oDstInstr.asCopyTests: 2667 2751 oSrcInstr = g_dAllInstructionsByStat.get(sSrcInstr, None); 2668 if oSrcInstr and oSrcInstr != oDstInstr: 2669 oDstInstr.aoTests.extend(oSrcInstr.aoTests); 2670 elif oSrcInstr: 2671 asErrors.append('%s:%s: error: @opcopytests reference "%s" matches the destination\n' 2672 % ( oDstInstr.sSrcFile, oDstInstr.iLineCreated, sSrcInstr)); 2752 if oSrcInstr: 2753 aoSrcInstrs = [oSrcInstr,]; 2754 else: 2755 aoSrcInstrs = g_dAllInstructionsByFunction.get(sSrcInstr, []); 2756 if aoSrcInstrs: 2757 for oSrcInstr in aoSrcInstrs: 2758 if oSrcInstr != oDstInstr: 2759 oDstInstr.aoTests.extend(oSrcInstr.aoTests); 2760 else: 2761 asErrors.append('%s:%s: error: @opcopytests reference "%s" matches the destination\n' 2762 % ( oDstInstr.sSrcFile, oDstInstr.iLineCreated, sSrcInstr)); 2673 2763 else: 2674 2764 asErrors.append('%s:%s: error: @opcopytests reference "%s" not found\n' … … 2679 2769 return len(asErrors); 2680 2770 2771 2772 def __applyOnlyTest(): 2773 """ 2774 If g_aoOnlyTestInstructions contains any instructions, drop aoTests from 2775 all other instructions so that only these get tested. 2776 """ 2777 if g_aoOnlyTestInstructions: 2778 for oInstr in g_aoAllInstructions: 2779 if oInstr.aoTests: 2780 if oInstr not in g_aoOnlyTestInstructions: 2781 oInstr.aoTests = []; 2782 return 0; 2681 2783 2682 2784 def __parseAll(): … … 2694 2796 cErrors += __parseFileByName(os.path.join(sSrcDir, sName), sDefaultMap); 2695 2797 cErrors += __doTestCopying(); 2696 2798 cErrors += __applyOnlyTest(); 2697 2799 2698 2800 if cErrors != 0: -
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-data.py
r66114 r66124 73 73 sConstant = oSelector.kdVariables[oSelector.sVariable][oSelector.sValue]; 74 74 sConstant = sConstant.upper().replace('.', '_'); 75 if oSelector.s Value.sOp == '==':75 if oSelector.sOp == '==': 76 76 sByte = '(BS3CG1PRED_%s << BS3CG1SEL_OP_PRED_SHIFT) | BS3CG1SEL_OP_IS_TRUE' % (sConstant,); 77 elif oSelector.s Value.sOp == '!=':77 elif oSelector.sOp == '!=': 78 78 sByte = '(BS3CG1PRED_%s << BS3CG1SEL_OP_PRED_SHIFT) | BS3CG1SEL_OP_IS_FALSE' % (sConstant,); 79 79 else: … … 167 167 sOpcode += 'BS3CG1_CTXOP_SIZE_ESC'; 168 168 if fSignExtend: 169 sOpcode += ' | BS3CG1_CTXOP_SIGN_EXT';169 sOpcode += ' | BS3CG1_CTXOP_SIGN_EXT'; 170 170 asRet.append(sOpcode); 171 171 … … 227 227 228 228 def __init__(self, oInstr): 229 self.offTests = -1; 230 self.cbTests = 0; 231 self.asLines = []; 229 self.offTests = -1; 230 self.cbTests = 0; 231 self.asLines = []; # type: list(str) 232 self.aoInstructions = []; # type: list(iai.Instruction) 232 233 233 234 # Encode the tests. … … 239 240 + len(oEncodedTest.asInputs) + len(oEncodedTest.asOutputs); 240 241 241 self.asLines += self.bytesToLines(' /*hdr:*/ ', oEncodedTest.asHdr); 242 self.asLines.append(' /* test #%s: %s */' % (iTest, oTest,)); 243 self.asLines += self.bytesToLines(' ', oEncodedTest.asHdr); 242 244 if oEncodedTest.asSelectors: 243 245 self.asLines += self.bytesToLines(' /*sel:*/ ', oEncodedTest.asSelectors); … … 342 344 self.cbTests = 0; 343 345 344 def addTests(self, oTests ):346 def addTests(self, oTests, oInstr): # type: (Bs3Cg1EncodedTests, iai.Instruction) -> Bs3Cg1EncodedTests 345 347 """ 346 348 Adds oTests to self.aoTests, setting the oTests.offTests member. … … 351 353 for oExisting in self.aoTests: 352 354 if oTests.isEqual(oExisting): 355 oExisting.aoInstructions.append(oInstr); 353 356 return oExisting; 354 357 … … 357 360 self.aoTests.append(oTests); 358 361 self.cbTests += oTests.cbTests; 362 363 assert not oTests.aoInstructions; 364 oTests.aoInstructions.append(oInstr); 359 365 360 366 return oTests; … … 374 380 if oInstr.aoTests: 375 381 oTests = Bs3Cg1EncodedTests(oInstr); 376 oTests = self.addTests(oTests );382 oTests = self.addTests(oTests, oInstr); 377 383 378 384 for oMap in oInstr.aoMaps: … … 491 497 ]; 492 498 for oTests in self.aoTests: 493 asLines.append(' /* offTests=%s */' % (oTests.offTests,)); 499 asLines.append(' /*'); 500 asLines.append(' * offTests=%s' % (oTests.offTests,)); 501 asLines.append(' * Instructions: %s' % (', '.join([oInstr.sStats for oInstr in oTests.aoInstructions]),)); 502 asLines.append(' */'); 494 503 asLines += oTests.asLines; 495 504 asLines += [ -
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c
r66123 r66124 75 75 * Debug print macro. 76 76 */ 77 #if 177 #if 0 78 78 # define BS3CG1_DPRINTF(a_ArgList) Bs3TestPrintf a_ArgList 79 //# define BS3CG1_DEBUG_CTX_MOD79 # define BS3CG1_DEBUG_CTX_MOD 80 80 #else 81 81 # define BS3CG1_DPRINTF(a_ArgList) do { } while (0) … … 698 698 pThis->aOperands[0].cbOp = 4; 699 699 pThis->aOperands[1].cbOp = 4; 700 pThis->cbOperand = 2;700 pThis->cbOperand = 4; 701 701 } 702 702 } … … 1339 1339 if (iEncodingNext <= iEncoding) 1340 1340 break; 1341 BS3CG1_DPRINTF(("\ndbg: Encoding #%u: cbCurInst=%u %.*Rhxs\n", iEncoding, This.cbCurInstr, This.cbCurInstr, This.abCurInstr));1341 BS3CG1_DPRINTF(("\ndbg: Encoding #%u: cbCurInst=%u: %.*Rhxs\n", iEncoding, This.cbCurInstr, This.cbCurInstr, This.abCurInstr)); 1342 1342 1343 1343 /* … … 1395 1395 &This.TrapFrame.Ctx, NULL /*pbCode*/)) 1396 1396 { 1397 Bs3TestCheckRegCtxEx(&This.TrapFrame.Ctx, &This.Ctx, This.cbCurInstr, 0 /*cbSpAdjust*/, 1398 0 /*fExtraEfl*/, pszMode, iEncoding); 1397 if (!Bs3TestCheckRegCtxEx(&This.TrapFrame.Ctx, &This.Ctx, This.cbCurInstr, 0 /*cbSpAdjust*/, 1398 0 /*fExtraEfl*/, pszMode, iEncoding)) 1399 Bs3TestFailedF("encoding#%u: %.*Rhxs", iEncoding, This.cbCurInstr, This.abCurInstr); 1399 1400 } 1400 1401 } 1401 1402 else 1402 1403 { 1403 Bs3TestFailedF("bXcpt=%#x expected %#x; rip=%RX64 expected %RX64; encoding : %.*Rhxs",1404 Bs3TestFailedF("bXcpt=%#x expected %#x; rip=%RX64 expected %RX64; encoding#u: %.*Rhxs", 1404 1405 This.TrapFrame.bXcpt, BS3_MODE_IS_PAGED(bMode) ? X86_XCPT_PF : X86_XCPT_UD, 1405 1406 This.TrapFrame.Ctx.rip.u, This.Ctx.rip.u + This.cbCurInstr, 1406 This.cbCurInstr, This.abCurInstr);1407 iEncoding, This.cbCurInstr, This.abCurInstr); 1407 1408 } 1408 1409 } … … 1414 1415 if (pHdr->fLast) 1415 1416 { 1416 BS3CG1_DPRINTF(("dbg: Last\n "));1417 BS3CG1_DPRINTF(("dbg: Last\n\n")); 1417 1418 break; 1418 1419 }
Note:
See TracChangeset
for help on using the changeset viewer.