From 82b77505f9420f11d614c2ae0f74153ca4ee3cb5 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 2 May 2023 09:48:50 +0200 Subject: cooker updates spilling all over the place Only tangentially related: - make seitan C99 again, so that I can build cooker without warnings - make Makefiles make use of the usual conventions about assigning directory paths in variables, drop numbers.h as requirement for cooker and make it convenient to run stand-alone Makefiles - fix up nr_syscalls.sh to be POSIX, otherwise it will give syntax errors on my system - define a single, common way to refer to offsets in gluten, and functions to use those offsets in a safe way. Immediates are gone: cooker will write any bit of "data" to the read-only section - call const what has to be const - define on-disk layout for gluten - add OP_NR (to check syscall numbers), rename OP_COPY_ARGS to OP_LOAD (it loads _selected_ stuff from arguments) As for cooker itself: - drop ARG_ and arg_ prefixes from struct names, and similar - add/rework functions to build OP_NR, OP_LOAD, OP_CMP, and to write constant data to gluten - add parsing for "compound" arguments, but that's not completely hooked into evaluation for numeric arguments yet Signed-off-by: Stefano Brivio --- scripts/nr_syscalls.sh | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'scripts') diff --git a/scripts/nr_syscalls.sh b/scripts/nr_syscalls.sh index 380d6f1..5110a9b 100755 --- a/scripts/nr_syscalls.sh +++ b/scripts/nr_syscalls.sh @@ -27,31 +27,31 @@ FOOTER_NUMBERS="}; #endif" -syscalls=( - "accept" - "bind" - "connect" - "getpeername" - "getsockname" - "getsockopt" - "listen" - "mount" - "openat" - "recvfrom" - "recvmmsg" - "recvmsg" - "sendmmsg" - "sendmsg" - "sendto" - "setsockopt" - "shutdown" - "socket" - "socketpair" -) +syscalls=" + accept + bind + connect + getpeername + getsockname + getsockopt + listen + mount + openat + recvfrom + recvmmsg + recvmsg + sendmmsg + sendmsg + sendto + setsockopt + shutdown + socket + socketpair +" printf '%s\n' "${HEADER_NUMBERS}" > "${OUT_NUMBERS}" # syscall_nr - Get syscall number from compiler, also note in numbers.h -__in="$(printf "#include \n#include \n__NR_%s" ${syscalls[@]})" +__in="$(for c in ${syscalls}; do printf "#include \n#include \n__NR_%s" $c; done)" __out="$(echo "${__in}" |cc -E -xc - -o - |sed -n '/\#.*$/!p'| sed '/^$/d')" awk -v AS="${syscalls[*]}" -v BS="${__out[*]}" \ -- cgit v1.2.3