1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_SH_SYSCALL_64_H
3 #define __ASM_SH_SYSCALL_64_H
5 #include <uapi/linux/audit.h>
6 #include <linux/kernel.h>
7 #include <linux/sched.h>
8 #include <asm/ptrace.h>
10 /* The system call number is given by the user in R9 */
11 static inline long syscall_get_nr(struct task_struct *task,
14 return (regs->syscall_nr >= 0) ? regs->regs[9] : -1L;
17 static inline void syscall_rollback(struct task_struct *task,
21 * XXX: This needs some thought. On SH we don't
22 * save away the original R9 value anywhere.
26 static inline long syscall_get_error(struct task_struct *task,
29 return IS_ERR_VALUE(regs->regs[9]) ? regs->regs[9] : 0;
32 static inline long syscall_get_return_value(struct task_struct *task,
38 static inline void syscall_set_return_value(struct task_struct *task,
43 regs->regs[9] = -error;
48 static inline void syscall_get_arguments(struct task_struct *task,
50 unsigned int i, unsigned int n,
54 memcpy(args, ®s->regs[2 + i], n * sizeof(args[0]));
57 static inline void syscall_set_arguments(struct task_struct *task,
59 unsigned int i, unsigned int n,
60 const unsigned long *args)
63 memcpy(®s->regs[2 + i], args, n * sizeof(args[0]));
66 static inline int syscall_get_arch(void)
68 int arch = AUDIT_ARCH_SH;
71 arch |= __AUDIT_ARCH_64BIT;
73 #ifdef CONFIG_CPU_LITTLE_ENDIAN
74 arch |= __AUDIT_ARCH_LE;
79 #endif /* __ASM_SH_SYSCALL_64_H */