From 81749f1fe87e489c4e2e7408a0fae9370c3810b3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 19:09:30 +0200 Subject: Adding upstream version 2.5.5. Signed-off-by: Daniel Baumann --- src/arch-gperf-generate | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 src/arch-gperf-generate (limited to 'src/arch-gperf-generate') diff --git a/src/arch-gperf-generate b/src/arch-gperf-generate new file mode 100755 index 0000000..9e6c000 --- /dev/null +++ b/src/arch-gperf-generate @@ -0,0 +1,40 @@ +#!/bin/bash + +# NOTE: changes to the arch_syscall_table struct in syscalls.h will affect +# this script/gperf - BEWARE! + +### +# helper functions + +function exit_usage() { + echo "usage: $0 " + exit 1 +} + +### +# main + +# sanity check +[[ ! -r "$1" || ! -r "$2" ]] && exit_usage +sys_csv=$1 +gperf_tmpl=$2 + +sys_csv_tmp=$(mktemp -t generate_syscalls_XXXXXX) + +# filter and prepare the syscall csv file +cat $sys_csv | grep -v '^#' | nl -ba -s, -v0 | \ + sed -e 's/^[[:space:]]\+\([0-9]\+\),\([^,]\+\),\(.*\)/\2,\1,\3/' \ + -e ':repeat; {s|\([^,]\+\)\(.*\)[^_]PNR|\1\2,__PNR_\1|g;}; t repeat' \ + > $sys_csv_tmp +[[ $? -ne 0 ]] && exit 1 + +# create the gperf file +sed -e "/@@SYSCALLS_TABLE@@/r $sys_csv_tmp" \ + -e '/@@SYSCALLS_TABLE@@/d' \ + $gperf_tmpl > syscalls.perf +[[ $? -ne 0 ]] && exit 1 + +# cleanup +rm -f $sys_csv_tmp + +exit 0 -- cgit v1.2.3