Commit 54f565ea authored by William Lee Irwin III's avatar William Lee Irwin III Committed by David S. Miller

[SPARC]: Fix TIF_USEDFPU flag atomicity

From: William Lee Irwin III <wli@holomorphy.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c0a79b22
...@@ -348,7 +348,7 @@ void exit_thread(void) ...@@ -348,7 +348,7 @@ void exit_thread(void)
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
if(last_task_used_math == current) { if(last_task_used_math == current) {
#else #else
if(current_thread_info()->flags & _TIF_USEDFPU) { if (test_thread_flag(TIF_USEDFPU)) {
#endif #endif
/* Keep process from leaving FPU in a bogon state. */ /* Keep process from leaving FPU in a bogon state. */
put_psr(get_psr() | PSR_EF); put_psr(get_psr() | PSR_EF);
...@@ -357,7 +357,7 @@ void exit_thread(void) ...@@ -357,7 +357,7 @@ void exit_thread(void)
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
last_task_used_math = NULL; last_task_used_math = NULL;
#else #else
current_thread_info()->flags &= ~_TIF_USEDFPU; clear_thread_flag(TIF_USEDFPU);
#endif #endif
} }
} }
...@@ -371,7 +371,7 @@ void flush_thread(void) ...@@ -371,7 +371,7 @@ void flush_thread(void)
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
if(last_task_used_math == current) { if(last_task_used_math == current) {
#else #else
if(current_thread_info()->flags & _TIF_USEDFPU) { if (test_thread_flag(TIF_USEDFPU)) {
#endif #endif
/* Clean the fpu. */ /* Clean the fpu. */
put_psr(get_psr() | PSR_EF); put_psr(get_psr() | PSR_EF);
...@@ -380,7 +380,7 @@ void flush_thread(void) ...@@ -380,7 +380,7 @@ void flush_thread(void)
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
last_task_used_math = NULL; last_task_used_math = NULL;
#else #else
current_thread_info()->flags &= ~_TIF_USEDFPU; clear_thread_flag(TIF_USEDFPU);
#endif #endif
} }
...@@ -466,13 +466,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -466,13 +466,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
if(last_task_used_math == current) { if(last_task_used_math == current) {
#else #else
if(current_thread_info()->flags & _TIF_USEDFPU) { if (test_thread_flag(TIF_USEDFPU)) {
#endif #endif
put_psr(get_psr() | PSR_EF); put_psr(get_psr() | PSR_EF);
fpsave(&p->thread.float_regs[0], &p->thread.fsr, fpsave(&p->thread.float_regs[0], &p->thread.fsr,
&p->thread.fpqueue[0], &p->thread.fpqdepth); &p->thread.fpqueue[0], &p->thread.fpqdepth);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
current_thread_info()->flags &= ~_TIF_USEDFPU; clear_thread_flag(TIF_USEDFPU);
#endif #endif
} }
...@@ -609,13 +609,13 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs) ...@@ -609,13 +609,13 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
return 1; return 1;
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (current_thread_info()->flags & _TIF_USEDFPU) { if (test_thread_flag(TIF_USEDFPU)) {
put_psr(get_psr() | PSR_EF); put_psr(get_psr() | PSR_EF);
fpsave(&current->thread.float_regs[0], &current->thread.fsr, fpsave(&current->thread.float_regs[0], &current->thread.fsr,
&current->thread.fpqueue[0], &current->thread.fpqdepth); &current->thread.fpqueue[0], &current->thread.fpqdepth);
if (regs != NULL) { if (regs != NULL) {
regs->psr &= ~(PSR_EF); regs->psr &= ~(PSR_EF);
current_thread_info()->flags &= ~(_TIF_USEDFPU); clear_thread_flag(TIF_USEDFPU);
} }
} }
#else #else
......
...@@ -259,7 +259,7 @@ void do_fpd_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, ...@@ -259,7 +259,7 @@ void do_fpd_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
} else { } else {
fpload(&current->thread.float_regs[0], &current->thread.fsr); fpload(&current->thread.float_regs[0], &current->thread.fsr);
} }
current_thread_info()->flags |= _TIF_USEDFPU; set_thread_flag(TIF_USEDFPU);
#endif #endif
} }
...@@ -290,7 +290,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, ...@@ -290,7 +290,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
if(!fpt) { if(!fpt) {
#else #else
if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) { if (!test_tsk_thread_flag(fpt, TIF_USEDFPU)) {
#endif #endif
fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth); fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
regs->psr &= ~PSR_EF; regs->psr &= ~PSR_EF;
...@@ -333,7 +333,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, ...@@ -333,7 +333,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
/* nope, better SIGFPE the offending process... */ /* nope, better SIGFPE the offending process... */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
task_thread_info(fpt)->flags &= ~_TIF_USEDFPU; clear_tsk_thread_flag(fpt, TIF_USEDFPU);
#endif #endif
if(psr & PSR_PS) { if(psr & PSR_PS) {
/* The first fsr store/load we tried trapped, /* The first fsr store/load we tried trapped,
......
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