Changeset 100744 in vbox
- Timestamp:
- Jul 31, 2023 8:57:57 AM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllThrdPython.py
r100743 r100744 1034 1034 return self.aoVariations[0].emitThreadedCallStmts(0); 1035 1035 1036 # Currently only have variations for address mode. 1036 class Case: 1037 def __init__(self, sCond, aoBody = None): 1038 self.sCond = sCond; 1039 self.aoBody = aoBody # type: list(iai.McCppGeneric) 1040 def toCode(self): 1041 aoStmts = [ iai.McCppGeneric('case %s:' % (self.sCond), cchIndent = 4), ]; 1042 aoStmts.extend(self.aoBody); 1043 aoStmts.append(iai.McCppGeneric('break;', cchIndent = 8)); 1044 return aoStmts; 1045 1046 # Generate the case statements. 1047 # pylintx: disable=x 1037 1048 dByVari = self.dVariations; 1038 1049 aoCases = []; 1050 if ThreadedFunctionVariation.ksVariation_64_Addr32 in dByVari: 1051 aoCases.append(Case('IEMMODE_64BIT', [ 1052 iai.McCppCond('RT_LIKELY(pVCpu->iem.s.enmEffAddrMode == IEMMODE_64BIT)', fDecode = True, cchIndent = 8, 1053 aoIfBranch = dByVari[ThrdFnVar.ksVariation_64].emitThreadedCallStmts(0), 1054 aoElseBranch = dByVari[ThrdFnVar.ksVariation_64_Addr32].emitThreadedCallStmts(0)), 1055 ])); 1056 elif ThrdFnVar.ksVariation_64 in dByVari: 1057 aoCases.append(Case('IEMMODE_64BIT', dByVari[ThrdFnVar.ksVariation_64].emitThreadedCallStmts(8))); 1058 1059 if ThrdFnVar.ksVariation_32_Addr16 in dByVari: 1060 aoCases.extend([ 1061 Case('IEMMODE_32BIT | IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK', [ 1062 iai.McCppCond('RT_LIKELY(pVCpu->iem.s.enmEffAddrMode == IEMMODE_32BIT)', fDecode = True, cchIndent = 8, 1063 aoIfBranch = dByVari[ThrdFnVar.ksVariation_32_Flat].emitThreadedCallStmts(0), 1064 aoElseBranch = dByVari[ThrdFnVar.ksVariation_32_Addr16].emitThreadedCallStmts(0)), 1065 ]), 1066 Case('IEMMODE_32BIT', [ 1067 iai.McCppCond('RT_LIKELY(pVCpu->iem.s.enmEffAddrMode == IEMMODE_32BIT)', fDecode = True, cchIndent = 8, 1068 aoIfBranch = dByVari[ThrdFnVar.ksVariation_32].emitThreadedCallStmts(0), 1069 aoElseBranch = dByVari[ThrdFnVar.ksVariation_32_Addr16].emitThreadedCallStmts(0)), 1070 ]), 1071 ]); 1072 elif ThrdFnVar.ksVariation_32 in dByVari: 1073 aoCases.append(Case('IEMMODE_32BIT', dByVari[ThrdFnVar.ksVariation_32].emitThreadedCallStmts(8))); 1074 1075 if ThrdFnVar.ksVariation_16_Addr32 in dByVari: 1076 aoCases.append(Case('IEMMODE_16BIT', [ 1077 iai.McCppCond('RT_LIKELY(pVCpu->iem.s.enmEffAddrMode == IEMMODE_16BIT)', fDecode = True, cchIndent = 8, 1078 aoIfBranch = dByVari[ThrdFnVar.ksVariation_16].emitThreadedCallStmts(0), 1079 aoElseBranch = dByVari[ThrdFnVar.ksVariation_16_Addr32].emitThreadedCallStmts(0)), 1080 ])); 1081 elif ThrdFnVar.ksVariation_16 in dByVari: 1082 aoCases.append(Case('IEMMODE_16BIT', dByVari[ThrdFnVar.ksVariation_16].emitThreadedCallStmts(8))); 1083 1084 if ThrdFnVar.ksVariation_16_Pre386 in dByVari: 1085 aoCases.append(Case('IEMMODE_16BIT | IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK', 1086 dByVari[ThrdFnVar.ksVariation_16_Pre386].emitThreadedCallStmts(8))); 1087 1088 # Generate the switch statement. 1039 1089 sExecMask = 'IEM_F_MODE_CPUMODE_MASK'; 1040 if ( Thr eadedFunctionVariation.ksVariation_64_Addr32 in dByVari1041 or Thr eadedFunctionVariation.ksVariation_32_Addr16 in dByVari1042 or Thr eadedFunctionVariation.ksVariation_32_Flat in dByVari1043 or Thr eadedFunctionVariation.ksVariation_16_Addr32 in dByVari):1090 if ( ThrdFnVar.ksVariation_64_Addr32 in dByVari 1091 or ThrdFnVar.ksVariation_32_Addr16 in dByVari 1092 or ThrdFnVar.ksVariation_32_Flat in dByVari 1093 or ThrdFnVar.ksVariation_16_Addr32 in dByVari): 1044 1094 sExecMask = '(IEM_F_MODE_CPUMODE_MASK | IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK)'; 1095 1045 1096 aoStmts = [ 1046 1097 iai.McCppGeneric('switch (pVCpu->iem.s.fExec & %s)' % (sExecMask,)), 1047 1098 iai.McCppGeneric('{'), 1048 1099 ]; 1049 1050 if ThreadedFunctionVariation.ksVariation_64_Addr32 in dByVari: 1051 aoStmts.extend([ 1052 iai.McCppGeneric('case IEMMODE_64BIT:', cchIndent = 4), 1053 iai.McCppCond('RT_LIKELY(pVCpu->iem.s.enmEffAddrMode == IEMMODE_64BIT)', fDecode = True, cchIndent = 8, 1054 aoIfBranch = dByVari[ThreadedFunctionVariation.ksVariation_64].emitThreadedCallStmts(0), 1055 aoElseBranch = dByVari[ThreadedFunctionVariation.ksVariation_64_Addr32].emitThreadedCallStmts(0)), 1056 iai.McCppGeneric('break;', cchIndent = 8), 1057 ]); 1058 elif ThreadedFunctionVariation.ksVariation_64 in dByVari: 1059 aoStmts.append(iai.McCppGeneric('case IEMMODE_64BIT:', cchIndent = 4)); 1060 aoStmts.extend(dByVari[ThreadedFunctionVariation.ksVariation_64].emitThreadedCallStmts(8)); 1061 aoStmts.append(iai.McCppGeneric('break;', cchIndent = 8)); 1062 1063 if ThreadedFunctionVariation.ksVariation_32_Addr16 in dByVari: 1064 aoStmts.extend([ 1065 iai.McCppGeneric('case IEMMODE_32BIT | IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK:', cchIndent = 4), 1066 iai.McCppCond('RT_LIKELY(pVCpu->iem.s.enmEffAddrMode == IEMMODE_32BIT)', fDecode = True, cchIndent = 8, 1067 aoIfBranch = dByVari[ThreadedFunctionVariation.ksVariation_32_Flat].emitThreadedCallStmts(0), 1068 aoElseBranch = dByVari[ThreadedFunctionVariation.ksVariation_32_Addr16].emitThreadedCallStmts(0)), 1069 iai.McCppGeneric('break;', cchIndent = 8), 1070 iai.McCppGeneric('case IEMMODE_32BIT:', cchIndent = 4), 1071 iai.McCppCond('RT_LIKELY(pVCpu->iem.s.enmEffAddrMode == IEMMODE_32BIT)', fDecode = True, cchIndent = 8, 1072 aoIfBranch = dByVari[ThreadedFunctionVariation.ksVariation_32].emitThreadedCallStmts(0), 1073 aoElseBranch = dByVari[ThreadedFunctionVariation.ksVariation_32_Addr16].emitThreadedCallStmts(0)), 1074 iai.McCppGeneric('break;', cchIndent = 8), 1075 ]); 1076 elif ThreadedFunctionVariation.ksVariation_32 in dByVari: 1077 aoStmts.append(iai.McCppGeneric('case IEMMODE_32BIT:', cchIndent = 4)); 1078 aoStmts.extend(dByVari[ThreadedFunctionVariation.ksVariation_32].emitThreadedCallStmts(8)); 1079 aoStmts.append(iai.McCppGeneric('break;', cchIndent = 8)); 1080 1081 if ThreadedFunctionVariation.ksVariation_16_Addr32 in dByVari: 1082 aoStmts.extend([ 1083 iai.McCppGeneric('case IEMMODE_16BIT:', cchIndent = 4), 1084 iai.McCppCond('RT_LIKELY(pVCpu->iem.s.enmEffAddrMode == IEMMODE_16BIT)', fDecode = True, cchIndent = 8, 1085 aoIfBranch = dByVari[ThreadedFunctionVariation.ksVariation_16].emitThreadedCallStmts(0), 1086 aoElseBranch = dByVari[ThreadedFunctionVariation.ksVariation_16_Addr32].emitThreadedCallStmts(0)), 1087 iai.McCppGeneric('break;', cchIndent = 8), 1088 ]); 1089 elif ThreadedFunctionVariation.ksVariation_16 in dByVari: 1090 aoStmts.append(iai.McCppGeneric('case IEMMODE_16BIT:', cchIndent = 4)); 1091 aoStmts.extend(dByVari[ThreadedFunctionVariation.ksVariation_16].emitThreadedCallStmts(8)); 1092 aoStmts.append(iai.McCppGeneric('break;', cchIndent = 8)); 1093 1094 if ThreadedFunctionVariation.ksVariation_16_Pre386 in dByVari: 1095 aoStmts.append(iai.McCppGeneric('case IEMMODE_16BIT | IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK:', cchIndent = 4)); 1096 aoStmts.extend(dByVari[ThreadedFunctionVariation.ksVariation_16_Pre386].emitThreadedCallStmts(8)); 1097 aoStmts.append(iai.McCppGeneric('break;', cchIndent = 8)); 1098 1100 for oCase in aoCases: 1101 aoStmts.extend(oCase.toCode()); 1099 1102 aoStmts.extend([ 1100 1103 iai.McCppGeneric('IEM_NOT_REACHED_DEFAULT_CASE_RET();', cchIndent = 4), … … 1175 1178 return iai.McStmt.renderCodeForList(self.morphInputCode(self.oMcBlock.aoStmts)[0], 1176 1179 cchIndent = cchIndent).replace('\n', ' /* gen */\n', 1); 1180 1181 # Short alias for ThreadedFunctionVariation. 1182 ThrdFnVar = ThreadedFunctionVariation; 1177 1183 1178 1184
Note:
See TracChangeset
for help on using the changeset viewer.