From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=213.97.179.56 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795119754; b=Pi22zl//kxh5Xg1IPPDAi0IGpgXwsFBqNWM586s5Rdqei4lWBwKYByuk3IskMpycNQZ+ kh8ONSG+2OUJFcYXGPxjMlZMLTYAlqEO3rYW71A7BBQuVjC3N4LfTgNvoNmki7PJQhp8F 8vLck7PrI97tsU9nTnx3SgRveYkxMW0uX8y+aShVgIJHgV2oJLRjz6whKgyVFGNMwhEXT LIJN3OWkEBFjrS8oGSGwn6gbNy92FT3/dBY4RsiDxc0OFHJIfAHXSiLiZ26AoZVSukAxK H/mRjLspxv3TUnW/pshALXcjTqsYf6kypxyjfQjNZXA/XGD9JETVQM0DXNU8CFLsN+g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795119754; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer; bh=acAs9/SQ1Yv5CmVC3Wx8W3hZfk9+iiiVIVdL5p8xhkY=; b=A5lsSg+ehFIoXWahVzIJg9NP1XF18iTYlE7z+d5WuFgjBMMJiHF3oiyhjZKsmX7BtFSl nWQRmIPCAEXrJHqipUxG5siPgmKu7K+/ZRaB1zFGj9nOKvdSYiXYyHNv8DEt3Y6HHxzy5 jqxqeqHYuYoH2iyQKbeCK+6VGc3SW4gyNqoBWI6VJhO3kNMoHRhl+jZfvR0hUfOp1WoE9 pgeMNwvWAch4IbyC4Bv0q/a2OJOHoR/7X6+bS9xUg7Ww6jM4esovsFGmOw35c/om8Cc8D tHqZbQZinSBOJSikIpOU0JrJIKmIEQb3FTHgcQGxs5Jr/74BrwgpAWB4gpKKaazqntA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass header.d=igalia.com header.i=@igalia.com header.a=rsa-sha256 header.s=20170329 header.b="EpU2/gs3"; arc=none smtp.remote-ip=213.97.179.56 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D67A3606E4D6; Thu, 19 Nov 2026 20:22:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D67A3606E4D6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.a=rsa-sha256 header.s=20170329 header.b=EpU2/gs3 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:Message-Id:Content-Transfer-Encoding:Content-Type: MIME-Version:Subject:Date:From:From:Reply-To; bh=acAs9/SQ1Yv5CmVC3Wx8W3hZfk9+iiiVIVdL5p8xhkY=; t=1795119753; x=2110479753; b=EpU2/gs3UY549N8OA4HYUaFu46zq3YBO5GVyWE4jdKZk/yA2IUq4jHfMv6DHQNQ/LvbuoJbrmfZ r7dS2EB60NDgWAHdrffhQQyrPmciVQnw2gRt/Xf1lfd9/Wk5Df1dNHE+dFfBNf+FUU81rsUVngSS1 m3KrtlUOJmdA8qKQ5LBgCss0niSInfhKrRiu/7BrvMxjaZKBe0izSmYOhwMMvc6b4APmaXrf4BOeQ xchTozSnBZ00ZOb8TGfcjbF0bKM+vikP+ddbwgduH0mQdf9SE42mMUjAmS7/+YJe+VaYrvcsYfTZX 0S4nY0CeVu8c03l2simuk8UHDuIpTxlhlxqg==; Received: from [177.172.124.218] (helo=[192.168.15.100]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1xU8eN-00000001cIK-3BMM; Thu, 19 Nov 2026 21:22:31 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Thu, 19 Nov 2026 17:21:59 -0300 Subject: [PATCH v10 09/16] syscalls: Add an option for offsetting the common table X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20261119-tonyk-syscall_table-v10-9-a7c9ebd900f6@igalia.com> References: <20261119-tonyk-syscall_table-v10-0-a7c9ebd900f6@igalia.com> In-Reply-To: <20261119-tonyk-syscall_table-v10-0-a7c9ebd900f6@igalia.com> To: Masami Hiramatsu , Arnd Bergmanon Cc: Christian Brauner , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, kernel-dev@igalia.com, Thomas Bogendoerfer , linux-alpha@vger.kernel.org, linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, soc@lists.linux.dev, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, Arnaldo Carvalho de Melo , linux-perf-users@vger.kernel.org, Ingo Molnar , Magnus Lindholm , =?utf-8?q?Andr=C3=A9_Almeida?= X-Mailer: b4 0.15.2 To better support architectures that doesn't share the same syscall numbers, but have them in the same sequence, add an new option to offset the common syscall table numbers by a value. This make it possible to reuse the common syscall table for alpha. Signed-off-by: André Almeida --- Changes on v10: - Now, the result of the offset for the header is #define syscall (110 + ) --- scripts/syscallhdr.sh | 26 ++++++++++++++++++-------- scripts/syscalltbl.sh | 20 +++++++++++++++----- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh index 8f7dfcf19a4c..f2d670f45ec8 100755 --- a/scripts/syscallhdr.sh +++ b/scripts/syscallhdr.sh @@ -16,17 +16,18 @@ set -e usage() { - echo >&2 "usage: $0 [--abis ABIS] [--emit-nr] [--offset OFFSET] [--prefix PREFIX] [--common-tbl PATH] INFILE OUTFILE" >&2 + echo >&2 "usage: $0 [--abis ABIS] [--emit-nr] [--offset OFFSET] [--prefix PREFIX] [--common-tbl PATH] [--common-offset NR] INFILE OUTFILE" >&2 echo >&2 echo >&2 " INFILE input syscall table" echo >&2 " OUTFILE output header file" echo >&2 echo >&2 "options:" - echo >&2 " --abis ABIS ABI(s) to handle (By default, all lines are handled)" - echo >&2 " --emit-nr Emit the macro of the number of syscalls (__NR_syscalls)" - echo >&2 " --offset OFFSET The offset of syscall numbers" - echo >&2 " --prefix PREFIX The prefix to the macro like __NR_" - echo >&2 " --common-tbl PATH Use the common number table" + echo >&2 " --abis ABIS ABI(s) to handle (By default, all lines are handled)" + echo >&2 " --emit-nr Emit the macro of the number of syscalls (__NR_syscalls)" + echo >&2 " --offset OFFSET The offset of syscall numbers" + echo >&2 " --prefix PREFIX The prefix to the macro like __NR_" + echo >&2 " --common-tbl PATH Use the common number table" + echo >&2 " --common-offset NR Add an offset for the numbers of the common table" exit 1 } @@ -34,6 +35,7 @@ usage() { abis= emit_nr= offset= +common_offset= prefix= common_tbl= common_tbl_path= @@ -57,6 +59,9 @@ do common_tbl=1 common_tbl_path=$2 shift 2;; + --common-offset) + common_offset=$2 + shift 2;; -*) echo "$1: unknown option" >&2 usage;; @@ -98,14 +103,19 @@ emit_end_guard() { } max=0 -# gen_hdr(infile) +# gen_hdr(infile, offset_nr) gen_hdr() { input=$1 tmpfile=$(mktemp) + offset_nr=$2 grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$input" > $tmpfile while read nr abi name native compat; do + if [ -n "$offset_nr" ]; then + nr="($nr + $offset_nr)" + fi + max=$nr if [ -n "$offset" ]; then @@ -123,7 +133,7 @@ emit_start_guard > $outfile gen_hdr $infile >> $outfile if [ -n "$common_tbl" ]; then - gen_hdr $common_tbl_path >> "$outfile" + gen_hdr $common_tbl_path $common_offset >> "$outfile" fi if [ -n "$emit_nr" ]; then diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh index 70da0039ab22..1e9cac32c02d 100755 --- a/scripts/syscalltbl.sh +++ b/scripts/syscalltbl.sh @@ -16,14 +16,15 @@ set -e usage() { - echo >&2 "usage: $0 [--abis ABIS] [--common-tbl PATH] INFILE OUTFILE" >&2 + echo >&2 "usage: $0 [--abis ABIS] [--common-tbl PATH] [--common-offset NR] INFILE OUTFILE" >&2 echo >&2 echo >&2 " INFILE input syscall table" echo >&2 " OUTFILE output header file" echo >&2 echo >&2 "options:" - echo >&2 " --abis ABIS ABI(s) to handle (By default, all lines are handled)" - echo >&2 " --common-tbl PATH Use the common syscall number table" + echo >&2 " --abis ABIS ABI(s) to handle (By default, all lines are handled)" + echo >&2 " --common-tbl PATH Use the common syscall number table" + echo >&2 " --common-offset OFFSET Add an offset for the numbers of the common table" exit 1 } @@ -31,6 +32,7 @@ usage() { abis= common_tbl= common_tbl_path= +common_offset= while [ $# -gt 0 ] do @@ -42,6 +44,9 @@ do common_tbl=1 common_tbl_path=$2 shift 2;; + --common-offset) + common_offset=$2 + shift 2;; -*) echo "$1: unknown option" >&2 usage;; @@ -59,14 +64,19 @@ outfile="$2" nxt=0 -# gen_tbl(infile) +# gen_tbl(infile, offset_nr) gen_tbl() { input=$1 tmpfile=$(mktemp) + offset_nr=$2 grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$input" > $tmpfile while read nr abi name native compat noreturn; do + if [ -n "$offset_nr" ]; then + nr=$((nr + offset_nr)) + fi + if [ $nxt -gt $nr ]; then echo "error: $input: syscall table is not sorted or duplicates the same syscall number" >&2 exit 1 @@ -108,5 +118,5 @@ gen_tbl() { gen_tbl $infile > "$outfile" if [ -n "$common_tbl" ]; then - gen_tbl $common_tbl_path >> "$outfile" + gen_tbl $common_tbl_path $common_offset >> "$outfile" fi -- 2.56.1