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