]> err.no Git - linux-2.6/commitdiff
powerpc: fix giveup_vsx to save registers correctly
authorMichael Neuling <mikey@neuling.org>
Fri, 11 Jul 2008 06:29:12 +0000 (16:29 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 15 Jul 2008 02:29:23 +0000 (12:29 +1000)
giveup_vsx didn't save the FPU and VMX regsiters.  Change it to be
like giveup_fpr/altivec which save these registers.

Also update call sites where FPU and VMX are already saved to use the
original giveup_vsx (renamed to __giveup_vsx).

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/misc_64.S
arch/powerpc/kernel/process.c
arch/powerpc/kernel/signal_32.c
arch/powerpc/kernel/signal_64.c
include/asm-powerpc/system.h

index 31b9026cf1e377dd5286e5b463b828acbd2604fc..4dd70cf7bb4eb6e17e8755b4f5fad3b4fb9ae49d 100644 (file)
@@ -508,12 +508,12 @@ _GLOBAL(giveup_altivec)
 
 #ifdef CONFIG_VSX
 /*
- * giveup_vsx(tsk)
- * Disable VSX for the task given as the argument,
- * and save the vector registers in its thread_struct.
+ * __giveup_vsx(tsk)
+ * Disable VSX for the task given as the argument.
+ * Does NOT save vsx registers.
  * Enables the VSX for use in the kernel on return.
  */
-_GLOBAL(giveup_vsx)
+_GLOBAL(__giveup_vsx)
        mfmsr   r5
        oris    r5,r5,MSR_VSX@h
        mtmsrd  r5                      /* enable use of VSX now */
index 0a4eb0811590de033a3544c8b574dce9ea52ab04..219f3634115e46a05d0c1426d115aa95d58fef48 100644 (file)
@@ -159,6 +159,13 @@ void enable_kernel_vsx(void)
 EXPORT_SYMBOL(enable_kernel_vsx);
 #endif
 
+void giveup_vsx(struct task_struct *tsk)
+{
+       giveup_fpu(tsk);
+       giveup_altivec(tsk);
+       __giveup_vsx(tsk);
+}
+
 void flush_vsx_to_thread(struct task_struct *tsk)
 {
        if (tsk->thread.regs) {
@@ -290,7 +297,8 @@ struct task_struct *__switch_to(struct task_struct *prev,
 #endif /* CONFIG_ALTIVEC */
 #ifdef CONFIG_VSX
        if (prev->thread.regs && (prev->thread.regs->msr & MSR_VSX))
-               giveup_vsx(prev);
+               /* VMX and FPU registers are already save here */
+               __giveup_vsx(prev);
 #endif /* CONFIG_VSX */
 #ifdef CONFIG_SPE
        /*
index 6f6810db0a74eb47ddbdae23d264529c7fb68f63..3e80aa32b8b09e1daf432cb7e112d9a04be7ce4a 100644 (file)
@@ -452,7 +452,7 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
         * contains valid data
         */
        if (current->thread.used_vsr) {
-               flush_vsx_to_thread(current);
+               __giveup_vsx(current);
                if (copy_vsx_to_user(&frame->mc_vsregs, current))
                        return 1;
                msr |= MSR_VSX;
index 5f9d2ef2e24be8668cb0b4562ca332971796d7b7..65ad925c3a8f2e1ece221f7c709619c0a7cc4199 100644 (file)
@@ -122,7 +122,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
         * VMX data.
         */
        if (current->thread.used_vsr) {
-               flush_vsx_to_thread(current);
+               __giveup_vsx(current);
                v_regs += ELF_NVRREG;
                err |= copy_vsx_to_user(v_regs, current);
                /* set MSR_VSX in the MSR value in the frame to
index 0c12c66733f659f1fd8fbb11eb4601a3cbef0517..e6e25e2364ebf87d6012a977d3e5b0d66382820b 100644 (file)
@@ -139,6 +139,7 @@ extern void enable_kernel_altivec(void);
 extern void giveup_altivec(struct task_struct *);
 extern void load_up_altivec(struct task_struct *);
 extern int emulate_altivec(struct pt_regs *);
+extern void __giveup_vsx(struct task_struct *);
 extern void giveup_vsx(struct task_struct *);
 extern void enable_kernel_spe(void);
 extern void giveup_spe(struct task_struct *);