hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/mips/include/asm/syscall.h
....@@ -38,7 +38,7 @@
3838 static inline long syscall_get_nr(struct task_struct *task,
3939 struct pt_regs *regs)
4040 {
41
- return current_thread_info()->syscall;
41
+ return task_thread_info(task)->syscall;
4242 }
4343
4444 static inline void mips_syscall_update_nr(struct task_struct *task,
....@@ -54,7 +54,7 @@
5454 task_thread_info(task)->syscall = regs->regs[2];
5555 }
5656
57
-static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
57
+static inline void mips_get_syscall_arg(unsigned long *arg,
5858 struct task_struct *task, struct pt_regs *regs, unsigned int n)
5959 {
6060 unsigned long usp __maybe_unused = regs->regs[29];
....@@ -63,23 +63,24 @@
6363 case 0: case 1: case 2: case 3:
6464 *arg = regs->regs[4 + n];
6565
66
- return 0;
66
+ return;
6767
6868 #ifdef CONFIG_32BIT
6969 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;
7172 #endif
7273
7374 #ifdef CONFIG_64BIT
7475 case 4: case 5: case 6: case 7:
7576 #ifdef CONFIG_MIPS32_O32
7677 if (test_tsk_thread_flag(task, TIF_32BIT_REGS))
77
- return get_user(*arg, (int *)usp + n);
78
+ get_user(*arg, (int *)usp + n);
7879 else
7980 #endif
8081 *arg = regs->regs[4 + n];
8182
82
- return 0;
83
+ return;
8384 #endif
8485
8586 default:
....@@ -87,6 +88,12 @@
8788 }
8889
8990 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;
9097 }
9198
9299 static inline long syscall_get_return_value(struct task_struct *task,
....@@ -116,38 +123,31 @@
116123
117124 static inline void syscall_get_arguments(struct task_struct *task,
118125 struct pt_regs *regs,
119
- unsigned int i, unsigned int n,
120126 unsigned long *args)
121127 {
122
- int ret;
128
+ unsigned int i = 0;
129
+ unsigned int n = 6;
123130
124131 /* O32 ABI syscall() */
125132 if (mips_syscall_is_indirect(task, regs))
126133 i++;
127134
128135 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++);
137137 }
138138
139139 extern const unsigned long sys_call_table[];
140140 extern const unsigned long sys32_call_table[];
141141 extern const unsigned long sysn32_call_table[];
142142
143
-static inline int syscall_get_arch(void)
143
+static inline int syscall_get_arch(struct task_struct *task)
144144 {
145145 int arch = AUDIT_ARCH_MIPS;
146146 #ifdef CONFIG_64BIT
147
- if (!test_thread_flag(TIF_32BIT_REGS)) {
147
+ if (!test_tsk_thread_flag(task, TIF_32BIT_REGS)) {
148148 arch |= __AUDIT_ARCH_64BIT;
149149 /* N32 sets only TIF_32BIT_ADDR */
150
- if (test_thread_flag(TIF_32BIT_ADDR))
150
+ if (test_tsk_thread_flag(task, TIF_32BIT_ADDR))
151151 arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
152152 }
153153 #endif