Commit 57732625 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] pass regs into dump_fpu() in elf coredump

From: Pete Zaitcev <zaitcev@redhat.com>

sparc32 needs the registers passed into dump_fpu().
parent 923a1b0f
...@@ -590,16 +590,20 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs) ...@@ -590,16 +590,20 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
put_psr(get_psr() | PSR_EF); put_psr(get_psr() | PSR_EF);
fpsave(&current->thread.float_regs[0], &current->thread.fsr, fpsave(&current->thread.float_regs[0], &current->thread.fsr,
&current->thread.fpqueue[0], &current->thread.fpqdepth); &current->thread.fpqueue[0], &current->thread.fpqdepth);
regs->psr &= ~(PSR_EF); if (regs != NULL) {
current->flags &= ~(PF_USEDFPU); regs->psr &= ~(PSR_EF);
current->flags &= ~(PF_USEDFPU);
}
} }
#else #else
if (current == last_task_used_math) { if (current == last_task_used_math) {
put_psr(get_psr() | PSR_EF); put_psr(get_psr() | PSR_EF);
fpsave(&current->thread.float_regs[0], &current->thread.fsr, fpsave(&current->thread.float_regs[0], &current->thread.fsr,
&current->thread.fpqueue[0], &current->thread.fpqdepth); &current->thread.fpqueue[0], &current->thread.fpqdepth);
last_task_used_math = 0; if (regs != NULL) {
regs->psr &= ~(PSR_EF); regs->psr &= ~(PSR_EF);
last_task_used_math = 0;
}
} }
#endif #endif
memcpy(&fpregs->pr_fr.pr_regs[0], memcpy(&fpregs->pr_fr.pr_regs[0],
......
...@@ -1158,7 +1158,7 @@ static int elf_dump_thread_status(long signr, struct task_struct * p, struct lis ...@@ -1158,7 +1158,7 @@ static int elf_dump_thread_status(long signr, struct task_struct * p, struct lis
t->num_notes++; t->num_notes++;
sz += notesize(&t->notes[0]); 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)); fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(t->fpu), &(t->fpu));
t->num_notes++; t->num_notes++;
sz += notesize(&t->notes[1]); sz += notesize(&t->notes[1]);
...@@ -1286,7 +1286,7 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) ...@@ -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); fill_note(notes +2, "CORE", NT_TASKSTRUCT, sizeof(*current), current);
/* Try to dump the FPU. */ /* 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); fill_note(notes +3, "CORE", NT_PRFPREG, sizeof(*fpu), fpu);
else else
--numnote; --numnote;
......
...@@ -107,12 +107,12 @@ static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* ...@@ -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 *); 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 #ifdef ELF_CORE_COPY_FPREGS
return ELF_CORE_COPY_FPREGS(t, fpu); return ELF_CORE_COPY_FPREGS(t, fpu);
#else #else
return dump_fpu(NULL, fpu); return dump_fpu(regs, fpu);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment