generate_linux_syscalls: Generate syscalls for x32.

Also update the syscalls file based on Linux 6.10. No diffs other than x32.
This commit is contained in:
Alex Rønne Petersen 2024-10-16 06:07:51 +02:00
parent 43878f51d9
commit d61e4ef8b0
No known key found for this signature in database
3 changed files with 393 additions and 8 deletions

View File

@ -122,17 +122,11 @@ pub const SECCOMP = @import("linux/seccomp.zig");
pub const syscalls = @import("linux/syscalls.zig");
pub const SYS = switch (@import("builtin").cpu.arch) {
.x86 => syscalls.X86,
.x86_64 => syscalls.X64,
.aarch64, .aarch64_be => syscalls.Arm64,
.arc => syscalls.Arc,
.arm, .armeb, .thumb, .thumbeb => syscalls.Arm,
.aarch64, .aarch64_be => syscalls.Arm64,
.csky => syscalls.CSky,
.hexagon => syscalls.Hexagon,
.riscv32 => syscalls.RiscV32,
.riscv64 => syscalls.RiscV64,
.sparc => syscalls.Sparc,
.sparc64 => syscalls.Sparc64,
.loongarch64 => syscalls.LoongArch64,
.m68k => syscalls.M68k,
.mips, .mipsel => syscalls.MipsO32,
@ -140,9 +134,18 @@ pub const SYS = switch (@import("builtin").cpu.arch) {
.gnuabin32, .muslabin32 => syscalls.MipsN32,
else => syscalls.MipsN64,
},
.riscv32 => syscalls.RiscV32,
.riscv64 => syscalls.RiscV64,
.s390x => syscalls.S390x,
.sparc => syscalls.Sparc,
.sparc64 => syscalls.Sparc64,
.powerpc, .powerpcle => syscalls.PowerPC,
.powerpc64, .powerpc64le => syscalls.PowerPC64,
.s390x => syscalls.S390x,
.x86 => syscalls.X86,
.x86_64 => switch (builtin.abi) {
.gnux32, .muslx32 => syscalls.X32,
else => syscalls.X64,
},
.xtensa => syscalls.Xtensa,
else => @compileError("The Zig Standard Library is missing syscall definitions for the target CPU architecture"),
};

View File

