mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "André Almeida" <andrealmeid@igalia.com>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	 Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	 "H. Peter Anvin" <hpa@zytor.com>,
	Nathan Chancellor <nathan@kernel.org>,
	 Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	kernel-dev@igalia.com, "André Almeida" <andrealmeid@igalia.com>
Subject: [PATCH RFC v2 2/4] syscalls: Add support for x86_x32 for the common syscall table
Date: Mon, 27 Jul 2026 23:47:03 -0300	[thread overview]
Message-ID: <20260727-tonyk-syscall_table-v2-2-95d4f1ee471f@igalia.com> (raw)
In-Reply-To: <20260727-tonyk-syscall_table-v2-0-95d4f1ee471f@igalia.com>

x86_x32 has a peculiar ordering: first, goes the x86 syscalls. Then, the
shared syscall numbers from the common table, and finally the x86_x32
syscall numbers. Adapt syscallhdr.sh script to take this into account.

Let's hope that x32 is deprecated before the syscall table reaches syscall
512, to avoid making the shared table more confusing.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 scripts/syscallhdr.sh | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh
index 0fc3e8dfc7e5..06372006509e 100755
--- a/scripts/syscallhdr.sh
+++ b/scripts/syscallhdr.sh
@@ -72,6 +72,12 @@ fi
 infile="$1"
 outfile="$2"
 
+is_x32=
+
+if [[ "$abis" == *"x32"* ]]; then
+	is_x32=1
+fi
+
 guard=_UAPI_ASM_$(basename "$outfile" |
 	sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
 	-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g')
@@ -116,10 +122,32 @@ gen_hdr() {
 
 emit_start_guard > $outfile
 
-gen_hdr $infile >> $outfile
+# x32 has a special ordering. We need to get first the common numbers from x86
+# table, then the common numbers from scripts/syscall_common.tbl and finally the
+# x32 numbers
+if [ -n "$is_x32" ]; then
+
+	abis="${abis//x32|/}"
+	abis="${abis//|x32/}"
+	abis="${abis//x32/}"
+
+	if [[ $abis != "()" ]]; then
+		gen_hdr $infile >> $outfile
+
+		if [ -n "$common_tbl" ]; then
+			gen_hdr $COMMON_TBL_PATH  >> "$outfile"
+		fi
+	fi
+
+	abis="(x32)"
+
+	gen_hdr $infile >> "$outfile"
+else
+	gen_hdr $infile >> $outfile
 
-if [ -n "$common_tbl" ]; then
-	gen_hdr $COMMON_TBL_PATH  >> "$outfile"
+	if [ -n "$common_tbl" ]; then
+		gen_hdr $COMMON_TBL_PATH  >> "$outfile"
+	fi
 fi
 
 emit_nr $(($max + 1)) $prefix >> $outfile

-- 
2.55.0


  parent reply	other threads:[~2026-07-28  2:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28  2:47 [PATCH RFC v2 0/4] syscalls: Add a shared table for all archs André Almeida
2026-07-28  2:47 ` [PATCH RFC v2 1/4] syscalls: Create unified partial " André Almeida
2026-07-28  6:47   ` Arnd Bergmann
2026-07-28  2:47 ` André Almeida [this message]
2026-07-28  2:47 ` [PATCH RFC v2 3/4] x86: Use common syscall table André Almeida
2026-07-28  2:47 ` [PATCH RFC v2 4/4] scripts/syscall.tbl: Use the common table André Almeida
2026-07-28  8:30 ` [PATCH RFC v2 0/4] syscalls: Add a shared table for all archs Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260727-tonyk-syscall_table-v2-2-95d4f1ee471f@igalia.com \
    --to=andrealmeid@igalia.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®