提交 fcb2ac5b 编写于 作者: J Jiri Slaby 提交者: Ingo Molnar

x86_32: introduce restore_fpu_checking()

Impact: cleanup, prepare FPU code unificaton

Like on x86_64, return an error from restore_fpu and kill the task
if it fails.

Also rename restore_fpu to restore_fpu_checking which allows ifdefs
to be removed in math_state_restore().
Signed-off-by: NJiri Slaby <jirislaby@gmail.com>
LKML-Reference: <1239190320-23952-1-git-send-email-jirislaby@gmail.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 577c9c45
...@@ -185,12 +185,10 @@ static inline void tolerant_fwait(void) ...@@ -185,12 +185,10 @@ static inline void tolerant_fwait(void)
asm volatile("fnclex ; fwait"); asm volatile("fnclex ; fwait");
} }
static inline void restore_fpu(struct task_struct *tsk) static inline int restore_fpu_checking(struct task_struct *tsk)
{ {
if (task_thread_info(tsk)->status & TS_XSAVE) { if (task_thread_info(tsk)->status & TS_XSAVE)
xrstor_checking(&tsk->thread.xstate->xsave); return xrstor_checking(&tsk->thread.xstate->xsave);
return;
}
/* /*
* The "nop" is needed to make the instructions the same * The "nop" is needed to make the instructions the same
* length. * length.
...@@ -200,6 +198,7 @@ static inline void restore_fpu(struct task_struct *tsk) ...@@ -200,6 +198,7 @@ static inline void restore_fpu(struct task_struct *tsk)
"fxrstor %1", "fxrstor %1",
X86_FEATURE_FXSR, X86_FEATURE_FXSR,
"m" (tsk->thread.xstate->fxsave)); "m" (tsk->thread.xstate->fxsave));
return 0;
} }
/* We need a safe address that is cheap to find and that is already /* We need a safe address that is cheap to find and that is already
......
...@@ -839,9 +839,6 @@ asmlinkage void math_state_restore(void) ...@@ -839,9 +839,6 @@ asmlinkage void math_state_restore(void)
} }
clts(); /* Allow maths ops (or we recurse) */ clts(); /* Allow maths ops (or we recurse) */
#ifdef CONFIG_X86_32
restore_fpu(tsk);
#else
/* /*
* Paranoid restore. send a SIGSEGV if we fail to restore the state. * Paranoid restore. send a SIGSEGV if we fail to restore the state.
*/ */
...@@ -850,7 +847,7 @@ asmlinkage void math_state_restore(void) ...@@ -850,7 +847,7 @@ asmlinkage void math_state_restore(void)
force_sig(SIGSEGV, tsk); force_sig(SIGSEGV, tsk);
return; return;
} }
#endif
thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */ thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */
tsk->fpu_counter++; tsk->fpu_counter++;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册