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