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 extern const unsigned long sys_call_table
[];
15 static inline int syscall_get_nr(struct task_struct
*task
,
18 return task_thread_info(task
)->syscall
;
21 static inline void syscall_rollback(struct task_struct
*task
,
24 regs
->ARM_r0
= regs
->ARM_ORIG_r0
;
27 static inline long syscall_get_error(struct task_struct
*task
,
30 unsigned long error
= regs
->ARM_r0
;
31 return IS_ERR_VALUE(error
) ? error
: 0;
34 static inline long syscall_get_return_value(struct task_struct
*task
,
40 static inline void syscall_set_return_value(struct task_struct
*task
,
44 regs
->ARM_r0
= (long) error
? error
: val
;
47 #define SYSCALL_MAX_ARGS 7
49 static inline void syscall_get_arguments(struct task_struct
*task
,
51 unsigned int i
, unsigned int n
,
54 if (i
+ n
> SYSCALL_MAX_ARGS
) {
55 unsigned long *args_bad
= args
+ SYSCALL_MAX_ARGS
- i
;
56 unsigned int n_bad
= n
+ i
- SYSCALL_MAX_ARGS
;
57 pr_warning("%s called with max args %d, handling only %d\n",
58 __func__
, i
+ n
, SYSCALL_MAX_ARGS
);
59 memset(args_bad
, 0, n_bad
* sizeof(args
[0]));
60 n
= SYSCALL_MAX_ARGS
- i
;
64 args
[0] = regs
->ARM_ORIG_r0
;
70 memcpy(args
, ®s
->ARM_r0
+ i
, n
* sizeof(args
[0]));
73 static inline void syscall_set_arguments(struct task_struct
*task
,
75 unsigned int i
, unsigned int n
,
76 const unsigned long *args
)
78 if (i
+ n
> SYSCALL_MAX_ARGS
) {
79 pr_warning("%s called with max args %d, handling only %d\n",
80 __func__
, i
+ n
, SYSCALL_MAX_ARGS
);
81 n
= SYSCALL_MAX_ARGS
- i
;
85 regs
->ARM_ORIG_r0
= args
[0];
91 memcpy(®s
->ARM_r0
+ i
, args
, n
* sizeof(args
[0]));
94 #endif /* _ASM_ARM_SYSCALL_H */