mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 10:00:16 +02:00
Scripts: Updates generate syscall numbers to support renaming
Instead of manually renaming the three syscalls each time, let the script do it automatically.
This commit is contained in:
1 parent
3bc4df7295
commit
82319c9deb
1 file changed
+24
@@ -6,6 +6,16 @@ import logging
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.WARNING)
|
||||
|
||||
# Usage of this script is `Scripts/GenerateSyscallNumbers.py <Path to Linux directory>`
|
||||
# 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)
|
||||
|
||||
Reference in new issue
Block a user