From: Pete Zaitcev <zaitcev@redhat.com>

sparc32 needs the registers passed into dump_fpu().




 arch/sparc/kernel/process.c |   12 ++++++++----
 fs/binfmt_elf.c             |    4 ++--
 include/linux/elfcore.h     |    4 ++--
 3 files changed, 12 insertions(+), 8 deletions(-)

diff -puN arch/sparc/kernel/process.c~coredump-pass-regs arch/sparc/kernel/process.c
--- 25/arch/sparc/kernel/process.c~coredump-pass-regs	2003-07-13 21:54:02.000000000 -0700
+++ 25-akpm/arch/sparc/kernel/process.c	2003-07-13 21:54:02.000000000 -0700
@@ -590,16 +590,20 @@ int dump_fpu (struct pt_regs * regs, elf
 		put_psr(get_psr() | PSR_EF);
 		fpsave(&current->thread.float_regs[0], &current->thread.fsr,
 		       &current->thread.fpqueue[0], &current->thread.fpqdepth);
-		regs->psr &= ~(PSR_EF);
-		current->flags &= ~(PF_USEDFPU);
+		if (regs != NULL) {
+			regs->psr &= ~(PSR_EF);
+			current->flags &= ~(PF_USEDFPU);
+		}
 	}
 #else
 	if (current == last_task_used_math) {
 		put_psr(get_psr() | PSR_EF);
 		fpsave(&current->thread.float_regs[0], &current->thread.fsr,
 		       &current->thread.fpqueue[0], &current->thread.fpqdepth);
-		last_task_used_math = 0;
-		regs->psr &= ~(PSR_EF);
+		if (regs != NULL) {
+			regs->psr &= ~(PSR_EF);
+			last_task_used_math = 0;
+		}
 	}
 #endif
 	memcpy(&fpregs->pr_fr.pr_regs[0],
diff -puN fs/binfmt_elf.c~coredump-pass-regs fs/binfmt_elf.c
--- 25/fs/binfmt_elf.c~coredump-pass-regs	2003-07-13 21:54:02.000000000 -0700
+++ 25-akpm/fs/binfmt_elf.c	2003-07-13 21:54:02.000000000 -0700
@@ -1158,7 +1158,7 @@ static int elf_dump_thread_status(long s
 	t->num_notes++;
 	sz += notesize(&t->notes[0]);
 
-	if ((t->prstatus.pr_fpvalid = elf_core_copy_task_fpregs(p, &t->fpu))) {
+	if ((t->prstatus.pr_fpvalid = elf_core_copy_task_fpregs(p, NULL, &t->fpu))) {
 		fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(t->fpu), &(t->fpu));
 		t->num_notes++;
 		sz += notesize(&t->notes[1]);
@@ -1286,7 +1286,7 @@ static int elf_core_dump(long signr, str
 	fill_note(notes +2, "CORE", NT_TASKSTRUCT, sizeof(*current), current);
   
   	/* Try to dump the FPU. */
-	if ((prstatus->pr_fpvalid = elf_core_copy_task_fpregs(current, fpu)))
+	if ((prstatus->pr_fpvalid = elf_core_copy_task_fpregs(current, regs, fpu)))
 		fill_note(notes +3, "CORE", NT_PRFPREG, sizeof(*fpu), fpu);
 	else
 		--numnote;
diff -puN include/linux/elfcore.h~coredump-pass-regs include/linux/elfcore.h
--- 25/include/linux/elfcore.h~coredump-pass-regs	2003-07-13 21:54:02.000000000 -0700
+++ 25-akpm/include/linux/elfcore.h	2003-07-13 21:54:02.000000000 -0700
@@ -107,12 +107,12 @@ static inline int elf_core_copy_task_reg
 
 extern int dump_fpu (struct pt_regs *, elf_fpregset_t *);
 
-static inline int elf_core_copy_task_fpregs(struct task_struct *t, elf_fpregset_t *fpu)
+static inline int elf_core_copy_task_fpregs(struct task_struct *t, struct pt_regs *regs, elf_fpregset_t *fpu)
 {
 #ifdef ELF_CORE_COPY_FPREGS
 	return ELF_CORE_COPY_FPREGS(t, fpu);
 #else
-	return dump_fpu(NULL, fpu);
+	return dump_fpu(regs, fpu);
 #endif
 }
 

_