Commit | Line | Data |
---|---|---|
a7f626c1 AJ |
1 | /* |
2 | * Copyright (C) 2011 Texas Instruments Incorporated | |
3 | * Author: Mark Salter <msalter@redhat.com> | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; either version 2 of the License, or | |
8 | * (at your option) any later version. | |
9 | */ | |
10 | ||
11 | #ifndef __ASM_C6X_SYSCALL_H | |
12 | #define __ASM_C6X_SYSCALL_H | |
13 | ||
14 | #include <linux/err.h> | |
15 | #include <linux/sched.h> | |
16 | ||
17 | static inline int syscall_get_nr(struct task_struct *task, | |
18 | struct pt_regs *regs) | |
19 | { | |
20 | return regs->b0; | |
21 | } | |
22 | ||
23 | static inline void syscall_rollback(struct task_struct *task, | |
24 | struct pt_regs *regs) | |
25 | { | |
26 | /* do nothing */ | |
27 | } | |
28 | ||
29 | static inline long syscall_get_error(struct task_struct *task, | |
30 | struct pt_regs *regs) | |
31 | { | |
32 | return IS_ERR_VALUE(regs->a4) ? regs->a4 : 0; | |
33 | } | |
34 | ||
35 | static inline long syscall_get_return_value(struct task_struct *task, | |
36 | struct pt_regs *regs) | |
37 | { | |
38 | return regs->a4; | |
39 | } | |
40 | ||
41 | static inline void syscall_set_return_value(struct task_struct *task, | |
42 | struct pt_regs *regs, | |
43 | int error, long val) | |
44 | { | |
45 | regs->a4 = error ?: val; | |
46 | } | |
47 | ||
48 | static inline void syscall_get_arguments(struct task_struct *task, | |
b35f549d SRRH |
49 | struct pt_regs *regs, |
50 | unsigned long *args) | |
a7f626c1 | 51 | { |
b35f549d SRRH |
52 | *args++ = regs->a4; |
53 | *args++ = regs->b4; | |
54 | *args++ = regs->a6; | |
55 | *args++ = regs->b6; | |
56 | *args++ = regs->a8; | |
57 | *args = regs->b8; | |
a7f626c1 AJ |
58 | } |
59 | ||
60 | static inline void syscall_set_arguments(struct task_struct *task, | |
61 | struct pt_regs *regs, | |
62 | unsigned int i, unsigned int n, | |
63 | const unsigned long *args) | |
64 | { | |
65 | switch (i) { | |
66 | case 0: | |
67 | if (!n--) | |
68 | break; | |
69 | regs->a4 = *args++; | |
70 | case 1: | |
71 | if (!n--) | |
72 | break; | |
73 | regs->b4 = *args++; | |
74 | case 2: | |
75 | if (!n--) | |
76 | break; | |
77 | regs->a6 = *args++; | |
78 | case 3: | |
79 | if (!n--) | |
80 | break; | |
81 | regs->b6 = *args++; | |
82 | case 4: | |
83 | if (!n--) | |
84 | break; | |
85 | regs->a8 = *args++; | |
86 | case 5: | |
87 | if (!n--) | |
88 | break; | |
89 | regs->a9 = *args++; | |
90 | case 6: | |
91 | if (!n) | |
92 | break; | |
93 | default: | |
94 | BUG(); | |
95 | } | |
96 | } | |
97 | ||
98 | #endif /* __ASM_C6X_SYSCALLS_H */ |