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