[POWERPC] Ensure FULL_REGS on exec
[sfrench/cifs-2.6.git] / arch / powerpc / kernel / process.c
index a83727b308a0186e8a5dfadc06fd2be687029834..8a1b001d0b110fa5a31a3fb53ed215312680f04c 100644 (file)
@@ -83,7 +83,7 @@ void flush_fp_to_thread(struct task_struct *tsk)
                         */
                        BUG_ON(tsk != current);
 #endif
-                       giveup_fpu(current);
+                       giveup_fpu(tsk);
                }
                preempt_enable();
        }
@@ -143,7 +143,7 @@ void flush_altivec_to_thread(struct task_struct *tsk)
 #ifdef CONFIG_SMP
                        BUG_ON(tsk != current);
 #endif
-                       giveup_altivec(current);
+                       giveup_altivec(tsk);
                }
                preempt_enable();
        }
@@ -182,7 +182,7 @@ void flush_spe_to_thread(struct task_struct *tsk)
 #ifdef CONFIG_SMP
                        BUG_ON(tsk != current);
 #endif
-                       giveup_spe(current);
+                       giveup_spe(tsk);
                }
                preempt_enable();
        }
@@ -605,6 +605,13 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
        regs->ccr = 0;
        regs->gpr[1] = sp;
 
+       /*
+        * We have just cleared all the nonvolatile GPRs, so make
+        * FULL_REGS(regs) return true.  This is necessary to allow
+        * ptrace to examine the thread immediately after exec.
+        */
+       regs->trap &= ~1UL;
+
 #ifdef CONFIG_PPC32
        regs->mq = 0;
        regs->nip = start;