提交 6de5a8a5 编写于 作者: E Eli Cooper 提交者: Richard Weinberger

um: fix FPU state preservation around signal handlers

This patch makes UML saves/restores FPU state from/to the fpstate in
pt_regs when setting up or returning from a signal stack, rather than
calling ptrace directly. This ensures that FPU state is correctly
preserved around signal handlers in a multi-threaded scenario.
Signed-off-by: NEli Cooper <elicooper@gmx.com>
上级 44549e8f
...@@ -225,20 +225,10 @@ static int copy_sc_from_user(struct pt_regs *regs, ...@@ -225,20 +225,10 @@ static int copy_sc_from_user(struct pt_regs *regs,
} else } else
#endif #endif
{ {
struct user_i387_struct fp; err = copy_from_user(regs->regs.fp, (void *)sc.fpstate,
err = copy_from_user(&fp, (void *)sc.fpstate,
sizeof(struct user_i387_struct)); sizeof(struct user_i387_struct));
if (err) if (err)
return 1; return 1;
err = restore_fp_registers(pid, (unsigned long *) &fp);
if (err < 0) {
printk(KERN_ERR "copy_sc_from_user - "
"restore_fp_registers failed, errno = %d\n",
-err);
return 1;
}
} }
return 0; return 0;
} }
...@@ -325,10 +315,8 @@ static int copy_sc_to_user(struct sigcontext __user *to, ...@@ -325,10 +315,8 @@ static int copy_sc_to_user(struct sigcontext __user *to,
} else } else
#endif #endif
{ {
struct user_i387_struct fp; if (copy_to_user(to_fp, regs->regs.fp,
sizeof(struct user_i387_struct)))
err = save_fp_registers(pid, (unsigned long *) &fp);
if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct)))
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册