Fix avr32 TIF atomicity in do_debug_priv

avr32 updates the thread flags 1 - non atomically and 2 - with the wrong value
(for TIF_SINGLE_STEP) in this function.

It applies to 2.6.20.

Signed-off-by: Mathieu Desnoyers <[EMAIL PROTECTED]>

--- a/arch/avr32/kernel/ptrace.c
+++ b/arch/avr32/kernel/ptrace.c
@@ -306,14 +306,12 @@ asmlinkage void do_debug_priv(struct pt_regs *regs)
        if (likely(ds & DS_SSS)) {
                extern void itlb_miss(void);
                extern void tlb_miss_common(void);
-               struct thread_info *ti;
 
                dc = __mfdr(DBGREG_DC);
                dc &= ~DC_SS;
                __mtdr(DBGREG_DC, dc);
 
-               ti = current_thread_info();
-               ti->flags |= _TIF_BREAKPOINT;
+               set_tsk_thread_flag(tsk, TIF_BREAKPOINT);
 
                /* The TLB miss handlers don't check thread flags */
                if ((regs->pc >= (unsigned long)&itlb_miss)
@@ -328,7 +326,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs)
                 * single step.
                 */
                if ((regs->sr & MODE_MASK) != MODE_SUPERVISOR)
-                       ti->flags |= TIF_SINGLE_STEP;
+                       set_tsk_thread_flag(tsk, TIF_SINGLE_STEP);
        } else {
                panic("Unable to handle debug trap at pc = %08lx\n",
                      regs->pc);
-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to