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