Commit 8090bfd2 authored by Richard Weinberger's avatar Richard Weinberger

um: Fix fpstate handling

The x86 FPU cleanup changed fpstate to a plain integer.
UML on x86 has to deal with that too.
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent fb1770aa
...@@ -211,7 +211,7 @@ static int copy_sc_from_user(struct pt_regs *regs, ...@@ -211,7 +211,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
if (err) if (err)
return 1; return 1;
err = convert_fxsr_from_user(&fpx, sc.fpstate); err = convert_fxsr_from_user(&fpx, (void *)sc.fpstate);
if (err) if (err)
return 1; return 1;
...@@ -227,7 +227,7 @@ static int copy_sc_from_user(struct pt_regs *regs, ...@@ -227,7 +227,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
{ {
struct user_i387_struct fp; struct user_i387_struct fp;
err = copy_from_user(&fp, 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;
...@@ -291,7 +291,7 @@ static int copy_sc_to_user(struct sigcontext __user *to, ...@@ -291,7 +291,7 @@ static int copy_sc_to_user(struct sigcontext __user *to,
#endif #endif
#undef PUTREG #undef PUTREG
sc.oldmask = mask; sc.oldmask = mask;
sc.fpstate = to_fp; sc.fpstate = (unsigned long)to_fp;
err = copy_to_user(to, &sc, sizeof(struct sigcontext)); err = copy_to_user(to, &sc, sizeof(struct sigcontext));
if (err) if (err)
...@@ -468,12 +468,10 @@ long sys_sigreturn(void) ...@@ -468,12 +468,10 @@ long sys_sigreturn(void)
struct sigframe __user *frame = (struct sigframe __user *)(sp - 8); struct sigframe __user *frame = (struct sigframe __user *)(sp - 8);
sigset_t set; sigset_t set;
struct sigcontext __user *sc = &frame->sc; struct sigcontext __user *sc = &frame->sc;
unsigned long __user *oldmask = &sc->oldmask;
unsigned long __user *extramask = frame->extramask;
int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long); int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long);
if (copy_from_user(&set.sig[0], oldmask, sizeof(set.sig[0])) || if (copy_from_user(&set.sig[0], (void *)sc->oldmask, sizeof(set.sig[0])) ||
copy_from_user(&set.sig[1], extramask, sig_size)) copy_from_user(&set.sig[1], frame->extramask, sig_size))
goto segfault; goto segfault;
set_current_blocked(&set); set_current_blocked(&set);
...@@ -505,6 +503,7 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig, ...@@ -505,6 +503,7 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
{ {
struct rt_sigframe __user *frame; struct rt_sigframe __user *frame;
int err = 0, sig = ksig->sig; int err = 0, sig = ksig->sig;
unsigned long fp_to;
frame = (struct rt_sigframe __user *) frame = (struct rt_sigframe __user *)
round_down(stack_top - sizeof(struct rt_sigframe), 16); round_down(stack_top - sizeof(struct rt_sigframe), 16);
...@@ -526,7 +525,10 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig, ...@@ -526,7 +525,10 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
err |= __save_altstack(&frame->uc.uc_stack, PT_REGS_SP(regs)); err |= __save_altstack(&frame->uc.uc_stack, PT_REGS_SP(regs));
err |= copy_sc_to_user(&frame->uc.uc_mcontext, &frame->fpstate, regs, err |= copy_sc_to_user(&frame->uc.uc_mcontext, &frame->fpstate, regs,
set->sig[0]); set->sig[0]);
err |= __put_user(&frame->fpstate, &frame->uc.uc_mcontext.fpstate);
fp_to = (unsigned long)&frame->fpstate;
err |= __put_user(fp_to, &frame->uc.uc_mcontext.fpstate);
if (sizeof(*set) == 16) { if (sizeof(*set) == 16) {
err |= __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]); err |= __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
err |= __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]); err |= __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment