elfcore.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #ifndef _LINUX_ELFCORE_H
  2. #define _LINUX_ELFCORE_H
  3. #include <linux/types.h>
  4. #include <linux/signal.h>
  5. #include <linux/time.h>
  6. #include <linux/user.h>
  7. #include <linux/ptrace.h>
  8. struct elf_siginfo
  9. {
  10. int si_signo; /* signal number */
  11. int si_code; /* extra code */
  12. int si_errno; /* errno */
  13. };
  14. #include <asm/elf.h>
  15. #ifndef __KERNEL__
  16. typedef elf_greg_t greg_t;
  17. typedef elf_gregset_t gregset_t;
  18. typedef elf_fpregset_t fpregset_t;
  19. typedef elf_fpxregset_t fpxregset_t;
  20. #define NGREG ELF_NGREG
  21. #endif
  22. /*
  23. * Definitions to generate Intel SVR4-like core files.
  24. * These mostly have the same names as the SVR4 types with "elf_"
  25. * tacked on the front to prevent clashes with linux definitions,
  26. * and the typedef forms have been avoided. This is mostly like
  27. * the SVR4 structure, but more Linuxy, with things that Linux does
  28. * not support and which gdb doesn't really use excluded.
  29. * Fields present but not used are marked with "XXX".
  30. */
  31. struct elf_prstatus
  32. {
  33. #if 0
  34. long pr_flags; /* XXX Process flags */
  35. short pr_why; /* XXX Reason for process halt */
  36. short pr_what; /* XXX More detailed reason */
  37. #endif
  38. struct elf_siginfo pr_info; /* Info associated with signal */
  39. short pr_cursig; /* Current signal */
  40. unsigned long pr_sigpend; /* Set of pending signals */
  41. unsigned long pr_sighold; /* Set of held signals */
  42. #if 0
  43. struct sigaltstack pr_altstack; /* Alternate stack info */
  44. struct sigaction pr_action; /* Signal action for current sig */
  45. #endif
  46. pid_t pr_pid;
  47. pid_t pr_ppid;
  48. pid_t pr_pgrp;
  49. pid_t pr_sid;
  50. struct timeval pr_utime; /* User time */
  51. struct timeval pr_stime; /* System time */
  52. struct timeval pr_cutime; /* Cumulative user time */
  53. struct timeval pr_cstime; /* Cumulative system time */
  54. #if 0
  55. long pr_instr; /* Current instruction */
  56. #endif
  57. elf_gregset_t pr_reg; /* GP registers */
  58. int pr_fpvalid; /* True if math co-processor being used. */
  59. };
  60. #define ELF_PRARGSZ (80) /* Number of chars for args */
  61. struct elf_prpsinfo
  62. {
  63. char pr_state; /* numeric process state */
  64. char pr_sname; /* char for pr_state */
  65. char pr_zomb; /* zombie */
  66. char pr_nice; /* nice val */
  67. unsigned long pr_flag; /* flags */
  68. __kernel_uid_t pr_uid;
  69. __kernel_gid_t pr_gid;
  70. pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
  71. /* Lots missing */
  72. char pr_fname[16]; /* filename of executable */
  73. char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
  74. };
  75. #ifndef __KERNEL__
  76. typedef struct elf_prstatus prstatus_t;
  77. typedef struct elf_prpsinfo prpsinfo_t;
  78. #define PRARGSZ ELF_PRARGSZ
  79. #endif
  80. #ifdef __KERNEL__
  81. static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
  82. {
  83. #ifdef ELF_CORE_COPY_REGS
  84. ELF_CORE_COPY_REGS((*elfregs), regs)
  85. #else
  86. BUG_ON(sizeof(*elfregs) != sizeof(*regs));
  87. *(struct pt_regs *)elfregs = *regs;
  88. #endif
  89. }
  90. static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs)
  91. {
  92. #ifdef ELF_CORE_COPY_TASK_REGS
  93. return ELF_CORE_COPY_TASK_REGS(t, elfregs);
  94. #endif
  95. return 0;
  96. }
  97. extern int dump_fpu (struct pt_regs *, elf_fpregset_t *);
  98. static inline int elf_core_copy_task_fpregs(struct task_struct *t, struct pt_regs *regs, elf_fpregset_t *fpu)
  99. {
  100. #ifdef ELF_CORE_COPY_FPREGS
  101. return ELF_CORE_COPY_FPREGS(t, fpu);
  102. #else
  103. return dump_fpu(regs, fpu);
  104. #endif
  105. }
  106. #ifdef ELF_CORE_COPY_XFPREGS
  107. static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
  108. {
  109. return ELF_CORE_COPY_XFPREGS(t, xfpu);
  110. }
  111. #endif
  112. #endif /* __KERNEL__ */
  113. #endif /* _LINUX_ELFCORE_H */