Merge branches 'acpi-scan', 'acpi-tables', 'acpi-misc' and 'acpi-pm'
[sfrench/cifs-2.6.git] / arch / csky / include / asm / syscall.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2
3 #ifndef __ASM_SYSCALL_H
4 #define __ASM_SYSCALL_H
5
6 #include <linux/sched.h>
7 #include <linux/err.h>
8 #include <abi/regdef.h>
9 #include <uapi/linux/audit.h>
10
11 static inline int
12 syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
13 {
14         return regs_syscallid(regs);
15 }
16
17 static inline void
18 syscall_rollback(struct task_struct *task, struct pt_regs *regs)
19 {
20         regs->a0 = regs->orig_a0;
21 }
22
23 static inline long
24 syscall_get_error(struct task_struct *task, struct pt_regs *regs)
25 {
26         unsigned long error = regs->a0;
27
28         return IS_ERR_VALUE(error) ? error : 0;
29 }
30
31 static inline long
32 syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
33 {
34         return regs->a0;
35 }
36
37 static inline void
38 syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
39                 int error, long val)
40 {
41         regs->a0 = (long) error ?: val;
42 }
43
44 static inline void
45 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
46                       unsigned long *args)
47 {
48         args[0] = regs->orig_a0;
49         args++;
50         memcpy(args, &regs->a1, 5 * sizeof(args[0]));
51 }
52
53 static inline void
54 syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
55                       const unsigned long *args)
56 {
57         regs->orig_a0 = args[0];
58         args++;
59         memcpy(&regs->a1, args, 5 * sizeof(regs->a1));
60 }
61
62 static inline int
63 syscall_get_arch(void)
64 {
65         return AUDIT_ARCH_CSKY;
66 }
67
68 #endif  /* __ASM_SYSCALL_H */