@ -833,6 +833,372 @@ pub const X64 = enum(usize) {
mseal = 462,
};
pub const X32 = enum(usize) {
read = 0,
write = 1,
open = 2,
close = 3,
stat = 4,
fstat = 5,
lstat = 6,
poll = 7,
lseek = 8,
mmap = 9,
mprotect = 10,
munmap = 11,
brk = 12,
rt_sigprocmask = 14,
pread64 = 17,
pwrite64 = 18,
access = 21,
pipe = 22,
select = 23,
sched_yield = 24,
mremap = 25,
msync = 26,
mincore = 27,
madvise = 28,
shmget = 29,
shmat = 30,
shmctl = 31,
dup = 32,
dup2 = 33,
pause = 34,
nanosleep = 35,
getitimer = 36,
alarm = 37,
setitimer = 38,
getpid = 39,
sendfile = 40,
socket = 41,
connect = 42,
accept = 43,
sendto = 44,
shutdown = 48,
bind = 49,
listen = 50,
getsockname = 51,
getpeername = 52,
socketpair = 53,
clone = 56,
fork = 57,
vfork = 58,
exit = 60,
wait4 = 61,
kill = 62,
uname = 63,
semget = 64,
semop = 65,
semctl = 66,
shmdt = 67,
msgget = 68,
msgsnd = 69,
msgrcv = 70,
msgctl = 71,
fcntl = 72,
flock = 73,
fsync = 74,
fdatasync = 75,
truncate = 76,
ftruncate = 77,
getdents = 78,
getcwd = 79,
chdir = 80,
fchdir = 81,
rename = 82,
mkdir = 83,
rmdir = 84,
creat = 85,
link = 86,
unlink = 87,
symlink = 88,
readlink = 89,
chmod = 90,
fchmod = 91,
chown = 92,
fchown = 93,
lchown = 94,
umask = 95,
gettimeofday = 96,
getrlimit = 97,
getrusage = 98,
sysinfo = 99,
times = 100,
getuid = 102,
syslog = 103,
getgid = 104,
setuid = 105,
setgid = 106,
geteuid = 107,
getegid = 108,
setpgid = 109,
getppid = 110,
getpgrp = 111,
setsid = 112,
setreuid = 113,
setregid = 114,
getgroups = 115,
setgroups = 116,
setresuid = 117,
getresuid = 118,
setresgid = 119,
getresgid = 120,
getpgid = 121,
setfsuid = 122,
setfsgid = 123,
getsid = 124,
capget = 125,
capset = 126,
rt_sigsuspend = 130,
utime = 132,
mknod = 133,
personality = 135,
ustat = 136,
statfs = 137,
fstatfs = 138,
sysfs = 139,
getpriority = 140,
setpriority = 141,
sched_setparam = 142,
sched_getparam = 143,
sched_setscheduler = 144,
sched_getscheduler = 145,
sched_get_priority_max = 146,
sched_get_priority_min = 147,
sched_rr_get_interval = 148,
mlock = 149,
munlock = 150,
mlockall = 151,
munlockall = 152,
vhangup = 153,
modify_ldt = 154,
pivot_root = 155,
prctl = 157,
arch_prctl = 158,
adjtimex = 159,
setrlimit = 160,
chroot = 161,
sync = 162,
acct = 163,
settimeofday = 164,
mount = 165,
umount2 = 166,
swapon = 167,
swapoff = 168,
reboot = 169,
sethostname = 170,
setdomainname = 171,
iopl = 172,
ioperm = 173,
init_module = 175,
delete_module = 176,
quotactl = 179,
getpmsg = 181,
putpmsg = 182,
afs_syscall = 183,
tuxcall = 184,
security = 185,
gettid = 186,
readahead = 187,
setxattr = 188,
lsetxattr = 189,
fsetxattr = 190,
getxattr = 191,
lgetxattr = 192,
fgetxattr = 193,
listxattr = 194,
llistxattr = 195,
flistxattr = 196,
removexattr = 197,
lremovexattr = 198,
fremovexattr = 199,
tkill = 200,
time = 201,
futex = 202,
sched_setaffinity = 203,
sched_getaffinity = 204,
io_destroy = 207,
io_getevents = 208,
io_cancel = 210,
lookup_dcookie = 212,
epoll_create = 213,
remap_file_pages = 216,
getdents64 = 217,
set_tid_address = 218,
restart_syscall = 219,
semtimedop = 220,
fadvise64 = 221,
timer_settime = 223,
timer_gettime = 224,
timer_getoverrun = 225,
timer_delete = 226,
clock_settime = 227,
clock_gettime = 228,
clock_getres = 229,
clock_nanosleep = 230,
exit_group = 231,
epoll_wait = 232,
epoll_ctl = 233,
tgkill = 234,
utimes = 235,
mbind = 237,
set_mempolicy = 238,
get_mempolicy = 239,
mq_open = 240,
mq_unlink = 241,
mq_timedsend = 242,
mq_timedreceive = 243,
mq_getsetattr = 245,
add_key = 248,
request_key = 249,
keyctl = 250,
ioprio_set = 251,
ioprio_get = 252,
inotify_init = 253,
inotify_add_watch = 254,
inotify_rm_watch = 255,
migrate_pages = 256,
openat = 257,
mkdirat = 258,
mknodat = 259,
fchownat = 260,
futimesat = 261,
fstatat64 = 262,
unlinkat = 263,
renameat = 264,
linkat = 265,
symlinkat = 266,
readlinkat = 267,
fchmodat = 268,
faccessat = 269,
pselect6 = 270,
ppoll = 271,
unshare = 272,
splice = 275,
tee = 276,
sync_file_range = 277,
utimensat = 280,
epoll_pwait = 281,
signalfd = 282,
timerfd_create = 283,
eventfd = 284,
fallocate = 285,
timerfd_settime = 286,
timerfd_gettime = 287,
accept4 = 288,
signalfd4 = 289,
eventfd2 = 290,
epoll_create1 = 291,
dup3 = 292,
pipe2 = 293,
inotify_init1 = 294,
perf_event_open = 298,
fanotify_init = 300,
fanotify_mark = 301,
prlimit64 = 302,
name_to_handle_at = 303,
open_by_handle_at = 304,
clock_adjtime = 305,
syncfs = 306,
setns = 308,
getcpu = 309,
kcmp = 312,
finit_module = 313,
sched_setattr = 314,
sched_getattr = 315,
renameat2 = 316,
seccomp = 317,
getrandom = 318,
memfd_create = 319,
kexec_file_load = 320,
bpf = 321,
userfaultfd = 323,
membarrier = 324,
mlock2 = 325,
copy_file_range = 326,
pkey_mprotect = 329,
pkey_alloc = 330,
pkey_free = 331,
statx = 332,
io_pgetevents = 333,
rseq = 334,
pidfd_send_signal = 424,
io_uring_setup = 425,
io_uring_enter = 426,
io_uring_register = 427,
open_tree = 428,
move_mount = 429,
fsopen = 430,
fsconfig = 431,
fsmount = 432,
fspick = 433,
pidfd_open = 434,
clone3 = 435,
close_range = 436,
openat2 = 437,
pidfd_getfd = 438,
faccessat2 = 439,
process_madvise = 440,
epoll_pwait2 = 441,
mount_setattr = 442,
quotactl_fd = 443,
landlock_create_ruleset = 444,
landlock_add_rule = 445,
landlock_restrict_self = 446,
memfd_secret = 447,
process_mrelease = 448,
futex_waitv = 449,
set_mempolicy_home_node = 450,
cachestat = 451,
fchmodat2 = 452,
map_shadow_stack = 453,
futex_wake = 454,
futex_wait = 455,
futex_requeue = 456,
statmount = 457,
listmount = 458,
lsm_get_self_attr = 459,
lsm_set_self_attr = 460,
lsm_list_modules = 461,
mseal = 462,
rt_sigaction = 512,
rt_sigreturn = 513,
ioctl = 514,
readv = 515,
writev = 516,
recvfrom = 517,
sendmsg = 518,
recvmsg = 519,
execve = 520,
ptrace = 521,
rt_sigpending = 522,
rt_sigtimedwait = 523,
rt_sigqueueinfo = 524,
sigaltstack = 525,
timer_create = 526,
mq_notify = 527,
kexec_load = 528,
waitid = 529,
set_robust_list = 530,
get_robust_list = 531,
vmsplice = 532,
move_pages = 533,
preadv = 534,
pwritev = 535,
rt_tgsigqueueinfo = 536,
recvmmsg = 537,
sendmmsg = 538,
process_vm_readv = 539,
process_vm_writev = 540,
setsockopt = 541,
getsockopt = 542,
io_setup = 543,
io_submit = 544,
execveat = 545,
preadv2 = 546,
pwritev2 = 547,
};
pub const Arm = enum(usize) {
const arm_base = 0x0f0000;

View File

@ -162,6 +162,22 @@ const arch_infos = [_]ArchInfo{
.additional_enum = null,
},
},
.{
.table = .{
.name = "x32",
.enum_name = "X32",
.file_path = "arch/x86/entry/syscalls/syscall_64.tbl",
.process_file = &processTableBasedArch,
.filters = .{
.abiCheckParams = .{ .abi = "64", .flow = .@"continue" },
.fixedName = &fixedName,
.isReservedNameOld = null,
},
.header = null,
.extra_values = null,
.additional_enum = null,
},
},
.{
.table = .{
.name = "arm",