xref: /illumos-gate/usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c (revision 4c28a617e3922d92a58e813a5b955eb526b9c386)
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 /*
27  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
28  */
29 #include <struct_layout.h>
30 
31 
32 static const sl_auxv_layout_t auxv_layout = {
33 	{ 0,	8,	0,	0 },		/* sizeof (auxv_t) */
34 	{ 0,	4,	0,	1 },		/* a_type */
35 	{ 4,	4,	0,	1 },		/* a_un.a_val */
36 	{ 4,	4,	0,	0 },		/* a_un.a_ptr */
37 	{ 4,	4,	0,	0 },		/* a_un.a_fcn */
38 };
39 
40 
41 static const sl_prgregset_layout_t prgregset_layout = {
42 	{ 0,	152,	0,	0 },		/* sizeof (prgregset_t) */
43 	{ 0,	4,	38,	0 },		/* elt0 */
44 };
45 
46 
47 static const sl_lwpstatus_layout_t lwpstatus_layout = {
48 	{ 0,	896,	0,	0 },		/* sizeof (lwpstatus_t) */
49 	{ 0,	4,	0,	0 },		/* pr_flags */
50 	{ 4,	4,	0,	0 },		/* pr_lwpid */
51 	{ 8,	2,	0,	0 },		/* pr_why */
52 	{ 10,	2,	0,	0 },		/* pr_what */
53 	{ 12,	2,	0,	0 },		/* pr_cursig */
54 	{ 16,	128,	0,	0 },		/* pr_info */
55 	{ 144,	16,	0,	0 },		/* pr_lwppend */
56 	{ 160,	16,	0,	0 },		/* pr_lwphold */
57 	{ 176,	32,	0,	0 },		/* pr_action */
58 	{ 208,	12,	0,	0 },		/* pr_altstack */
59 	{ 220,	4,	0,	0 },		/* pr_oldcontext */
60 	{ 224,	2,	0,	0 },		/* pr_syscall */
61 	{ 226,	2,	0,	0 },		/* pr_nsysarg */
62 	{ 228,	4,	0,	0 },		/* pr_errno */
63 	{ 232,	4,	8,	0 },		/* pr_sysarg[] */
64 	{ 264,	4,	0,	0 },		/* pr_rval1 */
65 	{ 268,	4,	0,	0 },		/* pr_rval2 */
66 	{ 272,	1,	8,	0 },		/* pr_clname[] */
67 	{ 280,	8,	0,	0 },		/* pr_tstamp */
68 	{ 288,	8,	0,	0 },		/* pr_utime */
69 	{ 296,	8,	0,	0 },		/* pr_stime */
70 	{ 332,	4,	0,	0 },		/* pr_errpriv */
71 	{ 336,	4,	0,	0 },		/* pr_ustack */
72 	{ 340,	4,	0,	0 },		/* pr_instr */
73 	{ 344,	152,	0,	0 },		/* pr_reg */
74 	{ 496,	400,	0,	0 },		/* pr_fpreg */
75 };
76 
77 
78 static const sl_pstatus_layout_t pstatus_layout = {
79 	{ 0,	1232,	0,	0 },		/* sizeof (pstatus_t) */
80 	{ 0,	4,	0,	1 },		/* pr_flags */
81 	{ 4,	4,	0,	1 },		/* pr_nlwp */
82 	{ 8,	4,	0,	0 },		/* pr_pid */
83 	{ 12,	4,	0,	0 },		/* pr_ppid */
84 	{ 16,	4,	0,	0 },		/* pr_pgid */
85 	{ 20,	4,	0,	0 },		/* pr_sid */
86 	{ 24,	4,	0,	1 },		/* pr_aslwpid */
87 	{ 28,	4,	0,	1 },		/* pr_agentid */
88 	{ 32,	16,	0,	0 },		/* pr_sigpend */
89 	{ 48,	4,	0,	0 },		/* pr_brkbase */
90 	{ 52,	4,	0,	0 },		/* pr_brksize */
91 	{ 56,	4,	0,	0 },		/* pr_stkbase */
92 	{ 60,	4,	0,	0 },		/* pr_stksize */
93 	{ 64,	8,	0,	0 },		/* pr_utime */
94 	{ 72,	8,	0,	0 },		/* pr_stime */
95 	{ 80,	8,	0,	0 },		/* pr_cutime */
96 	{ 88,	8,	0,	0 },		/* pr_cstime */
97 	{ 96,	16,	0,	0 },		/* pr_sigtrace */
98 	{ 112,	16,	0,	0 },		/* pr_flttrace */
99 	{ 128,	64,	0,	0 },		/* pr_sysentry */
100 	{ 192,	64,	0,	0 },		/* pr_sysexit */
101 	{ 256,	1,	0,	0 },		/* pr_dmodel */
102 	{ 260,	4,	0,	1 },		/* pr_taskid */
103 	{ 264,	4,	0,	1 },		/* pr_projid */
104 	{ 268,	4,	0,	1 },		/* pr_nzomb */
105 	{ 272,	4,	0,	1 },		/* pr_zoneid */
106 	{ 336,	896,	0,	0 },		/* pr_lwp */
107 };
108 
109 
110 static const sl_prstatus_layout_t prstatus_layout = {
111 	{ 0,	508,	0,	0 },		/* sizeof (prstatus_t) */
112 	{ 0,	4,	0,	1 },		/* pr_flags */
113 	{ 4,	2,	0,	1 },		/* pr_why */
114 	{ 6,	2,	0,	1 },		/* pr_what */
115 	{ 8,	128,	0,	0 },		/* pr_info */
116 	{ 136,	2,	0,	1 },		/* pr_cursig */
117 	{ 138,	2,	0,	0 },		/* pr_nlwp */
118 	{ 140,	16,	0,	0 },		/* pr_sigpend */
119 	{ 156,	16,	0,	0 },		/* pr_sighold */
120 	{ 172,	12,	0,	0 },		/* pr_altstack */
121 	{ 184,	32,	0,	0 },		/* pr_action */
122 	{ 216,	4,	0,	0 },		/* pr_pid */
123 	{ 220,	4,	0,	0 },		/* pr_ppid */
124 	{ 224,	4,	0,	0 },		/* pr_pgrp */
125 	{ 228,	4,	0,	0 },		/* pr_sid */
126 	{ 232,	8,	0,	0 },		/* pr_utime */
127 	{ 240,	8,	0,	0 },		/* pr_stime */
128 	{ 248,	8,	0,	0 },		/* pr_cutime */
129 	{ 256,	8,	0,	0 },		/* pr_cstime */
130 	{ 264,	1,	8,	0 },		/* pr_clname[] */
131 	{ 272,	2,	0,	1 },		/* pr_syscall */
132 	{ 274,	2,	0,	1 },		/* pr_nsysarg */
133 	{ 276,	4,	8,	1 },		/* pr_sysarg[] */
134 	{ 308,	4,	0,	0 },		/* pr_who */
135 	{ 312,	16,	0,	0 },		/* pr_lwppend */
136 	{ 328,	4,	0,	0 },		/* pr_oldcontext */
137 	{ 332,	4,	0,	0 },		/* pr_brkbase */
138 	{ 336,	4,	0,	0 },		/* pr_brksize */
139 	{ 340,	4,	0,	0 },		/* pr_stkbase */
140 	{ 344,	4,	0,	0 },		/* pr_stksize */
141 	{ 348,	2,	0,	1 },		/* pr_processor */
142 	{ 350,	2,	0,	1 },		/* pr_bind */
143 	{ 352,	4,	0,	1 },		/* pr_instr */
144 	{ 356,	152,	0,	0 },		/* pr_reg */
145 };
146 
147 
148 static const sl_psinfo_layout_t psinfo_layout = {
149 	{ 0,	336,	0,	0 },		/* sizeof (psinfo_t) */
150 	{ 0,	4,	0,	1 },		/* pr_flag */
151 	{ 4,	4,	0,	1 },		/* pr_nlwp */
152 	{ 8,	4,	0,	0 },		/* pr_pid */
153 	{ 12,	4,	0,	0 },		/* pr_ppid */
154 	{ 16,	4,	0,	0 },		/* pr_pgid */
155 	{ 20,	4,	0,	0 },		/* pr_sid */
156 	{ 24,	4,	0,	0 },		/* pr_uid */
157 	{ 28,	4,	0,	0 },		/* pr_euid */
158 	{ 32,	4,	0,	0 },		/* pr_gid */
159 	{ 36,	4,	0,	0 },		/* pr_egid */
160 	{ 40,	4,	0,	0 },		/* pr_addr */
161 	{ 44,	4,	0,	0 },		/* pr_size */
162 	{ 48,	4,	0,	0 },		/* pr_rssize */
163 	{ 56,	4,	0,	0 },		/* pr_ttydev */
164 	{ 60,	2,	0,	0 },		/* pr_pctcpu */
165 	{ 62,	2,	0,	0 },		/* pr_pctmem */
166 	{ 64,	8,	0,	0 },		/* pr_start */
167 	{ 72,	8,	0,	0 },		/* pr_time */
168 	{ 80,	8,	0,	0 },		/* pr_ctime */
169 	{ 88,	1,	16,	0 },		/* pr_fname[] */
170 	{ 104,	1,	80,	0 },		/* pr_psargs[] */
171 	{ 184,	4,	0,	1 },		/* pr_wstat */
172 	{ 188,	4,	0,	1 },		/* pr_argc */
173 	{ 192,	4,	0,	0 },		/* pr_argv */
174 	{ 196,	4,	0,	0 },		/* pr_envp */
175 	{ 200,	1,	0,	0 },		/* pr_dmodel */
176 	{ 204,	4,	0,	0 },		/* pr_taskid */
177 	{ 208,	4,	0,	0 },		/* pr_projid */
178 	{ 212,	4,	0,	1 },		/* pr_nzomb */
179 	{ 216,	4,	0,	0 },		/* pr_poolid */
180 	{ 220,	4,	0,	0 },		/* pr_zoneid */
181 	{ 224,	4,	0,	0 },		/* pr_contract */
182 	{ 232,	104,	0,	0 },		/* pr_lwp */
183 };
184 
185 
186 static const sl_prpsinfo_layout_t prpsinfo_layout = {
187 	{ 0,	260,	0,	0 },		/* sizeof (prpsinfo_t) */
188 	{ 0,	1,	0,	0 },		/* pr_state */
189 	{ 1,	1,	0,	0 },		/* pr_sname */
190 	{ 2,	1,	0,	0 },		/* pr_zomb */
191 	{ 3,	1,	0,	0 },		/* pr_nice */
192 	{ 4,	4,	0,	0 },		/* pr_flag */
193 	{ 8,	4,	0,	0 },		/* pr_uid */
194 	{ 12,	4,	0,	0 },		/* pr_gid */
195 	{ 16,	4,	0,	0 },		/* pr_pid */
196 	{ 20,	4,	0,	0 },		/* pr_ppid */
197 	{ 24,	4,	0,	0 },		/* pr_pgrp */
198 	{ 28,	4,	0,	0 },		/* pr_sid */
199 	{ 32,	4,	0,	0 },		/* pr_addr */
200 	{ 36,	4,	0,	0 },		/* pr_size */
201 	{ 40,	4,	0,	0 },		/* pr_rssize */
202 	{ 44,	4,	0,	0 },		/* pr_wchan */
203 	{ 48,	8,	0,	0 },		/* pr_start */
204 	{ 56,	8,	0,	0 },		/* pr_time */
205 	{ 64,	4,	0,	1 },		/* pr_pri */
206 	{ 68,	1,	0,	0 },		/* pr_oldpri */
207 	{ 69,	1,	0,	0 },		/* pr_cpu */
208 	{ 70,	2,	0,	0 },		/* pr_ottydev */
209 	{ 72,	4,	0,	0 },		/* pr_lttydev */
210 	{ 76,	1,	8,	0 },		/* pr_clname[] */
211 	{ 84,	1,	16,	0 },		/* pr_fname[] */
212 	{ 100,	1,	80,	0 },		/* pr_psargs[] */
213 	{ 180,	2,	0,	1 },		/* pr_syscall */
214 	{ 184,	8,	0,	0 },		/* pr_ctime */
215 	{ 192,	4,	0,	0 },		/* pr_bysize */
216 	{ 196,	4,	0,	0 },		/* pr_byrssize */
217 	{ 200,	4,	0,	1 },		/* pr_argc */
218 	{ 204,	4,	0,	0 },		/* pr_argv */
219 	{ 208,	4,	0,	0 },		/* pr_envp */
220 	{ 212,	4,	0,	1 },		/* pr_wstat */
221 	{ 216,	2,	0,	0 },		/* pr_pctcpu */
222 	{ 218,	2,	0,	0 },		/* pr_pctmem */
223 	{ 220,	4,	0,	0 },		/* pr_euid */
224 	{ 224,	4,	0,	0 },		/* pr_egid */
225 	{ 228,	4,	0,	0 },		/* pr_aslwpid */
226 	{ 232,	1,	0,	0 },		/* pr_dmodel */
227 };
228 
229 
230 static const sl_lwpsinfo_layout_t lwpsinfo_layout = {
231 	{ 0,	104,	0,	0 },		/* sizeof (lwpsinfo_t) */
232 	{ 0,	4,	0,	1 },		/* pr_flag */
233 	{ 4,	4,	0,	0 },		/* pr_lwpid */
234 	{ 8,	4,	0,	0 },		/* pr_addr */
235 	{ 12,	4,	0,	0 },		/* pr_wchan */
236 	{ 16,	1,	0,	0 },		/* pr_stype */
237 	{ 17,	1,	0,	0 },		/* pr_state */
238 	{ 18,	1,	0,	0 },		/* pr_sname */
239 	{ 19,	1,	0,	0 },		/* pr_nice */
240 	{ 20,	2,	0,	0 },		/* pr_syscall */
241 	{ 22,	1,	0,	0 },		/* pr_oldpri */
242 	{ 23,	1,	0,	0 },		/* pr_cpu */
243 	{ 24,	4,	0,	1 },		/* pr_pri */
244 	{ 28,	2,	0,	0 },		/* pr_pctcpu */
245 	{ 32,	8,	0,	0 },		/* pr_start */
246 	{ 40,	8,	0,	0 },		/* pr_time */
247 	{ 48,	1,	8,	0 },		/* pr_clname[] */
248 	{ 56,	1,	16,	0 },		/* pr_name[] */
249 	{ 72,	4,	0,	1 },		/* pr_onpro */
250 	{ 76,	4,	0,	1 },		/* pr_bindpro */
251 	{ 80,	4,	0,	1 },		/* pr_bindpset */
252 	{ 84,	4,	0,	1 },		/* pr_lgrp */
253 };
254 
255 
256 static const sl_prcred_layout_t prcred_layout = {
257 	{ 0,	32,	0,	0 },		/* sizeof (prcred_t) */
258 	{ 0,	4,	0,	0 },		/* pr_euid */
259 	{ 4,	4,	0,	0 },		/* pr_ruid */
260 	{ 8,	4,	0,	0 },		/* pr_suid */
261 	{ 12,	4,	0,	0 },		/* pr_egid */
262 	{ 16,	4,	0,	0 },		/* pr_rgid */
263 	{ 20,	4,	0,	0 },		/* pr_sgid */
264 	{ 24,	4,	0,	1 },		/* pr_ngroups */
265 	{ 28,	4,	1,	0 },		/* pr_groups[] */
266 };
267 
268 
269 static const sl_prpriv_layout_t prpriv_layout = {
270 	{ 0,	16,	0,	0 },		/* sizeof (prpriv_t) */
271 	{ 0,	4,	0,	0 },		/* pr_nsets */
272 	{ 4,	4,	0,	0 },		/* pr_setsize */
273 	{ 8,	4,	0,	0 },		/* pr_infosize */
274 	{ 12,	4,	1,	0 },		/* pr_sets[] */
275 };
276 
277 
278 static const sl_priv_impl_info_layout_t priv_impl_info_layout = {
279 	{ 0,	28,	0,	0 },		/* sizeof (priv_impl_info_t) */
280 	{ 0,	4,	0,	0 },		/* priv_headersize */
281 	{ 4,	4,	0,	0 },		/* priv_flags */
282 	{ 8,	4,	0,	0 },		/* priv_nsets */
283 	{ 12,	4,	0,	0 },		/* priv_setsize */
284 	{ 16,	4,	0,	0 },		/* priv_max */
285 	{ 20,	4,	0,	0 },		/* priv_infosize */
286 	{ 24,	4,	0,	0 },		/* priv_globalinfosize */
287 };
288 
289 
290 static const sl_fltset_layout_t fltset_layout = {
291 	{ 0,	16,	0,	0 },		/* sizeof (fltset_t) */
292 	{ 0,	4,	4,	0 },		/* word[] */
293 };
294 
295 
296 static const sl_siginfo_layout_t siginfo_layout = {
297 	{ 0,	128,	0,	0 },		/* sizeof (siginfo_t) */
298 	{ 0,	4,	0,	0 },		/* si_signo */
299 	{ 8,	4,	0,	0 },		/* si_errno */
300 	{ 4,	4,	0,	1 },		/* si_code */
301 	{ 20,	4,	0,	0 },		/* si_value.sival_int */
302 	{ 20,	4,	0,	0 },		/* si_value.sival_ptr */
303 	{ 12,	4,	0,	0 },		/* si_pid */
304 	{ 16,	4,	0,	0 },		/* si_uid */
305 	{ 28,	4,	0,	0 },		/* si_ctid */
306 	{ 32,	4,	0,	0 },		/* si_zoneid */
307 	{ 12,	4,	0,	0 },		/* si_entity */
308 	{ 12,	4,	0,	0 },		/* si_addr */
309 	{ 20,	4,	0,	0 },		/* si_status */
310 	{ 16,	4,	0,	0 },		/* si_band */
311 };
312 
313 
314 static const sl_sigset_layout_t sigset_layout = {
315 	{ 0,	16,	0,	0 },		/* sizeof (sigset_t) */
316 	{ 0,	4,	4,	0 },		/* __sigbits[] */
317 };
318 
319 
320 static const sl_sigaction_layout_t sigaction_layout = {
321 	{ 0,	32,	0,	0 },		/* sizeof (struct sigaction) */
322 	{ 0,	4,	0,	0 },		/* sa_flags */
323 	{ 4,	4,	0,	0 },		/* sa_handler */
324 	{ 4,	4,	0,	0 },		/* sa_sigaction */
325 	{ 8,	16,	0,	0 },		/* sa_mask */
326 };
327 
328 
329 static const sl_stack_layout_t stack_layout = {
330 	{ 0,	12,	0,	0 },		/* sizeof (stack_t) */
331 	{ 0,	4,	0,	0 },		/* ss_sp */
332 	{ 4,	4,	0,	0 },		/* ss_size */
333 	{ 8,	4,	0,	0 },		/* ss_flags */
334 };
335 
336 
337 static const sl_sysset_layout_t sysset_layout = {
338 	{ 0,	64,	0,	0 },		/* sizeof (sysset_t) */
339 	{ 0,	4,	16,	0 },		/* word[] */
340 };
341 
342 
343 static const sl_timestruc_layout_t timestruc_layout = {
344 	{ 0,	8,	0,	0 },		/* sizeof (timestruc_t) */
345 	{ 0,	4,	0,	0 },		/* tv_sec */
346 	{ 4,	4,	0,	0 },		/* tv_nsec */
347 };
348 
349 
350 static const sl_utsname_layout_t utsname_layout = {
351 	{ 0,	1285,	0,	0 },		/* sizeof (struct utsname) */
352 	{ 0,	1,	257,	0 },		/* sysname[] */
353 	{ 257,	1,	257,	0 },		/* nodename[] */
354 	{ 514,	1,	257,	0 },		/* release[] */
355 	{ 771,	1,	257,	0 },		/* version[] */
356 	{ 1028,	1,	257,	0 },		/* machine[] */
357 };
358 
359 
360 static const sl_prfdinfo_layout_t prfdinfo_layout = {
361 	{ 0,	1088,	0,	0 },		/* sizeof (prfdinfo_t) */
362 	{ 0,	4,	0,	0 },		/* pr_fd */
363 	{ 4,	4,	0,	0 },		/* pr_mode */
364 	{ 8,	4,	0,	0 },		/* pr_uid */
365 	{ 12,	4,	0,	0 },		/* pr_gid */
366 	{ 16,	4,	0,	0 },		/* pr_major */
367 	{ 20,	4,	0,	0 },		/* pr_minor */
368 	{ 24,	4,	0,	0 },		/* pr_rmajor */
369 	{ 28,	4,	0,	0 },		/* pr_rminor */
370 	{ 32,	8,	0,	0 },		/* pr_ino */
371 	{ 40,	8,	0,	0 },		/* pr_offset */
372 	{ 48,	8,	0,	0 },		/* pr_size */
373 	{ 56,	4,	0,	0 },		/* pr_fileflags */
374 	{ 60,	4,	0,	0 },		/* pr_fdflags */
375 	{ 64,	1,	1024,	0 },		/* pr_path[] */
376 };
377 
378 
379 static const sl_prsecflags_layout_t prsecflags_layout = {
380 	{ 0,	40,	0,	0 },		/* sizeof (prsecflags_t) */
381 	{ 0,	4,	0,	0 },		/* pr_version */
382 	{ 8,	8,	0,	0 },		/* pr_effective */
383 	{ 16,	8,	0,	0 },		/* pr_inherit */
384 	{ 24,	8,	0,	0 },		/* pr_lower */
385 	{ 32,	8,	0,	0 },		/* pr_upper */
386 };
387 
388 
389 
390 
391 static const sl_arch_layout_t layout_sparc = {
392 	&auxv_layout,
393 	&fltset_layout,
394 	&lwpsinfo_layout,
395 	&lwpstatus_layout,
396 	&prcred_layout,
397 	&priv_impl_info_layout,
398 	&prpriv_layout,
399 	&psinfo_layout,
400 	&pstatus_layout,
401 	&prgregset_layout,
402 	&prpsinfo_layout,
403 	&prstatus_layout,
404 	&sigaction_layout,
405 	&siginfo_layout,
406 	&sigset_layout,
407 	&stack_layout,
408 	&sysset_layout,
409 	&timestruc_layout,
410 	&utsname_layout,
411 	&prfdinfo_layout,
412 	&prsecflags_layout,
413 };
414 
415 
416 const sl_arch_layout_t *
417 struct_layout_sparc(void)
418 {
419 	return (&layout_sparc);
420 }
421