diff options
author | Jeff Dike <jdike@addtoit.com> | 2005-06-25 17:55:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:35 -0400 |
commit | e0877f07e85a46e4fde32bd84f08551d360839fe (patch) | |
tree | 97e29c30e5f1ee7f06f5cdd4760291d3bba6640e /arch/um/kernel | |
parent | 41f2148a67f28803d64bf5ff538591af90a5ab57 (diff) |
[PATCH] uml: fork cleanup
Fix the do_fork calling convention: normal arch pass the regs and the new sp
value to do_fork instead of NULL.
Currently the arch-independent code ignores these values, while the UML code
(actually it's copy_thread) gets the right values by itself.
With this patch, things are fixed up.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r-- | arch/um/kernel/process_kern.c | 4 | ||||
-rw-r--r-- | arch/um/kernel/skas/process_kern.c | 14 | ||||
-rw-r--r-- | arch/um/kernel/syscall_kern.c | 19 | ||||
-rw-r--r-- | arch/um/kernel/tt/process_kern.c | 17 |
4 files changed, 11 insertions, 43 deletions
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c index 157584ae4792..0c57bc6e3747 100644 --- a/arch/um/kernel/process_kern.c +++ b/arch/um/kernel/process_kern.c | |||
@@ -96,8 +96,8 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) | |||
96 | 96 | ||
97 | current->thread.request.u.thread.proc = fn; | 97 | current->thread.request.u.thread.proc = fn; |
98 | current->thread.request.u.thread.arg = arg; | 98 | current->thread.request.u.thread.arg = arg; |
99 | pid = do_fork(CLONE_VM | CLONE_UNTRACED | flags, 0, NULL, 0, NULL, | 99 | pid = do_fork(CLONE_VM | CLONE_UNTRACED | flags, 0, |
100 | NULL); | 100 | ¤t->thread.regs, 0, NULL, NULL); |
101 | if(pid < 0) | 101 | if(pid < 0) |
102 | panic("do_fork failed in kernel_thread, errno = %d", pid); | 102 | panic("do_fork failed in kernel_thread, errno = %d", pid); |
103 | return(pid); | 103 | return(pid); |
diff --git a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c index fc71ef295782..8f0607f54b7a 100644 --- a/arch/um/kernel/skas/process_kern.c +++ b/arch/um/kernel/skas/process_kern.c | |||
@@ -111,8 +111,7 @@ int copy_thread_skas(int nr, unsigned long clone_flags, unsigned long sp, | |||
111 | void (*handler)(int); | 111 | void (*handler)(int); |
112 | 112 | ||
113 | if(current->thread.forking){ | 113 | if(current->thread.forking){ |
114 | memcpy(&p->thread.regs.regs.skas, | 114 | memcpy(&p->thread.regs.regs.skas, ®s->regs.skas, |
115 | ¤t->thread.regs.regs.skas, | ||
116 | sizeof(p->thread.regs.regs.skas)); | 115 | sizeof(p->thread.regs.regs.skas)); |
117 | REGS_SET_SYSCALL_RETURN(p->thread.regs.regs.skas.regs, 0); | 116 | REGS_SET_SYSCALL_RETURN(p->thread.regs.regs.skas.regs, 0); |
118 | if(sp != 0) REGS_SP(p->thread.regs.regs.skas.regs) = sp; | 117 | if(sp != 0) REGS_SP(p->thread.regs.regs.skas.regs) = sp; |
@@ -201,14 +200,3 @@ int thread_pid_skas(struct task_struct *task) | |||
201 | #warning Need to look up userspace_pid by cpu | 200 | #warning Need to look up userspace_pid by cpu |
202 | return(userspace_pid[0]); | 201 | return(userspace_pid[0]); |
203 | } | 202 | } |
204 | |||
205 | /* | ||
206 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
207 | * Emacs will notice this stuff at the end of the file and automatically | ||
208 | * adjust the settings for this buffer only. This must remain at the end | ||
209 | * of the file. | ||
210 | * --------------------------------------------------------------------------- | ||
211 | * Local variables: | ||
212 | * c-file-style: "linux" | ||
213 | * End: | ||
214 | */ | ||
diff --git a/arch/um/kernel/syscall_kern.c b/arch/um/kernel/syscall_kern.c index b7a55251e897..8e1a3501ff46 100644 --- a/arch/um/kernel/syscall_kern.c +++ b/arch/um/kernel/syscall_kern.c | |||
@@ -31,7 +31,8 @@ long sys_fork(void) | |||
31 | long ret; | 31 | long ret; |
32 | 32 | ||
33 | current->thread.forking = 1; | 33 | current->thread.forking = 1; |
34 | ret = do_fork(SIGCHLD, 0, NULL, 0, NULL, NULL); | 34 | ret = do_fork(SIGCHLD, UPT_SP(¤t->thread.regs.regs), |
35 | ¤t->thread.regs, 0, NULL, NULL); | ||
35 | current->thread.forking = 0; | 36 | current->thread.forking = 0; |
36 | return(ret); | 37 | return(ret); |
37 | } | 38 | } |
@@ -41,8 +42,9 @@ long sys_vfork(void) | |||
41 | long ret; | 42 | long ret; |
42 | 43 | ||
43 | current->thread.forking = 1; | 44 | current->thread.forking = 1; |
44 | ret = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, NULL, 0, NULL, | 45 | ret = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, |
45 | NULL); | 46 | UPT_SP(¤t->thread.regs.regs), |
47 | ¤t->thread.regs, 0, NULL, NULL); | ||
46 | current->thread.forking = 0; | 48 | current->thread.forking = 0; |
47 | return(ret); | 49 | return(ret); |
48 | } | 50 | } |
@@ -162,14 +164,3 @@ int next_syscall_index(int limit) | |||
162 | spin_unlock(&syscall_lock); | 164 | spin_unlock(&syscall_lock); |
163 | return(ret); | 165 | return(ret); |
164 | } | 166 | } |
165 | |||
166 | /* | ||
167 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
168 | * Emacs will notice this stuff at the end of the file and automatically | ||
169 | * adjust the settings for this buffer only. This must remain at the end | ||
170 | * of the file. | ||
171 | * --------------------------------------------------------------------------- | ||
172 | * Local variables: | ||
173 | * c-file-style: "linux" | ||
174 | * End: | ||
175 | */ | ||
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c index 776310fd5b8b..a189a2b92935 100644 --- a/arch/um/kernel/tt/process_kern.c +++ b/arch/um/kernel/tt/process_kern.c | |||
@@ -266,10 +266,10 @@ int copy_thread_tt(int nr, unsigned long clone_flags, unsigned long sp, | |||
266 | } | 266 | } |
267 | 267 | ||
268 | if(current->thread.forking){ | 268 | if(current->thread.forking){ |
269 | sc_to_sc(UPT_SC(&p->thread.regs.regs), | 269 | sc_to_sc(UPT_SC(&p->thread.regs.regs), UPT_SC(®s->regs)); |
270 | UPT_SC(¤t->thread.regs.regs)); | ||
271 | SC_SET_SYSCALL_RETURN(UPT_SC(&p->thread.regs.regs), 0); | 270 | SC_SET_SYSCALL_RETURN(UPT_SC(&p->thread.regs.regs), 0); |
272 | if(sp != 0) SC_SP(UPT_SC(&p->thread.regs.regs)) = sp; | 271 | if(sp != 0) |
272 | SC_SP(UPT_SC(&p->thread.regs.regs)) = sp; | ||
273 | } | 273 | } |
274 | p->thread.mode.tt.extern_pid = new_pid; | 274 | p->thread.mode.tt.extern_pid = new_pid; |
275 | 275 | ||
@@ -459,14 +459,3 @@ int is_valid_pid(int pid) | |||
459 | read_unlock(&tasklist_lock); | 459 | read_unlock(&tasklist_lock); |
460 | return(0); | 460 | return(0); |
461 | } | 461 | } |
462 | |||
463 | /* | ||
464 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
465 | * Emacs will notice this stuff at the end of the file and automatically | ||
466 | * adjust the settings for this buffer only. This must remain at the end | ||
467 | * of the file. | ||
468 | * --------------------------------------------------------------------------- | ||
469 | * Local variables: | ||
470 | * c-file-style: "linux" | ||
471 | * End: | ||
472 | */ | ||