|
@@ -129,7 +129,7 @@ void release_thread(struct task_struct *dead_task)
|
|
|
|
|
|
int copy_thread(unsigned long clone_flags, unsigned long sp,
|
|
int copy_thread(unsigned long clone_flags, unsigned long sp,
|
|
unsigned long arg,
|
|
unsigned long arg,
|
|
- struct task_struct *p, struct pt_regs *regs)
|
|
|
|
|
|
+ struct task_struct *p, struct pt_regs *unused)
|
|
{
|
|
{
|
|
struct pt_regs *childregs = task_pt_regs(p);
|
|
struct pt_regs *childregs = task_pt_regs(p);
|
|
struct task_struct *tsk;
|
|
struct task_struct *tsk;
|
|
@@ -138,7 +138,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
|
|
p->thread.sp = (unsigned long) childregs;
|
|
p->thread.sp = (unsigned long) childregs;
|
|
p->thread.sp0 = (unsigned long) (childregs+1);
|
|
p->thread.sp0 = (unsigned long) (childregs+1);
|
|
|
|
|
|
- if (unlikely(!regs)) {
|
|
|
|
|
|
+ if (unlikely(p->flags & PF_KTHREAD)) {
|
|
/* kernel thread */
|
|
/* kernel thread */
|
|
memset(childregs, 0, sizeof(struct pt_regs));
|
|
memset(childregs, 0, sizeof(struct pt_regs));
|
|
p->thread.ip = (unsigned long) ret_from_kernel_thread;
|
|
p->thread.ip = (unsigned long) ret_from_kernel_thread;
|
|
@@ -156,12 +156,13 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
|
|
memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
|
|
memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
- *childregs = *regs;
|
|
|
|
|
|
+ *childregs = *current_pt_regs();
|
|
childregs->ax = 0;
|
|
childregs->ax = 0;
|
|
- childregs->sp = sp;
|
|
|
|
|
|
+ if (sp)
|
|
|
|
+ childregs->sp = sp;
|
|
|
|
|
|
p->thread.ip = (unsigned long) ret_from_fork;
|
|
p->thread.ip = (unsigned long) ret_from_fork;
|
|
- task_user_gs(p) = get_user_gs(regs);
|
|
|
|
|
|
+ task_user_gs(p) = get_user_gs(current_pt_regs());
|
|
|
|
|
|
p->fpu_counter = 0;
|
|
p->fpu_counter = 0;
|
|
p->thread.io_bitmap_ptr = NULL;
|
|
p->thread.io_bitmap_ptr = NULL;
|