From c131f122778c62f920a99bbf854ced4a37ee8b03 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 3 Dec 2023 19:23:35 +0100 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- linux/syscall-table.mk | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 linux/syscall-table.mk (limited to 'linux/syscall-table.mk') diff --git a/linux/syscall-table.mk b/linux/syscall-table.mk new file mode 100644 index 0000000..3f0d944 --- /dev/null +++ b/linux/syscall-table.mk @@ -0,0 +1,60 @@ +OBJ += linux/syscall-table.o + + +linux/syscall-table.o: generated/linux-syscall-table.h linux/syscalls.h $(LINUX_SYSCALLS_HDR) generated/linux-syscall-dedup.h +linux/syscall-table.lo: generated/linux-syscall-table.h linux/syscalls.h $(LINUX_SYSCALLS_HDR) generated/linux-syscall-dedup.h + +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 + set -e; \ + macros="$$(sed -n 's/^\s*\x23\s*define\s\+MAKE_\([^(]*\)(.*$$/\1/p' < linux/syscall-table.c)"; \ + for arch in $(SUPPORTED_LINUX_ARCHES); do \ + for macro in $$macros; do \ + printf '\43define MAKE_%s_%s(...) MAKE_%s(%s, __VA_ARGS__)\n' \ + "$$arch" "$$macro" "$$macro" "$$arch"; \ + done; \ + done > $@ + + +generated/linux-syscalls.h: linux/syscalls.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) + printf '%s\n' 'This may take some time ...'; \ + set -e; arch=; \ + cat -- $(LINUX_SYSCALLS_ARCH_HDR) \ + | sed 's/^\s*X[A-Z_]*(\([^,]*\).*$$/\1/' \ + | sed 's/\x23\s*define\s\+LIST_LINUX_SYSCALLS_FOR_\(.*\)(.*/\1/' \ + | sed '/^\s*$$/d' \ + | (\ + while read line; do \ + if test -z "$$(printf '%s\n' "$$line" | sed 's/^[A-Z].*$$//')"; then \ + if test -n "$$arch"; then \ + printf '\43define %s_LINUX_SYSCALL_FOR_%s %i\n' \ + MIN "$$arch" "$$min" \ + MAX "$$arch" "$$max"; \ + fi; \ + arch="$$line"; \ + min=; \ + max=; \ + else \ + val=$$(( $$line )); \ + if test -z "$$min" || test "$$val" -lt "$$min"; then \ + min=$$val; \ + fi; \ + if test -z "$$max" || test "$$val" -gt "$$max"; then \ + max=$$val; \ + fi; \ + fi; \ + done; \ + printf '\43define %s_LINUX_SYSCALL_FOR_%s %i\n' \ + MIN "$$arch" "$$min" \ + MAX "$$arch" "$$max"; \ + ) > $@ -- cgit v1.2.3-70-g09d2