aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2005-06-25 17:55:21 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:24:35 -0400
commite0877f07e85a46e4fde32bd84f08551d360839fe (patch)
tree97e29c30e5f1ee7f06f5cdd4760291d3bba6640e /arch/um
parent41f2148a67f28803d64bf5ff538591af90a5ab57 (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')
-rw-r--r--arch/um/kernel/process_kern.c4
-rw-r--r--arch/um/kernel/skas/process_kern.c14
-rw-r--r--arch/um/kernel/syscall_kern.c19
-rw-r--r--arch/um/kernel/tt/process_kern.c17
-rw-r--r--arch/um/sys-i386/syscalls.c23
-rw-r--r--arch/um/sys-x86_64/syscalls.c23
6 files changed, 19 insertions, 81 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 &current->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, &regs->regs.skas,
115 &current->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(&current->thread.regs.regs),
35 &current->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(&current->thread.regs.regs),
47 &current->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(&regs->regs));
270 UPT_SC(&current->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 */
diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c
index 335e2d89504d..83e9be820a86 100644
--- a/arch/um/sys-i386/syscalls.c
+++ b/arch/um/sys-i386/syscalls.c
@@ -69,15 +69,11 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp,
69{ 69{
70 long ret; 70 long ret;
71 71
72 /* XXX: normal arch do here this pass, and also pass the regs to 72 if (!newsp)
73 * do_fork, instead of NULL. Currently the arch-independent code 73 newsp = UPT_SP(&current->thread.regs.regs);
74 * ignores these values, while the UML code (actually it's
75 * copy_thread) does the right thing. But this should change,
76 probably. */
77 /*if (!newsp)
78 newsp = UPT_SP(current->thread.regs);*/
79 current->thread.forking = 1; 74 current->thread.forking = 1;
80 ret = do_fork(clone_flags, newsp, NULL, 0, parent_tid, child_tid); 75 ret = do_fork(clone_flags, newsp, &current->thread.regs, 0, parent_tid,
76 child_tid);
81 current->thread.forking = 0; 77 current->thread.forking = 0;
82 return(ret); 78 return(ret);
83} 79}
@@ -197,14 +193,3 @@ long sys_sigaction(int sig, const struct old_sigaction __user *act,
197 193
198 return ret; 194 return ret;
199} 195}
200
201/*
202 * Overrides for Emacs so that we follow Linus's tabbing style.
203 * Emacs will notice this stuff at the end of the file and automatically
204 * adjust the settings for this buffer only. This must remain at the end
205 * of the file.
206 * ---------------------------------------------------------------------------
207 * Local variables:
208 * c-file-style: "linux"
209 * End:
210 */
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index 6f44f40204ed..3259a4db4534 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -174,26 +174,11 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp,
174{ 174{
175 long ret; 175 long ret;
176 176
177 /* XXX: normal arch do here this pass, and also pass the regs to 177 if (!newsp)
178 * do_fork, instead of NULL. Currently the arch-independent code 178 newsp = UPT_SP(&current->thread.regs.regs);
179 * ignores these values, while the UML code (actually it's
180 * copy_thread) does the right thing. But this should change,
181 probably. */
182 /*if (!newsp)
183 newsp = UPT_SP(current->thread.regs);*/
184 current->thread.forking = 1; 179 current->thread.forking = 1;
185 ret = do_fork(clone_flags, newsp, NULL, 0, parent_tid, child_tid); 180 ret = do_fork(clone_flags, newsp, &current->thread.regs, 0, parent_tid,
181 child_tid);
186 current->thread.forking = 0; 182 current->thread.forking = 0;
187 return(ret); 183 return(ret);
188} 184}
189
190/*
191 * Overrides for Emacs so that we follow Linus's tabbing style.
192 * Emacs will notice this stuff at the end of the file and automatically
193 * adjust the settings for this buffer only. This must remain at the end
194 * of the file.
195 * ---------------------------------------------------------------------------
196 * Local variables:
197 * c-file-style: "linux"
198 * End:
199 */