|
@@ -235,15 +235,15 @@ asmlinkage void ret_from_fork(void) asm("ret_from_fork");
|
|
|
|
|
|
int copy_thread(unsigned long clone_flags, unsigned long stack_start,
|
|
|
unsigned long stk_sz, struct task_struct *p,
|
|
|
- struct pt_regs *regs)
|
|
|
+ struct pt_regs *unused)
|
|
|
{
|
|
|
struct pt_regs *childregs = task_pt_regs(p);
|
|
|
unsigned long tls = p->thread.tp_value;
|
|
|
|
|
|
memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context));
|
|
|
|
|
|
- if (likely(regs)) {
|
|
|
- *childregs = *regs;
|
|
|
+ if (likely(!(p->flags & PF_KTHREAD))) {
|
|
|
+ *childregs = *current_pt_regs();
|
|
|
childregs->regs[0] = 0;
|
|
|
if (is_compat_thread(task_thread_info(p))) {
|
|
|
if (stack_start)
|
|
@@ -266,7 +266,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
|
|
|
* for the new thread.
|
|
|
*/
|
|
|
if (clone_flags & CLONE_SETTLS)
|
|
|
- tls = regs->regs[3];
|
|
|
+ tls = childregs->regs[3];
|
|
|
} else {
|
|
|
memset(childregs, 0, sizeof(struct pt_regs));
|
|
|
childregs->pstate = PSR_MODE_EL1h;
|