dump_task.c 615 B

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