elfcore.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. #ifdef CONFIG_BINFMT_ELF_FDPIC
  59. /* When using FDPIC, the loadmap addresses need to be communicated
  60. * to GDB in order for GDB to do the necessary relocations. The
  61. * fields (below) used to communicate this information are placed
  62. * immediately after ``pr_reg'', so that the loadmap addresses may
  63. * be viewed as part of the register set if so desired.
  64. */
  65. unsigned long pr_exec_fdpic_loadmap;
  66. unsigned long pr_interp_fdpic_loadmap;
  67. #endif
  68. int pr_fpvalid; /* True if math co-processor being used. */
  69. };
  70. #define ELF_PRARGSZ (80) /* Number of chars for args */
  71. struct elf_prpsinfo
  72. {
  73. char pr_state; /* numeric process state */
  74. char pr_sname; /* char for pr_state */
  75. char pr_zomb; /* zombie */
  76. char pr_nice; /* nice val */
  77. unsigned long pr_flag; /* flags */
  78. __kernel_uid_t pr_uid;
  79. __kernel_gid_t pr_gid;
  80. pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
  81. /* Lots missing */
  82. char pr_fname[16]; /* filename of executable */
  83. char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
  84. };
  85. #ifndef __KERNEL__
  86. typedef struct elf_prstatus prstatus_t;
  87. typedef struct elf_prpsinfo prpsinfo_t;
  88. #define PRARGSZ ELF_PRARGSZ
  89. #endif
  90. #ifdef __KERNEL__
  91. static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
  92. {
  93. #ifdef ELF_CORE_COPY_REGS
  94. ELF_CORE_COPY_REGS((*elfregs), regs)
  95. #else
  96. BUG_ON(sizeof(*elfregs) != sizeof(*regs));
  97. *(struct pt_regs *)elfregs = *regs;
  98. #endif
  99. }
  100. static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs)
  101. {
  102. #ifdef ELF_CORE_COPY_TASK_REGS
  103. return ELF_CORE_COPY_TASK_REGS(t, elfregs);
  104. #endif
  105. return 0;
  106. }
  107. extern int dump_fpu (struct pt_regs *, elf_fpregset_t *);
  108. static inline int elf_core_copy_task_fpregs(struct task_struct *t, struct pt_regs *regs, elf_fpregset_t *fpu)
  109. {
  110. #ifdef ELF_CORE_COPY_FPREGS
  111. return ELF_CORE_COPY_FPREGS(t, fpu);
  112. #else
  113. return dump_fpu(regs, fpu);
  114. #endif
  115. }
  116. #ifdef ELF_CORE_COPY_XFPREGS
  117. static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
  118. {
  119. return ELF_CORE_COPY_XFPREGS(t, xfpu);
  120. }
  121. #endif
  122. #endif /* __KERNEL__ */
  123. #endif /* _LINUX_ELFCORE_H */