Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1309508

[PATCH v6 09/21] arm64: ilp32: add is_ilp32_compat_{task,thread} and TIF_32BIT_AARCH64

From Yury Norov <ynorov@caviumnetworks.com>
Newsgroups linux.kernel
Subject [PATCH v6 09/21] arm64: ilp32: add is_ilp32_compat_{task,thread} and TIF_32BIT_AARCH64
Date 2016-01-14 18:30 +0100
Message-ID <qQTSH-1KH-35@gated-at.bofh.it> (permalink)
References <qQTSG-1KH-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


ILP32 tasks are needed to be distinguished from lp64 and aarch32.
This patch adds helper functions is_ilp32_compat_{task,thread} and
thread flag TIF_32BIT_AARCH64 to address it. This is a preparation
for following patches in ilp32 patchset.

For consistency, SET_PERSONALITY are changed here accordingly.

Signed-off-by: Andrew Pinski <Andrew.Pinski@caviumnetworks.com>
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
Reviewed-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/arm64/include/asm/elf.h         | 13 +++++++++++--
 arch/arm64/include/asm/is_compat.h   | 28 +++++++++++++++++++++++++++-
 arch/arm64/include/asm/thread_info.h |  1 +
 3 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index 2f62ded..5e27a64 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -135,7 +135,11 @@ typedef struct user_fpsimd_state elf_fpregset_t;
  */
 #define ELF_PLAT_INIT(_r, load_addr)	(_r)->regs[0] = 0
 
-#define SET_PERSONALITY(ex)		clear_thread_flag(TIF_32BIT);
+#define SET_PERSONALITY(ex)		\
+do {						\
+	clear_thread_flag(TIF_32BIT_AARCH64);	\
+	clear_thread_flag(TIF_32BIT);		\
+} while (0)
 
 #define ARCH_DLINFO							\
 do {									\
@@ -174,7 +178,12 @@ typedef compat_elf_greg_t		compat_elf_gregset_t[COMPAT_ELF_NGREG];
 					 ((x)->e_flags & EF_ARM_EABI_MASK))
 
 #define compat_start_thread		compat_start_thread
-#define COMPAT_SET_PERSONALITY(ex)	set_thread_flag(TIF_32BIT);
+#define COMPAT_SET_PERSONALITY(ex)		\
+do {						\
+	clear_thread_flag(TIF_32BIT_AARCH64);	\
+	set_thread_flag(TIF_32BIT);		\
+} while (0)
+
 #define COMPAT_ARCH_DLINFO
 extern int aarch32_setup_vectors_page(struct linux_binprm *bprm,
 				      int uses_interp);
diff --git a/arch/arm64/include/asm/is_compat.h b/arch/arm64/include/asm/is_compat.h
index 6139b5a..55134cf 100644
--- a/arch/arm64/include/asm/is_compat.h
+++ b/arch/arm64/include/asm/is_compat.h
@@ -45,11 +45,37 @@ static inline int is_a32_compat_thread(struct thread_info *thread)
 
 #endif /* CONFIG_AARCH32_EL0 */
 
+#ifdef CONFIG_ARM64_ILP32
+
+static inline int is_ilp32_compat_task(void)
+{
+	return test_thread_flag(TIF_32BIT_AARCH64);
+}
+
+static inline int is_ilp32_compat_thread(struct thread_info *thread)
+{
+	return test_ti_thread_flag(thread, TIF_32BIT_AARCH64);
+}
+
+#else
+
+static inline int is_ilp32_compat_task(void)
+{
+	return 0;
+}
+
+static inline int is_ilp32_compat_thread(struct thread_info *thread)
+{
+	return 0;
+}
+
+#endif /* CONFIG_ARM64_ILP32 */
+
 #ifdef CONFIG_COMPAT
 
 static inline int is_compat_task(void)
 {
-	return is_a32_compat_task();
+	return is_a32_compat_task() || is_ilp32_compat_task();
 }
 
 #endif /* CONFIG_COMPAT */
diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
index dd046c5..c74d4f5 100644
--- a/arch/arm64/include/asm/thread_info.h
+++ b/arch/arm64/include/asm/thread_info.h
@@ -113,6 +113,7 @@ static inline struct thread_info *current_thread_info(void)
 #define TIF_RESTORE_SIGMASK	20
 #define TIF_SINGLESTEP		21
 #define TIF_32BIT		22	/* AARCH32 process */
+#define TIF_32BIT_AARCH64	23	/* 32 bit process on AArch64(ILP32) */
 
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC5 PATCH v6 00/21] ILP32 for ARM64 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 16/21] arm64: signal32: move ilp32 and aarch32 common code to separated file Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 09/21] arm64: ilp32: add is_ilp32_compat_{task,thread} and TIF_32BIT_AARCH64 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 05/21] arm64: compat: change config dependences to aarch32 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 19/21] arm64:ilp32: add ARM64_ILP32 to Kconfig Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 15/21] arm64: signal: share lp64 signal routines to ilp32 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 08/21] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat) Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 18/21] arm64:ilp32: add vdso-ilp32 and use for signal return Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 13/21] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 02/21] arm64: ensure the kernel is compiled for LP64 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 04/21] arm64: change some CONFIG_COMPAT over to use CONFIG_AARCH32_EL0 instead Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 07/21] thread: move thread bits accessors to separated file Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 10/21] arm64: introduce binfmt_elf32.c Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 17/21] arm64: ilp32: introduce ilp32-specific handlers for sigframe Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 12/21] arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  [PATCH v6 11/21] arm64: ilp32: introduce binfmt_ilp32.c Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 18:30 +0100
  Re: [PATCH v6 20/21] all: s390: make compat wrappers the generic  solution Yury Norov <ynorov@caviumnetworks.com> - 2016-01-14 19:20 +0100
  Re: [PATCH v6 20/21] all: s390: make compat wrappers the generic  solution Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-01-15 13:50 +0100
    Re: [PATCH v6 20/21] all: s390: make compat wrappers the generic  solution Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-01-20 09:20 +0100
      Re: [PATCH v6 20/21] all: s390: make compat wrappers the generic  solution Yury Norov <ynorov@caviumnetworks.com> - 2016-01-20 13:20 +0100
  Re: [RFC5 PATCH v6 00/21] ILP32 for ARM64 "Zhangjian (Bamvor)" <bamvor.zhangjian@huawei.com> - 2016-01-18 14:20 +0100
    Re: [RFC5 PATCH v6 00/21] ILP32 for ARM64 Andreas Schwab <schwab@suse.de> - 2016-01-18 14:30 +0100
      Re: [RFC5 PATCH v6 00/21] ILP32 for ARM64 Bamvor Zhang Jian <bamvor.zhangjian@linaro.org> - 2016-01-18 14:50 +0100

csiph-web