dump_task.c 594 B

12345678910111213141516171819202122232425262728293031
  1. #include <linux/elfcore.h>
  2. #include <linux/sched.h>
  3. /*
  4. * Capture the user space registers if the task is not running (in user space)
  5. */
  6. int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
  7. {
  8. struct pt_regs ptregs;
  9. ptregs = *task_pt_regs(tsk);
  10. elf_core_copy_regs(regs, &ptregs);
  11. return 1;
  12. }
  13. int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpu)
  14. {
  15. int fpvalid = 0;
  16. #if defined(CONFIG_SH_FPU)
  17. fpvalid = !!tsk_used_math(tsk);
  18. if (fpvalid) {
  19. unlazy_fpu(tsk, task_pt_regs(tsk));
  20. memcpy(fpu, &tsk->thread.fpu.hard, sizeof(*fpu));
  21. }
  22. #endif
  23. return fpvalid;
  24. }