2 * Access to user system call parameters and results
4 * See asm-generic/syscall.h for descriptions of what we must do here.
7 #ifndef _ASM_ARM_SYSCALL_H
8 #define _ASM_ARM_SYSCALL_H
10 #include <linux/err.h>
11 #include <linux/sched.h>
13 #include <asm/unistd.h>
15 #define NR_syscalls (__NR_syscalls)
17 extern const unsigned long sys_call_table
[];
19 static inline int syscall_get_nr(struct task_struct
*task
,
22 return task_thread_info(task
)->syscall
;
25 static inline void syscall_rollback(struct task_struct
*task
,
28 regs
->ARM_r0
= regs
->ARM_ORIG_r0
;
31 static inline long syscall_get_error(struct task_struct
*task
,
34 unsigned long error
= regs
->ARM_r0
;
35 return IS_ERR_VALUE(error
) ? error
: 0;
38 static inline long syscall_get_return_value(struct task_struct
*task
,
44 static inline void syscall_set_return_value(struct task_struct
*task
,
48 regs
->ARM_r0
= (long) error
? error
: val
;
51 #define SYSCALL_MAX_ARGS 7
53 static inline void syscall_get_arguments(struct task_struct
*task
,
55 unsigned int i
, unsigned int n
,
58 if (i
+ n
> SYSCALL_MAX_ARGS
) {
59 unsigned long *args_bad
= args
+ SYSCALL_MAX_ARGS
- i
;
60 unsigned int n_bad
= n
+ i
- SYSCALL_MAX_ARGS
;
61 pr_warning("%s called with max args %d, handling only %d\n",
62 __func__
, i
+ n
, SYSCALL_MAX_ARGS
);
63 memset(args_bad
, 0, n_bad
* sizeof(args
[0]));
64 n
= SYSCALL_MAX_ARGS
- i
;
68 args
[0] = regs
->ARM_ORIG_r0
;
74 memcpy(args
, ®s
->ARM_r0
+ i
, n
* sizeof(args
[0]));
77 static inline void syscall_set_arguments(struct task_struct
*task
,
79 unsigned int i
, unsigned int n
,
80 const unsigned long *args
)
82 if (i
+ n
> SYSCALL_MAX_ARGS
) {
83 pr_warning("%s called with max args %d, handling only %d\n",
84 __func__
, i
+ n
, SYSCALL_MAX_ARGS
);
85 n
= SYSCALL_MAX_ARGS
- i
;
89 regs
->ARM_ORIG_r0
= args
[0];
95 memcpy(®s
->ARM_r0
+ i
, args
, n
* sizeof(args
[0]));
98 #endif /* _ASM_ARM_SYSCALL_H */