aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/process_32.c')
-rw-r--r--arch/x86/kernel/process_32.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 44e0bff38e72..16efa974532b 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -129,7 +129,7 @@ void release_thread(struct task_struct *dead_task)
129 129
130int copy_thread(unsigned long clone_flags, unsigned long sp, 130int copy_thread(unsigned long clone_flags, unsigned long sp,
131 unsigned long arg, 131 unsigned long arg,
132 struct task_struct *p, struct pt_regs *regs) 132 struct task_struct *p, struct pt_regs *unused)
133{ 133{
134 struct pt_regs *childregs = task_pt_regs(p); 134 struct pt_regs *childregs = task_pt_regs(p);
135 struct task_struct *tsk; 135 struct task_struct *tsk;
@@ -138,7 +138,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
138 p->thread.sp = (unsigned long) childregs; 138 p->thread.sp = (unsigned long) childregs;
139 p->thread.sp0 = (unsigned long) (childregs+1); 139 p->thread.sp0 = (unsigned long) (childregs+1);
140 140
141 if (unlikely(!regs)) { 141 if (unlikely(p->flags & PF_KTHREAD)) {
142 /* kernel thread */ 142 /* kernel thread */
143 memset(childregs, 0, sizeof(struct pt_regs)); 143 memset(childregs, 0, sizeof(struct pt_regs));
144 p->thread.ip = (unsigned long) ret_from_kernel_thread; 144 p->thread.ip = (unsigned long) ret_from_kernel_thread;
@@ -156,12 +156,13 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
156 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps)); 156 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
157 return 0; 157 return 0;
158 } 158 }
159 *childregs = *regs; 159 *childregs = *current_pt_regs();
160 childregs->ax = 0; 160 childregs->ax = 0;
161 childregs->sp = sp; 161 if (sp)
162 childregs->sp = sp;
162 163
163 p->thread.ip = (unsigned long) ret_from_fork; 164 p->thread.ip = (unsigned long) ret_from_fork;
164 task_user_gs(p) = get_user_gs(regs); 165 task_user_gs(p) = get_user_gs(current_pt_regs());
165 166
166 p->fpu_counter = 0; 167 p->fpu_counter = 0;
167 p->thread.io_bitmap_ptr = NULL; 168 p->thread.io_bitmap_ptr = NULL;