From 683f205402a99cfc8cea46c83ce9b46a42616d42 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 16 Dec 2023 12:40:10 +0100 Subject: All kinds of stuff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- linux/errors.c | 47 ++++++---- linux/linux-support.mk | 60 ++++++++---- linux/signals.c | 47 ++++++---- linux/structs.c | 248 +++++++++++++++++++++++++++++++++++++++++++++++++ linux/structs.mk | 4 + linux/symbols.c | 29 +----- linux/syscall-table.c | 12 +-- linux/syscall-table.mk | 14 ++- linux/syscalls.h | 187 +++++++++++++++++-------------------- linux/syscalls.mk | 4 +- linux/types.c | 6 +- 11 files changed, 466 insertions(+), 192 deletions(-) create mode 100644 linux/structs.c create mode 100644 linux/structs.mk (limited to 'linux') diff --git a/linux/errors.c b/linux/errors.c index 94c3cd2..0b1c2ea 100644 --- a/linux/errors.c +++ b/linux/errors.c @@ -14,7 +14,8 @@ get_linux_syscall_errors(enum libsyscalls_arch arch, const struct libsyscalls_na goto out switch ((int)arch) { - case LIBSYSCALLS_ARCH_ALPHA: + case LIBSYSCALLS_ARCH_ALPHA_LE: + case LIBSYSCALLS_ARCH_ALPHA_BE: #ifdef LIST_LINUX_ERRORS_FOR_ALPHA CASE(alpha); #else @@ -30,15 +31,18 @@ get_linux_syscall_errors(enum libsyscalls_arch arch, const struct libsyscalls_na break; #endif - case LIBSYSCALLS_ARCH_ARM_OABI: - case LIBSYSCALLS_ARCH_ARM_EABI: + case LIBSYSCALLS_ARCH_ARM_OABI_LE: + case LIBSYSCALLS_ARCH_ARM_OABI_BE: + case LIBSYSCALLS_ARCH_ARM_EABI_LE: + case LIBSYSCALLS_ARCH_ARM_EABI_BE: #ifdef LIST_LINUX_ERRORS_FOR_ARM CASE(arm); #else break; #endif - case LIBSYSCALLS_ARCH_IA64: + case LIBSYSCALLS_ARCH_IA64_LE: + case LIBSYSCALLS_ARCH_IA64_BE: #ifdef LIST_LINUX_ERRORS_FOR_IA64 CASE(ia64); #else @@ -52,16 +56,20 @@ get_linux_syscall_errors(enum libsyscalls_arch arch, const struct libsyscalls_na break; #endif - case LIBSYSCALLS_ARCH_MICROBLAZE: -#ifdef LIST_LINUX_ERRORS_FOR_MICROBLAZE + case LIBSYSCALLS_ARCH_MICROBLAZE_32_LE: + case LIBSYSCALLS_ARCH_MICROBLAZE_32_BE: +#ifdef LIST_LINUX_ERRORS_FOR_MICROBLAZE_32 CASE(microblaze); #else break; #endif - case LIBSYSCALLS_ARCH_MIPS_O32: - case LIBSYSCALLS_ARCH_MIPS_N32: - case LIBSYSCALLS_ARCH_MIPS_N64: + case LIBSYSCALLS_ARCH_MIPS_O32_LE: + case LIBSYSCALLS_ARCH_MIPS_O32_BE: + case LIBSYSCALLS_ARCH_MIPS_N32_LE: + case LIBSYSCALLS_ARCH_MIPS_N32_BE: + case LIBSYSCALLS_ARCH_MIPS_N64_LE: + case LIBSYSCALLS_ARCH_MIPS_N64_BE: #ifdef LIST_LINUX_ERRORS_FOR_MIPS CASE(mips); #else @@ -76,10 +84,14 @@ get_linux_syscall_errors(enum libsyscalls_arch arch, const struct libsyscalls_na break; #endif - case LIBSYSCALLS_ARCH_POWERPC_32: - case LIBSYSCALLS_ARCH_POWERPC_64: - case LIBSYSCALLS_ARCH_POWERPC_NOSPU: - case LIBSYSCALLS_ARCH_POWERPC_SPU: + case LIBSYSCALLS_ARCH_POWERPC_32_LE: + case LIBSYSCALLS_ARCH_POWERPC_32_BE: + case LIBSYSCALLS_ARCH_POWERPC_64_LE: + case LIBSYSCALLS_ARCH_POWERPC_64_BE: + case LIBSYSCALLS_ARCH_POWERPC_NOSPU_LE: + case LIBSYSCALLS_ARCH_POWERPC_NOSPU_BE: + case LIBSYSCALLS_ARCH_POWERPC_SPU_LE: + case LIBSYSCALLS_ARCH_POWERPC_SPU_BE: #ifdef LIST_LINUX_ERRORS_FOR_POWERPC CASE(powerpc); #else @@ -94,7 +106,8 @@ get_linux_syscall_errors(enum libsyscalls_arch arch, const struct libsyscalls_na break; #endif - case LIBSYSCALLS_ARCH_SH: + case LIBSYSCALLS_ARCH_SH_LE: + case LIBSYSCALLS_ARCH_SH_BE: #ifdef LIST_LINUX_ERRORS_FOR_SH CASE(sh); #else @@ -102,14 +115,16 @@ get_linux_syscall_errors(enum libsyscalls_arch arch, const struct libsyscalls_na #endif case LIBSYSCALLS_ARCH_SPARC_32: - case LIBSYSCALLS_ARCH_SPARC_64: + case LIBSYSCALLS_ARCH_SPARC_64_LE: + case LIBSYSCALLS_ARCH_SPARC_64_BE: #ifdef LIST_LINUX_ERRORS_FOR_SPARC CASE(sparc); #else break; #endif - case LIBSYSCALLS_ARCH_XTENSA: + case LIBSYSCALLS_ARCH_XTENSA_LE: + case LIBSYSCALLS_ARCH_XTENSA_BE: #ifdef LIST_LINUX_ERRORS_FOR_XTENSA CASE(xtensa); #else diff --git a/linux/linux-support.mk b/linux/linux-support.mk index c4a3f94..6756e87 100644 --- a/linux/linux-support.mk +++ b/linux/linux-support.mk @@ -6,30 +6,45 @@ LINUX_VERSION = 6.6 # works afterwards SUPPORTED_LINUX_ARCHES =\ - ALPHA\ + ALPHA_LE\ + ALPHA_BE\ AMD64\ AMD64_X32\ - ARM_OABI\ - ARM_EABI\ - IA64\ + ARM_OABI_LE\ + ARM_OABI_BE\ + ARM_EABI_LE\ + ARM_EABI_BE\ + IA64_LE\ + IA64_BE\ M68K\ - MICROBLAZE\ - MIPS_O32\ - MIPS_N32\ - MIPS_N64\ + MICROBLAZE_32_LE\ + MICROBLAZE_32_BE\ + MIPS_O32_LE\ + MIPS_O32_BE\ + MIPS_N32_LE\ + MIPS_N32_BE\ + MIPS_N64_LE\ + MIPS_N64_BE\ PARISC_32\ PARISC_64\ - POWERPC_32\ - POWERPC_64\ - POWERPC_NOSPU\ - POWERPC_SPU\ + POWERPC_32_LE\ + POWERPC_32_BE\ + POWERPC_64_LE\ + POWERPC_64_BE\ + POWERPC_NOSPU_LE\ + POWERPC_NOSPU_BE\ + POWERPC_SPU_LE\ + POWERPC_SPU_BE\ S390_32\ S390_64\ - SH\ + SH_LE\ + SH_BE\ SPARC_32\ - SPARC_64\ + SPARC_64_LE\ + SPARC_64_BE\ I386\ - XTENSA + XTENSA_LE\ + XTENSA_BE OPERATING_SYSTEMS += linux NPARAMS += 8 @@ -45,6 +60,7 @@ include linux/download.mk include linux/errors.mk include linux/integers.mk include linux/signals.mk +include linux/structs.mk include linux/syscalls.mk include linux/syscall-table.mk include linux/symbols.mk @@ -57,4 +73,16 @@ generated/linux-arches.h: linux/linux-support.mk mkdir -p -- generated (printf '\43define LIST_LINUX_ARCHES(X, D)\\\n' && \ printf '\tX(%s) D\\\n' $(SUPPORTED_LINUX_ARCHES); \ - ) | sed '$$s/ D\\//' > $@ + ) | sed '/X()/d' | sed '$$s/\\$$//' | sed '$$s/ D$$//' > $@ + (printf '\43define LIST_LINUX_ARCHES_WITH_BIENDIAN(X, D)\\\n' && \ + printf '\tX(%s) D\\\n' $(SUPPORTED_LINUX_ARCHES) \ + | sed -n 's/_LE)/)/p'; \ + ) | sed '/X()/d' | sed '$$s/\\$$//' | sed '$$s/ D$$//' >> $@ + (printf '\43define LIST_LINUX_ARCHES_WITH_UNIENDIAN(X, D)\\\n' && \ + printf '\tX(%s) D\\\n' $(SUPPORTED_LINUX_ARCHES); \ + ) | sed '/_[LB]E)/d' \ + | sed '/X()/d' | sed '$$s/\\$$//' | sed '$$s/ D$$//' >> $@ + (printf '\43define LIST_LINUX_ARCHES_WITHOUT_ENDIANS(X, D)\\\n' && \ + printf '\tX(%s) D\\\n' $(SUPPORTED_LINUX_ARCHES); \ + ) | sed 's/_[LB]E)/)/' | uniq \ + | sed '/X()/d' | sed '$$s/\\$$//' | sed '$$s/ D$$//' >> $@ diff --git a/linux/signals.c b/linux/signals.c index 743fc89..7adc44c 100644 --- a/linux/signals.c +++ b/linux/signals.c @@ -14,7 +14,8 @@ get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_num goto out switch ((int)arch) { - case LIBSYSCALLS_ARCH_ALPHA: + case LIBSYSCALLS_ARCH_ALPHA_LE: + case LIBSYSCALLS_ARCH_ALPHA_BE: #ifdef LIST_LINUX_SIGNALS_FOR_ALPHA CASE(alpha); #else @@ -30,15 +31,18 @@ get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_num break; #endif - case LIBSYSCALLS_ARCH_ARM_OABI: - case LIBSYSCALLS_ARCH_ARM_EABI: + case LIBSYSCALLS_ARCH_ARM_OABI_LE: + case LIBSYSCALLS_ARCH_ARM_OABI_BE: + case LIBSYSCALLS_ARCH_ARM_EABI_LE: + case LIBSYSCALLS_ARCH_ARM_EABI_BE: #ifdef LIST_LINUX_SIGNALS_FOR_ARM CASE(arm); #else break; #endif - case LIBSYSCALLS_ARCH_IA64: + case LIBSYSCALLS_ARCH_IA64_LE: + case LIBSYSCALLS_ARCH_IA64_BE: #ifdef LIST_LINUX_SIGNALS_FOR_IA64 CASE(ia64); #else @@ -52,16 +56,20 @@ get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_num break; #endif - case LIBSYSCALLS_ARCH_MICROBLAZE: -#ifdef LIST_LINUX_SIGNALS_FOR_MICROBLAZE + case LIBSYSCALLS_ARCH_MICROBLAZE_32_LE: + case LIBSYSCALLS_ARCH_MICROBLAZE_32_BE: +#ifdef LIST_LINUX_SIGNALS_FOR_MICROBLAZE_32 CASE(microblaze); #else break; #endif - case LIBSYSCALLS_ARCH_MIPS_O32: - case LIBSYSCALLS_ARCH_MIPS_N32: - case LIBSYSCALLS_ARCH_MIPS_N64: + case LIBSYSCALLS_ARCH_MIPS_O32_LE: + case LIBSYSCALLS_ARCH_MIPS_O32_BE: + case LIBSYSCALLS_ARCH_MIPS_N32_LE: + case LIBSYSCALLS_ARCH_MIPS_N32_BE: + case LIBSYSCALLS_ARCH_MIPS_N64_LE: + case LIBSYSCALLS_ARCH_MIPS_N64_BE: #ifdef LIST_LINUX_SIGNALS_FOR_MIPS CASE(mips); #else @@ -76,10 +84,14 @@ get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_num break; #endif - case LIBSYSCALLS_ARCH_POWERPC_32: - case LIBSYSCALLS_ARCH_POWERPC_64: - case LIBSYSCALLS_ARCH_POWERPC_NOSPU: - case LIBSYSCALLS_ARCH_POWERPC_SPU: + case LIBSYSCALLS_ARCH_POWERPC_32_LE: + case LIBSYSCALLS_ARCH_POWERPC_32_BE: + case LIBSYSCALLS_ARCH_POWERPC_64_LE: + case LIBSYSCALLS_ARCH_POWERPC_64_BE: + case LIBSYSCALLS_ARCH_POWERPC_NOSPU_LE: + case LIBSYSCALLS_ARCH_POWERPC_NOSPU_BE: + case LIBSYSCALLS_ARCH_POWERPC_SPU_LE: + case LIBSYSCALLS_ARCH_POWERPC_SPU_BE: #ifdef LIST_LINUX_SIGNALS_FOR_POWERPC CASE(powerpc); #else @@ -94,7 +106,8 @@ get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_num break; #endif - case LIBSYSCALLS_ARCH_SH: + case LIBSYSCALLS_ARCH_SH_LE: + case LIBSYSCALLS_ARCH_SH_BE: #ifdef LIST_LINUX_SIGNALS_FOR_SH CASE(sh); #else @@ -102,14 +115,16 @@ get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_num #endif case LIBSYSCALLS_ARCH_SPARC_32: - case LIBSYSCALLS_ARCH_SPARC_64: + case LIBSYSCALLS_ARCH_SPARC_64_LE: + case LIBSYSCALLS_ARCH_SPARC_64_BE: #ifdef LIST_LINUX_SIGNALS_FOR_SPARC CASE(sparc); #else break; #endif - case LIBSYSCALLS_ARCH_XTENSA: + case LIBSYSCALLS_ARCH_XTENSA_LE: + case LIBSYSCALLS_ARCH_XTENSA_BE: #ifdef LIST_LINUX_SIGNALS_FOR_XTENSA CASE(xtensa); #else diff --git a/linux/structs.c b/linux/structs.c new file mode 100644 index 0000000..d9ac2d7 --- /dev/null +++ b/linux/structs.c @@ -0,0 +1,248 @@ +/* See LICENSE file for copyright and license details. */ + +/* This file is included from ../libsyscalls_get_struct_description.c */ + + +/* Don't forget to add new ones to ../libsyscalls.h */ +#define LIST_LINUX_STRUCTS(X, D)\ + X(STRUCT, AIO_SIGSET, 0 /* TODO bitmask */,\ + FIELD("sigmask", ULONG_ARRAY, IN, INPTR),\ + FIELD("sigsetsize", SIZE, IN)) D\ + X(STRUCT, COMPAT_AIO_SIGSET, 0 /* TODO bitmask */,\ + FIELD("sigmask", UINT32, IN, OUT),\ + FIELD("sigsetsize", UINT32, IN, OUT)) D\ + X(STRUCT, CACHESTAT, 0,\ + FIELD("nr_cache", UINT64, IN, OUT),\ + FIELD("nr_dirty", UINT64, IN, OUT),\ + FIELD("nr_writeback", UINT64, IN, OUT),\ + FIELD("nr_evicted", UINT64, IN, OUT),\ + FIELD("nr_recently_evicted", UINT64, IN, OUT)) D\ + X(STRUCT, CACHESTAT_RANGE, 0,\ + FIELD("off", UINT64, IN, OUT),\ + FIELD("len", UINT64, IN, OUT)) D\ + X(STRUCT, CLONE_ARGS, 0, /* TODO which fields are IN and OUT? */\ + FIELD("flags", UINT64, IN) /* TODO bitmask */,\ + FIELD("pidfd", UINT64, IN) /* TODO actually (int *) */,\ + FIELD("child_tid", UINT64, IN) /* TODO actually (pid_t *) */,\ + FIELD("parent_tid", UINT64, IN) /* TODO actually (pid_t *) */,\ + FIELD("exit_signal", UINT64, IN) /* TODO actually INT_SIGNAL */,\ + FIELD("stack", UINT64, IN),\ + FIELD("stack_size", UINT64, IN),\ + FIELD("tls", UINT64, IN), /* TODO actually MEMORY_ADDRESS */\ + /* Since Linux 5.5: */\ + FIELD("set_tid", UINT64, IN), /* TODO acually (pid_t *) with count in next field */\ + FIELD("set_tid_size", UINT64, IN),\ + FIELD("cgroup", UINT64, IN)) /* TODO actually INT_FD */ D\ + X(STRUCT, EPOLL_EVENT, 0, /* TODO different in libc */\ + FIELD("events", UINT, IN, OUT) /* TODO bitmask */,\ + FIELD("data", UINT64, PARTIAL, IN, OUT)) D\ + X(STRUCT, OABI_EPOLL_EVENT, 0, /* TODO different in libc */\ + FIELD("events", UINT, IN, OUT) /* TODO bitmask */,\ + FIELD("data", UINT64_FRONT_32, PARTIAL, IN, OUT),\ + FIELD("data", UINT64_BACK_32, PARTIAL, IN, OUT)) D\ + X(STRUCT, FILE_HANDLE, 0) D /* TODO */\ + X(STRUCT, FUTEX_WAITV, 0,\ + FIELD("val", UINT64, IN, OUT),\ + FIELD("uaddr", UINT64, IN, OUT), /* TODO actually (void *) */\ + FIELD("flags", UINT32, IN, OUT), /* TODO bitmask */\ + FIELD(NULL, UINT32, IN, OUT)) D\ + X(STRUCT, IOB, 0) D /* TODO */\ + X(STRUCT, IOVEC, 0) D /* TODO */\ + X(STRUCT, IO_EVENT, 0,\ + FIELD("data", UINT64, IN, OUT),\ + FIELD("obj", UINT64, IN, OUT),\ + FIELD("res", INT64, IN, OUT),\ + FIELD("res2", INT64, IN, OUT)) D\ + X(STRUCT, IO_URING_PARAMS, 0) D /* TODO */\ + X(STRUCT, ITIMERSPEC, 0,\ + FIELD("it_interval", STRUCT_TIMESPEC, IN, OUT),\ + FIELD("it_value", STRUCT_TIMESPEC, IN, OUT)) D\ + X(STRUCT, ITIMERSPEC64, 0,\ + FIELD("it_interval", STRUCT_TIMESPEC64, IN, OUT),\ + FIELD("it_value", STRUCT_TIMESPEC64, IN, OUT)) D\ + X(STRUCT, KEXEC_SEGMENT, 0) D /* TODO */\ + X(STRUCT, COMPAT_KEXEC_SEGMENT, 0) D /* TODO */\ + X(STRUCT, LANDLOCK_RULESET_ATTR, 0) D /* TODO */\ + X(STRUCT, LINUX_DIRENT, 0) D /* TODO */\ + X(STRUCT, LINUX_DIRENT64, 0) D /* TODO */\ + X(STRUCT, MMAP_ARG_STRUCT, 0) D /* TODO */\ + X(STRUCT, MMSGHDR, 0) D /* TODO */\ + X(STRUCT, MOUNT_ATTR, 0) D /* TODO */\ + X(STRUCT, MQ_ATTR, 0) D /* TODO */\ + X(STRUCT, MSGBUF, 0) D /* TODO */\ + X(STRUCT, MSGHDR, 0) D /* TODO */\ + X(STRUCT, MSQID_DS, 0) D /* TODO */\ + X(STRUCT, NEW_UTSNAME, 0,\ + FIELD("sysname", BUFFER_65, OUT),\ + FIELD("nodename", BUFFER_65, OUT),\ + FIELD("release", BUFFER_65, OUT),\ + FIELD("version", BUFFER_65, OUT),\ + FIELD("machine", BUFFER_65, OUT),\ + FIELD("domainname", BUFFER_65, OUT)) D\ + X(STRUCT, OLDOLD_UTSNAME, 0,\ + FIELD("sysname", BUFFER_9, OUT),\ + FIELD("nodename", BUFFER_9, OUT),\ + FIELD("release", BUFFER_9, OUT),\ + FIELD("version", BUFFER_9, OUT),\ + FIELD("machine", BUFFER_9, OUT)) D\ + X(STRUCT, OLD_ITIMERSPEC32, 0,\ + FIELD("it_interval", STRUCT_OLD_TIMESPEC32, IN, OUT),\ + FIELD("it_value", STRUCT_OLD_TIMESPEC32, IN, OUT)) D\ + X(STRUCT, ITIMERVAL, 0,\ + FIELD("it_interval", STRUCT_TIMEVAL, IN, OUT),\ + FIELD("it_value", STRUCT_TIMEVAL, IN, OUT)) D\ + X(STRUCT, OLD_ITIMERVAL, 0,\ + FIELD("it_interval", STRUCT_OLD_TIMEVAL, IN, OUT),\ + FIELD("it_value", STRUCT_OLD_TIMEVAL, IN, OUT)) D\ + X(STRUCT, OLD_LINUX_DIRENT, 0) D /* TODO */\ + X(STRUCT, OLD_SIGACTION, 0) D /* TODO */\ + X(STRUCT, OLD_STAT, 0) D /* TODO */\ + X(STRUCT, OLD_TIMESPEC32, 0) D /* TODO */\ + X(STRUCT, OLD_TIMEVAL, 0) D /* TODO */\ + X(STRUCT, OLD_TIMEVAL32, 0) D /* TODO */\ + X(STRUCT, OLD_TIMEX32, 0) D /* TODO */\ + X(STRUCT, OLD_UTIMBUF32, 0) D /* TODO */\ + X(STRUCT, OLD_UTSNAME, 0,\ + FIELD("sysname", BUFFER_65, OUT),\ + FIELD("nodename", BUFFER_65, OUT),\ + FIELD("release", BUFFER_65, OUT),\ + FIELD("version", BUFFER_65, OUT),\ + FIELD("machine", BUFFER_65, OUT)) D\ + X(STRUCT, OPEN_HOW, 0) D /* TODO */\ + X(STRUCT, PERF_EVENT_ATTR, 0) D /* TODO */\ + X(STRUCT, POLLFD, 0,\ + FIELD("pollfd", INT_FD, IN),\ + FIELD("events", SHORT, IN), /* TODO bitmask */\ + FIELD("revents", SHORT, OUT)) D /* TODO bitmask */\ + X(STRUCT, RLIMIT, 0,\ + FIELD("rlim_cur", ULONG, IN, OUT),\ + FIELD("rlim_max", ULONG, IN, OUT)) D\ + X(STRUCT, RLIMIT64, 0,\ + FIELD("rlim_cur", UINT64, IN, OUT),\ + FIELD("rlim_max", UINT64, IN, OUT)) D\ + X(STRUCT, COMPAT_RLIMIT, 0,\ + FIELD("rlim_cur", UINT32, IN, OUT),\ + FIELD("rlim_max", UINT32, IN, OUT)) D\ + X(STRUCT, ROBUST_LIST_HEAD, 0) D /* TODO */\ + X(STRUCT, RSEQ, 0) D /* TODO */\ + X(STRUCT, RUSAGE, 0) D /* TODO */\ + X(STRUCT, SCHED_ATTR, 0,\ + FIELD("size", UINT32, IN, OUT),\ + FIELD("sched_policy", UINT32, IN, OUT),\ + FIELD("sched_flags", UINT64, IN, OUT),\ + FIELD("sched_nice", INT32, IN, OUT),\ + FIELD("sched_priority", UINT32, IN, OUT),\ + FIELD("sched_runtime", UINT64, IN, OUT),\ + FIELD("sched_deadline", UINT32, IN, OUT),\ + FIELD("sched_period", UINT32, IN, OUT)) D\ + X(STRUCT, SCHED_PARAM, 0,\ + FIELD("sched_priority", INT, IN, OUT)) D\ + X(STRUCT, SEL_ARG_STRUCT, 0) D /* TODO */\ + X(STRUCT, SEMBUF, 0,\ + FIELD("sem_num", USHORT, IN, OUT),\ + FIELD("sem_op", SHORT, IN, OUT), /* TODO enum */\ + FIELD("sem_flg", SHORT, IN, OUT)) D /* TODO bitmask */\ + X(STRUCT, SEMID_DS, 0) D /* TODO */\ + X(STRUCT, SHMID_DS, 0) D /* TODO */\ + X(STRUCT, SIGACTION, 0) D /* TODO */\ + X(STRUCT, SIGALTSTACK, 0) D /* TODO */\ + X(STRUCT, SIGEVENT, 0) D /* TODO */\ + X(STRUCT, SIGINFO, 0) D /* TODO */\ + X(STRUCT, SOCKADDR, 0) D /* TODO */\ + X(STRUCT, STAT, 0) D /* TODO */\ + X(STRUCT, STAT64, 0) D /* TODO */\ + X(STRUCT, STATFS, 0) D /* TODO */\ + X(STRUCT, STATFS64, 0) D /* TODO */\ + X(STRUCT, STATX, 0) D /* TODO */\ + X(STRUCT, SYSINFO, 0) D /* TODO */\ + X(STRUCT, TIMESPEC, 0) D /* TODO */\ + X(STRUCT, TIMESPEC64, 0) D /* TODO */\ + X(STRUCT, TIMEVAL, 0) D /* TODO */\ + X(STRUCT, TIMEX, 0) D /* TODO */\ + X(STRUCT, TIMEZONE, 0) D /* TODO */\ + X(STRUCT, TMS, 0) D /* TODO */\ + X(STRUCT, USTAT, 0) D /* TODO */\ + X(STRUCT, UTIMBUF, 0) D /* TODO */\ + X(UNION, BPF_ATTR, 0) /* TODO */ + + +#define X(TYPE, NAME, ...)\ + static struct libsyscalls_structure_description linux_##TYPE##_##NAME##_prototype = TYPE(__VA_ARGS__) + LIST_LINUX_STRUCTS(X, ;); +#undef X + + +static enum libsyscalls_error +fix_linux_struct_description(enum libsyscalls_arch arch, enum libsyscalls_datatype datatype, unsigned class, + const void *data, size_t data_size, struct libsyscalls_structure_description *description) +{ + switch ((int)datatype) { + case LIBSYSCALLS_TYPE_STRUCT_SOCKADDR: + if (class != LIBSYSCALLS_TYPEBITS_SCALAR) + return LIBSYSCALLS_E_NOSUCHTYPE; + description->size = 0; + description->relative_position_of_size = +1; + description->absolute_position_of_size = -1; + /* TODO that is the alignment of `struct sockaddr`? */ + break; + + case LIBSYSCALLS_TYPE_STRUCT_CLONE_ARGS: + description->alignment = 64; + break; + + case LIBSYSCALLS_TYPE_STRUCT_RSEQ: + description->alignment = 4 * 64; + break; + + default: + break; + } + + (void) arch; + (void) data; + (void) data_size; + return LIBSYSCALLS_E_OK; +} + + +static enum libsyscalls_error +get_linux_struct_description(enum libsyscalls_arch arch, enum libsyscalls_datatype datatype, unsigned class, + const void *data, size_t data_size, struct libsyscalls_structure_description **description_out, + int *dont_align_fields_out) +{ + struct libsyscalls_structure_description *description; + + switch ((int)datatype) { + case LIBSYSCALLS_TYPE_STRUCT_EPOLL_EVENT: + if (arch == LIBSYSCALLS_ARCH_AMD64 || arch == LIBSYSCALLS_ARCH_AMD64_X32) + datatype = LIBSYSCALLS_TYPE_STRUCT_OABI_EPOLL_EVENT; + break; + + default: + break; + } + +#define CASE(TYPE, NAME, ...)\ + case LIBSYSCALLS_TYPE_##TYPE##_##NAME:\ + description = copy_struct(&linux_##TYPE##_##NAME##_prototype);\ + break + + switch ((int)datatype) { + LIST_LINUX_STRUCTS(CASE, ;); + default: + return LIBSYSCALLS_E_NOSUCHTYPE; + } + +#undef CASE + + if (!description) + return LIBSYSCALLS_E_NOMEM; + + (void) class; + (void) data; + (void) data_size; + + *description_out = description; + *dont_align_fields_out = 0; + return LIBSYSCALLS_E_OK; +} diff --git a/linux/structs.mk b/linux/structs.mk new file mode 100644 index 0000000..748db51 --- /dev/null +++ b/linux/structs.mk @@ -0,0 +1,4 @@ +# See LICENSE file for copyright and license details. + +libsyscalls_get_struct_description.o: linux/structs.c +libsyscalls_get_struct_description.lo: linux/structs.c diff --git a/linux/symbols.c b/linux/symbols.c index 7a3c8e5..ac90b80 100644 --- a/linux/symbols.c +++ b/linux/symbols.c @@ -32,11 +32,6 @@ extract_linux_symbol_signal(struct libsyscalls_symbol_printer_data *data, unsign } -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunsafe-buffer-usage" -#endif - static const char * extract_linux_symbol_mode(struct libsyscalls_symbol_printer_data *data, unsigned long long int *valuep, char *fallback_out) { @@ -133,10 +128,6 @@ extract_linux_symbol_umask(struct libsyscalls_symbol_printer_data *data, unsigne return data->buf; } -#if defined(__clang__) -# pragma clang diagnostic pop -#endif - static const char * extract_linux_symbol_dev(struct libsyscalls_symbol_printer_data *data, unsigned long long int *valuep, char *fallback_out) @@ -279,14 +270,9 @@ have_fun: } -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunsafe-buffer-usage" -#endif - static struct libsyscalls_syscall_display_info * get_linux_syscall_display_info(enum libsyscalls_arch arch, const struct libsyscalls_syscall_abi *syscall, - long long int syscall_number, unsigned long long int *syscall_argument) + long long int syscall_number, const unsigned long long int *syscall_argument) { LIBSYSCALLS_SYMBOL_PRINTER_DATA *data; libsyscalls_symbol_printer_function **funcs; @@ -314,18 +300,9 @@ get_linux_syscall_display_info(enum libsyscalls_arch arch, const struct libsysca } { -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wvla" -#endif - char data_vla_buf[(size_t)(nargs + 1) * data_size + data_align]; libsyscalls_symbol_printer_function *funcs_vla[nargs + 1]; -#if defined(__clang__) -# pragma clang diagnostic pop -#endif - data = (void *)ALIGN_BUF(data_vla_buf, data_align); funcs = funcs_vla; @@ -343,7 +320,3 @@ get_linux_syscall_display_info(enum libsyscalls_arch arch, const struct libsysca return build_syscall_display_info(data, data_size, data_align, funcs, syscall, nargs, nsyms); } } - -#if defined(__clang__) -# pragma clang diagnostic pop -#endif diff --git a/linux/syscall-table.c b/linux/syscall-table.c index 5a5d9c2..0b1e0a0 100644 --- a/linux/syscall-table.c +++ b/linux/syscall-table.c @@ -43,8 +43,8 @@ #define X(ARCH)\ - LIST_LINUX_SYSCALLS_FOR_##ARCH(MAKE_##ARCH##_SYSCALL_WITHOUT_COMPAT, MAKE_##ARCH##_SYSCALL_WITH_COMPAT, ;) -LIST_LINUX_ARCHES(X, ;); + LIST_LINUX_SYSCALLS_FOR_##ARCH(MAKE_##ARCH##_SYSCALL_WITHOUT_COMPAT, MAKE_##ARCH##_SYSCALL_WITH_COMPAT, ;); +LIST_LINUX_ARCHES_WITHOUT_ENDIANS(X,) #undef X #ifndef CREATING_DEDUP_TABLE @@ -57,13 +57,13 @@ LIST_LINUX_ARCHES(X, ;); #define X(ARCH)\ static const struct libsyscalls_syscall *const linux_##ARCH##_syscalls_table[] = {\ LIST_LINUX_SYSCALLS_FOR_##ARCH(MAKE_##ARCH##_SYSCALL_TABLE_ENTRY, MAKE_##ARCH##_SYSCALL_TABLE_ENTRY, COMMA)\ - } -LIST_LINUX_ARCHES(X, ;); + }; +LIST_LINUX_ARCHES_WITHOUT_ENDIANS(X,) #undef X - const struct libsyscalls_syscall *const *const libsyscalls_linux_syscalls_table_[] = { -#define X(ARCH) [LIBSYSCALLS_ARCH_##ARCH] = linux_##ARCH##_syscalls_table +#define X(ARCH)\ + [LIBSYSCALLS_ARCH_##ARCH] = linux_##ARCH##_syscalls_table LIST_LINUX_ARCHES(X, COMMA) #undef X }; diff --git a/linux/syscall-table.mk b/linux/syscall-table.mk index 7e6fb1a..a90be35 100644 --- a/linux/syscall-table.mk +++ b/linux/syscall-table.mk @@ -10,7 +10,7 @@ libsyscalls_get_syscall_range.o: $(LINUX_SYSCALLS_HDR) libsyscalls_get_syscall_range.lo: $(LINUX_SYSCALLS_HDR) -generated/linux-syscall-table.h: linux/syscall-table.c common.h linux/linux-support.mk +generated/linux-syscall-table.h: linux/syscall-table.c common.h linux/linux-support.mk linux/syscall-table.mk set -e; \ macros="$$(sed -n 's/^$(s)*$(h)$(s)*define$(s)\{1,\}MAKE_\([^(]*\)(.*$$/\1/p' < linux/syscall-table.c)"; \ for arch in $(SUPPORTED_LINUX_ARCHES); do \ @@ -18,17 +18,19 @@ generated/linux-syscall-table.h: linux/syscall-table.c common.h linux/linux-supp printf '\43define MAKE_%s_%s(...) MAKE_%s(%s, __VA_ARGS__)\n' \ "$$arch" "$$macro" "$$macro" "$$arch"; \ done; \ - done > $@ + done \ + | sed 's/_[BL]E\([_,]\)/\1/g' \ + | sort -u > $@ -generated/linux-syscalls.h: linux/syscalls.mk +generated/linux-syscalls.h: linux/syscalls.mk linux/syscall-table.mk mkdir -p -- generated printf '\43include "%s"\n' $(LINUX_SYSCALLS_HDR) \ | grep -v '"$@"' \ | sed 's:generated/::' > $@ -generated/linux-syscall-ranges.h: $(LINUX_SYSCALLS_ARCH_HDR) +generated/linux-syscall-ranges.h: $(LINUX_SYSCALLS_ARCH_HDR) linux/syscall-table.mk printf '%s\n' 'This may take some time ...'; \ set -e; arch=; \ cat -- $(LINUX_SYSCALLS_ARCH_HDR) \ @@ -60,3 +62,7 @@ generated/linux-syscall-ranges.h: $(LINUX_SYSCALLS_ARCH_HDR) MIN "$$arch" "$$min" \ MAX "$$arch" "$$max"; \ ) > $@ + printf '\43define MIN_LINUX_SYSCALL_FOR_%s\n' $(SUPPORTED_LINUX_ARCHES) \ + | sed -n 's/\(MIN_LINUX_SYSCALL_FOR_.*\)_[LB]E$$/& \1/p' >> $@ + printf '\43define MAX_LINUX_SYSCALL_FOR_%s\n' $(SUPPORTED_LINUX_ARCHES) \ + | sed -n 's/\(MAX_LINUX_SYSCALL_FOR_.*\)_[LB]E$$/& \1/p' >> $@ diff --git a/linux/syscalls.h b/linux/syscalls.h index f55dac5..36c1236 100644 --- a/linux/syscalls.h +++ b/linux/syscalls.h @@ -115,15 +115,6 @@ _Static_assert(END_OF_LINUX_SYMBOL_PRINTERS <= 0xFF, "LINUX_SYMBOL_PRINTER enums #ifndef SYMBOL_PRINTERS_ONLY -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wgnu-flexible-array-initializer" -# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" /* TODO how does that make sense in C23? */ -#elif defined(__GNUC__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wpedantic" -#endif - #define SYS(...) SYSCALL_ABI(linux, __VA_ARGS__) #define SYMBOLS(A, ...) .symbol_printer = (LINUX_SYMBOL_PRINTER_##A __VA_OPT__(SYMBOLS_2(__VA_ARGS__))) @@ -420,7 +411,7 @@ TODO_SYS(sys_sched_setaffinity, SCHEDULING, SET, 3, ZERO(INT), PARAMS(_,INT, _,U #undef TODO_SYS -#define XXX TODO /* when none on the architectures is not support yet by libsyscalls's core */ +#define XXX TODO static struct libsyscalls_syscall_abi TODO = {.category = LIBSYSCALLS_CAT_SUPPORT_PENDING, .min_argument_count = -1, @@ -725,11 +716,11 @@ static struct libsyscalls_syscall_abi TODO = #define linux_syscall_sys_idle XXX /* arm alpha */ #define linux_syscall_sys_pciconfig_iobase XXX /* arm alpha powerpc */ -#define linux_syscall_sys_pciconfig_read TODO /* arm alpha powerpc sparc ia64 */ -#define linux_syscall_sys_pciconfig_write TODO /* arm alpha powerpc sparc ia64 */ +#define linux_syscall_sys_pciconfig_read XXX /* arm alpha powerpc sparc ia64 */ +#define linux_syscall_sys_pciconfig_write XXX /* arm alpha powerpc sparc ia64 */ #define linux_syscall_sys_syscall XXX /* arm mips */ -#define linux_syscall_sys_mmap2 TODO /* arm microblaze parisc powerpc sparc ia64 m64k sh */ -#define linux_syscall_sys_rt_sigreturn_wrapper TODO /* arm microblaze parisc */ +#define linux_syscall_sys_mmap2 XXX /* arm microblaze parisc powerpc sparc ia64 m64k sh */ +#define linux_syscall_sys_rt_sigreturn_wrapper XXX /* arm microblaze parisc */ #define linux_syscall_sys_afs_syscall XXX /* arm */ #define linux_syscall_sys_arm_fadvise64_64 XXX /* arm */ #define linux_syscall_sys_break XXX /* arm */ @@ -764,16 +755,16 @@ static struct libsyscalls_syscall_abi TODO = #define linux_syscall_sys_stty XXX /* arm */ #define linux_syscall_sys_ulimit XXX /* arm */ -#define linux_syscall_compat_sys_epoll_pwait TODO /* mips parisc powerpc sparc s390 */ -#define linux_syscall_compat_sys_fanotify_mark TODO /* mips parisc powerpc sparc s390 */ -#define linux_syscall_compat_sys_fcntl TODO /* mips parisc powerpc sparc s390 */ -#define linux_syscall_sys_cacheflush TODO /* mips parisc m68k sh */ -#define linux_syscall_sys32_rt_sigreturn TODO /* mips sparc */ -#define linux_syscall_sys32_sigreturn TODO /* mips sparc */ +#define linux_syscall_compat_sys_epoll_pwait XXX /* mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_fanotify_mark XXX /* mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_fcntl XXX /* mips parisc powerpc sparc s390 */ +#define linux_syscall_sys_cacheflush XXX /* mips parisc m68k sh */ +#define linux_syscall_sys32_rt_sigreturn XXX /* mips sparc */ +#define linux_syscall_sys32_sigreturn XXX /* mips sparc */ #define linux_syscall_compat_sys_recv XXX /* mips powerpc */ -#define linux_syscall___sys_clone TODO /* mips m68k */ -#define linux_syscall___sys_clone3 TODO /* mips m68k */ -#define linux_syscall___sys_fork TODO /* mips m68k */ +#define linux_syscall___sys_clone XXX /* mips m68k */ +#define linux_syscall___sys_clone3 XXX /* mips m68k */ +#define linux_syscall___sys_fork XXX /* mips m68k */ #define linux_syscall___sys_sysmips XXX /* mips */ #define linux_syscall_compat_sys_old_msgctl XXX /* mips */ #define linux_syscall_compat_sys_old_semctl XXX /* mips */ @@ -797,9 +788,9 @@ static struct libsyscalls_syscall_abi TODO = #define linux_syscall_sysm_pipe XXX /* mips */ #define linux_syscall_sysn32_rt_sigreturn XXX /* mips */ -#define linux_syscall_sys_stime TODO /* powerpc parisc sparc */ -#define linux_syscall_compat_sys_sendfile64 TODO /* powerpc parisc s390 */ -#define linux_syscall_compat_sys_fallocate TODO /* powerpc sparc */ +#define linux_syscall_sys_stime XXX /* powerpc parisc sparc */ +#define linux_syscall_compat_sys_sendfile64 XXX /* powerpc parisc s390 */ +#define linux_syscall_compat_sys_fallocate XXX /* powerpc sparc */ #define linux_syscall_alpha_syscall_zero XXX /* alpha */ #define linux_syscall_sys_getdtablesize XXX /* alpha */ @@ -851,75 +842,75 @@ static struct libsyscalls_syscall_abi TODO = #define linux_syscall_sys_pread_wrapper XXX /* sh */ #define linux_syscall_sys_pwrite_wrapper XXX /* sh */ -#define linux_syscall___sys_vfork TODO /* m68k */ -#define linux_syscall_sys_atomic_barrier TODO /* m68k */ -#define linux_syscall_sys_atomic_cmpxchg_32 TODO /* m68k */ - -#define linux_syscall_compat_sys_io_pgetevents_time64 TODO /* parisc */ -#define linux_syscall_parisc_compat_signalfd4 TODO /* parisc */ -#define linux_syscall_parisc_eventfd2 TODO /* parisc */ -#define linux_syscall_parisc_fadvise64_64 TODO /* parisc */ -#define linux_syscall_parisc_fallocate TODO /* parisc */ -#define linux_syscall_parisc_ftruncate64 TODO /* parisc */ -#define linux_syscall_parisc_inotify_init1 TODO /* parisc */ -#define linux_syscall_parisc_madvise TODO /* parisc */ -#define linux_syscall_parisc_personality TODO /* parisc */ -#define linux_syscall_parisc_pipe2 TODO /* parisc */ -#define linux_syscall_parisc_pread64 TODO /* parisc */ -#define linux_syscall_parisc_pwrite64 TODO /* parisc */ -#define linux_syscall_parisc_readahead TODO /* parisc */ -#define linux_syscall_parisc_signalfd4 TODO /* parisc */ -#define linux_syscall_parisc_sync_file_range TODO /* parisc */ -#define linux_syscall_parisc_timerfd_create TODO /* parisc */ -#define linux_syscall_parisc_truncate64 TODO /* parisc */ -#define linux_syscall_parisc_userfaultfd TODO /* parisc */ -#define linux_syscall_sys32_fanotify_mark TODO /* parisc */ -#define linux_syscall_sys32_unimplemented TODO /* parisc */ -#define linux_syscall_sys_acl_get TODO /* parisc */ -#define linux_syscall_sys_acl_set TODO /* parisc */ -#define linux_syscall_sys_alloc_hugepages TODO /* parisc */ -#define linux_syscall_sys_attrctl TODO /* parisc */ -#define linux_syscall_sys_clone3_wrapper TODO /* parisc */ -#define linux_syscall_sys_clone_wrapper TODO /* parisc */ -#define linux_syscall_sys_fork_wrapper TODO /* parisc */ -#define linux_syscall_sys_free_hugepages TODO /* parisc */ -#define linux_syscall_sys_timerfd TODO /* parisc */ -#define linux_syscall_sys_vfork_wrapper TODO /* parisc */ - -#define linux_syscall_compat_sys_fadvise64 TODO /* sparc */ -#define linux_syscall_compat_sys_fadvise64_64 TODO /* sparc */ -#define linux_syscall_compat_sys_fstat64 TODO /* sparc */ -#define linux_syscall_compat_sys_fstatat64 TODO /* sparc */ -#define linux_syscall_compat_sys_lstat64 TODO /* sparc */ -#define linux_syscall_compat_sys_pread64 TODO /* sparc */ -#define linux_syscall_compat_sys_pwrite64 TODO /* sparc */ -#define linux_syscall_compat_sys_readahead TODO /* sparc */ -#define linux_syscall_compat_sys_sparc_sigaction TODO /* sparc */ -#define linux_syscall_compat_sys_stat64 TODO /* sparc */ -#define linux_syscall_compat_sys_sync_file_range TODO /* sparc */ -#define linux_syscall_sparc_exit TODO /* sparc */ -#define linux_syscall_sparc_exit_group TODO /* sparc */ -#define linux_syscall_sunos_execv TODO /* sparc */ -#define linux_syscall_sys32_execve TODO /* sparc */ -#define linux_syscall_sys32_execveat TODO /* sparc */ -#define linux_syscall_sys32_mmap2 TODO /* sparc */ -#define linux_syscall_sys32_socketcall TODO /* sparc */ -#define linux_syscall_sys64_execve TODO /* sparc */ -#define linux_syscall_sys64_execveat TODO /* sparc */ -#define linux_syscall_sys_64_mremap TODO /* sparc */ -#define linux_syscall_sys_64_munmap TODO /* sparc */ -#define linux_syscall_sys_getdomainname TODO /* sparc */ -#define linux_syscall_sys_kern_features TODO /* sparc */ -#define linux_syscall_sys_memory_ordering TODO /* sparc */ -#define linux_syscall_sys_nis_syscall TODO /* sparc */ -#define linux_syscall_sys_sparc64_personality TODO /* sparc */ -#define linux_syscall_sys_sparc_adjtimex TODO /* sparc */ -#define linux_syscall_sys_sparc_clock_adjtime TODO /* sparc */ -#define linux_syscall_sys_sparc_ipc TODO /* sparc */ -#define linux_syscall_sys_sparc_pipe TODO /* sparc */ -#define linux_syscall_sys_sparc_remap_file_pages TODO /* sparc */ -#define linux_syscall_sys_sparc_sigaction TODO /* sparc */ -#define linux_syscall_sys_utrap_install TODO /* sparc */ +#define linux_syscall___sys_vfork XXX /* m68k */ +#define linux_syscall_sys_atomic_barrier XXX /* m68k */ +#define linux_syscall_sys_atomic_cmpxchg_32 XXX /* m68k */ + +#define linux_syscall_compat_sys_io_pgetevents_time64 XXX /* parisc */ +#define linux_syscall_parisc_compat_signalfd4 XXX /* parisc */ +#define linux_syscall_parisc_eventfd2 XXX /* parisc */ +#define linux_syscall_parisc_fadvise64_64 XXX /* parisc */ +#define linux_syscall_parisc_fallocate XXX /* parisc */ +#define linux_syscall_parisc_ftruncate64 XXX /* parisc */ +#define linux_syscall_parisc_inotify_init1 XXX /* parisc */ +#define linux_syscall_parisc_madvise XXX /* parisc */ +#define linux_syscall_parisc_personality XXX /* parisc */ +#define linux_syscall_parisc_pipe2 XXX /* parisc */ +#define linux_syscall_parisc_pread64 XXX /* parisc */ +#define linux_syscall_parisc_pwrite64 XXX /* parisc */ +#define linux_syscall_parisc_readahead XXX /* parisc */ +#define linux_syscall_parisc_signalfd4 XXX /* parisc */ +#define linux_syscall_parisc_sync_file_range XXX /* parisc */ +#define linux_syscall_parisc_timerfd_create XXX /* parisc */ +#define linux_syscall_parisc_truncate64 XXX /* parisc */ +#define linux_syscall_parisc_userfaultfd XXX /* parisc */ +#define linux_syscall_sys32_fanotify_mark XXX /* parisc */ +#define linux_syscall_sys32_unimplemented XXX /* parisc */ +#define linux_syscall_sys_acl_get XXX /* parisc */ +#define linux_syscall_sys_acl_set XXX /* parisc */ +#define linux_syscall_sys_alloc_hugepages XXX /* parisc */ +#define linux_syscall_sys_attrctl XXX /* parisc */ +#define linux_syscall_sys_clone3_wrapper XXX /* parisc */ +#define linux_syscall_sys_clone_wrapper XXX /* parisc */ +#define linux_syscall_sys_fork_wrapper XXX /* parisc */ +#define linux_syscall_sys_free_hugepages XXX /* parisc */ +#define linux_syscall_sys_timerfd XXX /* parisc */ +#define linux_syscall_sys_vfork_wrapper XXX /* parisc */ + +#define linux_syscall_compat_sys_fadvise64 XXX /* sparc */ +#define linux_syscall_compat_sys_fadvise64_64 XXX /* sparc */ +#define linux_syscall_compat_sys_fstat64 XXX /* sparc */ +#define linux_syscall_compat_sys_fstatat64 XXX /* sparc */ +#define linux_syscall_compat_sys_lstat64 XXX /* sparc */ +#define linux_syscall_compat_sys_pread64 XXX /* sparc */ +#define linux_syscall_compat_sys_pwrite64 XXX /* sparc */ +#define linux_syscall_compat_sys_readahead XXX /* sparc */ +#define linux_syscall_compat_sys_sparc_sigaction XXX /* sparc */ +#define linux_syscall_compat_sys_stat64 XXX /* sparc */ +#define linux_syscall_compat_sys_sync_file_range XXX /* sparc */ +#define linux_syscall_sparc_exit XXX /* sparc */ +#define linux_syscall_sparc_exit_group XXX /* sparc */ +#define linux_syscall_sunos_execv XXX /* sparc */ +#define linux_syscall_sys32_execve XXX /* sparc */ +#define linux_syscall_sys32_execveat XXX /* sparc */ +#define linux_syscall_sys32_mmap2 XXX /* sparc */ +#define linux_syscall_sys32_socketcall XXX /* sparc */ +#define linux_syscall_sys64_execve XXX /* sparc */ +#define linux_syscall_sys64_execveat XXX /* sparc */ +#define linux_syscall_sys_64_mremap XXX /* sparc */ +#define linux_syscall_sys_64_munmap XXX /* sparc */ +#define linux_syscall_sys_getdomainname XXX /* sparc */ +#define linux_syscall_sys_kern_features XXX /* sparc */ +#define linux_syscall_sys_memory_ordering XXX /* sparc */ +#define linux_syscall_sys_nis_syscall XXX /* sparc */ +#define linux_syscall_sys_sparc64_personality XXX /* sparc */ +#define linux_syscall_sys_sparc_adjtimex XXX /* sparc */ +#define linux_syscall_sys_sparc_clock_adjtime XXX /* sparc */ +#define linux_syscall_sys_sparc_ipc XXX /* sparc */ +#define linux_syscall_sys_sparc_pipe XXX /* sparc */ +#define linux_syscall_sys_sparc_remap_file_pages XXX /* sparc */ +#define linux_syscall_sys_sparc_sigaction XXX /* sparc */ +#define linux_syscall_sys_utrap_install XXX /* sparc */ #define linux_syscall_compat_sys_mmap2 XXX /* powerpc */ #define linux_syscall_compat_sys_ppc32_fadvise64 XXX /* powerpc */ @@ -978,11 +969,5 @@ static struct libsyscalls_syscall_abi TODO = #define linux_syscall_sys_s390_runtime_instr XXX /* s390 */ #define linux_syscall_sys_s390_sthyi XXX /* s390 */ -#if defined(__clang__) -# pragma clang diagnostic pop -#else -# pragma GCC diagnostic pop -#endif - #endif /* !SYMBOL_PRINTERS_ONLY */ diff --git a/linux/syscalls.mk b/linux/syscalls.mk index de748b3..190f170 100644 --- a/linux/syscalls.mk +++ b/linux/syscalls.mk @@ -161,7 +161,7 @@ generated/linux-syscalls/m68k.h: $(LINUX_SYSCALL_DIR)/m68k.tbl linux/syscalls.mk generated/linux-syscalls/microblaze.h: $(LINUX_SYSCALL_DIR)/microblaze.tbl linux/syscalls.mk mkdir -p -- generated/linux-syscalls - printf '\43define LIST_LINUX_SYSCALLS_FOR_MICROBLAZE(X, _X_COMPAT, D)\\\n' > $@ + printf '\43define LIST_LINUX_SYSCALLS_FOR_MICROBLAZE_32(X, _X_COMPAT, D)\\\n' > $@ printf '%i common %s %s\n' \ 251 set_zone_reclaim sys_set_zone_reclaim \ 285 setaltroot sys_setaltroot \ @@ -450,3 +450,5 @@ generated/linux-syscall-dedup.h: $(HDR) $(LINUX_SYSCALLS_HDR) linux/syscalls.h l fi; \ done \ ) > $@ + printf '\43define linux_%s_syscalls_table\n' $(SUPPORTED_LINUX_ARCHES) \ + | sed -n 's/ linux_\(.*\)_[LB]E_syscalls_table/& linux_\1_syscalls_table/p' >> $@ diff --git a/linux/types.c b/linux/types.c index 66bb276..83f2bd1 100644 --- a/linux/types.c +++ b/linux/types.c @@ -3,9 +3,7 @@ /* This file is included from ../libsyscalls_get_datatype_description.c */ -/* If new architectures are added, the table at the top of - * ../libsyscalls_get_datatype_description.c must be updated */ - +/* If new architectures are added, LIST_ARCH_SPECS in ../common.h must be updated */ static enum libsyscalls_error get_linux_datatype_description(enum libsyscalls_arch arch, enum libsyscalls_datatype *datatype, @@ -17,7 +15,7 @@ get_linux_datatype_description(enum libsyscalls_arch arch, enum libsyscalls_data * and long long int as 64 bit (it's code even make such assumptions), * however that's is not necessarily the case for more exotic * architectures, for example, some specialised processors have 16 bit - * chars and run Linux (although not mainline). Linux also used + * chars and run Linux (although not mainline). Linux also uses * long int for addresses (intptr_t), which is normally how it should * be done but Windows always set long int to 32 bit (at least on x86/amd64) * for backwards compatibility, and of course it cannot be assumed that -- cgit v1.2.3-70-g09d2