[SPARC]: Fix TIF_USEDFPU flag atomicity
authorWilliam Lee Irwin III <wli@holomorphy.com>
Tue, 13 Mar 2007 00:08:25 +0000 (17:08 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Mar 2007 00:08:25 +0000 (17:08 -0700)
From: William Lee Irwin III <wli@holomorphy.com>

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/kernel/process.c
arch/sparc/kernel/traps.c

index 113bd48a89bde9ccd16bce8c7e9c827e117ccb92..fc874e63a499818e5f32ff6517d1df361b6a1f3a 100644 (file)
@@ -348,7 +348,7 @@ void exit_thread(void)
 #ifndef CONFIG_SMP
        if(last_task_used_math == current) {
 #else
-       if(current_thread_info()->flags & _TIF_USEDFPU) {
+       if (test_thread_flag(TIF_USEDFPU)) {
 #endif
                /* Keep process from leaving FPU in a bogon state. */
                put_psr(get_psr() | PSR_EF);
@@ -357,7 +357,7 @@ void exit_thread(void)
 #ifndef CONFIG_SMP
                last_task_used_math = NULL;
 #else
-               current_thread_info()->flags &= ~_TIF_USEDFPU;
+               clear_thread_flag(TIF_USEDFPU);
 #endif
        }
 }
@@ -371,7 +371,7 @@ void flush_thread(void)
 #ifndef CONFIG_SMP
        if(last_task_used_math == current) {
 #else
-       if(current_thread_info()->flags & _TIF_USEDFPU) {
+       if (test_thread_flag(TIF_USEDFPU)) {
 #endif
                /* Clean the fpu. */
                put_psr(get_psr() | PSR_EF);
@@ -380,7 +380,7 @@ void flush_thread(void)
 #ifndef CONFIG_SMP
                last_task_used_math = NULL;
 #else
-               current_thread_info()->flags &= ~_TIF_USEDFPU;
+               clear_thread_flag(TIF_USEDFPU);
 #endif
        }
 
@@ -466,13 +466,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
 #ifndef CONFIG_SMP
        if(last_task_used_math == current) {
 #else
-       if(current_thread_info()->flags & _TIF_USEDFPU) {
+       if (test_thread_flag(TIF_USEDFPU)) {
 #endif
                put_psr(get_psr() | PSR_EF);
                fpsave(&p->thread.float_regs[0], &p->thread.fsr,
                       &p->thread.fpqueue[0], &p->thread.fpqdepth);
 #ifdef CONFIG_SMP
-               current_thread_info()->flags &= ~_TIF_USEDFPU;
+               clear_thread_flag(TIF_USEDFPU);
 #endif
        }
 
@@ -609,13 +609,13 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
                return 1;
        }
 #ifdef CONFIG_SMP
-       if (current_thread_info()->flags & _TIF_USEDFPU) {
+       if (test_thread_flag(TIF_USEDFPU)) {
                put_psr(get_psr() | PSR_EF);
                fpsave(&current->thread.float_regs[0], &current->thread.fsr,
                       &current->thread.fpqueue[0], &current->thread.fpqdepth);
                if (regs != NULL) {
                        regs->psr &= ~(PSR_EF);
-                       current_thread_info()->flags &= ~(_TIF_USEDFPU);
+                       clear_thread_flag(TIF_USEDFPU);
                }
        }
 #else
index 6a70d215fd0432c4e6783505a44370c75bc48e2d..527687afc1c43adffb47785f33ebcb4703635189 100644 (file)
@@ -259,7 +259,7 @@ void do_fpd_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
        } else {
                fpload(&current->thread.float_regs[0], &current->thread.fsr);
        }
-       current_thread_info()->flags |= _TIF_USEDFPU;
+       set_thread_flag(TIF_USEDFPU);
 #endif
 }
 
@@ -290,7 +290,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
 #ifndef CONFIG_SMP
        if(!fpt) {
 #else
-        if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) {
+       if (!test_tsk_thread_flag(fpt, TIF_USEDFPU)) {
 #endif
                fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
                regs->psr &= ~PSR_EF;
@@ -333,7 +333,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
        /* nope, better SIGFPE the offending process... */
               
 #ifdef CONFIG_SMP
-       task_thread_info(fpt)->flags &= ~_TIF_USEDFPU;
+       clear_tsk_thread_flag(fpt, TIF_USEDFPU);
 #endif
        if(psr & PSR_PS) {
                /* The first fsr store/load we tried trapped,