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,
52 memcpy(args, ®s->regs[2], 6 * sizeof(args[0]));
55 static inline void syscall_set_arguments(struct task_struct *task,
57 unsigned int i, unsigned int n,
58 const unsigned long *args)
61 memcpy(®s->regs[2 + i], args, n * sizeof(args[0]));
64 static inline int syscall_get_arch(void)
66 int arch = AUDIT_ARCH_SH;
69 arch |= __AUDIT_ARCH_64BIT;
71 #ifdef CONFIG_CPU_LITTLE_ENDIAN
72 arch |= __AUDIT_ARCH_LE;
77 #endif /* __ASM_SH_SYSCALL_64_H */