Merge git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86
[sfrench/cifs-2.6.git] / arch / powerpc / kernel / process.c
index 7949c203cb89f5df7a7b27471d1b904e9af672a0..4846bf543a8c5cf9dd2f95a611c4deae04cd9863 100644 (file)
@@ -149,10 +149,32 @@ void flush_altivec_to_thread(struct task_struct *tsk)
        }
 }
 
-int dump_task_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
+int dump_task_altivec(struct task_struct *tsk, elf_vrregset_t *vrregs)
 {
-       flush_altivec_to_thread(current);
-       memcpy(vrregs, &current->thread.vr[0], sizeof(*vrregs));
+       /* ELF_NVRREG includes the VSCR and VRSAVE which we need to save
+        * separately, see below */
+       const int nregs = ELF_NVRREG - 2;
+       elf_vrreg_t *reg;
+       u32 *dest;
+
+       if (tsk == current)
+               flush_altivec_to_thread(tsk);
+
+       reg = (elf_vrreg_t *)vrregs;
+
+       /* copy the 32 vr registers */
+       memcpy(reg, &tsk->thread.vr[0], nregs * sizeof(*reg));
+       reg += nregs;
+
+       /* copy the vscr */
+       memcpy(reg, &tsk->thread.vscr, sizeof(*reg));
+       reg++;
+
+       /* vrsave is stored in the high 32bit slot of the final 128bits */
+       memset(reg, 0, sizeof(*reg));
+       dest = (u32 *)reg;
+       *dest = tsk->thread.vrsave;
+
        return 1;
 }
 #endif /* CONFIG_ALTIVEC */
@@ -437,10 +459,10 @@ void show_regs(struct pt_regs * regs)
                printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
 #endif
        printk("TASK = %p[%d] '%s' THREAD: %p",
-              current, current->pid, current->comm, task_thread_info(current));
+              current, task_pid_nr(current), current->comm, task_thread_info(current));
 
 #ifdef CONFIG_SMP
-       printk(" CPU: %d", smp_processor_id());
+       printk(" CPU: %d", raw_smp_processor_id());
 #endif /* CONFIG_SMP */
 
        for (i = 0;  i < 32;  i++) {