public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: libc-alpha@sourceware.org
Subject: [PATCH] x32: Add <asm/unistd_x32.h> and regenerate arch-syscall.h
Date: Sat, 15 Aug 2020 14:31:38 -0700	[thread overview]
Message-ID: <20200815213138.1375595-1-hjl.tools@gmail.com> (raw)

X32 uses the same 64-bit syscall interface for set_thread_area.  But
__NR_set_thread_area is missing from <asm/unistd_x32.h>.  A kernel patch
was submitted:

From 7b05d5b43ae2545e0d4a3edb24205d18bc883626 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 15 Aug 2020 10:34:00 -0700
Subject: [PATCH] x86-64: Enable x32 set_thread_area

X32 uses the common 64-bit syscall interface for set_thread_area.  Tested
with tools/testing/selftests/x86/sigreturn.c on x32.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 arch/x86/entry/syscalls/syscall_64.tbl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
index 37b844f839bc..670193a73f6e 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -213,7 +213,7 @@
 202	common	futex			sys_futex
 203	common	sched_setaffinity	sys_sched_setaffinity
 204	common	sched_getaffinity	sys_sched_getaffinity
-205	64	set_thread_area
+205	common	set_thread_area
 206	64	io_setup		sys_io_setup
 207	common	io_destroy		sys_io_destroy
 208	common	io_getevents		sys_io_getevents
--
2.26.2

Add <asm/unistd_x32.h> for older kernel header files and regenerate
x32 arch-syscall.h.
---
 sysdeps/unix/sysv/linux/x86/include/asm/unistd_x32.h | 9 +++++++++
 sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h    | 1 +
 2 files changed, 10 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/x86/include/asm/unistd_x32.h

diff --git a/sysdeps/unix/sysv/linux/x86/include/asm/unistd_x32.h b/sysdeps/unix/sysv/linux/x86/include/asm/unistd_x32.h
new file mode 100644
index 0000000000..4de22a7737
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86/include/asm/unistd_x32.h
@@ -0,0 +1,9 @@
+/* FIXME: __NR_set_thread_area should come from the kernel header file.
+   This file should be removed if <asm/unistd_x32.h> from the kernel
+   header file contains __NR_set_thread_area.  */
+
+#include_next <asm/unistd_x32.h>
+
+#ifndef __NR_set_thread_area
+# define __NR_set_thread_area 1073742029
+#endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
index 1a701c1472..7b64b1fa0c 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
@@ -260,6 +260,7 @@
 #define __NR_sendto 1073741868
 #define __NR_set_mempolicy 1073742062
 #define __NR_set_robust_list 1073742354
+#define __NR_set_thread_area 1073742029
 #define __NR_set_tid_address 1073742042
 #define __NR_setdomainname 1073741995
 #define __NR_setfsgid 1073741947
-- 
2.26.2


             reply	other threads:[~2020-08-15 21:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-15 21:31 H.J. Lu [this message]
2020-08-24 11:17 ` Florian Weimer
2020-08-24 12:42   ` H.J. Lu
2020-08-24 13:22     ` Florian Weimer
2020-08-24 13:56       ` H.J. Lu
2020-08-24 17:17         ` Florian Weimer
2020-08-24 18:54           ` H.J. Lu
2020-08-24 19:10             ` Florian Weimer
2020-08-24 19:29               ` H.J. Lu
2020-08-25 10:50                 ` Florian Weimer
2020-08-25 12:51                   ` [PATCH] x32: Add <fixup-asm-unistd.h> " H.J. Lu
2020-08-26  9:35                     ` Florian Weimer
2020-08-27 13:36                       ` H.J. Lu
2020-08-31 12:56                         ` Florian Weimer

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=20200815213138.1375595-1-hjl.tools@gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).