[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20181213172257.GO6024@altlinux.org>
Date: Thu, 13 Dec 2018 20:22:57 +0300
From: "Dmitry V. Levin" <ldv@...linux.org>
To: Geert Uytterhoeven <geert@...ux-m68k.org>,
Oleg Nesterov <oleg@...hat.com>,
Andy Lutomirski <luto@...nel.org>
Cc: Elvira Khabirova <lineprinter@...linux.org>,
Eugene Syromyatnikov <esyr@...hat.com>,
linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org
Subject: [PATCH v6 15/27] m68k: add asm/syscall.h
syscall_get_* functions are required to be implemented on all
architectures in order to extend the generic ptrace API with
PTRACE_GET_SYSCALL_INFO request.
This introduces asm/syscall.h on m68k implementing all 5 syscall_get_*
functions as documented in asm-generic/syscall.h: syscall_get_nr,
syscall_get_arguments, syscall_get_error, syscall_get_return_value,
and syscall_get_arch.
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Elvira Khabirova <lineprinter@...linux.org>
Cc: Eugene Syromyatnikov <esyr@...hat.com>
Cc: linux-m68k@...ts.linux-m68k.org
Signed-off-by: Dmitry V. Levin <ldv@...linux.org>
---
Notes:
v6: added missing includes, use asm-generic/syscall.h
v5: added syscall_get_nr, syscall_get_arguments, syscall_get_error,
and syscall_get_return_value
v1: added syscall_get_arch
arch/m68k/include/asm/syscall.h | 42 +++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 arch/m68k/include/asm/syscall.h
diff --git a/arch/m68k/include/asm/syscall.h b/arch/m68k/include/asm/syscall.h
new file mode 100644
index 000000000000..c87b14417753
--- /dev/null
+++ b/arch/m68k/include/asm/syscall.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_M68K_SYSCALL_H
+#define _ASM_M68K_SYSCALL_H
+
+#include <asm/ptrace.h>
+#include <asm-generic/syscall.h>
+#include <linux/err.h>
+#include <uapi/linux/audit.h>
+
+static inline int
+syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
+{
+ return regs->orig_d0;
+}
+
+static inline void
+__syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
+ unsigned int i, unsigned int n, unsigned long *args)
+{
+ BUILD_BUG_ON(sizeof(regs->d1) != sizeof(args[0]));
+ memcpy(args, ®s->d1 + i, n * sizeof(args[0]));
+}
+
+static inline long
+syscall_get_error(struct task_struct *task, struct pt_regs *regs)
+{
+ return IS_ERR_VALUE(regs->d0) ? regs->d0 : 0;
+}
+
+static inline long
+syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
+{
+ return regs->d0;
+}
+
+static inline int
+syscall_get_arch(void)
+{
+ return AUDIT_ARCH_M68K;
+}
+
+#endif /* _ASM_M68K_SYSCALL_H */
--
ldv
Powered by blists - more mailing lists