syscalls: Remove start and number from syscall_get_arguments() args
[linux-block.git] / arch / csky / include / asm / syscall.h
CommitLineData
4859bfca
GR
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>
d770b256 9#include <uapi/linux/audit.h>
4859bfca
GR
10
11static inline int
12syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
13{
14 return regs_syscallid(regs);
15}
16
17static inline void
18syscall_rollback(struct task_struct *task, struct pt_regs *regs)
19{
20 regs->a0 = regs->orig_a0;
21}
22
23static inline long
24syscall_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
31static inline long
32syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
33{
34 return regs->a0;
35}
36
37static inline void
38syscall_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
44static inline void
45syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
b35f549d 46 unsigned long *args)
4859bfca 47{
b35f549d
SRRH
48 args[0] = regs->orig_a0;
49 args++;
50 memcpy(args, &regs->a1, 5 * sizeof(args[0]));
4859bfca
GR
51}
52
53static inline void
54syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
55 unsigned int i, unsigned int n, const unsigned long *args)
56{
57 BUG_ON(i + n > 6);
58 if (i == 0) {
59 regs->orig_a0 = args[0];
60 args++;
4859bfca 61 n--;
ed3bb007
DL
62 } else {
63 i--;
4859bfca 64 }
ed3bb007 65 memcpy(&regs->a1 + i, args, n * sizeof(regs->a1));
4859bfca
GR
66}
67
d770b256
DL
68static inline int
69syscall_get_arch(void)
70{
71 return AUDIT_ARCH_CSKY;
72}
73
4859bfca 74#endif /* __ASM_SYSCALL_H */