Changeset 108937 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Apr 10, 2025 10:55:42 PM (4 weeks ago)
- svn:sync-xref-src-repo-rev:
- 168447
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/target-armv8/bsd-spec-analyze.py
r108916 r108937 92 92 'FEAT_PCDPHINT': False, ##@todo 'fPCDPHint', 93 93 'FEAT_SME2p2': False, ##@todo 'fSme2p2', 94 'FEAT_SSVE_FEXPA': False, ##@todo 'fSsveFexpa', 94 95 'FEAT_SSVE_FP8DOT2': False, ##@todo 'fSsveFp8Dot2', 95 96 'FEAT_SSVE_FP8DOT4': False, ##@todo 'fSsveFp8Dot4', 97 'FEAT_SSVE_FP8FMA': False, ##@todo 'fSsveFp8Fma', 96 98 'FEAT_SVE2p2': False, ##@todo 'fSve2p2', 97 99 'FEAT_SVE_BFSCALE': False, ##@todo 'fSveBfscale', … … 100 102 'FEAT_SME_F8F16': False, ##@todo 'fSmeF8F16', 101 103 'FEAT_SME_F8F32': False, ##@todo 'fSmeF8F32', 104 'FEAT_SME_LUTv2': False, ##@todo 'fSmeLutv2', 105 'FEAT_SME_MOP4': False, ##@todo 'fSmeMop4', 106 'FEAT_SME_TMOP': False, ##@todo 'fSmeTmop', 107 'FEAT_SVE_AES2': False, ##@todo 'fSveAes2', 102 108 103 109 # Generated by sed + sort: … … 502 508 self.oRight = oLeft; 503 509 510 def clone(self): 511 return ArmAstBinaryOp(self.oLeft.clone(), self.sOp, self.oRight.clone()); 512 504 513 @staticmethod 505 514 def needParentheses(oNode, sOp = '&&'): … … 591 600 self.oExpr = oExpr; 592 601 602 def clone(self): 603 return ArmAstUnaryOp(self.sOp, self.oExpr.clone()); 604 593 605 @staticmethod 594 606 def needParentheses(oNode): … … 609 621 def __init__(self, oVar, aoValues): 610 622 ArmAstBase.__init__(self, ArmAstBase.ksTypeSquareOp); 623 assert isinstance(oVar, ArmAstBase); 611 624 self.oVar = oVar; 612 625 self.aoValues = aoValues; 626 627 def clone(self): 628 return ArmAstSquareOp(self.oVar.clone(), [oValue.clone() for oValue in self.aoValues]); 613 629 614 630 def toString(self): … … 624 640 ArmAstBase.__init__(self, ArmAstBase.ksTypeConcat); 625 641 self.aoValues = aoValues; 642 643 def clone(self): 644 return ArmAstConcat([oValue.clone() for oValue in self.aoValues]); 626 645 627 646 def toString(self): … … 663 682 self.aoArgs = aoArgs; 664 683 684 def clone(self): 685 return ArmAstFunction(self.sName, [oArg.clone() for oArg in self.aoArgs]); 686 665 687 def toString(self): 666 688 return '%s(%s)' % (self.sName, ','.join([oArg.toString() for oArg in self.aoArgs]),); … … 677 699 assert self.s_oReValidName.match(sName), 'sName=%s' % (sName); 678 700 self.sName = sName; 701 702 def clone(self): 703 return ArmAstIdentifier(self.sName); 679 704 680 705 def toString(self): … … 692 717 self.fValue = fValue; 693 718 719 def clone(self): 720 return ArmAstBool(self.fValue); 721 694 722 def toString(self): 695 723 return 'true' if self.fValue is True else 'false'; … … 703 731 ArmAstBase.__init__(self, ArmAstBase.ksTypeInteger); 704 732 self.iValue = int(iValue); 733 734 def clone(self): 735 return ArmAstInteger(self.iValue); 705 736 706 737 def toString(self): … … 720 751 self.aoValues = aoValues; 721 752 753 def clone(self): 754 return ArmAstSet([oValue.clone() for oValue in self.aoValues]); 755 722 756 def toString(self): 723 757 return '(%s)' % (', '.join([oValue.toString() for oValue in self.aoValues]),); … … 731 765 ArmAstBase.__init__(self, ArmAstBase.ksTypeValue); 732 766 self.sValue = sValue; 767 768 def clone(self): 769 return ArmAstValue(self.sValue); 733 770 734 771 def toString(self): … … 773 810 def __repr__(self): 774 811 return self.__str__(); 812 813 def clone(self): 814 return ArmEncodesetField(self.oJson, self.iFirstBit, self.cBitsWidth, self.fFixed, self.fValue, self.sName); 775 815 776 816 def getMask(self): … … 819 859 820 860 @staticmethod 821 def fromJsonEncodeset(oJson, aoSet, fCovered):861 def encodesetFromJson(oJson): 822 862 assert oJson['_type'] == 'Instruction.Encodeset.Encodeset', oJson['_type']; 863 aoSet = []; 864 fFields = 0; 823 865 for oJsonValue in oJson['values']: 824 866 oNewField = ArmEncodesetField.fromJson(oJsonValue); 825 867 fNewMask = oNewField.getShiftedMask(); 826 if (fNewMask & fCovered) != fNewMask: 827 aoSet.append(oNewField) 828 fCovered |= fNewMask; 829 return (aoSet, fCovered); 830 831 832 class ArmInstruction(object): 868 assert (fNewMask & fFields) == 0; 869 aoSet.append(oNewField); 870 fFields |= fNewMask; 871 return (aoSet, fFields); 872 873 @staticmethod 874 def encodesetAddParentFields(aoFields, fFields, aoParentFields): 875 for oParentField in aoParentFields: 876 fNewMask = oParentField.getShiftedMask(); 877 if (fNewMask & fFields) != fNewMask: 878 aoFields.append(oParentField.clone()); # (paranoid: clone) 879 fFields |= fNewMask; 880 return (aoFields, fFields); 881 882 883 class ArmInstructionBase(object): 884 """ 885 Base class for ArmInstruction, ArmInstructionSet and ArmInstructionGroup 886 887 Instances of ArmInstruction will have ArmInstructionGroup (or maybe 888 ArmInstructionGroup) as parent. 889 890 Instances of ArmInstructionGroup have ArmInstructionSet as parent. 891 892 Instances of ArmInstructionSet doesn't have a parent, so it is None. 893 """ 894 895 s_oReValidName = re.compile('^[_A-Za-z][_A-Za-z0-9]+$'); 896 897 def __init__(self, oJson, sName, aoFields, fFields, oCondition, oParent): 898 self.oJson = oJson; 899 self.sName = sName; 900 self.oParent = oParent; 901 self.aoFields = aoFields; 902 self.fFields = fFields; ##< Not necessarily correct for Instructions! 903 self.oCondition = oCondition; 904 905 assert ArmInstructionBase.s_oReValidName.match(sName), '%s' % (sName); 906 assert (oJson['_type'] == 'Instruction.InstructionSet') == (oParent is None); 907 assert not oParent or isinstance(oParent, (ArmInstructionGroup, ArmInstructionSet)); 908 909 910 def getUpIterator(self): 911 """ Get an iterator the starts with 'self' and goes up the parent chain. """ 912 class UpIterator(object): 913 def __init__(self, oNode): 914 self.oNext = oNode; 915 916 def __iter__(self): 917 return self; 918 919 def __next__(self): 920 oRet = self.oNext; 921 if oRet: 922 self.oNext = oRet.oParent; 923 return oRet; 924 raise StopIteration(); 925 return UpIterator(self); 926 927 def getFieldByName(self, sName, fRaiseXpctIfNotFound = True): 928 """ Looks up a named field in the aoFields. """ 929 for oField in self.aoFields: 930 if oField.sName and oField.sName == sName: 931 return oField; 932 if fRaiseXpctIfNotFound: 933 raise Exception('Could not find field %s in instruction %s' % (sName, self.sName,)); 934 return None; 935 936 937 class ArmInstructionOrganizerBase(ArmInstructionBase): 938 """ Common base class for ArmInstructionSet and ArmInstructionGroup. """ 939 940 s_oReValidName = re.compile('^[_A-Za-z][_A-Za-z0-9]+$'); 941 942 def __init__(self, oJson, sName, aoFields, fFields, oCondition, oParent = None): 943 ArmInstructionBase.__init__(self, oJson, sName, aoFields, fFields, oCondition, oParent); 944 self.aoInstructions = []; ##< The instruction directly under this object (no in sub-set or groups). 945 self.dInstructions = {}; ##< The instructions in self.aoInstructions indexed by name. 946 self.aoAllInstructions = []; ##< All the instructions in this set. 947 self.dAllInstructions = {}; ##< The instructions in self.aoAllInstructions indexed by name. 948 self.aoGroups = []; ##< Groups under this object. 949 950 def toString(self): 951 return '%s-name=%s Fields=#%u/%#010x cond=%s parent=%s' \ 952 % ('set' if isinstance(self, ArmInstructionSet) else 'group', self.sName, 953 len(self.aoFields), self.fFields, self.oCondition.toString(), self.oParent.sName if self.oParent else '<none>',); 954 955 def addInstruction(self, oInstr): 956 """ Recursively adds the instruction to the ALL collections.""" 957 self.aoAllInstructions.append(oInstr); 958 assert oInstr.sName not in self.dAllInstructions; 959 self.dAllInstructions[oInstr.sName] = oInstr; 960 961 if self.oParent: 962 self.oParent.addInstruction(oInstr); 963 else: 964 g_dAllArmInstructionsBySet[self.sName].append(oInstr); 965 966 def addImmediateInstruction(self, oInstr): 967 """ Adds an instruction immediately below this group/set. """ 968 assert oInstr.sName not in self.dInstructions; 969 assert oInstr.oParent == self; 970 971 self.aoInstructions.append(oInstr); 972 self.dInstructions[oInstr.sName] = oInstr; 973 974 if self.oParent: 975 assert isinstance(self, ArmInstructionGroup); 976 g_dAllArmInstructionsByGroup[self.sName].append(oInstr); 977 978 self.addInstruction(oInstr); 979 980 class ArmInstructionSet(ArmInstructionOrganizerBase): 981 """ Representation of a Instruction.InstructionSet object. """ 982 983 def __init__(self, oJson, sName, aoFields, fFields, oCondition, cBitsWidth): 984 ArmInstructionOrganizerBase.__init__(self, oJson, sName, aoFields, fFields, oCondition); 985 self.cBitsWidth = cBitsWidth; 986 assert cBitsWidth == 32; 987 988 def __str__(self): 989 return self.toString(); 990 991 def __repr__(self): 992 return self.toString(); 993 994 def toString(self): 995 return ArmInstructionOrganizerBase.toString(self) + ' read_bits=%u' % (self.cBitsWidth,); 996 997 @staticmethod 998 def fromJson(oJson): 999 assert oJson['_type'] == 'Instruction.InstructionSet'; 1000 sName = oJson['name']; 1001 1002 (aoFields, fFields) = ArmEncodesetField.encodesetFromJson(oJson['encoding']); 1003 oCondition = ArmAstBase.fromJson(oJson['condition']); 1004 print('debug: Instruction set %s' % (sName,)); 1005 return ArmInstructionSet(oJson, sName, aoFields, fFields, oCondition, int(oJson['read_width'])); 1006 1007 1008 class ArmInstructionGroup(ArmInstructionOrganizerBase): 1009 """ Representation of a Instruction.InstructionGroup object. """ 1010 1011 def __init__(self, oJson, sName, aoFields, fFields, oCondition, oParent): 1012 ArmInstructionOrganizerBase.__init__(self, oJson, sName, aoFields, fFields, oCondition, oParent); 1013 1014 def __str__(self): 1015 return self.toString(); 1016 1017 def __repr__(self): 1018 return self.toString(); 1019 1020 def toString(self): 1021 return ArmInstructionOrganizerBase.toString(self); 1022 1023 @staticmethod 1024 def fromJson(oJson, oParent): 1025 assert oJson['_type'] == 'Instruction.InstructionGroup'; 1026 sName = oJson['name']; 1027 1028 (aoFields, fFields) = ArmEncodesetField.encodesetFromJson(oJson['encoding']); 1029 oCondition = ArmAstBase.fromJson(oJson['condition']); 1030 print('debug: Instruction group %s' % (sName,)); 1031 return ArmInstructionGroup(oJson, sName, aoFields, fFields, oCondition, oParent); 1032 1033 1034 1035 class ArmInstruction(ArmInstructionBase): 833 1036 """ 834 1037 ARM instruction … … 836 1039 s_oReValidName = re.compile('^[_A-Za-z][_A-Za-z0-9]+$'); 837 1040 838 def __init__(self, oJson, sName, sMemonic, sAsmDisplay, aoEncodesets, oCondition): 839 assert self.s_oReValidName.match(sName), 'sName=%s' % (sName); 840 self.oJson = oJson; 841 self.sName = sName; 1041 def __init__(self, oJson, sName, sMemonic, sAsmDisplay, aoFields, fFields, oCondition, oParent): 1042 ArmInstructionBase.__init__(self, oJson, sName, aoFields, fFields, oCondition, oParent); 842 1043 self.sMnemonic = sMemonic; 843 1044 self.sAsmDisplay = sAsmDisplay; 844 self.sSet = None;845 self.asGroups = [];846 self.aoEncodesets = aoEncodesets;847 self.oCondition = oCondition;848 1045 self.fFixedMask = 0; 849 1046 self.fFixedValue = 0; 850 for oField in ao Encodesets:1047 for oField in aoFields: 851 1048 self.fFixedMask |= oField.fFixed << oField.iFirstBit; 852 1049 self.fFixedValue |= oField.fValue << oField.iFirstBit; … … 854 1051 # State related to decoder. 855 1052 self.fDecoderLeafCheckNeeded = False; ##< Whether we need to check fixed value/mask in leaf decoder functions. 1053 1054 # Check input. 1055 assert self.s_oReValidName.match(sName), 'sName=%s' % (sName); 856 1056 857 1057 def toString(self, cchName = 0, fEncoding = False): … … 861 1061 sRet = 'sName=%-*s sMnemonic=%-*s' % (cchName, self.sName, cchName, self.sMnemonic); 862 1062 if not fEncoding: 863 return '%s fFixedValue/Mask=%#x/%#x #encoding=%s' % (sRet, self.fFixedValue, self.fFixedMask, len(self.ao Encodesets));1063 return '%s fFixedValue/Mask=%#x/%#x #encoding=%s' % (sRet, self.fFixedValue, self.fFixedMask, len(self.aoFields)); 864 1064 return '%s fFixedValue/Mask=%#x/%#x encoding=\n %s' \ 865 % (sRet, self.fFixedValue, self.fFixedMask, ',\n '.join([str(s) for s in self.ao Encodesets]),);1065 % (sRet, self.fFixedValue, self.fFixedMask, ',\n '.join([str(s) for s in self.aoFields]),); 866 1066 867 1067 def __str__(self): … … 877 1077 return self.sName[:-1]; 878 1078 879 def getFieldByName(self, sName, fRaiseXpctIfNotFound = True): 880 """ Looks up a named field in the aoEncodesets. """ 881 for oField in self.aoEncodesets: 882 if oField.sName and oField.sName == sName: 883 return oField; 884 if fRaiseXpctIfNotFound: 885 raise Exception('Could not find field %s in instruction %s' % (sName, self.sName,)); 886 return None; 1079 def getSetAndGroupNames(self): 1080 asNames = []; 1081 oParent = self.oParent; 1082 while oParent: 1083 asNames.append(oParent.sName) 1084 oParent = oParent.oParent; 1085 return asNames; 1086 1087 def getSetAndGroupNamesWithLabels(self): 1088 asNames = self.getSetAndGroupNames(); 1089 if len(asNames) > 1: 1090 return 'Instruction Set: %s Group%s: %s' % (asNames[-1], 's' if len(asNames) > 2 else '', ', '.join(asNames[:-1]),); 1091 return 'Instruction Set: %s' % (asNames[-1],); 1092 887 1093 888 1094 … … 895 1101 896 1102 ## All the instructions. 897 g_aoAllArmInstructions = [] # type: List[ArmInstruction]1103 g_aoAllArmInstructions = [] # type: List[ArmInstruction] 898 1104 899 1105 ## All the instructions by name (not mnemonic). 900 g_dAllArmInstructionsByName = {} # type: Dict[ArmInstruction] 901 902 ## All the instruction by instruction set name. 903 g_dAllArmInstructionsBySet = {} # type: Dict[List[ArmInstruction]] 904 905 ## All the instruction by instruction group name. 906 g_dAllArmInstructionsByGroup = {} # type: Dict[List[ArmInstruction]] 1106 g_dAllArmInstructionsByName = {} # type: Dict[ArmInstruction] 1107 1108 ## All the instructions by instruction set name. 1109 g_dAllArmInstructionsBySet = collections.defaultdict(list) # type: Dict[List[ArmInstruction]] 1110 1111 ## All the instructions by (immediate) instruction group name. 1112 g_dAllArmInstructionsByGroup = collections.defaultdict(list) # type: Dict[List[ArmInstruction]] 1113 1114 ## The instruction sets. 1115 g_aoArmInstructionSets = [] # type: List[ArmInstructionSet] 1116 1117 ## The instruction sets by name. 1118 g_dArmInstructionSets = {} # type: Dict[ArmInstructionSet] 1119 1120 ## The instruction groups. 1121 g_aoArmInstructionGroups = [] # type: List[ArmInstructionGroup] 1122 1123 ## The instruction groups. 1124 g_dArmInstructionGroups = {} # type: Dict[ArmInstructionGroup] 907 1125 908 1126 … … 985 1203 986 1204 987 def parseInstructions( aoStack, aoJson, ddAsmRules):1205 def parseInstructions(oParent, aoJson, ddAsmRules): 988 1206 for oJson in aoJson: 989 if oJson['_type'] == "Instruction.InstructionSet": 990 assert oJson['name']; 991 parseInstructions([oJson,] + aoStack, oJson['children'], ddAsmRules); 992 993 elif oJson['_type'] == "Instruction.InstructionGroup": 994 assert oJson['name']; 995 parseInstructions([oJson,] + aoStack, oJson['children'], ddAsmRules); 996 997 elif oJson['_type'] == "Instruction.Instruction": 1207 sType = oJson['_type']; 1208 if sType == 'Instruction.InstructionSet': 1209 if oParent: raise Exception("InstructionSet shouldn't have a parent!"); 1210 oInstrSet = ArmInstructionSet.fromJson(oJson); 1211 assert oInstrSet.sName not in g_dArmInstructionSets; 1212 g_dArmInstructionSets[oInstrSet.sName] = oInstrSet; 1213 g_aoArmInstructionSets.append(oInstrSet); 1214 1215 parseInstructions(oInstrSet, oJson['children'], ddAsmRules); 1216 1217 elif sType == 'Instruction.InstructionGroup': 1218 if not oParent: raise Exception("InstructionGroup should have a parent!"); 1219 oInstrGroup = ArmInstructionGroup.fromJson(oJson, oParent); 1220 #if oInstrGroup.sName in g_dArmInstructionGroups: # happens with 1221 1222 if oInstrGroup.sName in g_dArmInstructionGroups: 1223 if oInstrGroup.sName == oParent.sName: # sve_intx_clamp, sve_intx_dot2 1224 oInstrGroup.sName += '_lvl2' 1225 else: 1226 assert oInstrGroup.sName not in g_dArmInstructionGroups, '%s' % (oInstrGroup.sName,); 1227 1228 g_dArmInstructionGroups[oInstrGroup.sName] = oInstrGroup; 1229 g_aoArmInstructionGroups.append(oInstrGroup); 1230 oParent.aoGroups.append(oInstrGroup); 1231 1232 parseInstructions(oInstrGroup, oJson['children'], ddAsmRules); 1233 1234 elif sType == "Instruction.Instruction": 1235 if not oParent: raise Exception("Instruction should have a parent!"); 1236 998 1237 # 999 1238 # Start by getting the instruction attributes. … … 1001 1240 sInstrNm = oJson['name']; 1002 1241 1003 (aoEncodesets, fCovered) = ArmEncodesetField.fromJsonEncodeset(oJson['encoding'], [], 0); 1004 for oParent in aoStack: 1005 if 'encoding' in oParent: 1006 (aoEncodesets, fCovered) = ArmEncodesetField.fromJsonEncodeset(oParent['encoding'], aoEncodesets, fCovered); 1007 1008 oCondition = ArmAstBase.fromJson(oJson['condition']); 1242 (aoFields, fFields) = ArmEncodesetField.encodesetFromJson(oJson['encoding']); 1243 oCondition = ArmAstBase.fromJson(oJson['condition']); 1244 1245 for oUp in oParent.getUpIterator(): 1246 if oUp.fFields & ~fFields: 1247 (aoFields, fFields) = ArmEncodesetField.encodesetAddParentFields(aoFields, fFields, oUp.aoFields); 1248 if not oUp.oCondition.isBoolAndTrue(): 1249 oCondition = ArmAstBinaryOp(oCondition, '&&', oUp.oCondition.clone()); 1250 1009 1251 #sCondBefore = oCondition.toString(); 1010 1252 #print('debug transfer: %s: org: %s' % (sInstrNm, sCondBefore)); 1011 (oCondition, fMod) = transferConditionsToEncoding(oCondition, aoEncodesets, collections.defaultdict(list), sInstrNm); 1253 ## @todo fFields isn't updated here! 1254 (oCondition, fMod) = transferConditionsToEncoding(oCondition, aoFields, collections.defaultdict(list), sInstrNm); 1012 1255 #if fMod: 1013 1256 # print('debug transfer: %s: %s ----> %s' % (sInstrNm, sCondBefore, oCondition.toString())); … … 1029 1272 # Instantiate it. 1030 1273 # 1031 oInstr = ArmInstruction(oJson, sInstrNm, sMnemonic, sAsmDisplay, ao Encodesets, oCondition);1274 oInstr = ArmInstruction(oJson, sInstrNm, sMnemonic, sAsmDisplay, aoFields, fFields, oCondition, oParent); 1032 1275 1033 1276 # 1034 1277 # Add the instruction to the various lists and dictionaries. 1035 # This is where the sSet and asGroups properties are populated.1036 1278 # 1037 1279 g_aoAllArmInstructions.append(oInstr); … … 1039 1281 g_dAllArmInstructionsByName[oInstr.sName] = oInstr; 1040 1282 1041 for oParent in reversed(aoStack): ## @todo reversed? 1042 sName = oParent['name']; 1043 sParentType = oParent['_type']; 1044 if sParentType == "Instruction.InstructionSet": 1045 assert not oInstr.sSet; 1046 oInstr.sSet = sName; 1047 if sName in g_dAllArmInstructionsBySet: 1048 g_dAllArmInstructionsBySet[sName].append(oInstr); 1049 else: 1050 g_dAllArmInstructionsBySet[sName] = [oInstr,]; 1051 elif sParentType == "Instruction.InstructionGroup": 1052 if sName not in oInstr.asGroups: # sve_intx_clamp comes up twice for instance. 1053 oInstr.asGroups.append(sName); 1054 if sName in g_dAllArmInstructionsByGroup: 1055 g_dAllArmInstructionsByGroup[sName].append(oInstr); 1056 else: 1057 g_dAllArmInstructionsByGroup[sName] = [oInstr,]; 1058 else: 1059 raise Exception('Unexpected stack entry type: %s' % (sParentType,)); 1283 oParent.addImmediateInstruction(oInstr); 1284 1285 else: 1286 raise Exception('Unexpected instruction object type: %s' % (sType,)); 1060 1287 1061 1288 return True; 1062 1289 1063 def transferConditionsToEncoding(oCondition, ao Encodesets, dPendingNotEq, sInstrNm, uDepth = 0, fMod = False):1290 def transferConditionsToEncoding(oCondition, aoFields, dPendingNotEq, sInstrNm, uDepth = 0, fMod = False): 1064 1291 """ 1065 1292 This is for dealing with stuff like asr_z_p_zi_ and lsr_z_p_zi_ which has … … 1079 1306 # Recurse into each side of an AND expression. 1080 1307 #print('debug transfer: %s: recursion...' % (sInstrNm,)); 1081 (oCondition.oLeft, fMod) = transferConditionsToEncoding(oCondition.oLeft, ao Encodesets, dPendingNotEq,1308 (oCondition.oLeft, fMod) = transferConditionsToEncoding(oCondition.oLeft, aoFields, dPendingNotEq, 1082 1309 sInstrNm, uDepth + 1, fMod); 1083 (oCondition.oRight, fMod) = transferConditionsToEncoding(oCondition.oRight, ao Encodesets, dPendingNotEq,1310 (oCondition.oRight, fMod) = transferConditionsToEncoding(oCondition.oRight, aoFields, dPendingNotEq, 1084 1311 sInstrNm, uDepth + 1, fMod); 1085 1312 if oCondition.oLeft.isBoolAndTrue(): … … 1096 1323 oValue = oCondition.oRight; 1097 1324 #print('debug transfer: %s: binaryop step 2...' % (sInstrNm,)); 1098 for oField in ao Encodesets: # ArmEncodesetField1325 for oField in aoFields: # ArmEncodesetField 1099 1326 if oField.sName and oField.sName == sFieldName: 1100 1327 # ArmAstInteger (unlikely): … … 1953 2180 # Organize this by instruction set, groups and instructions. 1954 2181 sPrevCategory = ''; 1955 for oInstr in sorted(g_aoAllArmInstructions, key = operator.attrgetter('sSet', 'asGroups')):2182 for oInstr in sorted(g_aoAllArmInstructions, key = ArmInstruction.getSetAndGroupNames): 1956 2183 # New group/category? 1957 sCategory = ' / '.join( [oInstr.sSet if oInstr.sSet else 'no-instr-set'] + oInstr.asGroups);2184 sCategory = ' / '.join(oInstr.getSetAndGroupNames(),); 1958 2185 if sCategory != sPrevCategory: 1959 2186 asLines += [ … … 1970 2197 # Emit the instruction stub. 1971 2198 asArgs = [ # Note! Must match generateDecoderFunctions exactly. 1972 oField.sName for oField in sorted(oInstr.ao Encodesets, key = operator.attrgetter('iFirstBit')) if oField.sName2199 oField.sName for oField in sorted(oInstr.aoFields, key = operator.attrgetter('iFirstBit')) if oField.sName 1973 2200 ]; 1974 2201 asLines += [ … … 1991 2218 1992 2219 def getFieldInfo(self, sName): 1993 oField = oInstr.getFieldByName(sName) 1994 return (sName, oField.cBitsWidth); 2220 oInstr = self.oInstr; 2221 oField = oInstr.getFieldByName(sName, False) 2222 if oField: 2223 return (sName, oField.cBitsWidth); 2224 # Look for the field in groups and sets and generate a name that extracts it from uOpcode: 2225 ## @todo eliminate conditions checks from the parent on parent fields that are fixed in the given instr. 2226 for oParent in oInstr.oParent.getUpIterator(): 2227 oField = oParent.getFieldByName(sName, False); 2228 if oField: 2229 return ('((uOpcode >> %u) & %#x)' % (oField.iFirstBit, oField.getMask()), oField.cBitsWidth); 2230 raise Exception('Field %s was not found for instruction %s' % (sName, oInstr.sName,)); 1995 2231 1996 2232 def convertFunctionCall(self, oCall): … … 2004 2240 sCpumFeature = g_dSpecFeatToCpumFeat.get(sFeatureNm, None); 2005 2241 if sCpumFeature is None: 2006 raise Exception('IsFeatureImplemented parameter not known: %s (see g_dSpecFeatToCpumFeat)' 2007 % (sFeatureNm)); 2008 if sCpumFeature is False: 2242 print('warning: IsFeatureImplemented parameter not known: %s (see g_dSpecFeatToCpumFeat)' % (sFeatureNm)); 2243 #raise Exception('IsFeatureImplemented parameter not known: %s (see g_dSpecFeatToCpumFeat)' 2244 # % (sFeatureNm)); 2245 if not isinstance(sCpumFeature, str): 2009 2246 return 'false /** @todo IEM_GET_GUEST_CPU_FEATURES(pVCpu)->%s*/' % (sFeatureNm,); 2010 2247 return 'IEM_GET_GUEST_CPU_FEATURES(pVCpu)->%s /*%s*/' % (sCpumFeature, sFeatureNm,) … … 2017 2254 '', 2018 2255 '/* %08x/%08x: %s' % (oInstr.fFixedMask, oInstr.fFixedValue, oInstr.sAsmDisplay,), 2019 ' Instruction Set: %s%s%s */' 2020 % (oInstr.sSet, ' Group: ' if oInstr.asGroups else '', ','.join(oInstr.asGroups),), 2256 ' %s */'% (oInstr.getSetAndGroupNamesWithLabels(),), 2021 2257 'FNIEMOP_DEF_1(iemDecodeA64_%s, uint32_t, uOpcode)' % (sCName,), 2022 2258 '{', … … 2042 2278 asArgs = []; 2043 2279 sLogFmt = ''; 2044 for oField in sorted(oInstr.ao Encodesets, key = operator.attrgetter('iFirstBit')): # ArmEncodesetField2280 for oField in sorted(oInstr.aoFields, key = operator.attrgetter('iFirstBit')): # ArmEncodesetField 2045 2281 if oField.sName: 2046 2282 asArgs.append(oField.sName);
Note:
See TracChangeset
for help on using the changeset viewer.