diff --git a/Scripts/GenerateSyscallNumbers.py b/Scripts/GenerateSyscallNumbers.py index fe69987ec..466eada1f 100755 --- a/Scripts/GenerateSyscallNumbers.py +++ b/Scripts/GenerateSyscallNumbers.py @@ -6,6 +6,16 @@ import logging logger = logging.getLogger() logger.setLevel(logging.WARNING) +# Usage of this script is `Scripts/GenerateSyscallNumbers.py ` +# This will then parse the syscall headers and format them in an enum +# Then this will be output in stdout +# This output should then be checked and copied to the following headers, splitting up the enums: +# - Source/Tests/LinuxSyscalls/x32/SyscallsEnum.h +# - Source/Tests/LinuxSyscalls/x64/SyscallsEnum.h +# - Source/Tests/LinuxSyscalls/Arm64/SyscallsEnum.h +# `FEX_Syscalls_Common` is provided in the output as just an indicator for which syscalls are using the common +# syscall interface. + @dataclass class SyscallDefinition: arch: str @@ -44,6 +54,14 @@ Syscallx64File = "/arch/x86/entry/syscalls/syscall_64.tbl" Syscallx86File = "/arch/x86/entry/syscalls/syscall_32.tbl" SyscallArm64File = "/include/uapi/asm-generic/unistd.h" +# Syscall names that had naming conflict with some global definitions +# Renamed to work around that issue +DefinitionRenameDict = { + "pread64": "pread_64", + "pwrite64": "pwrite_64", + "prlimit64": "prlimit_64" +} + Definitions_x64 = [] Definitions_x64_dict = {} Definitions_x86 = [] @@ -86,6 +104,9 @@ def ParseArchSyscalls(Defs, DefsDict, Arch, FilePath, IgnoreArch): else: EntryName = split_text[3] + if Name in DefinitionRenameDict: + Name = DefinitionRenameDict[Name] + Def = SyscallDefinition(Arch, Num, ABI, Name, EntryName) Defs.append(Def) @@ -154,6 +175,9 @@ def ParseCommonArchSyscalls(Defs, DefsDict, Arch, FilePath): ABI = Arch EntryName = split_text[1].strip().split(")")[0] + if Name in DefinitionRenameDict: + Name = DefinitionRenameDict[Name] + Def = SyscallDefinition(Arch, Num, ABI, Name, EntryName) Defs.append(Def)