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, 16, 0, 0 }, /* sizeof (auxv_t) */ 33 { 0, 4, 0, 1 }, /* a_type */ 34 { 8, 8, 0, 1 }, /* a_un.a_val */ 35 { 8, 8, 0, 0 }, /* a_un.a_ptr */ 36 { 8, 8, 0, 0 }, /* a_un.a_fcn */ 37 }; 38 39 40 static const sl_prgregset_layout_t prgregset_layout = { 41 { 0, 224, 0, 0 }, /* sizeof (prgregset_t) */ 42 { 0, 8, 28, 0 }, /* elt0 */ 43 }; 44 45 46 static const sl_lwpstatus_layout_t lwpstatus_layout = { 47 { 0, 1296, 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, 256, 0, 0 }, /* pr_info */ 54 { 272, 16, 0, 0 }, /* pr_lwppend */ 55 { 288, 16, 0, 0 }, /* pr_lwphold */ 56 { 304, 32, 0, 0 }, /* pr_action */ 57 { 336, 24, 0, 0 }, /* pr_altstack */ 58 { 360, 8, 0, 0 }, /* pr_oldcontext */ 59 { 368, 2, 0, 0 }, /* pr_syscall */ 60 { 370, 2, 0, 0 }, /* pr_nsysarg */ 61 { 372, 4, 0, 0 }, /* pr_errno */ 62 { 376, 8, 8, 0 }, /* pr_sysarg[] */ 63 { 440, 8, 0, 0 }, /* pr_rval1 */ 64 { 448, 8, 0, 0 }, /* pr_rval2 */ 65 { 456, 1, 8, 0 }, /* pr_clname[] */ 66 { 464, 16, 0, 0 }, /* pr_tstamp */ 67 { 480, 16, 0, 0 }, /* pr_utime */ 68 { 496, 16, 0, 0 }, /* pr_stime */ 69 { 524, 4, 0, 0 }, /* pr_errpriv */ 70 { 528, 8, 0, 0 }, /* pr_ustack */ 71 { 536, 8, 0, 0 }, /* pr_instr */ 72 { 544, 224, 0, 0 }, /* pr_reg */ 73 { 768, 528, 0, 0 }, /* pr_fpreg */ 74 }; 75 76 77 static const sl_pstatus_layout_t pstatus_layout = { 78 { 0, 1680, 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, 8, 0, 0 }, /* pr_brkbase */ 89 { 56, 8, 0, 0 }, /* pr_brksize */ 90 { 64, 8, 0, 0 }, /* pr_stkbase */ 91 { 72, 8, 0, 0 }, /* pr_stksize */ 92 { 80, 16, 0, 0 }, /* pr_utime */ 93 { 96, 16, 0, 0 }, /* pr_stime */ 94 { 112, 16, 0, 0 }, /* pr_cutime */ 95 { 128, 16, 0, 0 }, /* pr_cstime */ 96 { 144, 16, 0, 0 }, /* pr_sigtrace */ 97 { 160, 16, 0, 0 }, /* pr_flttrace */ 98 { 176, 64, 0, 0 }, /* pr_sysentry */ 99 { 240, 64, 0, 0 }, /* pr_sysexit */ 100 { 304, 1, 0, 0 }, /* pr_dmodel */ 101 { 308, 4, 0, 1 }, /* pr_taskid */ 102 { 312, 4, 0, 1 }, /* pr_projid */ 103 { 316, 4, 0, 1 }, /* pr_nzomb */ 104 { 320, 4, 0, 1 }, /* pr_zoneid */ 105 { 384, 1296, 0, 0 }, /* pr_lwp */ 106 }; 107 108 109 static const sl_prstatus_layout_t prstatus_layout = { 110 { 0, 824, 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, 256, 0, 0 }, /* pr_info */ 115 { 264, 2, 0, 1 }, /* pr_cursig */ 116 { 266, 2, 0, 0 }, /* pr_nlwp */ 117 { 268, 16, 0, 0 }, /* pr_sigpend */ 118 { 284, 16, 0, 0 }, /* pr_sighold */ 119 { 304, 24, 0, 0 }, /* pr_altstack */ 120 { 328, 32, 0, 0 }, /* pr_action */ 121 { 360, 4, 0, 0 }, /* pr_pid */ 122 { 364, 4, 0, 0 }, /* pr_ppid */ 123 { 368, 4, 0, 0 }, /* pr_pgrp */ 124 { 372, 4, 0, 0 }, /* pr_sid */ 125 { 376, 16, 0, 0 }, /* pr_utime */ 126 { 392, 16, 0, 0 }, /* pr_stime */ 127 { 408, 16, 0, 0 }, /* pr_cutime */ 128 { 424, 16, 0, 0 }, /* pr_cstime */ 129 { 440, 1, 8, 0 }, /* pr_clname[] */ 130 { 448, 2, 0, 1 }, /* pr_syscall */ 131 { 450, 2, 0, 1 }, /* pr_nsysarg */ 132 { 456, 8, 8, 1 }, /* pr_sysarg[] */ 133 { 520, 4, 0, 0 }, /* pr_who */ 134 { 524, 16, 0, 0 }, /* pr_lwppend */ 135 { 544, 8, 0, 0 }, /* pr_oldcontext */ 136 { 552, 8, 0, 0 }, /* pr_brkbase */ 137 { 560, 8, 0, 0 }, /* pr_brksize */ 138 { 568, 8, 0, 0 }, /* pr_stkbase */ 139 { 576, 8, 0, 0 }, /* pr_stksize */ 140 { 584, 2, 0, 1 }, /* pr_processor */ 141 { 586, 2, 0, 1 }, /* pr_bind */ 142 { 592, 8, 0, 1 }, /* pr_instr */ 143 { 600, 224, 0, 0 }, /* pr_reg */ 144 }; 145 146 147 static const sl_psinfo_layout_t psinfo_layout = { 148 { 0, 416, 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, 8, 0, 0 }, /* pr_addr */ 160 { 48, 8, 0, 0 }, /* pr_size */ 161 { 56, 8, 0, 0 }, /* pr_rssize */ 162 { 72, 8, 0, 0 }, /* pr_ttydev */ 163 { 80, 2, 0, 0 }, /* pr_pctcpu */ 164 { 82, 2, 0, 0 }, /* pr_pctmem */ 165 { 88, 16, 0, 0 }, /* pr_start */ 166 { 104, 16, 0, 0 }, /* pr_time */ 167 { 120, 16, 0, 0 }, /* pr_ctime */ 168 { 136, 1, 16, 0 }, /* pr_fname[] */ 169 { 152, 1, 80, 0 }, /* pr_psargs[] */ 170 { 232, 4, 0, 1 }, /* pr_wstat */ 171 { 236, 4, 0, 1 }, /* pr_argc */ 172 { 240, 8, 0, 0 }, /* pr_argv */ 173 { 248, 8, 0, 0 }, /* pr_envp */ 174 { 256, 1, 0, 0 }, /* pr_dmodel */ 175 { 260, 4, 0, 0 }, /* pr_taskid */ 176 { 264, 4, 0, 0 }, /* pr_projid */ 177 { 268, 4, 0, 1 }, /* pr_nzomb */ 178 { 272, 4, 0, 0 }, /* pr_poolid */ 179 { 276, 4, 0, 0 }, /* pr_zoneid */ 180 { 280, 4, 0, 0 }, /* pr_contract */ 181 { 288, 128, 0, 0 }, /* pr_lwp */ 182 }; 183 184 185 static const sl_prpsinfo_layout_t prpsinfo_layout = { 186 { 0, 328, 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, 8, 0, 0 }, /* pr_addr */ 199 { 40, 8, 0, 0 }, /* pr_size */ 200 { 48, 8, 0, 0 }, /* pr_rssize */ 201 { 56, 8, 0, 0 }, /* pr_wchan */ 202 { 64, 16, 0, 0 }, /* pr_start */ 203 { 80, 16, 0, 0 }, /* pr_time */ 204 { 96, 4, 0, 1 }, /* pr_pri */ 205 { 100, 1, 0, 0 }, /* pr_oldpri */ 206 { 101, 1, 0, 0 }, /* pr_cpu */ 207 { 102, 2, 0, 0 }, /* pr_ottydev */ 208 { 104, 8, 0, 0 }, /* pr_lttydev */ 209 { 112, 1, 8, 0 }, /* pr_clname[] */ 210 { 120, 1, 16, 0 }, /* pr_fname[] */ 211 { 136, 1, 80, 0 }, /* pr_psargs[] */ 212 { 216, 2, 0, 1 }, /* pr_syscall */ 213 { 224, 16, 0, 0 }, /* pr_ctime */ 214 { 240, 8, 0, 0 }, /* pr_bysize */ 215 { 248, 8, 0, 0 }, /* pr_byrssize */ 216 { 256, 4, 0, 1 }, /* pr_argc */ 217 { 264, 8, 0, 0 }, /* pr_argv */ 218 { 272, 8, 0, 0 }, /* pr_envp */ 219 { 280, 4, 0, 1 }, /* pr_wstat */ 220 { 284, 2, 0, 0 }, /* pr_pctcpu */ 221 { 286, 2, 0, 0 }, /* pr_pctmem */ 222 { 288, 4, 0, 0 }, /* pr_euid */ 223 { 292, 4, 0, 0 }, /* pr_egid */ 224 { 296, 4, 0, 0 }, /* pr_aslwpid */ 225 { 300, 1, 0, 0 }, /* pr_dmodel */ 226 }; 227 228 229 static const sl_lwpsinfo_layout_t lwpsinfo_layout = { 230 { 0, 128, 0, 0 }, /* sizeof (lwpsinfo_t) */ 231 { 0, 4, 0, 1 }, /* pr_flag */ 232 { 4, 4, 0, 0 }, /* pr_lwpid */ 233 { 8, 8, 0, 0 }, /* pr_addr */ 234 { 16, 8, 0, 0 }, /* pr_wchan */ 235 { 24, 1, 0, 0 }, /* pr_stype */ 236 { 25, 1, 0, 0 }, /* pr_state */ 237 { 26, 1, 0, 0 }, /* pr_sname */ 238 { 27, 1, 0, 0 }, /* pr_nice */ 239 { 28, 2, 0, 0 }, /* pr_syscall */ 240 { 30, 1, 0, 0 }, /* pr_oldpri */ 241 { 31, 1, 0, 0 }, /* pr_cpu */ 242 { 32, 4, 0, 1 }, /* pr_pri */ 243 { 36, 2, 0, 0 }, /* pr_pctcpu */ 244 { 40, 16, 0, 0 }, /* pr_start */ 245 { 56, 16, 0, 0 }, /* pr_time */ 246 { 72, 1, 8, 0 }, /* pr_clname[] */ 247 { 80, 1, 16, 0 }, /* pr_name[] */ 248 { 96, 4, 0, 1 }, /* pr_onpro */ 249 { 100, 4, 0, 1 }, /* pr_bindpro */ 250 { 104, 4, 0, 1 }, /* pr_bindpset */ 251 { 108, 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, 256, 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 { 32, 4, 0, 0 }, /* si_value.sival_int */ 301 { 32, 8, 0, 0 }, /* si_value.sival_ptr */ 302 { 16, 4, 0, 0 }, /* si_pid */ 303 { 24, 4, 0, 0 }, /* si_uid */ 304 { 48, 4, 0, 0 }, /* si_ctid */ 305 { 52, 4, 0, 0 }, /* si_zoneid */ 306 { 16, 4, 0, 0 }, /* si_entity */ 307 { 16, 8, 0, 0 }, /* si_addr */ 308 { 32, 4, 0, 0 }, /* si_status */ 309 { 24, 8, 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 { 8, 8, 0, 0 }, /* sa_handler */ 323 { 8, 8, 0, 0 }, /* sa_sigaction */ 324 { 16, 16, 0, 0 }, /* sa_mask */ 325 }; 326 327 328 static const sl_stack_layout_t stack_layout = { 329 { 0, 24, 0, 0 }, /* sizeof (stack_t) */ 330 { 0, 8, 0, 0 }, /* ss_sp */ 331 { 8, 8, 0, 0 }, /* ss_size */ 332 { 16, 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, 16, 0, 0 }, /* sizeof (timestruc_t) */ 344 { 0, 8, 0, 0 }, /* tv_sec */ 345 { 8, 8, 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_amd64 = { 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 ×truc_layout, 380 &utsname_layout, 381 }; 382 383 384 const sl_arch_layout_t * 385 struct_layout_amd64(void) 386 { 387 return (&layout_amd64); 388 } 389