[PATCH 2/2] x86/ipipe: Define and use ipipe_root_nr_syscalls

Jan Kiszka jan.kiszka at siemens.com
Thu Jan 31 18:01:37 CET 2019


From: Jan Kiszka <jan.kiszka at siemens.com>

If we support compat mode, we need to account for IA32_NR_syscalls being
different than NR_syscalls.

Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
---
 arch/x86/entry/common.c           | 3 ++-
 arch/x86/include/asm/ipipe_base.h | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 568f45c47063..8b729d9386b3 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -290,7 +290,8 @@ __visible inline void syscall_return_slowpath(struct pt_regs *regs)
 	 * want to run them exactly once per syscall exit with IRQs on.
 	 */
 	if (unlikely((!IS_ENABLED(CONFIG_IPIPE) ||
-		      syscall_get_nr(current, regs) < NR_syscalls) &&
+		      syscall_get_nr(current, regs) <
+				ipipe_root_nr_syscalls(ti)) &&
 		     (cached_flags & SYSCALL_EXIT_WORK_FLAGS)))
 		syscall_slow_exit_work(regs, cached_flags);
 
diff --git a/arch/x86/include/asm/ipipe_base.h b/arch/x86/include/asm/ipipe_base.h
index e0debe840abd..c09697b1f20c 100644
--- a/arch/x86/include/asm/ipipe_base.h
+++ b/arch/x86/include/asm/ipipe_base.h
@@ -115,6 +115,11 @@ static inline unsigned long __ipipe_ffnz(unsigned long ul)
       return ul;
 }
 
+#ifdef CONFIG_IA32_EMULATION
+#define ipipe_root_nr_syscalls(ti)	\
+	((ti->status & TS_COMPAT) ? IA32_NR_syscalls : NR_syscalls)
+#endif /* CONFIG_IA32_EMULATION */
+
 #endif	/* X86_64 */
 
 struct pt_regs;
-- 
2.16.4



More information about the Xenomai mailing list