.. | .. |
---|
38 | 38 | static inline long syscall_get_nr(struct task_struct *task, |
---|
39 | 39 | struct pt_regs *regs) |
---|
40 | 40 | { |
---|
41 | | - return current_thread_info()->syscall; |
---|
| 41 | + return task_thread_info(task)->syscall; |
---|
42 | 42 | } |
---|
43 | 43 | |
---|
44 | 44 | static inline void mips_syscall_update_nr(struct task_struct *task, |
---|
.. | .. |
---|
54 | 54 | task_thread_info(task)->syscall = regs->regs[2]; |
---|
55 | 55 | } |
---|
56 | 56 | |
---|
57 | | -static inline unsigned long mips_get_syscall_arg(unsigned long *arg, |
---|
| 57 | +static inline void mips_get_syscall_arg(unsigned long *arg, |
---|
58 | 58 | struct task_struct *task, struct pt_regs *regs, unsigned int n) |
---|
59 | 59 | { |
---|
60 | 60 | unsigned long usp __maybe_unused = regs->regs[29]; |
---|
.. | .. |
---|
63 | 63 | case 0: case 1: case 2: case 3: |
---|
64 | 64 | *arg = regs->regs[4 + n]; |
---|
65 | 65 | |
---|
66 | | - return 0; |
---|
| 66 | + return; |
---|
67 | 67 | |
---|
68 | 68 | #ifdef CONFIG_32BIT |
---|
69 | 69 | case 4: case 5: case 6: case 7: |
---|
70 | | - return get_user(*arg, (int *)usp + n); |
---|
| 70 | + get_user(*arg, (int *)usp + n); |
---|
| 71 | + return; |
---|
71 | 72 | #endif |
---|
72 | 73 | |
---|
73 | 74 | #ifdef CONFIG_64BIT |
---|
74 | 75 | case 4: case 5: case 6: case 7: |
---|
75 | 76 | #ifdef CONFIG_MIPS32_O32 |
---|
76 | 77 | if (test_tsk_thread_flag(task, TIF_32BIT_REGS)) |
---|
77 | | - return get_user(*arg, (int *)usp + n); |
---|
| 78 | + get_user(*arg, (int *)usp + n); |
---|
78 | 79 | else |
---|
79 | 80 | #endif |
---|
80 | 81 | *arg = regs->regs[4 + n]; |
---|
81 | 82 | |
---|
82 | | - return 0; |
---|
| 83 | + return; |
---|
83 | 84 | #endif |
---|
84 | 85 | |
---|
85 | 86 | default: |
---|
.. | .. |
---|
87 | 88 | } |
---|
88 | 89 | |
---|
89 | 90 | unreachable(); |
---|
| 91 | +} |
---|
| 92 | + |
---|
| 93 | +static inline long syscall_get_error(struct task_struct *task, |
---|
| 94 | + struct pt_regs *regs) |
---|
| 95 | +{ |
---|
| 96 | + return regs->regs[7] ? -regs->regs[2] : 0; |
---|
90 | 97 | } |
---|
91 | 98 | |
---|
92 | 99 | static inline long syscall_get_return_value(struct task_struct *task, |
---|
.. | .. |
---|
116 | 123 | |
---|
117 | 124 | static inline void syscall_get_arguments(struct task_struct *task, |
---|
118 | 125 | struct pt_regs *regs, |
---|
119 | | - unsigned int i, unsigned int n, |
---|
120 | 126 | unsigned long *args) |
---|
121 | 127 | { |
---|
122 | | - int ret; |
---|
| 128 | + unsigned int i = 0; |
---|
| 129 | + unsigned int n = 6; |
---|
123 | 130 | |
---|
124 | 131 | /* O32 ABI syscall() */ |
---|
125 | 132 | if (mips_syscall_is_indirect(task, regs)) |
---|
126 | 133 | i++; |
---|
127 | 134 | |
---|
128 | 135 | while (n--) |
---|
129 | | - ret |= mips_get_syscall_arg(args++, task, regs, i++); |
---|
130 | | - |
---|
131 | | - /* |
---|
132 | | - * No way to communicate an error because this is a void function. |
---|
133 | | - */ |
---|
134 | | -#if 0 |
---|
135 | | - return ret; |
---|
136 | | -#endif |
---|
| 136 | + mips_get_syscall_arg(args++, task, regs, i++); |
---|
137 | 137 | } |
---|
138 | 138 | |
---|
139 | 139 | extern const unsigned long sys_call_table[]; |
---|
140 | 140 | extern const unsigned long sys32_call_table[]; |
---|
141 | 141 | extern const unsigned long sysn32_call_table[]; |
---|
142 | 142 | |
---|
143 | | -static inline int syscall_get_arch(void) |
---|
| 143 | +static inline int syscall_get_arch(struct task_struct *task) |
---|
144 | 144 | { |
---|
145 | 145 | int arch = AUDIT_ARCH_MIPS; |
---|
146 | 146 | #ifdef CONFIG_64BIT |
---|
147 | | - if (!test_thread_flag(TIF_32BIT_REGS)) { |
---|
| 147 | + if (!test_tsk_thread_flag(task, TIF_32BIT_REGS)) { |
---|
148 | 148 | arch |= __AUDIT_ARCH_64BIT; |
---|
149 | 149 | /* N32 sets only TIF_32BIT_ADDR */ |
---|
150 | | - if (test_thread_flag(TIF_32BIT_ADDR)) |
---|
| 150 | + if (test_tsk_thread_flag(task, TIF_32BIT_ADDR)) |
---|
151 | 151 | arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; |
---|
152 | 152 | } |
---|
153 | 153 | #endif |
---|