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 78226C982E0 for ; Sat, 19 Sep 2026 00:32:15 +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=j1SCPR0sOnV4snc5rlr78Gy5aX zwkMhr1pGT4EPyyTF1bSCBX4ulZDLNcrMwUxM9pKmC4pd3Q0/0FrOLaCvej2vpAFB+FMotZjYsv9D /w+cm7vHsrzhA7/2Gm/BbDu9nRVyKQOarhibciMYkck4e2BEncnI49JQJabzy+40o9ut+iUZFBQZt 2bPlADYUE8E21ykpTNDrU4518WfDLzRNAMNm7LHEesna234DVUhMnmx4rJzjqh3BqqolKxRyjvpN8 SpoW4rXnawNIFDV+M68HmXFzj8HScfLP2JeolqqtqU1B8Dc3leG3w8cJePog48UVPGzglhyQGyJ+J EBwJfoyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x7izv-0000000FlCl-1bwq; Sat, 19 Sep 2026 00:32:07 +0000 Received: from fanzine2.igalia.com ([213.97.179.56]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x7izY-0000000FkxS-3iR3 for linux-arm-kernel@lists.infradead.org; Sat, 19 Sep 2026 00:31:46 +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=lxxiVmvXNlTmgJYVe3XlD45lJY KtpTiohfjJsklMhxdA8pCDtcmb1AKapB/45ku7f0iw1NSnYybir1sHKzAycWPPafZ3ohdr8YTDLii BL1qcClo+CJ9M5VdFSh8nu5sQCtH/RuyjGRZG2mwnFFIbpK0oPW5/IRcXpyN6Dk2NvLqPpU6c9a2W cfi+kOIisaI/IyuE0CyWbt/O7TlixWSJxFajg9+ZlmeRMPw4U4uNUv9zg0oN4tAcXfjrJZol2PfIl 7tGisjWyZLoaz+vFCibu+MRmpYIwxKFFgGb1ZOjahtzsJ/jBGPay+7t7R8BKoC3+TSxwV0z071s3b eoNquWFQ==; 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 1x7izX-004Bwz-5l; Sat, 19 Sep 2026 02:31:43 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Fri, 18 Sep 2026 21:31:16 -0300 Subject: [PATCH v8 09/12] 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: <20260918-tonyk-syscall_table-v8-9-0e2d60cad13e@igalia.com> References: <20260918-tonyk-syscall_table-v8-0-0e2d60cad13e@igalia.com> In-Reply-To: <20260918-tonyk-syscall_table-v8-0-0e2d60cad13e@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_173144_967811_E76D5939 X-CRM114-Status: GOOD ( 12.52 ) 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