process_32.c (f594d0b9b34aeb8e3ffa524eaa8a4085afb56d22) process_32.c (0100301bfdf56a2a370c7157b5ab0fbf9313e1cd)
1/*
2 * Copyright (C) 1995 Linus Torvalds
3 *
4 * Pentium III FXSR, SSE support
5 * Gareth Hughes <gareth@valinux.com>, May 2000
6 */
7
8/*

--- 119 unchanged lines hidden (view full) ---

128 BUG_ON(dead_task->mm);
129 release_vm86_irqs(dead_task);
130}
131
132int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
133 unsigned long arg, struct task_struct *p, unsigned long tls)
134{
135 struct pt_regs *childregs = task_pt_regs(p);
1/*
2 * Copyright (C) 1995 Linus Torvalds
3 *
4 * Pentium III FXSR, SSE support
5 * Gareth Hughes <gareth@valinux.com>, May 2000
6 */
7
8/*

--- 119 unchanged lines hidden (view full) ---

128 BUG_ON(dead_task->mm);
129 release_vm86_irqs(dead_task);
130}
131
132int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
133 unsigned long arg, struct task_struct *p, unsigned long tls)
134{
135 struct pt_regs *childregs = task_pt_regs(p);
136 struct fork_frame *fork_frame = container_of(childregs, struct fork_frame, regs);
137 struct inactive_task_frame *frame = &fork_frame->frame;
136 struct task_struct *tsk;
137 int err;
138
138 struct task_struct *tsk;
139 int err;
140
139 p->thread.sp = (unsigned long) childregs;
141 frame->bp = 0;
142 p->thread.sp = (unsigned long) fork_frame;
140 p->thread.sp0 = (unsigned long) (childregs+1);
141 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
142
143 if (unlikely(p->flags & PF_KTHREAD)) {
144 /* kernel thread */
145 memset(childregs, 0, sizeof(struct pt_regs));
143 p->thread.sp0 = (unsigned long) (childregs+1);
144 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
145
146 if (unlikely(p->flags & PF_KTHREAD)) {
147 /* kernel thread */
148 memset(childregs, 0, sizeof(struct pt_regs));
146 p->thread.ip = (unsigned long) ret_from_kernel_thread;
149 frame->ret_addr = (unsigned long) ret_from_kernel_thread;
147 task_user_gs(p) = __KERNEL_STACK_CANARY;
148 childregs->ds = __USER_DS;
149 childregs->es = __USER_DS;
150 childregs->fs = __KERNEL_PERCPU;
151 childregs->bx = sp; /* function */
152 childregs->bp = arg;
153 childregs->orig_ax = -1;
154 childregs->cs = __KERNEL_CS | get_kernel_rpl();
155 childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_FIXED;
156 p->thread.io_bitmap_ptr = NULL;
157 return 0;
158 }
159 *childregs = *current_pt_regs();
160 childregs->ax = 0;
161 if (sp)
162 childregs->sp = sp;
163
150 task_user_gs(p) = __KERNEL_STACK_CANARY;
151 childregs->ds = __USER_DS;
152 childregs->es = __USER_DS;
153 childregs->fs = __KERNEL_PERCPU;
154 childregs->bx = sp; /* function */
155 childregs->bp = arg;
156 childregs->orig_ax = -1;
157 childregs->cs = __KERNEL_CS | get_kernel_rpl();
158 childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_FIXED;
159 p->thread.io_bitmap_ptr = NULL;
160 return 0;
161 }
162 *childregs = *current_pt_regs();
163 childregs->ax = 0;
164 if (sp)
165 childregs->sp = sp;
166
164 p->thread.ip = (unsigned long) ret_from_fork;
167 frame->ret_addr = (unsigned long) ret_from_fork;
165 task_user_gs(p) = get_user_gs(current_pt_regs());
166
167 p->thread.io_bitmap_ptr = NULL;
168 tsk = current;
169 err = -ENOMEM;
170
171 if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
172 p->thread.io_bitmap_ptr = kmemdup(tsk->thread.io_bitmap_ptr,

--- 146 unchanged lines hidden ---
168 task_user_gs(p) = get_user_gs(current_pt_regs());
169
170 p->thread.io_bitmap_ptr = NULL;
171 tsk = current;
172 err = -ENOMEM;
173
174 if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
175 p->thread.io_bitmap_ptr = kmemdup(tsk->thread.io_bitmap_ptr,

--- 146 unchanged lines hidden ---