From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36D39C982D0 for ; Thu, 17 Sep 2026 23:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Wqb5iKIn7pHSmtRgWS6wBCsYSpV0OZZFytPa5NWq4PM=; b=Ou7ybf6lL6STSOzyTbDgqcCLLx 4bsr23E17UGv19B9kvIE9jGUI2L7VhuxGPiAVtl1v1NoZaHjVn4XxQNywDoxwFmYnqeZtj5F4JR7m hsJC/7UHqt3D/er8MN2QhCAtbPGx2/gK2dqnDhvyEKU+lihKH0zExtjkp3zdnk5VDdcQVTb9rY1R5 2D+W/dnDI7kCdKsp38b0GWdfob62wsRRhCoycEMcrstCTjzwLibV7my4b6Aahcm/hh6VqVjh0p4y6 pcYu6KhmAmUp2t7X9w4B+ghd2iySxS9kFozEMWJIFmaWFKluUm5QizVdKF8CiJcvv49yNhvHPqs+g l1P5ZRYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x7Lox-0000000CxdE-487f; Thu, 17 Sep 2026 23:47:15 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x7Lof-0000000CxSM-41VP for linux-arm-kernel@bombadil.infradead.org; Thu, 17 Sep 2026 23:46:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=Wqb5iKIn7pHSmtRgWS6wBCsYSpV0OZZFytPa5NWq4PM=; b=M8EkvZslN3u55MMV4c8Os4/u3D 6fESvbi+8RL31gxKaz2Bj/76vblSC9p75o5qnUTetmwbQbjTmReqT7iBBOrN7C+E8n8MApdFKtL+w fDS733FcpZ0i1rnhbg3c8YKssjGA9+WkxQCTYvhugUV/9+ddyWpnwUrOpZM2jk+XpjmGN0+hxbDsx wSeAfiOo7L/fHv5KH4xr53KQ6gv839/afxnbfmcFkK970o9AXgkTOimeC/DdPsyxoYM0p+NMvCYDs 73+cZHVQt6vTNA/TlsA0VbEvpUl2/Lxd1Di9VpKENBvu3eBSAV0zSG0mjB5cZuORfbaQoSDFi3xkh ZUfA8/rg==; Received: from fanzine2.igalia.com ([213.97.179.56]) by desiato.infradead.org with esmtps (Exim 4.99.2 #2 (Red Hat Linux)) id 1x7Lod-00000009OdV-0nvn for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2026 23:46:56 +0000 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=Wqb5iKIn7pHSmtRgWS6wBCsYSpV0OZZFytPa5NWq4PM=; b=okQjaKpUDgd0n5Bp8HhRfBq7Ds 8oM63xQvrRSxyxWxpyPsOd0ITpHY6/BUEVi3BFF29rcl3d7C+bz1EUuj73WGYqC4wh853+wF5/kak Dah33hi03AEs7eyaXy32vyq9VKuvyQk/T+6yXzj2JSQFGGrwopzPvtF0HnY3As9cKk0F5jx8pN/PT Di/bKCTdkB6lttym8ddddel8wmVisTzej6J6IpaZzKsAccVSXO3T6rJWd06usBI6Kc0Fx1esYh/In 6L5atJVbS68UbTXmq7FXEjePGfN49Ti5sgmg2mIQ7Y38HWPrdGEP5pWxytLr5U3qhld7ZUBpT6KEC PowqbRdQ==; Received: from [177.172.123.214] (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 1x7LoY-003hU7-5D; Fri, 18 Sep 2026 01:46:50 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Thu, 17 Sep 2026 20:46:13 -0300 Subject: [PATCH v7 10/13] syscalls: Add an option for offsetting the common table MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20260917-tonyk-syscall_table-v7-10-f4cd8f8e3265@igalia.com> References: <20260917-tonyk-syscall_table-v7-0-f4cd8f8e3265@igalia.com> In-Reply-To: <20260917-tonyk-syscall_table-v7-0-f4cd8f8e3265@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, =?utf-8?q?Andr=C3=A9_Almeida?= X-Mailer: b4 0.15.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260918_004655_359457_4EBE7190 X-CRM114-Status: GOOD ( 11.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 from v4: - I was reusing the logic from --offset to apply the --common-offset, but the logic is different: --offset does a string concat, and --common-offset does a addition to the number --- 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..cf6bba3019b1 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.55.0