Skip to content

Commit

Permalink
Merge branch 'x86/fpu' into x86/core
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingo Molnar committed Jul 30, 2008
2 parents d25ae38 + 6ffac1e commit b2d9d33
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
11 changes: 10 additions & 1 deletion arch/x86/kernel/signal_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@ static inline int restore_i387(struct _fpstate __user *buf)
clts();
task_thread_info(current)->status |= TS_USEDFPU;
}
return restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
err = restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
if (unlikely(err)) {
/*
* Encountered an error while doing the restore from the
* user buffer, clear the fpu state.
*/
clear_fpu(tsk);
clear_used_math();
}
return err;
}

/*
Expand Down
9 changes: 8 additions & 1 deletion arch/x86/kernel/traps_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,14 @@ asmlinkage void math_state_restore(void)
}

clts(); /* Allow maths ops (or we recurse) */
restore_fpu_checking(&me->thread.xstate->fxsave);
/*
* Paranoid restore. send a SIGSEGV if we fail to restore the state.
*/
if (unlikely(restore_fpu_checking(&me->thread.xstate->fxsave))) {
stts();
force_sig(SIGSEGV, me);
return;
}
task_thread_info(me)->status |= TS_USEDFPU;
me->fpu_counter++;
}
Expand Down
2 changes: 0 additions & 2 deletions include/asm-x86/i387.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
#else
: [fx] "cdaSDb" (fx), "m" (*fx), "0" (0));
#endif
if (unlikely(err))
init_fpu(current);
return err;
}

Expand Down

0 comments on commit b2d9d33

Please sign in to comment.