0001
0002
0003
0004
0005
0006
0007
0008 #ifndef _ASM_ARM_SYSCALL_H
0009 #define _ASM_ARM_SYSCALL_H
0010
0011 #include <uapi/linux/audit.h> /* for AUDIT_ARCH_* */
0012 #include <linux/elf.h> /* for ELF_EM */
0013 #include <linux/err.h>
0014 #include <linux/sched.h>
0015
0016 #include <asm/unistd.h>
0017
0018 #define NR_syscalls (__NR_syscalls)
0019
0020 extern const unsigned long sys_call_table[];
0021
0022 static inline int syscall_get_nr(struct task_struct *task,
0023 struct pt_regs *regs)
0024 {
0025 if (IS_ENABLED(CONFIG_AEABI) && !IS_ENABLED(CONFIG_OABI_COMPAT))
0026 return task_thread_info(task)->abi_syscall;
0027
0028 return task_thread_info(task)->abi_syscall & __NR_SYSCALL_MASK;
0029 }
0030
0031 static inline bool __in_oabi_syscall(struct task_struct *task)
0032 {
0033 return IS_ENABLED(CONFIG_OABI_COMPAT) &&
0034 (task_thread_info(task)->abi_syscall & __NR_OABI_SYSCALL_BASE);
0035 }
0036
0037 static inline bool in_oabi_syscall(void)
0038 {
0039 return __in_oabi_syscall(current);
0040 }
0041
0042 static inline void syscall_rollback(struct task_struct *task,
0043 struct pt_regs *regs)
0044 {
0045 regs->ARM_r0 = regs->ARM_ORIG_r0;
0046 }
0047
0048 static inline long syscall_get_error(struct task_struct *task,
0049 struct pt_regs *regs)
0050 {
0051 unsigned long error = regs->ARM_r0;
0052 return IS_ERR_VALUE(error) ? error : 0;
0053 }
0054
0055 static inline long syscall_get_return_value(struct task_struct *task,
0056 struct pt_regs *regs)
0057 {
0058 return regs->ARM_r0;
0059 }
0060
0061 static inline void syscall_set_return_value(struct task_struct *task,
0062 struct pt_regs *regs,
0063 int error, long val)
0064 {
0065 regs->ARM_r0 = (long) error ? error : val;
0066 }
0067
0068 #define SYSCALL_MAX_ARGS 7
0069
0070 static inline void syscall_get_arguments(struct task_struct *task,
0071 struct pt_regs *regs,
0072 unsigned long *args)
0073 {
0074 args[0] = regs->ARM_ORIG_r0;
0075 args++;
0076
0077 memcpy(args, ®s->ARM_r0 + 1, 5 * sizeof(args[0]));
0078 }
0079
0080 static inline int syscall_get_arch(struct task_struct *task)
0081 {
0082
0083 return AUDIT_ARCH_ARM;
0084 }
0085
0086 #endif