summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-07-17 19:25:46 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-07-17 19:25:46 -0700
commit5773262567608d397ec0aa41b250db1e3bb5e694 (patch)
treee4296e35931e469e7562388ec4a847e0f8fd60cc
parent923a1b0fecbfe58a303916a1b3a65b22e46238a9 (diff)
[PATCH] pass regs into dump_fpu() in elf coredump
From: Pete Zaitcev <zaitcev@redhat.com> sparc32 needs the registers passed into dump_fpu().
-rw-r--r--arch/sparc/kernel/process.c12
-rw-r--r--fs/binfmt_elf.c4
-rw-r--r--include/linux/elfcore.h4
3 files changed, 12 insertions, 8 deletions
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index f3fe5f6cad3b..d42c4a9ecb28 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -590,16 +590,20 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
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 --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index d808a9dfc9ec..53938f81c696 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1158,7 +1158,7 @@ static int elf_dump_thread_status(long signr, struct task_struct * p, struct lis
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, struct pt_regs * regs, struct file * file)
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 --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index 089d67225207..dbd7bb4a33b7 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -107,12 +107,12 @@ static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t*
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
}