xref: /illumos-gate/usr/src/cmd/sgs/elfdump/common/struct_layout_i386.c (revision 92a0208178405fef708b0283ffcaa02fbc3468ff)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include <struct_layout.h>
29 
30 
31 static const sl_auxv_layout_t auxv_layout = {
32 	{ 0,	8,	0,	0 },		/* sizeof (auxv_t) */
33 	{ 0,	4,	0,	1 },		/* a_type */
34 	{ 4,	4,	0,	1 },		/* a_un.a_val */
35 	{ 4,	4,	0,	0 },		/* a_un.a_ptr */
36 	{ 4,	4,	0,	0 },		/* a_un.a_fcn */
37 };
38 
39 
40 static const sl_prgregset_layout_t prgregset_layout = {
41 	{ 0,	76,	0,	0 },		/* sizeof (prgregset_t) */
42 	{ 0,	4,	19,	0 },		/* elt0 */
43 };
44 
45 
46 static const sl_lwpstatus_layout_t lwpstatus_layout = {
47 	{ 0,	800,	0,	0 },		/* sizeof (lwpstatus_t) */
48 	{ 0,	4,	0,	0 },		/* pr_flags */
49 	{ 4,	4,	0,	0 },		/* pr_lwpid */
50 	{ 8,	2,	0,	0 },		/* pr_why */
51 	{ 10,	2,	0,	0 },		/* pr_what */
52 	{ 12,	2,	0,	0 },		/* pr_cursig */
53 	{ 16,	128,	0,	0 },		/* pr_info */
54 	{ 144,	16,	0,	0 },		/* pr_lwppend */
55 	{ 160,	16,	0,	0 },		/* pr_lwphold */
56 	{ 176,	32,	0,	0 },		/* pr_action */
57 	{ 208,	12,	0,	0 },		/* pr_altstack */
58 	{ 220,	4,	0,	0 },		/* pr_oldcontext */
59 	{ 224,	2,	0,	0 },		/* pr_syscall */
60 	{ 226,	2,	0,	0 },		/* pr_nsysarg */
61 	{ 228,	4,	0,	0 },		/* pr_errno */
62 	{ 232,	4,	8,	0 },		/* pr_sysarg[] */
63 	{ 264,	4,	0,	0 },		/* pr_rval1 */
64 	{ 268,	4,	0,	0 },		/* pr_rval2 */
65 	{ 272,	1,	8,	0 },		/* pr_clname[] */
66 	{ 280,	8,	0,	0 },		/* pr_tstamp */
67 	{ 288,	8,	0,	0 },		/* pr_utime */
68 	{ 296,	8,	0,	0 },		/* pr_stime */
69 	{ 332,	4,	0,	0 },		/* pr_errpriv */
70 	{ 336,	4,	0,	0 },		/* pr_ustack */
71 	{ 340,	4,	0,	0 },		/* pr_instr */
72 	{ 344,	76,	0,	0 },		/* pr_reg */
73 	{ 420,	380,	0,	0 },		/* pr_fpreg */
74 };
75 
76 
77 static const sl_pstatus_layout_t pstatus_layout = {
78 	{ 0,	1136,	0,	0 },		/* sizeof (pstatus_t) */
79 	{ 0,	4,	0,	1 },		/* pr_flags */
80 	{ 4,	4,	0,	1 },		/* pr_nlwp */
81 	{ 8,	4,	0,	0 },		/* pr_pid */
82 	{ 12,	4,	0,	0 },		/* pr_ppid */
83 	{ 16,	4,	0,	0 },		/* pr_pgid */
84 	{ 20,	4,	0,	0 },		/* pr_sid */
85 	{ 24,	4,	0,	1 },		/* pr_aslwpid */
86 	{ 28,	4,	0,	1 },		/* pr_agentid */
87 	{ 32,	16,	0,	0 },		/* pr_sigpend */
88 	{ 48,	4,	0,	0 },		/* pr_brkbase */
89 	{ 52,	4,	0,	0 },		/* pr_brksize */
90 	{ 56,	4,	0,	0 },		/* pr_stkbase */
91 	{ 60,	4,	0,	0 },		/* pr_stksize */
92 	{ 64,	8,	0,	0 },		/* pr_utime */
93 	{ 72,	8,	0,	0 },		/* pr_stime */
94 	{ 80,	8,	0,	0 },		/* pr_cutime */
95 	{ 88,	8,	0,	0 },		/* pr_cstime */
96 	{ 96,	16,	0,	0 },		/* pr_sigtrace */
97 	{ 112,	16,	0,	0 },		/* pr_flttrace */
98 	{ 128,	64,	0,	0 },		/* pr_sysentry */
99 	{ 192,	64,	0,	0 },		/* pr_sysexit */
100 	{ 256,	1,	0,	0 },		/* pr_dmodel */
101 	{ 260,	4,	0,	1 },		/* pr_taskid */
102 	{ 264,	4,	0,	1 },		/* pr_projid */
103 	{ 268,	4,	0,	1 },		/* pr_nzomb */
104 	{ 272,	4,	0,	1 },		/* pr_zoneid */
105 	{ 336,	800,	0,	0 },		/* pr_lwp */
106 };
107 
108 
109 static const sl_prstatus_layout_t prstatus_layout = {
110 	{ 0,	432,	0,	0 },		/* sizeof (prstatus_t) */
111 	{ 0,	4,	0,	1 },		/* pr_flags */
112 	{ 4,	2,	0,	1 },		/* pr_why */
113 	{ 6,	2,	0,	1 },		/* pr_what */
114 	{ 8,	128,	0,	0 },		/* pr_info */
115 	{ 136,	2,	0,	1 },		/* pr_cursig */
116 	{ 138,	2,	0,	0 },		/* pr_nlwp */
117 	{ 140,	16,	0,	0 },		/* pr_sigpend */
118 	{ 156,	16,	0,	0 },		/* pr_sighold */
119 	{ 172,	12,	0,	0 },		/* pr_altstack */
120 	{ 184,	32,	0,	0 },		/* pr_action */
121 	{ 216,	4,	0,	0 },		/* pr_pid */
122 	{ 220,	4,	0,	0 },		/* pr_ppid */
123 	{ 224,	4,	0,	0 },		/* pr_pgrp */
124 	{ 228,	4,	0,	0 },		/* pr_sid */
125 	{ 232,	8,	0,	0 },		/* pr_utime */
126 	{ 240,	8,	0,	0 },		/* pr_stime */
127 	{ 248,	8,	0,	0 },		/* pr_cutime */
128 	{ 256,	8,	0,	0 },		/* pr_cstime */
129 	{ 264,	1,	8,	0 },		/* pr_clname[] */
130 	{ 272,	2,	0,	1 },		/* pr_syscall */
131 	{ 274,	2,	0,	1 },		/* pr_nsysarg */
132 	{ 276,	4,	8,	1 },		/* pr_sysarg[] */
133 	{ 308,	4,	0,	0 },		/* pr_who */
134 	{ 312,	16,	0,	0 },		/* pr_lwppend */
135 	{ 328,	4,	0,	0 },		/* pr_oldcontext */
136 	{ 332,	4,	0,	0 },		/* pr_brkbase */
137 	{ 336,	4,	0,	0 },		/* pr_brksize */
138 	{ 340,	4,	0,	0 },		/* pr_stkbase */
139 	{ 344,	4,	0,	0 },		/* pr_stksize */
140 	{ 348,	2,	0,	1 },		/* pr_processor */
141 	{ 350,	2,	0,	1 },		/* pr_bind */
142 	{ 352,	4,	0,	1 },		/* pr_instr */
143 	{ 356,	76,	0,	0 },		/* pr_reg */
144 };
145 
146 
147 static const sl_psinfo_layout_t psinfo_layout = {
148 	{ 0,	336,	0,	0 },		/* sizeof (psinfo_t) */
149 	{ 0,	4,	0,	1 },		/* pr_flag */
150 	{ 4,	4,	0,	1 },		/* pr_nlwp */
151 	{ 8,	4,	0,	0 },		/* pr_pid */
152 	{ 12,	4,	0,	0 },		/* pr_ppid */
153 	{ 16,	4,	0,	0 },		/* pr_pgid */
154 	{ 20,	4,	0,	0 },		/* pr_sid */
155 	{ 24,	4,	0,	0 },		/* pr_uid */
156 	{ 28,	4,	0,	0 },		/* pr_euid */
157 	{ 32,	4,	0,	0 },		/* pr_gid */
158 	{ 36,	4,	0,	0 },		/* pr_egid */
159 	{ 40,	4,	0,	0 },		/* pr_addr */
160 	{ 44,	4,	0,	0 },		/* pr_size */
161 	{ 48,	4,	0,	0 },		/* pr_rssize */
162 	{ 56,	4,	0,	0 },		/* pr_ttydev */
163 	{ 60,	2,	0,	0 },		/* pr_pctcpu */
164 	{ 62,	2,	0,	0 },		/* pr_pctmem */
165 	{ 64,	8,	0,	0 },		/* pr_start */
166 	{ 72,	8,	0,	0 },		/* pr_time */
167 	{ 80,	8,	0,	0 },		/* pr_ctime */
168 	{ 88,	1,	16,	0 },		/* pr_fname[] */
169 	{ 104,	1,	80,	0 },		/* pr_psargs[] */
170 	{ 184,	4,	0,	1 },		/* pr_wstat */
171 	{ 188,	4,	0,	1 },		/* pr_argc */
172 	{ 192,	4,	0,	0 },		/* pr_argv */
173 	{ 196,	4,	0,	0 },		/* pr_envp */
174 	{ 200,	1,	0,	0 },		/* pr_dmodel */
175 	{ 204,	4,	0,	0 },		/* pr_taskid */
176 	{ 208,	4,	0,	0 },		/* pr_projid */
177 	{ 212,	4,	0,	1 },		/* pr_nzomb */
178 	{ 216,	4,	0,	0 },		/* pr_poolid */
179 	{ 220,	4,	0,	0 },		/* pr_zoneid */
180 	{ 224,	4,	0,	0 },		/* pr_contract */
181 	{ 232,	104,	0,	0 },		/* pr_lwp */
182 };
183 
184 
185 static const sl_prpsinfo_layout_t prpsinfo_layout = {
186 	{ 0,	260,	0,	0 },		/* sizeof (prpsinfo_t) */
187 	{ 0,	1,	0,	0 },		/* pr_state */
188 	{ 1,	1,	0,	0 },		/* pr_sname */
189 	{ 2,	1,	0,	0 },		/* pr_zomb */
190 	{ 3,	1,	0,	0 },		/* pr_nice */
191 	{ 4,	4,	0,	0 },		/* pr_flag */
192 	{ 8,	4,	0,	0 },		/* pr_uid */
193 	{ 12,	4,	0,	0 },		/* pr_gid */
194 	{ 16,	4,	0,	0 },		/* pr_pid */
195 	{ 20,	4,	0,	0 },		/* pr_ppid */
196 	{ 24,	4,	0,	0 },		/* pr_pgrp */
197 	{ 28,	4,	0,	0 },		/* pr_sid */
198 	{ 32,	4,	0,	0 },		/* pr_addr */
199 	{ 36,	4,	0,	0 },		/* pr_size */
200 	{ 40,	4,	0,	0 },		/* pr_rssize */
201 	{ 44,	4,	0,	0 },		/* pr_wchan */
202 	{ 48,	8,	0,	0 },		/* pr_start */
203 	{ 56,	8,	0,	0 },		/* pr_time */
204 	{ 64,	4,	0,	1 },		/* pr_pri */
205 	{ 68,	1,	0,	0 },		/* pr_oldpri */
206 	{ 69,	1,	0,	0 },		/* pr_cpu */
207 	{ 70,	2,	0,	0 },		/* pr_ottydev */
208 	{ 72,	4,	0,	0 },		/* pr_lttydev */
209 	{ 76,	1,	8,	0 },		/* pr_clname[] */
210 	{ 84,	1,	16,	0 },		/* pr_fname[] */
211 	{ 100,	1,	80,	0 },		/* pr_psargs[] */
212 	{ 180,	2,	0,	1 },		/* pr_syscall */
213 	{ 184,	8,	0,	0 },		/* pr_ctime */
214 	{ 192,	4,	0,	0 },		/* pr_bysize */
215 	{ 196,	4,	0,	0 },		/* pr_byrssize */
216 	{ 200,	4,	0,	1 },		/* pr_argc */
217 	{ 204,	4,	0,	0 },		/* pr_argv */
218 	{ 208,	4,	0,	0 },		/* pr_envp */
219 	{ 212,	4,	0,	1 },		/* pr_wstat */
220 	{ 216,	2,	0,	0 },		/* pr_pctcpu */
221 	{ 218,	2,	0,	0 },		/* pr_pctmem */
222 	{ 220,	4,	0,	0 },		/* pr_euid */
223 	{ 224,	4,	0,	0 },		/* pr_egid */
224 	{ 228,	4,	0,	0 },		/* pr_aslwpid */
225 	{ 232,	1,	0,	0 },		/* pr_dmodel */
226 };
227 
228 
229 static const sl_lwpsinfo_layout_t lwpsinfo_layout = {
230 	{ 0,	104,	0,	0 },		/* sizeof (lwpsinfo_t) */
231 	{ 0,	4,	0,	1 },		/* pr_flag */
232 	{ 4,	4,	0,	0 },		/* pr_lwpid */
233 	{ 8,	4,	0,	0 },		/* pr_addr */
234 	{ 12,	4,	0,	0 },		/* pr_wchan */
235 	{ 16,	1,	0,	0 },		/* pr_stype */
236 	{ 17,	1,	0,	0 },		/* pr_state */
237 	{ 18,	1,	0,	0 },		/* pr_sname */
238 	{ 19,	1,	0,	0 },		/* pr_nice */
239 	{ 20,	2,	0,	0 },		/* pr_syscall */
240 	{ 22,	1,	0,	0 },		/* pr_oldpri */
241 	{ 23,	1,	0,	0 },		/* pr_cpu */
242 	{ 24,	4,	0,	1 },		/* pr_pri */
243 	{ 28,	2,	0,	0 },		/* pr_pctcpu */
244 	{ 32,	8,	0,	0 },		/* pr_start */
245 	{ 40,	8,	0,	0 },		/* pr_time */
246 	{ 48,	1,	8,	0 },		/* pr_clname[] */
247 	{ 56,	1,	16,	0 },		/* pr_name[] */
248 	{ 72,	4,	0,	1 },		/* pr_onpro */
249 	{ 76,	4,	0,	1 },		/* pr_bindpro */
250 	{ 80,	4,	0,	1 },		/* pr_bindpset */
251 	{ 84,	4,	0,	1 },		/* pr_lgrp */
252 };
253 
254 
255 static const sl_prcred_layout_t prcred_layout = {
256 	{ 0,	32,	0,	0 },		/* sizeof (prcred_t) */
257 	{ 0,	4,	0,	0 },		/* pr_euid */
258 	{ 4,	4,	0,	0 },		/* pr_ruid */
259 	{ 8,	4,	0,	0 },		/* pr_suid */
260 	{ 12,	4,	0,	0 },		/* pr_egid */
261 	{ 16,	4,	0,	0 },		/* pr_rgid */
262 	{ 20,	4,	0,	0 },		/* pr_sgid */
263 	{ 24,	4,	0,	1 },		/* pr_ngroups */
264 	{ 28,	4,	1,	0 },		/* pr_groups[] */
265 };
266 
267 
268 static const sl_prpriv_layout_t prpriv_layout = {
269 	{ 0,	16,	0,	0 },		/* sizeof (prpriv_t) */
270 	{ 0,	4,	0,	0 },		/* pr_nsets */
271 	{ 4,	4,	0,	0 },		/* pr_setsize */
272 	{ 8,	4,	0,	0 },		/* pr_infosize */
273 	{ 12,	4,	1,	0 },		/* pr_sets[] */
274 };
275 
276 
277 static const sl_priv_impl_info_layout_t priv_impl_info_layout = {
278 	{ 0,	28,	0,	0 },		/* sizeof (priv_impl_info_t) */
279 	{ 0,	4,	0,	0 },		/* priv_headersize */
280 	{ 4,	4,	0,	0 },		/* priv_flags */
281 	{ 8,	4,	0,	0 },		/* priv_nsets */
282 	{ 12,	4,	0,	0 },		/* priv_setsize */
283 	{ 16,	4,	0,	0 },		/* priv_max */
284 	{ 20,	4,	0,	0 },		/* priv_infosize */
285 	{ 24,	4,	0,	0 },		/* priv_globalinfosize */
286 };
287 
288 
289 static const sl_fltset_layout_t fltset_layout = {
290 	{ 0,	16,	0,	0 },		/* sizeof (fltset_t) */
291 	{ 0,	4,	4,	0 },		/* word[] */
292 };
293 
294 
295 static const sl_siginfo_layout_t siginfo_layout = {
296 	{ 0,	128,	0,	0 },		/* sizeof (siginfo_t) */
297 	{ 0,	4,	0,	0 },		/* si_signo */
298 	{ 8,	4,	0,	0 },		/* si_errno */
299 	{ 4,	4,	0,	1 },		/* si_code */
300 	{ 20,	4,	0,	0 },		/* si_value.sival_int */
301 	{ 20,	4,	0,	0 },		/* si_value.sival_ptr */
302 	{ 12,	4,	0,	0 },		/* si_pid */
303 	{ 16,	4,	0,	0 },		/* si_uid */
304 	{ 28,	4,	0,	0 },		/* si_ctid */
305 	{ 32,	4,	0,	0 },		/* si_zoneid */
306 	{ 12,	4,	0,	0 },		/* si_entity */
307 	{ 12,	4,	0,	0 },		/* si_addr */
308 	{ 20,	4,	0,	0 },		/* si_status */
309 	{ 16,	4,	0,	0 },		/* si_band */
310 };
311 
312 
313 static const sl_sigset_layout_t sigset_layout = {
314 	{ 0,	16,	0,	0 },		/* sizeof (sigset_t) */
315 	{ 0,	4,	4,	0 },		/* __sigbits[] */
316 };
317 
318 
319 static const sl_sigaction_layout_t sigaction_layout = {
320 	{ 0,	32,	0,	0 },		/* sizeof (struct sigaction) */
321 	{ 0,	4,	0,	0 },		/* sa_flags */
322 	{ 4,	4,	0,	0 },		/* sa_handler */
323 	{ 4,	4,	0,	0 },		/* sa_sigaction */
324 	{ 8,	16,	0,	0 },		/* sa_mask */
325 };
326 
327 
328 static const sl_stack_layout_t stack_layout = {
329 	{ 0,	12,	0,	0 },		/* sizeof (stack_t) */
330 	{ 0,	4,	0,	0 },		/* ss_sp */
331 	{ 4,	4,	0,	0 },		/* ss_size */
332 	{ 8,	4,	0,	0 },		/* ss_flags */
333 };
334 
335 
336 static const sl_sysset_layout_t sysset_layout = {
337 	{ 0,	64,	0,	0 },		/* sizeof (sysset_t) */
338 	{ 0,	4,	16,	0 },		/* word[] */
339 };
340 
341 
342 static const sl_timestruc_layout_t timestruc_layout = {
343 	{ 0,	8,	0,	0 },		/* sizeof (timestruc_t) */
344 	{ 0,	4,	0,	0 },		/* tv_sec */
345 	{ 4,	4,	0,	0 },		/* tv_nsec */
346 };
347 
348 
349 static const sl_utsname_layout_t utsname_layout = {
350 	{ 0,	1285,	0,	0 },		/* sizeof (struct utsname) */
351 	{ 0,	1,	257,	0 },		/* sysname[] */
352 	{ 257,	1,	257,	0 },		/* nodename[] */
353 	{ 514,	1,	257,	0 },		/* release[] */
354 	{ 771,	1,	257,	0 },		/* version[] */
355 	{ 1028,	1,	257,	0 },		/* machine[] */
356 };
357 
358 
359 
360 
361 static const sl_arch_layout_t layout_i386 = {
362 	&auxv_layout,
363 	&fltset_layout,
364 	&lwpsinfo_layout,
365 	&lwpstatus_layout,
366 	&prcred_layout,
367 	&priv_impl_info_layout,
368 	&prpriv_layout,
369 	&psinfo_layout,
370 	&pstatus_layout,
371 	&prgregset_layout,
372 	&prpsinfo_layout,
373 	&prstatus_layout,
374 	&sigaction_layout,
375 	&siginfo_layout,
376 	&sigset_layout,
377 	&stack_layout,
378 	&sysset_layout,
379 	&timestruc_layout,
380 	&utsname_layout,
381 };
382 
383 
384 const sl_arch_layout_t *
385 struct_layout_i386(void)
386 {
387 	return (&layout_i386);
388 }
389