mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-22 17:33:01 +00:00
i387: move TS_USEDFPU clearing out of __save_init_fpu and into callers
Touching TS_USEDFPU without touching CR0.TS is confusing, so don't do it. By moving it into the callers, we always do the TS_USEDFPU next to the CR0.TS accesses in the source code, and it's much easier to see how the two go hand in hand. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
15d8791cae
commit
b6c66418dc
@ -259,7 +259,6 @@ static inline void fpu_save_init(struct fpu *fpu)
|
|||||||
static inline void __save_init_fpu(struct task_struct *tsk)
|
static inline void __save_init_fpu(struct task_struct *tsk)
|
||||||
{
|
{
|
||||||
fpu_save_init(&tsk->thread.fpu);
|
fpu_save_init(&tsk->thread.fpu);
|
||||||
task_thread_info(tsk)->status &= ~TS_USEDFPU;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int fpu_fxrstor_checking(struct fpu *fpu)
|
static inline int fpu_fxrstor_checking(struct fpu *fpu)
|
||||||
@ -290,6 +289,7 @@ static inline void __unlazy_fpu(struct task_struct *tsk)
|
|||||||
{
|
{
|
||||||
if (task_thread_info(tsk)->status & TS_USEDFPU) {
|
if (task_thread_info(tsk)->status & TS_USEDFPU) {
|
||||||
__save_init_fpu(tsk);
|
__save_init_fpu(tsk);
|
||||||
|
task_thread_info(tsk)->status &= ~TS_USEDFPU;
|
||||||
stts();
|
stts();
|
||||||
} else
|
} else
|
||||||
tsk->fpu_counter = 0;
|
tsk->fpu_counter = 0;
|
||||||
@ -356,9 +356,11 @@ static inline void kernel_fpu_begin(void)
|
|||||||
|
|
||||||
WARN_ON_ONCE(!irq_fpu_usable());
|
WARN_ON_ONCE(!irq_fpu_usable());
|
||||||
preempt_disable();
|
preempt_disable();
|
||||||
if (me->status & TS_USEDFPU)
|
if (me->status & TS_USEDFPU) {
|
||||||
__save_init_fpu(me->task);
|
__save_init_fpu(me->task);
|
||||||
else
|
me->status &= ~TS_USEDFPU;
|
||||||
|
/* We do 'stts()' in kernel_fpu_end() */
|
||||||
|
} else
|
||||||
clts();
|
clts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,6 +451,7 @@ static inline void save_init_fpu(struct task_struct *tsk)
|
|||||||
WARN_ON_ONCE(!(task_thread_info(tsk)->status & TS_USEDFPU));
|
WARN_ON_ONCE(!(task_thread_info(tsk)->status & TS_USEDFPU));
|
||||||
preempt_disable();
|
preempt_disable();
|
||||||
__save_init_fpu(tsk);
|
__save_init_fpu(tsk);
|
||||||
|
task_thread_info(tsk)->status &= ~TS_USEDFPU;
|
||||||
stts();
|
stts();
|
||||||
preempt_enable();
|
preempt_enable();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user