Commit afa86fc426ff7e7f5477f15da9c405d08d5cf790
1 parent
135c37b83c
Exists in
master
and in
20 other branches
flagday: don't pass regs to copy_thread()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 34 changed files with 45 additions and 60 deletions Side-by-side Diff
- arch/alpha/kernel/process.c
- arch/arm/kernel/process.c
- arch/arm64/kernel/process.c
- arch/avr32/kernel/process.c
- arch/blackfin/kernel/process.c
- arch/c6x/kernel/process.c
- arch/cris/arch-v10/kernel/process.c
- arch/cris/arch-v32/kernel/process.c
- arch/frv/kernel/process.c
- arch/h8300/kernel/process.c
- arch/hexagon/kernel/process.c
- arch/ia64/kernel/process.c
- arch/m32r/kernel/process.c
- arch/m68k/kernel/process.c
- arch/microblaze/kernel/process.c
- arch/mips/kernel/process.c
- arch/mn10300/kernel/process.c
- arch/openrisc/kernel/process.c
- arch/parisc/kernel/process.c
- arch/powerpc/kernel/process.c
- arch/s390/kernel/process.c
- arch/score/kernel/process.c
- arch/sh/kernel/process_32.c
- arch/sh/kernel/process_64.c
- arch/sparc/kernel/process_32.c
- arch/sparc/kernel/process_64.c
- arch/tile/kernel/process.c
- arch/um/kernel/process.c
- arch/unicore32/kernel/process.c
- arch/x86/kernel/process_32.c
- arch/x86/kernel/process_64.c
- arch/xtensa/kernel/process.c
- include/linux/sched.h
- kernel/fork.c
arch/alpha/kernel/process.c
... | ... | @@ -241,7 +241,7 @@ |
241 | 241 | int |
242 | 242 | copy_thread(unsigned long clone_flags, unsigned long usp, |
243 | 243 | unsigned long arg, |
244 | - struct task_struct *p, struct pt_regs *wontuse) | |
244 | + struct task_struct *p) | |
245 | 245 | { |
246 | 246 | extern void ret_from_fork(void); |
247 | 247 | extern void ret_from_kernel_thread(void); |
arch/arm/kernel/process.c
... | ... | @@ -376,7 +376,7 @@ |
376 | 376 | |
377 | 377 | int |
378 | 378 | copy_thread(unsigned long clone_flags, unsigned long stack_start, |
379 | - unsigned long stk_sz, struct task_struct *p, struct pt_regs *unused) | |
379 | + unsigned long stk_sz, struct task_struct *p) | |
380 | 380 | { |
381 | 381 | struct thread_info *thread = task_thread_info(p); |
382 | 382 | struct pt_regs *childregs = task_pt_regs(p); |
arch/arm64/kernel/process.c
... | ... | @@ -234,8 +234,7 @@ |
234 | 234 | asmlinkage void ret_from_fork(void) asm("ret_from_fork"); |
235 | 235 | |
236 | 236 | int copy_thread(unsigned long clone_flags, unsigned long stack_start, |
237 | - unsigned long stk_sz, struct task_struct *p, | |
238 | - struct pt_regs *unused) | |
237 | + unsigned long stk_sz, struct task_struct *p) | |
239 | 238 | { |
240 | 239 | struct pt_regs *childregs = task_pt_regs(p); |
241 | 240 | unsigned long tls = p->thread.tp_value; |
arch/avr32/kernel/process.c
arch/blackfin/kernel/process.c
... | ... | @@ -141,14 +141,14 @@ |
141 | 141 | int |
142 | 142 | copy_thread(unsigned long clone_flags, |
143 | 143 | unsigned long usp, unsigned long topstk, |
144 | - struct task_struct *p, struct pt_regs *regs) | |
144 | + struct task_struct *p) | |
145 | 145 | { |
146 | 146 | struct pt_regs *childregs; |
147 | 147 | unsigned long *v; |
148 | 148 | |
149 | 149 | childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; |
150 | 150 | v = ((unsigned long *)childregs) - 2; |
151 | - if (unlikely(!regs)) { | |
151 | + if (unlikely(p->flags & PF_KTHREAD)) { | |
152 | 152 | memset(childregs, 0, sizeof(struct pt_regs)); |
153 | 153 | v[0] = usp; |
154 | 154 | v[1] = topstk; |
... | ... | @@ -157,7 +157,7 @@ |
157 | 157 | __asm__ __volatile__("%0 = syscfg;":"=da"(childregs->syscfg):); |
158 | 158 | p->thread.usp = 0; |
159 | 159 | } else { |
160 | - *childregs = *regs; | |
160 | + *childregs = *current_pt_regs(); | |
161 | 161 | childregs->r0 = 0; |
162 | 162 | p->thread.usp = usp ? : rdusp(); |
163 | 163 | v[0] = v[1] = 0; |
arch/c6x/kernel/process.c
arch/cris/arch-v10/kernel/process.c
... | ... | @@ -94,8 +94,7 @@ |
94 | 94 | asmlinkage void ret_from_kernel_thread(void); |
95 | 95 | |
96 | 96 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
97 | - unsigned long arg, | |
98 | - struct task_struct *p, struct pt_regs *unused) | |
97 | + unsigned long arg, struct task_struct *p) | |
99 | 98 | { |
100 | 99 | struct pt_regs *childregs = task_pt_regs(p); |
101 | 100 | struct switch_stack *swstack = ((struct switch_stack *)childregs) - 1; |
arch/cris/arch-v32/kernel/process.c
... | ... | @@ -109,8 +109,7 @@ |
109 | 109 | |
110 | 110 | int |
111 | 111 | copy_thread(unsigned long clone_flags, unsigned long usp, |
112 | - unsigned long arg, | |
113 | - struct task_struct *p, struct pt_regs *unused) | |
112 | + unsigned long arg, struct task_struct *p) | |
114 | 113 | { |
115 | 114 | struct pt_regs *childregs = task_pt_regs(p); |
116 | 115 | struct switch_stack *swstack = ((struct switch_stack *) childregs) - 1; |
arch/frv/kernel/process.c
arch/h8300/kernel/process.c
arch/hexagon/kernel/process.c
... | ... | @@ -87,8 +87,7 @@ |
87 | 87 | * Copy architecture-specific thread state |
88 | 88 | */ |
89 | 89 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
90 | - unsigned long arg, struct task_struct *p, | |
91 | - struct pt_regs *unused) | |
90 | + unsigned long arg, struct task_struct *p) | |
92 | 91 | { |
93 | 92 | struct thread_info *ti = task_thread_info(p); |
94 | 93 | struct hexagon_switch_stack *ss; |
arch/ia64/kernel/process.c
... | ... | @@ -393,12 +393,13 @@ |
393 | 393 | int |
394 | 394 | copy_thread(unsigned long clone_flags, |
395 | 395 | unsigned long user_stack_base, unsigned long user_stack_size, |
396 | - struct task_struct *p, struct pt_regs *regs) | |
396 | + struct task_struct *p) | |
397 | 397 | { |
398 | 398 | extern char ia64_ret_from_clone; |
399 | 399 | struct switch_stack *child_stack, *stack; |
400 | 400 | unsigned long rbs, child_rbs, rbs_size; |
401 | 401 | struct pt_regs *child_ptregs; |
402 | + struct pt_regs *regs = current_pt_regs(); | |
402 | 403 | int retval = 0; |
403 | 404 | |
404 | 405 | child_ptregs = (struct pt_regs *) ((unsigned long) p + IA64_STK_OFFSET) - 1; |
arch/m32r/kernel/process.c
... | ... | @@ -192,7 +192,7 @@ |
192 | 192 | } |
193 | 193 | |
194 | 194 | int copy_thread(unsigned long clone_flags, unsigned long spu, |
195 | - unsigned long arg, struct task_struct *tsk, struct pt_regs *unused) | |
195 | + unsigned long arg, struct task_struct *tsk) | |
196 | 196 | { |
197 | 197 | struct pt_regs *childregs = task_pt_regs(tsk); |
198 | 198 | extern void ret_from_fork(void); |
arch/m68k/kernel/process.c
... | ... | @@ -154,8 +154,7 @@ |
154 | 154 | } |
155 | 155 | |
156 | 156 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
157 | - unsigned long arg, | |
158 | - struct task_struct * p, struct pt_regs * unused) | |
157 | + unsigned long arg, struct task_struct *p) | |
159 | 158 | { |
160 | 159 | struct fork_frame { |
161 | 160 | struct switch_stack sw; |
arch/microblaze/kernel/process.c
... | ... | @@ -120,8 +120,7 @@ |
120 | 120 | } |
121 | 121 | |
122 | 122 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
123 | - unsigned long arg, | |
124 | - struct task_struct *p, struct pt_regs *unused) | |
123 | + unsigned long arg, struct task_struct *p) | |
125 | 124 | { |
126 | 125 | struct pt_regs *childregs = task_pt_regs(p); |
127 | 126 | struct thread_info *ti = task_thread_info(p); |
arch/mips/kernel/process.c
... | ... | @@ -114,10 +114,10 @@ |
114 | 114 | } |
115 | 115 | |
116 | 116 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
117 | - unsigned long arg, struct task_struct *p, struct pt_regs *regs) | |
117 | + unsigned long arg, struct task_struct *p) | |
118 | 118 | { |
119 | 119 | struct thread_info *ti = task_thread_info(p); |
120 | - struct pt_regs *childregs; | |
120 | + struct pt_regs *childregs, *regs = current_pt_regs(); | |
121 | 121 | unsigned long childksp; |
122 | 122 | p->set_child_tid = p->clear_child_tid = NULL; |
123 | 123 |
arch/mn10300/kernel/process.c
... | ... | @@ -206,7 +206,7 @@ |
206 | 206 | */ |
207 | 207 | int copy_thread(unsigned long clone_flags, |
208 | 208 | unsigned long c_usp, unsigned long ustk_size, |
209 | - struct task_struct *p, struct pt_regs *unused) | |
209 | + struct task_struct *p) | |
210 | 210 | { |
211 | 211 | struct thread_info *ti = task_thread_info(p); |
212 | 212 | struct pt_regs *c_regs; |
arch/openrisc/kernel/process.c
... | ... | @@ -142,7 +142,7 @@ |
142 | 142 | |
143 | 143 | int |
144 | 144 | copy_thread(unsigned long clone_flags, unsigned long usp, |
145 | - unsigned long arg, struct task_struct *p, struct pt_regs *regs) | |
145 | + unsigned long arg, struct task_struct *p) | |
146 | 146 | { |
147 | 147 | struct pt_regs *userregs; |
148 | 148 | struct pt_regs *kregs; |
arch/parisc/kernel/process.c
... | ... | @@ -204,10 +204,9 @@ |
204 | 204 | |
205 | 205 | int |
206 | 206 | copy_thread(unsigned long clone_flags, unsigned long usp, |
207 | - unsigned long arg, | |
208 | - struct task_struct *p, struct pt_regs *unused) | |
207 | + unsigned long arg, struct task_struct *p) | |
209 | 208 | { |
210 | - struct pt_regs * cregs = &(p->thread.regs); | |
209 | + struct pt_regs *cregs = &(p->thread.regs); | |
211 | 210 | void *stack = task_stack_page(p); |
212 | 211 | |
213 | 212 | /* We have to use void * instead of a function pointer, because |
arch/powerpc/kernel/process.c
... | ... | @@ -733,8 +733,7 @@ |
733 | 733 | extern unsigned long dscr_default; /* defined in arch/powerpc/kernel/sysfs.c */ |
734 | 734 | |
735 | 735 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
736 | - unsigned long arg, struct task_struct *p, | |
737 | - struct pt_regs *regs) | |
736 | + unsigned long arg, struct task_struct *p) | |
738 | 737 | { |
739 | 738 | struct pt_regs *childregs, *kregs; |
740 | 739 | extern void ret_from_fork(void); |
... | ... | @@ -759,6 +758,7 @@ |
759 | 758 | ti->flags |= _TIF_RESTOREALL; |
760 | 759 | f = ret_from_kernel_thread; |
761 | 760 | } else { |
761 | + struct pt_regs *regs = current_pt_regs(); | |
762 | 762 | CHECK_FULL_REGS(regs); |
763 | 763 | *childregs = *regs; |
764 | 764 | if (usp) |
arch/s390/kernel/process.c
... | ... | @@ -117,8 +117,7 @@ |
117 | 117 | } |
118 | 118 | |
119 | 119 | int copy_thread(unsigned long clone_flags, unsigned long new_stackp, |
120 | - unsigned long arg, | |
121 | - struct task_struct *p, struct pt_regs *unused) | |
120 | + unsigned long arg, struct task_struct *p) | |
122 | 121 | { |
123 | 122 | struct thread_info *ti; |
124 | 123 | struct fake_frame |
arch/score/kernel/process.c
... | ... | @@ -87,11 +87,11 @@ |
87 | 87 | * set up the kernel stack and exception frames for a new process |
88 | 88 | */ |
89 | 89 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
90 | - unsigned long arg, | |
91 | - struct task_struct *p, struct pt_regs *regs) | |
90 | + unsigned long arg, struct task_struct *p) | |
92 | 91 | { |
93 | 92 | struct thread_info *ti = task_thread_info(p); |
94 | 93 | struct pt_regs *childregs = task_pt_regs(p); |
94 | + struct pt_regs *regs = current_pt_regs(); | |
95 | 95 | |
96 | 96 | p->thread.reg0 = (unsigned long) childregs; |
97 | 97 | if (unlikely(p->flags & PF_KTHREAD)) { |
arch/sh/kernel/process_32.c
... | ... | @@ -128,8 +128,7 @@ |
128 | 128 | asmlinkage void ret_from_kernel_thread(void); |
129 | 129 | |
130 | 130 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
131 | - unsigned long arg, | |
132 | - struct task_struct *p, struct pt_regs *unused) | |
131 | + unsigned long arg, struct task_struct *p) | |
133 | 132 | { |
134 | 133 | struct thread_info *ti = task_thread_info(p); |
135 | 134 | struct pt_regs *childregs; |
arch/sh/kernel/process_64.c
... | ... | @@ -371,10 +371,9 @@ |
371 | 371 | asmlinkage void ret_from_kernel_thread(void); |
372 | 372 | |
373 | 373 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
374 | - unsigned long arg, | |
375 | - struct task_struct *p, struct pt_regs *regs) | |
374 | + unsigned long arg, struct task_struct *p) | |
376 | 375 | { |
377 | - struct pt_regs *childregs; | |
376 | + struct pt_regs *childregs, *regs = current_pt_regs(); | |
378 | 377 | |
379 | 378 | #ifdef CONFIG_SH_FPU |
380 | 379 | /* can't happen for a kernel thread */ |
arch/sparc/kernel/process_32.c
... | ... | @@ -319,11 +319,10 @@ |
319 | 319 | extern void ret_from_kernel_thread(void); |
320 | 320 | |
321 | 321 | int copy_thread(unsigned long clone_flags, unsigned long sp, |
322 | - unsigned long arg, | |
323 | - struct task_struct *p, struct pt_regs *regs) | |
322 | + unsigned long arg, struct task_struct *p) | |
324 | 323 | { |
325 | 324 | struct thread_info *ti = task_thread_info(p); |
326 | - struct pt_regs *childregs; | |
325 | + struct pt_regs *childregs, *regs = current_pt_regs(); | |
327 | 326 | char *new_stack; |
328 | 327 | |
329 | 328 | #ifndef CONFIG_SMP |
arch/sparc/kernel/process_64.c
... | ... | @@ -622,10 +622,10 @@ |
622 | 622 | * Child --> %o0 == parents pid, %o1 == 1 |
623 | 623 | */ |
624 | 624 | int copy_thread(unsigned long clone_flags, unsigned long sp, |
625 | - unsigned long arg, | |
626 | - struct task_struct *p, struct pt_regs *regs) | |
625 | + unsigned long arg, struct task_struct *p) | |
627 | 626 | { |
628 | 627 | struct thread_info *t = task_thread_info(p); |
628 | + struct pt_regs *regs = current_pt_regs(); | |
629 | 629 | struct sparc_stackf *parent_sf; |
630 | 630 | unsigned long child_stack_sz; |
631 | 631 | char *child_trap_frame; |
arch/tile/kernel/process.c
... | ... | @@ -157,10 +157,9 @@ |
157 | 157 | static void save_arch_state(struct thread_struct *t); |
158 | 158 | |
159 | 159 | int copy_thread(unsigned long clone_flags, unsigned long sp, |
160 | - unsigned long arg, | |
161 | - struct task_struct *p, struct pt_regs *unused) | |
160 | + unsigned long arg, struct task_struct *p) | |
162 | 161 | { |
163 | - struct pt_regs *childregs = task_pt_regs(p); | |
162 | + struct pt_regs *childregs = task_pt_regs(p), *regs = current_pt_regs(); | |
164 | 163 | unsigned long ksp; |
165 | 164 | unsigned long *callee_regs; |
166 | 165 |
arch/um/kernel/process.c
... | ... | @@ -161,8 +161,7 @@ |
161 | 161 | } |
162 | 162 | |
163 | 163 | int copy_thread(unsigned long clone_flags, unsigned long sp, |
164 | - unsigned long arg, struct task_struct * p, | |
165 | - struct pt_regs *regs) | |
164 | + unsigned long arg, struct task_struct * p) | |
166 | 165 | { |
167 | 166 | void (*handler)(void); |
168 | 167 | int kthread = current->flags & PF_KTHREAD; |
arch/unicore32/kernel/process.c
... | ... | @@ -262,7 +262,7 @@ |
262 | 262 | |
263 | 263 | int |
264 | 264 | copy_thread(unsigned long clone_flags, unsigned long stack_start, |
265 | - unsigned long stk_sz, struct task_struct *p, struct pt_regs *unused) | |
265 | + unsigned long stk_sz, struct task_struct *p) | |
266 | 266 | { |
267 | 267 | struct thread_info *thread = task_thread_info(p); |
268 | 268 | struct pt_regs *childregs = task_pt_regs(p); |
arch/x86/kernel/process_32.c
... | ... | @@ -128,8 +128,7 @@ |
128 | 128 | } |
129 | 129 | |
130 | 130 | int copy_thread(unsigned long clone_flags, unsigned long sp, |
131 | - unsigned long arg, | |
132 | - struct task_struct *p, struct pt_regs *unused) | |
131 | + unsigned long arg, struct task_struct *p) | |
133 | 132 | { |
134 | 133 | struct pt_regs *childregs = task_pt_regs(p); |
135 | 134 | struct task_struct *tsk; |
arch/x86/kernel/process_64.c
... | ... | @@ -146,8 +146,7 @@ |
146 | 146 | } |
147 | 147 | |
148 | 148 | int copy_thread(unsigned long clone_flags, unsigned long sp, |
149 | - unsigned long arg, | |
150 | - struct task_struct *p, struct pt_regs *regs) | |
149 | + unsigned long arg, struct task_struct *p) | |
151 | 150 | { |
152 | 151 | int err; |
153 | 152 | struct pt_regs *childregs; |
arch/xtensa/kernel/process.c
... | ... | @@ -199,8 +199,7 @@ |
199 | 199 | */ |
200 | 200 | |
201 | 201 | int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, |
202 | - unsigned long thread_fn_arg, | |
203 | - struct task_struct *p, struct pt_regs *unused) | |
202 | + unsigned long thread_fn_arg, struct task_struct *p) | |
204 | 203 | { |
205 | 204 | struct pt_regs *childregs = task_pt_regs(p); |
206 | 205 |
include/linux/sched.h
... | ... | @@ -2271,7 +2271,7 @@ |
2271 | 2271 | extern struct mm_struct *dup_mm(struct task_struct *tsk); |
2272 | 2272 | |
2273 | 2273 | extern int copy_thread(unsigned long, unsigned long, unsigned long, |
2274 | - struct task_struct *, struct pt_regs *); | |
2274 | + struct task_struct *); | |
2275 | 2275 | extern void flush_thread(void); |
2276 | 2276 | extern void exit_thread(void); |
2277 | 2277 |
kernel/fork.c
... | ... | @@ -1320,7 +1320,7 @@ |
1320 | 1320 | retval = copy_io(clone_flags, p); |
1321 | 1321 | if (retval) |
1322 | 1322 | goto bad_fork_cleanup_namespaces; |
1323 | - retval = copy_thread(clone_flags, stack_start, stack_size, p, regs); | |
1323 | + retval = copy_thread(clone_flags, stack_start, stack_size, p); | |
1324 | 1324 | if (retval) |
1325 | 1325 | goto bad_fork_cleanup_io; |
1326 | 1326 |