1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef _ASM_TILE_SYSCALL_H
19#define _ASM_TILE_SYSCALL_H
20
21#include <linux/sched.h>
22#include <linux/err.h>
23#include <arch/abi.h>
24
25
26extern void *sys_call_table[];
27#ifdef CONFIG_COMPAT
28extern void *compat_sys_call_table[];
29#endif
30
31
32
33
34
35
36static inline int syscall_get_nr(struct task_struct *t, struct pt_regs *regs)
37{
38 return regs->regs[TREG_SYSCALL_NR];
39}
40
41static inline void syscall_rollback(struct task_struct *task,
42 struct pt_regs *regs)
43{
44 regs->regs[0] = regs->orig_r0;
45}
46
47static inline long syscall_get_error(struct task_struct *task,
48 struct pt_regs *regs)
49{
50 unsigned long error = regs->regs[0];
51 return IS_ERR_VALUE(error) ? error : 0;
52}
53
54static inline long syscall_get_return_value(struct task_struct *task,
55 struct pt_regs *regs)
56{
57 return regs->regs[0];
58}
59
60static inline void syscall_set_return_value(struct task_struct *task,
61 struct pt_regs *regs,
62 int error, long val)
63{
64 regs->regs[0] = (long) error ?: val;
65}
66
67static inline void syscall_get_arguments(struct task_struct *task,
68 struct pt_regs *regs,
69 unsigned int i, unsigned int n,
70 unsigned long *args)
71{
72 BUG_ON(i + n > 6);
73 memcpy(args, ®s[i], n * sizeof(args[0]));
74}
75
76static inline void syscall_set_arguments(struct task_struct *task,
77 struct pt_regs *regs,
78 unsigned int i, unsigned int n,
79 const unsigned long *args)
80{
81 BUG_ON(i + n > 6);
82 memcpy(®s[i], args, n * sizeof(args[0]));
83}
84
85#endif
86