1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Access to user system call parameters and results
5 * See asm-generic/syscall.h for descriptions of what we must do here.
8 #ifndef _ASM_ARM_SYSCALL_H
9 #define _ASM_ARM_SYSCALL_H
11 #include <uapi/linux/audit.h> /* for AUDIT_ARCH_* */
12 #include <linux/elf.h> /* for ELF_EM */
13 #include <linux/err.h>
14 #include <linux/sched.h>
16 #include <asm/unistd.h>
18 #define NR_syscalls (__NR_syscalls)
20 extern const unsigned long sys_call_table[];
22 static inline int syscall_get_nr(struct task_struct *task,
25 if (IS_ENABLED(CONFIG_AEABI) && !IS_ENABLED(CONFIG_OABI_COMPAT))
26 return task_thread_info(task)->abi_syscall;
28 return task_thread_info(task)->abi_syscall & __NR_SYSCALL_MASK;
31 static inline bool __in_oabi_syscall(struct task_struct *task)
33 return IS_ENABLED(CONFIG_OABI_COMPAT) &&
34 (task_thread_info(task)->abi_syscall & __NR_OABI_SYSCALL_BASE);
37 static inline bool in_oabi_syscall(void)
39 return __in_oabi_syscall(current);
42 static inline void syscall_rollback(struct task_struct *task,
45 regs->ARM_r0 = regs->ARM_ORIG_r0;
48 static inline long syscall_get_error(struct task_struct *task,
51 unsigned long error = regs->ARM_r0;
52 return IS_ERR_VALUE(error) ? error : 0;
55 static inline long syscall_get_return_value(struct task_struct *task,
61 static inline void syscall_set_return_value(struct task_struct *task,
65 regs->ARM_r0 = (long) error ? error : val;
68 #define SYSCALL_MAX_ARGS 7
70 static inline void syscall_get_arguments(struct task_struct *task,
74 args[0] = regs->ARM_ORIG_r0;
77 memcpy(args, ®s->ARM_r0 + 1, 5 * sizeof(args[0]));
80 static inline void syscall_set_arguments(struct task_struct *task,
82 const unsigned long *args)
84 regs->ARM_ORIG_r0 = args[0];
87 memcpy(®s->ARM_r0 + 1, args, 5 * sizeof(args[0]));
90 static inline int syscall_get_arch(struct task_struct *task)
92 /* ARM tasks don't change audit architectures on the fly. */
93 return AUDIT_ARCH_ARM;
96 #endif /* _ASM_ARM_SYSCALL_H */