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