elfcore.h 4.1 KB

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