diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-12-15 14:33:22 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-15 14:33:28 -0500 |
commit | ab1eebe77dd08b26585860d534e07810d1cd274d (patch) | |
tree | 92b1ff0952cbdeef34922c43ff7eaac2162e77c4 /arch/x86/kernel/process_32.c | |
parent | 186a25026c44d1bfa97671110ff14dcd0c99678e (diff) | |
parent | df59e7bf439918f523ac29e996ec1eebbed60440 (diff) |
Merge branch 'x86/asm' into x86/urgent
Merge reason: it's stable so lets push it upstream.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/process_32.c')
-rw-r--r-- | arch/x86/kernel/process_32.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 120b88797a75..9c517b5858f0 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -180,39 +180,6 @@ void show_regs(struct pt_regs *regs) | |||
180 | show_trace(NULL, regs, ®s->sp, regs->bp); | 180 | show_trace(NULL, regs, ®s->sp, regs->bp); |
181 | } | 181 | } |
182 | 182 | ||
183 | /* | ||
184 | * This gets run with %bx containing the | ||
185 | * function to call, and %dx containing | ||
186 | * the "args". | ||
187 | */ | ||
188 | extern void kernel_thread_helper(void); | ||
189 | |||
190 | /* | ||
191 | * Create a kernel thread | ||
192 | */ | ||
193 | int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) | ||
194 | { | ||
195 | struct pt_regs regs; | ||
196 | |||
197 | memset(®s, 0, sizeof(regs)); | ||
198 | |||
199 | regs.bx = (unsigned long) fn; | ||
200 | regs.dx = (unsigned long) arg; | ||
201 | |||
202 | regs.ds = __USER_DS; | ||
203 | regs.es = __USER_DS; | ||
204 | regs.fs = __KERNEL_PERCPU; | ||
205 | regs.gs = __KERNEL_STACK_CANARY; | ||
206 | regs.orig_ax = -1; | ||
207 | regs.ip = (unsigned long) kernel_thread_helper; | ||
208 | regs.cs = __KERNEL_CS | get_kernel_rpl(); | ||
209 | regs.flags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2; | ||
210 | |||
211 | /* Ok, create the new process.. */ | ||
212 | return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL); | ||
213 | } | ||
214 | EXPORT_SYMBOL(kernel_thread); | ||
215 | |||
216 | void release_thread(struct task_struct *dead_task) | 183 | void release_thread(struct task_struct *dead_task) |
217 | { | 184 | { |
218 | BUG_ON(dead_task->mm); | 185 | BUG_ON(dead_task->mm); |
@@ -424,46 +391,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
424 | return prev_p; | 391 | return prev_p; |
425 | } | 392 | } |
426 | 393 | ||
427 | int sys_clone(struct pt_regs *regs) | ||
428 | { | ||
429 | unsigned long clone_flags; | ||
430 | unsigned long newsp; | ||
431 | int __user *parent_tidptr, *child_tidptr; | ||
432 | |||
433 | clone_flags = regs->bx; | ||
434 | newsp = regs->cx; | ||
435 | parent_tidptr = (int __user *)regs->dx; | ||
436 | child_tidptr = (int __user *)regs->di; | ||
437 | if (!newsp) | ||
438 | newsp = regs->sp; | ||
439 | return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr); | ||
440 | } | ||
441 | |||
442 | /* | ||
443 | * sys_execve() executes a new program. | ||
444 | */ | ||
445 | int sys_execve(struct pt_regs *regs) | ||
446 | { | ||
447 | int error; | ||
448 | char *filename; | ||
449 | |||
450 | filename = getname((char __user *) regs->bx); | ||
451 | error = PTR_ERR(filename); | ||
452 | if (IS_ERR(filename)) | ||
453 | goto out; | ||
454 | error = do_execve(filename, | ||
455 | (char __user * __user *) regs->cx, | ||
456 | (char __user * __user *) regs->dx, | ||
457 | regs); | ||
458 | if (error == 0) { | ||
459 | /* Make sure we don't return using sysenter.. */ | ||
460 | set_thread_flag(TIF_IRET); | ||
461 | } | ||
462 | putname(filename); | ||
463 | out: | ||
464 | return error; | ||
465 | } | ||
466 | |||
467 | #define top_esp (THREAD_SIZE - sizeof(unsigned long)) | 394 | #define top_esp (THREAD_SIZE - sizeof(unsigned long)) |
468 | #define top_ebp (THREAD_SIZE - 2*sizeof(unsigned long)) | 395 | #define top_ebp (THREAD_SIZE - 2*sizeof(unsigned long)) |
469 | 396 | ||