MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / ParseArchSyscalls

Function ParseArchSyscalls

Scripts/GenerateSyscallNumbers.py:78–119  ·  view source on GitHub ↗
(Defs, DefsDict, Arch, FilePath, IgnoreArch)

Source from the content-addressed store, hash-verified

76SyscallDefinitions = {}
77
78def ParseArchSyscalls(Defs, DefsDict, Arch, FilePath, IgnoreArch):
79 global NumArches
80 global SyscallDefinitions
81 syscall_file = open(FilePath, "r")
82 text_lines = syscall_file.readlines()
83 syscall_file.close()
84
85 NumArches += 1
86 for line in text_lines:
87 line = line.strip()
88
89 # Skip lines that are a comment
90 if line.startswith("#") or len(line) == 0:
91 continue
92
93 # Format: <Number> <ABI> <Name> <Entry Name>
94 split_text = line.split()
95
96 Num = split_text[0]
97 ABI = split_text[1]
98
99 # If the ABI is on the ignore list then don't store it
100 if ABI in IgnoreArch:
101 continue
102
103 Name = split_text[2]
104 if (len(split_text) < 4):
105 # This sometimes happens if the host doesn't have the entry
106 EntryName = "<None>"
107 else:
108 EntryName = split_text[3]
109
110 if Name in DefinitionRenameDict:
111 Name = DefinitionRenameDict[Name]
112
113 Def = SyscallDefinition(Arch, Num, ABI, Name, EntryName)
114
115 Defs.append(Def)
116 if not Name in SyscallDefinitions:
117 SyscallDefinitions[Name] = []
118
119 SyscallDefinitions[Name].append(Def)
120
121def ParseCommonArchSyscalls(Defs, DefsDict, Arch, FilePath):
122 global NumArches

Callers 1

mainFunction · 0.85

Calls 2

SyscallDefinitionClass · 0.85
appendMethod · 0.80

Tested by

no test coverage detected