| 223 | print("};") |
| 224 | |
| 225 | def ExportCommonSyscallDefines(): |
| 226 | global Definitions_Arm64 |
| 227 | global SyscallDefinitions |
| 228 | |
| 229 | print("enum FEX_Syscalls_Common {") |
| 230 | for Def in Definitions_Arm64: |
| 231 | # Check the dict to ensure the definitions exist everywhere |
| 232 | if not Def.Name in SyscallDefinitions: |
| 233 | continue |
| 234 | |
| 235 | Defs = SyscallDefinitions[Def.Name] |
| 236 | if len(Defs) != NumArches: |
| 237 | continue |
| 238 | |
| 239 | Number = Def.Number |
| 240 | Matches = True |
| 241 | for AllDef in Defs: |
| 242 | if AllDef.Number != Def.Number: |
| 243 | Matches = False |
| 244 | |
| 245 | if not Matches: |
| 246 | continue |
| 247 | |
| 248 | for AllDef in Defs: |
| 249 | if AllDef.EntryName == "<None>": |
| 250 | print(" // {} No entrypoint. -ENOSYS".format(AllDef.Arch)) |
| 251 | |
| 252 | print(" SYS_{} = {},".format(Def.Name, Def.Number)) |
| 253 | |
| 254 | |
| 255 | # Find a max between all architectures |
| 256 | Maximums = [] |
| 257 | for Defs in [Definitions_x64, Definitions_x86, Definitions_Arm64]: |
| 258 | Maximums.append(1 << (int(math.log(len(Defs), 2)) + 1)) |
| 259 | print(" SYSCALL_MAX = {},".format(max(Maximums))) |
| 260 | |
| 261 | print("};") |
| 262 | |
| 263 | |
| 264 | def main(): |