10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51618Srie * Common Development and Distribution License (the "License"). 61618Srie * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 211618Srie 220Sstevel@tonic-gate /* 230Sstevel@tonic-gate * Copyright (c) 1988 AT&T 240Sstevel@tonic-gate * All Rights Reserved 250Sstevel@tonic-gate * 26*9085SAli.Bahrami@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 271618Srie * Use is subject to license terms. 280Sstevel@tonic-gate */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifndef _CONV_H 310Sstevel@tonic-gate #define _CONV_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate /* 340Sstevel@tonic-gate * Global include file for conversion library. 350Sstevel@tonic-gate */ 360Sstevel@tonic-gate 370Sstevel@tonic-gate #include <stdlib.h> 380Sstevel@tonic-gate #include <libelf.h> 390Sstevel@tonic-gate #include <dlfcn.h> 400Sstevel@tonic-gate #include <libld.h> 410Sstevel@tonic-gate #include <sgs.h> 420Sstevel@tonic-gate 430Sstevel@tonic-gate #ifdef __cplusplus 440Sstevel@tonic-gate extern "C" { 450Sstevel@tonic-gate #endif 460Sstevel@tonic-gate 470Sstevel@tonic-gate /* 480Sstevel@tonic-gate * Configuration features available - maintained here (instead of debug.h) 490Sstevel@tonic-gate * to save libconv from having to include debug.h which results in numerous 500Sstevel@tonic-gate * "declared but not used or defined" lint errors. 510Sstevel@tonic-gate */ 520Sstevel@tonic-gate #define CONF_EDLIBPATH 0x000100 /* ELF default library path */ 530Sstevel@tonic-gate #define CONF_ESLIBPATH 0x000200 /* ELF secure library path */ 540Sstevel@tonic-gate #define CONF_ADLIBPATH 0x000400 /* AOUT default library path */ 550Sstevel@tonic-gate #define CONF_ASLIBPATH 0x000800 /* AOUT secure library path */ 560Sstevel@tonic-gate #define CONF_DIRCFG 0x001000 /* directory configuration available */ 570Sstevel@tonic-gate #define CONF_OBJALT 0x002000 /* object alternatives available */ 580Sstevel@tonic-gate #define CONF_MEMRESV 0x004000 /* memory reservation required */ 590Sstevel@tonic-gate #define CONF_ENVS 0x008000 /* environment variables available */ 600Sstevel@tonic-gate #define CONF_FLTR 0x010000 /* filter information available */ 610Sstevel@tonic-gate #define CONF_FEATMSK 0xffff00 620Sstevel@tonic-gate 630Sstevel@tonic-gate /* 644734Sab196087 * Buffer types: 654734Sab196087 * 664734Sab196087 * Many of the routines in this module require the user to supply a 674734Sab196087 * buffer into which the desired strings may be written. These are 684734Sab196087 * all arrays of characters, and might be defined as simple arrays 694734Sab196087 * of char. The problem with that approach is that when such an array 704734Sab196087 * is passed to a function, the C language considers it to have the 714734Sab196087 * type (char *), without any regard to its length. Not all of our 724734Sab196087 * buffers have the same length, and we want to ensure that the compiler 734734Sab196087 * will refuse to compile code that passes the wrong type of buffer to 744734Sab196087 * a given routine. The solution is to define the buffers as unions 754734Sab196087 * that contain the needed array, and then to pass the given union 764734Sab196087 * by address. The compiler will catch attempts to pass the wrong type 774734Sab196087 * of pointer, and the size of a structure/union is implicit in its type. 784734Sab196087 * 794734Sab196087 * A nice side effect of this approach is that we can use a union with 804734Sab196087 * multiple buffers to handle the cases where a given routine needs 814734Sab196087 * more than one type of buffer. The end result is a single buffer large 824734Sab196087 * enough to handle any of the subcases, but no larger. 834734Sab196087 */ 844734Sab196087 854734Sab196087 /* 864734Sab196087 * Size of buffer used by conv_invalid_val(): 874734Sab196087 * 881618Srie * Various values that can't be matched to a symbolic definition are converted 894734Sab196087 * to a numeric string. 904734Sab196087 * 914734Sab196087 * The buffer size reflects the maximum number of digits needed to 924734Sab196087 * display an integer as text, plus a trailing null, and with room for 934734Sab196087 * a leading "0x" if hexidecimal display is selected. 944734Sab196087 */ 954734Sab196087 #define CONV32_INV_BUFSIZE 12 964734Sab196087 typedef union { 974734Sab196087 char buf[CONV32_INV_BUFSIZE]; 984734Sab196087 } Conv32_inv_buf_t; 994734Sab196087 1004734Sab196087 #define CONV64_INV_BUFSIZE 22 1014734Sab196087 typedef union { 1024734Sab196087 char buf[CONV64_INV_BUFSIZE]; 1034734Sab196087 } Conv64_inv_buf_t; 1044734Sab196087 1054734Sab196087 1064734Sab196087 1074734Sab196087 /* conv_ehdr_flags() */ 1085088Sab196087 #define CONV_EHDR_FLAGS_BASE_BUFSIZE 69 1094734Sab196087 #define CONV32_EHDR_FLAGS_BUFSIZE \ 1105088Sab196087 (CONV_EHDR_FLAGS_BASE_BUFSIZE + CONV32_INV_BUFSIZE) 1114734Sab196087 typedef union { 1124734Sab196087 Conv32_inv_buf_t inv_buf; 1134734Sab196087 char buf[CONV32_EHDR_FLAGS_BUFSIZE]; 1144734Sab196087 } Conv32_ehdr_flags_buf_t; 1154734Sab196087 1164734Sab196087 #define CONV64_EHDR_FLAGS_BUFSIZE \ 1175088Sab196087 (CONV_EHDR_FLAGS_BASE_BUFSIZE + CONV64_INV_BUFSIZE) 1184734Sab196087 typedef union { 1194734Sab196087 Conv64_inv_buf_t inv_buf; 1204734Sab196087 char buf[CONV64_EHDR_FLAGS_BUFSIZE]; 1214734Sab196087 } Conv64_ehdr_flags_buf_t; 1224734Sab196087 1234734Sab196087 1244734Sab196087 /* conv_reject_desc() */ 1254734Sab196087 typedef union { 1264734Sab196087 Conv32_inv_buf_t inv_buf; 1274734Sab196087 Conv32_ehdr_flags_buf_t flags_buf; 1284734Sab196087 } Conv32_reject_desc_buf_t; 1294734Sab196087 1304734Sab196087 typedef union { 1314734Sab196087 Conv64_inv_buf_t inv_buf; 1324734Sab196087 Conv64_ehdr_flags_buf_t flags_buf; 1334734Sab196087 } Conv64_reject_desc_buf_t; 1344734Sab196087 1354734Sab196087 1364734Sab196087 /* 1374734Sab196087 * conv_cap_val_hw1() 1384734Sab196087 * 1394734Sab196087 * This size is based on the maximum number of hardware capabilities 1404734Sab196087 * that exist. See common/elfcap. 1414734Sab196087 */ 1424734Sab196087 #define CONV_CAP_VAL_HW1_BUFSIZE 195 1434734Sab196087 1444734Sab196087 typedef union { 1454734Sab196087 Conv32_inv_buf_t inv_buf; 1464734Sab196087 char buf[CONV_CAP_VAL_HW1_BUFSIZE]; 1474734Sab196087 } Conv32_cap_val_hw1_buf_t; 1484734Sab196087 1494734Sab196087 typedef union { 1504734Sab196087 Conv64_inv_buf_t inv_buf; 1514734Sab196087 char buf[CONV_CAP_VAL_HW1_BUFSIZE]; 1524734Sab196087 } Conv64_cap_val_hw1_buf_t; 1534734Sab196087 1544734Sab196087 1554734Sab196087 /* 1564734Sab196087 * conv_cap_val_sf1() 1571618Srie * 1584734Sab196087 * This size is based on the maximum number of software capabilities 1594734Sab196087 * that exist. See common/elfcap. 1604734Sab196087 */ 1614734Sab196087 #define CONV_CAP_VAL_SF1_BUFSIZE 45 1624734Sab196087 1634734Sab196087 typedef union { 1644734Sab196087 Conv32_inv_buf_t inv_buf; 1654734Sab196087 char buf[CONV_CAP_VAL_SF1_BUFSIZE]; 1664734Sab196087 } Conv32_cap_val_sf1_buf_t; 1674734Sab196087 1684734Sab196087 typedef union { 1694734Sab196087 Conv64_inv_buf_t inv_buf; 1704734Sab196087 char buf[CONV_CAP_VAL_SF1_BUFSIZE]; 1714734Sab196087 } Conv64_cap_val_sf1_buf_t; 1724734Sab196087 1734734Sab196087 1744734Sab196087 1754734Sab196087 /* conv_cap_val_buf() */ 1764734Sab196087 typedef union { 1774734Sab196087 Conv32_inv_buf_t inv_buf; 1784734Sab196087 Conv32_cap_val_hw1_buf_t cap_val_hw1_buf; 1794734Sab196087 Conv32_cap_val_sf1_buf_t cap_val_sf1_buf; 1804734Sab196087 } Conv32_cap_val_buf_t; 1814734Sab196087 1824734Sab196087 typedef union { 1834734Sab196087 Conv64_inv_buf_t inv_buf; 1844734Sab196087 Conv64_cap_val_hw1_buf_t cap_val_hw1_buf; 1854734Sab196087 Conv64_cap_val_sf1_buf_t cap_val_sf1_buf; 1864734Sab196087 } Conv64_cap_val_buf_t; 1874734Sab196087 1884734Sab196087 1894734Sab196087 /* conv_config_feat() */ 1905152Sab196087 #define CONV_CONFIG_FEAT_BUFSIZE 194 1914734Sab196087 1924734Sab196087 typedef union { 1934734Sab196087 Conv32_inv_buf_t inv_buf; 1944734Sab196087 char buf[CONV_CONFIG_FEAT_BUFSIZE]; 1954734Sab196087 } Conv32_config_feat_buf_t; 1964734Sab196087 1974734Sab196087 typedef union { 1984734Sab196087 Conv64_inv_buf_t inv_buf; 1994734Sab196087 char buf[CONV_CONFIG_FEAT_BUFSIZE]; 2004734Sab196087 } Conv64_config_feat_buf_t; 2014734Sab196087 2024734Sab196087 2034734Sab196087 /* conv_config_obj() */ 2044734Sab196087 #define CONV_CONFIG_OBJ_BUFSIZE 154 2054734Sab196087 2064734Sab196087 typedef union { 2074734Sab196087 Conv32_inv_buf_t inv_buf; 2084734Sab196087 char buf[CONV_CONFIG_OBJ_BUFSIZE]; 2094734Sab196087 } Conv32_config_obj_buf_t; 2104734Sab196087 2114734Sab196087 typedef union { 2124734Sab196087 Conv64_inv_buf_t inv_buf; 2134734Sab196087 char buf[CONV_CONFIG_OBJ_BUFSIZE]; 2144734Sab196087 } Conv64_config_obj_buf_t; 2154734Sab196087 2164734Sab196087 2174734Sab196087 /* conv_dl_mode() */ 2184734Sab196087 #define CONV_DL_MODE_BUFSIZE 122 2194734Sab196087 2204734Sab196087 typedef union { 2214734Sab196087 Conv32_inv_buf_t inv_buf; 2224734Sab196087 char buf[CONV_DL_MODE_BUFSIZE]; 2234734Sab196087 } Conv32_dl_mode_buf_t; 2244734Sab196087 2254734Sab196087 typedef union { 2264734Sab196087 Conv64_inv_buf_t inv_buf; 2274734Sab196087 char buf[CONV_DL_MODE_BUFSIZE]; 2284734Sab196087 } Conv64_dl_mode_buf_t; 2294734Sab196087 2304734Sab196087 2314734Sab196087 /* conv_dl_flag() */ 2325152Sab196087 #define CONV_DL_FLAG_BUFSIZE 175 2334734Sab196087 2344734Sab196087 typedef union { 2354734Sab196087 Conv32_inv_buf_t inv_buf; 2364734Sab196087 char buf[CONV_DL_FLAG_BUFSIZE]; 2374734Sab196087 } Conv32_dl_flag_buf_t; 2384734Sab196087 2394734Sab196087 typedef union { 2404734Sab196087 Conv64_inv_buf_t inv_buf; 2414734Sab196087 char buf[CONV_DL_FLAG_BUFSIZE]; 2424734Sab196087 } Conv64_dl_flag_buf_t; 2434734Sab196087 2444734Sab196087 2454734Sab196087 /* conv_grphdl_flags() */ 2465067Srie #define CONV_GRPHDL_FLAGS_BUFSIZE 82 2474734Sab196087 2484734Sab196087 typedef union { 2494734Sab196087 Conv32_inv_buf_t inv_buf; 2504734Sab196087 char buf[CONV_GRPHDL_FLAGS_BUFSIZE]; 2514734Sab196087 } Conv32_grphdl_flags_buf_t; 2524734Sab196087 2534734Sab196087 typedef union { 2544734Sab196087 Conv64_inv_buf_t inv_buf; 2554734Sab196087 char buf[CONV_GRPHDL_FLAGS_BUFSIZE]; 2564734Sab196087 } Conv64_grphdl_flags_buf_t; 2574734Sab196087 2584734Sab196087 2594734Sab196087 /* conv_grpdesc_flags() */ 2605067Srie #define CONV_GRPDESC_FLAGS_BUFSIZE 92 2614734Sab196087 2624734Sab196087 typedef union { 2634734Sab196087 Conv32_inv_buf_t inv_buf; 2644734Sab196087 char buf[CONV_GRPDESC_FLAGS_BUFSIZE]; 2654734Sab196087 } Conv32_grpdesc_flags_buf_t; 2664734Sab196087 2674734Sab196087 typedef union { 2684734Sab196087 Conv64_inv_buf_t inv_buf; 2694734Sab196087 char buf[CONV_GRPDESC_FLAGS_BUFSIZE]; 2704734Sab196087 } Conv64_grpdesc_flags_buf_t; 2714734Sab196087 2724734Sab196087 2734734Sab196087 /* conv_seg_flags() */ 2744734Sab196087 #define CONV_SEG_FLAGS_BUFSIZE 186 2754734Sab196087 2764734Sab196087 typedef union { 2774734Sab196087 Conv32_inv_buf_t inv_buf; 2784734Sab196087 char buf[CONV_SEG_FLAGS_BUFSIZE]; 2794734Sab196087 } Conv32_seg_flags_buf_t; 2804734Sab196087 2814734Sab196087 typedef union { 2824734Sab196087 Conv64_inv_buf_t inv_buf; 2834734Sab196087 char buf[CONV_SEG_FLAGS_BUFSIZE]; 2844734Sab196087 } Conv64_seg_flags_buf_t; 2854734Sab196087 2864734Sab196087 2874734Sab196087 /* conv_dyn_posflag1() */ 2885088Sab196087 #define CONV_DYN_POSFLAG1_BASE_BUFSIZE 23 2894734Sab196087 #define CONV32_DYN_POSFLAG1_BUFSIZE \ 2905088Sab196087 (CONV_DYN_POSFLAG1_BASE_BUFSIZE + CONV32_INV_BUFSIZE) 2914734Sab196087 typedef union { 2924734Sab196087 Conv32_inv_buf_t inv_buf; 2934734Sab196087 char buf[CONV32_DYN_POSFLAG1_BUFSIZE]; 2944734Sab196087 } Conv32_dyn_posflag1_buf_t; 2954734Sab196087 2964734Sab196087 #define CONV64_DYN_POSFLAG1_BUFSIZE \ 2975088Sab196087 (CONV_DYN_POSFLAG1_BASE_BUFSIZE + CONV64_INV_BUFSIZE) 2984734Sab196087 typedef union { 2994734Sab196087 Conv64_inv_buf_t inv_buf; 3004734Sab196087 char buf[CONV64_DYN_POSFLAG1_BUFSIZE]; 3014734Sab196087 } Conv64_dyn_posflag1_buf_t; 3024734Sab196087 3034734Sab196087 3044734Sab196087 /* conv_dyn_flag() */ 3055088Sab196087 #define CONV_DYN_FLAG_BASE_BUFSIZE 48 3064734Sab196087 #define CONV32_DYN_FLAG_BUFSIZE \ 3075088Sab196087 (CONV_DYN_FLAG_BASE_BUFSIZE + CONV32_INV_BUFSIZE) 3084734Sab196087 typedef union { 3094734Sab196087 Conv32_inv_buf_t inv_buf; 3104734Sab196087 char buf[CONV32_DYN_FLAG_BUFSIZE]; 3114734Sab196087 } Conv32_dyn_flag_buf_t; 3124734Sab196087 3134734Sab196087 #define CONV64_DYN_FLAG_BUFSIZE \ 3145088Sab196087 (CONV_DYN_FLAG_BASE_BUFSIZE + CONV64_INV_BUFSIZE) 3154734Sab196087 typedef union { 3164734Sab196087 Conv64_inv_buf_t inv_buf; 3174734Sab196087 char buf[CONV64_DYN_FLAG_BUFSIZE]; 3184734Sab196087 } Conv64_dyn_flag_buf_t; 3194734Sab196087 3204734Sab196087 3214734Sab196087 /* conv_dyn_flag1() */ 3225220Srie #define CONV_DYN_FLAG1_BASE_BUFSIZE 265 3234734Sab196087 #define CONV32_DYN_FLAG1_BUFSIZE \ 3245088Sab196087 (CONV_DYN_FLAG1_BASE_BUFSIZE + CONV32_INV_BUFSIZE) 3254734Sab196087 typedef union { 3264734Sab196087 Conv32_inv_buf_t inv_buf; 3274734Sab196087 char buf[CONV32_DYN_FLAG1_BUFSIZE]; 3284734Sab196087 } Conv32_dyn_flag1_buf_t; 3294734Sab196087 3304734Sab196087 #define CONV64_DYN_FLAG1_BUFSIZE \ 3315088Sab196087 (CONV_DYN_FLAG1_BASE_BUFSIZE + CONV64_INV_BUFSIZE) 3324734Sab196087 typedef union { 3334734Sab196087 Conv64_inv_buf_t inv_buf; 3344734Sab196087 char buf[CONV64_DYN_FLAG1_BUFSIZE]; 3354734Sab196087 } Conv64_dyn_flag1_buf_t; 3364734Sab196087 3374734Sab196087 3384734Sab196087 /* conv_dyn_feature1() */ 3395088Sab196087 #define CONV_DYN_FEATURE1_BASE_BUFSIZE 20 3404734Sab196087 #define CONV32_DYN_FEATURE1_BUFSIZE \ 3415088Sab196087 (CONV_DYN_FEATURE1_BASE_BUFSIZE + CONV32_INV_BUFSIZE) 3424734Sab196087 typedef union { 3434734Sab196087 Conv32_inv_buf_t inv_buf; 3444734Sab196087 char buf[CONV32_DYN_FEATURE1_BUFSIZE]; 3454734Sab196087 } Conv32_dyn_feature1_buf_t; 3464734Sab196087 3474734Sab196087 #define CONV64_DYN_FEATURE1_BUFSIZE \ 3485088Sab196087 (CONV_DYN_FEATURE1_BASE_BUFSIZE + CONV64_INV_BUFSIZE) 3494734Sab196087 typedef union { 3504734Sab196087 Conv64_inv_buf_t inv_buf; 3514734Sab196087 char buf[CONV64_DYN_FEATURE1_BUFSIZE]; 3524734Sab196087 } Conv64_dyn_feature1_buf_t; 3534734Sab196087 3544734Sab196087 3554734Sab196087 /* conv_bnd_type() */ 3565088Sab196087 #define CONV_BND_TYPE_BASE_BUFSIZE 29 3574734Sab196087 #define CONV32_BND_TYPE_BUFSIZE \ 3585088Sab196087 (CONV_BND_TYPE_BASE_BUFSIZE + CONV32_INV_BUFSIZE) 3594734Sab196087 typedef union { 3604734Sab196087 Conv32_inv_buf_t inv_buf; 3614734Sab196087 char buf[CONV32_BND_TYPE_BUFSIZE]; 3624734Sab196087 } Conv32_bnd_type_buf_t; 3634734Sab196087 3644734Sab196087 #define CONV64_BND_TYPE_BUFSIZE \ 3655088Sab196087 (CONV_BND_TYPE_BASE_BUFSIZE + CONV64_INV_BUFSIZE) 3664734Sab196087 typedef union { 3674734Sab196087 Conv64_inv_buf_t inv_buf; 3684734Sab196087 char buf[CONV64_BND_TYPE_BUFSIZE]; 3694734Sab196087 } Conv64_bnd_type_buf_t; 3704734Sab196087 3714734Sab196087 3724734Sab196087 /* conv_bnd_obj() */ 3735088Sab196087 #define CONV_BND_OBJ_BASE_BUFSIZE 38 3744734Sab196087 #define CONV32_BND_OBJ_BUFSIZE \ 3755088Sab196087 (CONV_BND_OBJ_BASE_BUFSIZE + CONV32_INV_BUFSIZE) 3764734Sab196087 typedef union { 3774734Sab196087 Conv32_inv_buf_t inv_buf; 3784734Sab196087 char buf[CONV32_BND_OBJ_BUFSIZE]; 3794734Sab196087 } Conv32_bnd_obj_buf_t; 3804734Sab196087 3814734Sab196087 #define CONV64_BND_OBJ_BUFSIZE \ 3825088Sab196087 (CONV_BND_OBJ_BASE_BUFSIZE + CONV64_INV_BUFSIZE) 3834734Sab196087 typedef union { 3844734Sab196087 Conv64_inv_buf_t inv_buf; 3854734Sab196087 char buf[CONV64_BND_OBJ_BUFSIZE]; 3864734Sab196087 } Conv64_bnd_obj_buf_t; 3874734Sab196087 3884734Sab196087 3894734Sab196087 /* conv_phdr_flags() */ 3905088Sab196087 #define CONV_PHDR_FLAGS_BASE_BUFSIZE 35 3914734Sab196087 #define CONV32_PHDR_FLAGS_BUFSIZE \ 3925088Sab196087 (CONV_PHDR_FLAGS_BASE_BUFSIZE + CONV32_INV_BUFSIZE) 3934734Sab196087 typedef union { 3944734Sab196087 Conv32_inv_buf_t inv_buf; 3954734Sab196087 char buf[CONV32_PHDR_FLAGS_BUFSIZE]; 3964734Sab196087 } Conv32_phdr_flags_buf_t; 3974734Sab196087 3984734Sab196087 #define CONV64_PHDR_FLAGS_BUFSIZE \ 3995088Sab196087 (CONV_PHDR_FLAGS_BASE_BUFSIZE + CONV64_INV_BUFSIZE) 4004734Sab196087 typedef union { 4014734Sab196087 Conv64_inv_buf_t inv_buf; 4024734Sab196087 char buf[CONV64_PHDR_FLAGS_BUFSIZE]; 4034734Sab196087 } Conv64_phdr_flags_buf_t; 4044734Sab196087 4054734Sab196087 4064734Sab196087 /* conv_sec_flags() */ 4075088Sab196087 #define CONV_SEC_FLAGS_BASE_BUFSIZE 168 4084734Sab196087 #define CONV32_SEC_FLAGS_BUFSIZE \ 4095088Sab196087 (CONV_SEC_FLAGS_BASE_BUFSIZE + CONV32_INV_BUFSIZE) 4104734Sab196087 typedef union { 4114734Sab196087 Conv32_inv_buf_t inv_buf; 4124734Sab196087 char buf[CONV32_SEC_FLAGS_BUFSIZE]; 4134734Sab196087 } Conv32_sec_flags_buf_t; 4144734Sab196087 4154734Sab196087 #define CONV64_SEC_FLAGS_BUFSIZE \ 4165088Sab196087 (CONV_SEC_FLAGS_BASE_BUFSIZE + CONV64_INV_BUFSIZE) 4174734Sab196087 typedef union { 4184734Sab196087 Conv64_inv_buf_t inv_buf; 4194734Sab196087 char buf[CONV64_SEC_FLAGS_BUFSIZE]; 4204734Sab196087 } Conv64_sec_flags_buf_t; 4214734Sab196087 4224734Sab196087 4234734Sab196087 /* conv_dwarf_ehe() */ 4244734Sab196087 #define CONV_DWARF_EHE_BUFSIZE 33 4254734Sab196087 typedef union { 4264734Sab196087 Conv32_inv_buf_t inv_buf; 4274734Sab196087 char buf[CONV_DWARF_EHE_BUFSIZE]; 4284734Sab196087 } Conv32_dwarf_ehe_buf_t; 4294734Sab196087 typedef union { 4304734Sab196087 Conv64_inv_buf_t inv_buf; 4314734Sab196087 char buf[CONV_DWARF_EHE_BUFSIZE]; 4324734Sab196087 } Conv64_dwarf_ehe_buf_t; 4334734Sab196087 4344734Sab196087 4355088Sab196087 /* conv_syminfo_flags() */ 4365088Sab196087 #define CONV_SYMINFO_FLAGS_BASE_BUFSIZE 36 4375088Sab196087 #define CONV32_SYMINFO_FLAGS_BUFSIZE \ 4385088Sab196087 (CONV_SYMINFO_FLAGS_BASE_BUFSIZE + CONV32_INV_BUFSIZE) 4395088Sab196087 typedef union { 4405088Sab196087 Conv32_inv_buf_t inv_buf; 4415088Sab196087 char buf[CONV32_SYMINFO_FLAGS_BUFSIZE]; 4425088Sab196087 } Conv32_syminfo_flags_buf_t; 4435088Sab196087 4445088Sab196087 #define CONV64_SYMINFO_FLAGS_BUFSIZE \ 4455088Sab196087 (CONV_SYMINFO_FLAGS_BASE_BUFSIZE + CONV64_INV_BUFSIZE) 4465088Sab196087 typedef union { 4475088Sab196087 Conv64_inv_buf_t inv_buf; 4485088Sab196087 char buf[CONV64_SYMINFO_FLAGS_BUFSIZE]; 4495088Sab196087 } Conv64_syminfo_flags_buf_t; 4505088Sab196087 4515088Sab196087 4526635Sab196087 /* conv_cnote_pr_flags() */ 4536635Sab196087 #define CONV_CNOTE_PR_FLAGS_BUFSIZE 244 4546635Sab196087 typedef union { 4556635Sab196087 Conv32_inv_buf_t inv_buf; 4566635Sab196087 char buf[CONV_CNOTE_PR_FLAGS_BUFSIZE]; 4576635Sab196087 } Conv32_cnote_pr_flags_buf_t; 4586635Sab196087 typedef union { 4596635Sab196087 Conv64_inv_buf_t inv_buf; 4606635Sab196087 char buf[CONV_CNOTE_PR_FLAGS_BUFSIZE]; 4616635Sab196087 } Conv64_cnote_pr_flags_buf_t; 4626635Sab196087 4636635Sab196087 4646635Sab196087 /* conv_cnote_old_pr_flags() */ 4656635Sab196087 #define CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE 164 4666635Sab196087 typedef union { 4676635Sab196087 Conv32_inv_buf_t inv_buf; 4686635Sab196087 char buf[CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE]; 4696635Sab196087 } Conv32_cnote_old_pr_flags_buf_t; 4706635Sab196087 typedef union { 4716635Sab196087 Conv64_inv_buf_t inv_buf; 4726635Sab196087 char buf[CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE]; 4736635Sab196087 } Conv64_cnote_old_pr_flags_buf_t; 4746635Sab196087 4756635Sab196087 4766635Sab196087 /* conv_cnote_proc_flag() */ 4776635Sab196087 #define CONV_CNOTE_PROC_FLAG_BUFSIZE 29 4786635Sab196087 typedef union { 4796635Sab196087 Conv32_inv_buf_t inv_buf; 4806635Sab196087 char buf[CONV_CNOTE_PROC_FLAG_BUFSIZE]; 4816635Sab196087 } Conv32_cnote_proc_flag_buf_t; 4826635Sab196087 typedef union { 4836635Sab196087 Conv64_inv_buf_t inv_buf; 4846635Sab196087 char buf[CONV_CNOTE_PROC_FLAG_BUFSIZE]; 4856635Sab196087 } Conv64_cnote_proc_flag_buf_t; 4866635Sab196087 4876635Sab196087 4886635Sab196087 /* conv_cnote_sigset() */ 4896635Sab196087 #define CONV_CNOTE_SIGSET_BUFSIZE 629 4906635Sab196087 typedef union { 4916635Sab196087 Conv32_inv_buf_t inv_buf; 4926635Sab196087 char buf[CONV_CNOTE_SIGSET_BUFSIZE]; 4936635Sab196087 } Conv32_cnote_sigset_buf_t; 4946635Sab196087 typedef union { 4956635Sab196087 Conv64_inv_buf_t inv_buf; 4966635Sab196087 char buf[CONV_CNOTE_SIGSET_BUFSIZE]; 4976635Sab196087 } Conv64_cnote_sigset_buf_t; 4986635Sab196087 4996635Sab196087 5006635Sab196087 /* conv_cnote_fltset() */ 5016635Sab196087 #define CONV_CNOTE_FLTSET_BUFSIZE 501 5026635Sab196087 typedef union { 5036635Sab196087 Conv32_inv_buf_t inv_buf; 5046635Sab196087 char buf[CONV_CNOTE_FLTSET_BUFSIZE]; 5056635Sab196087 } Conv32_cnote_fltset_buf_t; 5066635Sab196087 typedef union { 5076635Sab196087 Conv64_inv_buf_t inv_buf; 5086635Sab196087 char buf[CONV_CNOTE_FLTSET_BUFSIZE]; 5096635Sab196087 } Conv64_cnote_fltset_buf_t; 5106635Sab196087 5116635Sab196087 5126635Sab196087 /* conv_cnote_sysset() */ 5136635Sab196087 #define CONV_CNOTE_SYSSET_BUFSIZE 3212 5146635Sab196087 typedef union { 5156635Sab196087 Conv32_inv_buf_t inv_buf; 5166635Sab196087 char buf[CONV_CNOTE_SYSSET_BUFSIZE]; 5176635Sab196087 } Conv32_cnote_sysset_buf_t; 5186635Sab196087 typedef union { 5196635Sab196087 Conv64_inv_buf_t inv_buf; 5206635Sab196087 char buf[CONV_CNOTE_SYSSET_BUFSIZE]; 5216635Sab196087 } Conv64_cnote_sysset_buf_t; 5226635Sab196087 5236635Sab196087 5246635Sab196087 /* conv_cnote_sa_flags() */ 5256635Sab196087 #define CONV_CNOTE_SA_FLAGS_BUFSIZE 99 5266635Sab196087 typedef union { 5276635Sab196087 Conv32_inv_buf_t inv_buf; 5286635Sab196087 char buf[CONV_CNOTE_SA_FLAGS_BUFSIZE]; 5296635Sab196087 } Conv32_cnote_sa_flags_buf_t; 5306635Sab196087 typedef union { 5316635Sab196087 Conv64_inv_buf_t inv_buf; 5326635Sab196087 char buf[CONV_CNOTE_SA_FLAGS_BUFSIZE]; 5336635Sab196087 } Conv64_cnote_sa_flags_buf_t; 5346635Sab196087 5356635Sab196087 5366635Sab196087 /* conv_cnote_ss_flags() */ 5376635Sab196087 #define CONV_CNOTE_SS_FLAGS_BUFSIZE 38 5386635Sab196087 typedef union { 5396635Sab196087 Conv32_inv_buf_t inv_buf; 5406635Sab196087 char buf[CONV_CNOTE_SS_FLAGS_BUFSIZE]; 5416635Sab196087 } Conv32_cnote_ss_flags_buf_t; 5426635Sab196087 typedef union { 5436635Sab196087 Conv64_inv_buf_t inv_buf; 5446635Sab196087 char buf[CONV_CNOTE_SS_FLAGS_BUFSIZE]; 5456635Sab196087 } Conv64_cnote_ss_flags_buf_t; 5466635Sab196087 5476635Sab196087 5486635Sab196087 /* conv_cnote_cc_content() */ 5496635Sab196087 #define CONV_CNOTE_CC_CONTENT_BUFSIZE 87 5506635Sab196087 typedef union { 5516635Sab196087 Conv32_inv_buf_t inv_buf; 5526635Sab196087 char buf[CONV_CNOTE_CC_CONTENT_BUFSIZE]; 5536635Sab196087 } Conv32_cnote_cc_content_buf_t; 5546635Sab196087 typedef union { 5556635Sab196087 Conv64_inv_buf_t inv_buf; 5566635Sab196087 char buf[CONV_CNOTE_CC_CONTENT_BUFSIZE]; 5576635Sab196087 } Conv64_cnote_cc_content_buf_t; 5586635Sab196087 5596635Sab196087 5606635Sab196087 /* conv_cnote_auxv_af() */ 5616635Sab196087 #define CONV_CNOTE_AUXV_AF_BUFSIZE 63 5626635Sab196087 typedef union { 5636635Sab196087 Conv32_inv_buf_t inv_buf; 5646635Sab196087 char buf[CONV_CNOTE_AUXV_AF_BUFSIZE]; 5656635Sab196087 } Conv32_cnote_auxv_af_buf_t; 5666635Sab196087 typedef union { 5676635Sab196087 Conv64_inv_buf_t inv_buf; 5686635Sab196087 char buf[CONV_CNOTE_AUXV_AF_BUFSIZE]; 5696635Sab196087 } Conv64_cnote_auxv_af_buf_t; 5706635Sab196087 5716635Sab196087 5727682SAli.Bahrami@Sun.COM /* conv_ver_flags() */ 5737682SAli.Bahrami@Sun.COM #define CONV_VER_FLAGS_BUFSIZE 31 5747682SAli.Bahrami@Sun.COM typedef union { 5757682SAli.Bahrami@Sun.COM Conv32_inv_buf_t inv_buf; 5767682SAli.Bahrami@Sun.COM char buf[CONV_VER_FLAGS_BUFSIZE]; 5777682SAli.Bahrami@Sun.COM } Conv32_ver_flags_buf_t; 5787682SAli.Bahrami@Sun.COM typedef union { 5797682SAli.Bahrami@Sun.COM Conv64_inv_buf_t inv_buf; 5807682SAli.Bahrami@Sun.COM char buf[CONV_VER_FLAGS_BUFSIZE]; 5817682SAli.Bahrami@Sun.COM } Conv64_ver_flags_buf_t; 5827682SAli.Bahrami@Sun.COM 5837682SAli.Bahrami@Sun.COM 5844734Sab196087 5854734Sab196087 /* 5864734Sab196087 * Generic names for class specific buffer types above 5871618Srie */ 5881618Srie #if defined(_ELF64) 5894734Sab196087 #define CONV_INV_BUFSIZE CONV64_INV_BUFSIZE 5904734Sab196087 #define CONV_EHDR_FLAGS_BUFSIZE CONV64_EHDR_FLAGS_BUFSIZE 5914734Sab196087 #define CONV_DYN_POSFLAG1_BUFSIZE CONV64_DYN_POSFLAG1_BUFSIZE 5924734Sab196087 #define CONV_DYN_FLAG_BUFSIZE CONV64_DYN_FLAG_BUFSIZE 5934734Sab196087 #define CONV_DYN_FLAG1_BUFSIZE CONV64_DYN_FLAG1_BUFSIZE 5944734Sab196087 #define CONV_DYN_FEATURE1_BUFSIZE CONV64_DYN_FEATURE1_BUFSIZE 5954734Sab196087 #define CONV_BND_TYPE_BUFSIZE CONV64_BND_TYPE_BUFSIZE 5964734Sab196087 #define CONV_BND_OBJ_BUFSIZE CONV64_BND_OBJ_BUFSIZE 5974734Sab196087 #define CONV_PHDR_FLAGS_BUFSIZE CONV64_PHDR_FLAGS_BUFSIZE 5984734Sab196087 #define CONV_SEC_FLAGS_BUFSIZE CONV64_SEC_FLAGS_BUFSIZE 5995088Sab196087 #define CONV_SYMINFO_FLAGS_BUFSIZE CONV64_SYMINFO_FLAGS_BUFSIZE 6004734Sab196087 6014734Sab196087 #define Conv_inv_buf_t Conv64_inv_buf_t 6024734Sab196087 #define Conv_ehdr_flags_buf_t Conv64_ehdr_flags_buf_t 6034734Sab196087 #define Conv_reject_desc_buf_t Conv64_reject_desc_buf_t 6044734Sab196087 #define Conv_cap_val_hw1_buf_t Conv64_cap_val_hw1_buf_t 6054734Sab196087 #define Conv_cap_val_sf1_buf_t Conv64_cap_val_sf1_buf_t 6064734Sab196087 #define Conv_cap_val_buf_t Conv64_cap_val_buf_t 6074734Sab196087 #define Conv_config_feat_buf_t Conv64_config_feat_buf_t 6084734Sab196087 #define Conv_config_obj_buf_t Conv64_config_obj_buf_t 6094734Sab196087 #define Conv_dl_mode_buf_t Conv64_dl_mode_buf_t 6104734Sab196087 #define Conv_dl_flag_buf_t Conv64_dl_flag_buf_t 6114734Sab196087 #define Conv_grphdl_flags_buf_t Conv64_grphdl_flags_buf_t 6124734Sab196087 #define Conv_grpdesc_flags_buf_t Conv64_grpdesc_flags_buf_t 6134734Sab196087 #define Conv_seg_flags_buf_t Conv64_seg_flags_buf_t 6144734Sab196087 #define Conv_dyn_posflag1_buf_t Conv64_dyn_posflag1_buf_t 6154734Sab196087 #define Conv_dyn_flag_buf_t Conv64_dyn_flag_buf_t 6164734Sab196087 #define Conv_dyn_flag1_buf_t Conv64_dyn_flag1_buf_t 6174734Sab196087 #define Conv_dyn_feature1_buf_t Conv64_dyn_feature1_buf_t 6184734Sab196087 #define Conv_bnd_type_buf_t Conv64_bnd_type_buf_t 6194734Sab196087 #define Conv_bnd_obj_buf_t Conv64_bnd_obj_buf_t 6204734Sab196087 #define Conv_phdr_flags_buf_t Conv64_phdr_flags_buf_t 6214734Sab196087 #define Conv_sec_flags_buf_t Conv64_sec_flags_buf_t 6224734Sab196087 #define Conv_dwarf_ehe_buf_t Conv64_dwarf_ehe_buf_t 6235088Sab196087 #define Conv_syminfo_flags_buf_t Conv64_syminfo_flags_buf_t 6246635Sab196087 #define Conv_cnote_pr_flags_buf_t Conv64_cnote_pr_flags_buf_t 6256635Sab196087 #define Conv_cnote_old_pr_flags_buf_t Conv64_cnote_old_pr_flags_buf_t 6266635Sab196087 #define Conv_cnote_proc_flag_buf_t Conv64_cnote_proc_flag_buf_t 6276635Sab196087 #define Conv_cnote_sigset_buf_t Conv64_cnote_sigset_buf_t 6286635Sab196087 #define Conv_cnote_fltset_buf_t Conv64_cnote_fltset_buf_t 6296635Sab196087 #define Conv_cnote_sysset_buf_t Conv64_cnote_sysset_buf_t 6306635Sab196087 #define Conv_cnote_sa_flags_buf_t Conv64_cnote_sa_flags_buf_t 6316635Sab196087 #define Conv_cnote_ss_flags_buf_t Conv64_cnote_ss_flags_buf_t 6326635Sab196087 #define Conv_cnote_cc_content_buf_t Conv64_cnote_cc_content_buf_t 6336635Sab196087 #define Conv_cnote_auxv_af_buf_t Conv64_cnote_auxv_af_buf_t 6347682SAli.Bahrami@Sun.COM #define Conv_ver_flags_buf_t Conv64_ver_flags_buf_t 6351618Srie #else 6364734Sab196087 #define CONV_INV_BUFSIZE CONV32_INV_BUFSIZE 6374734Sab196087 #define CONV_EHDR_FLAGS_BUFSIZE CONV32_EHDR_FLAGS_BUFSIZE 6384734Sab196087 #define CONV_DYN_POSFLAG1_BUFSIZE CONV32_DYN_POSFLAG1_BUFSIZE 6394734Sab196087 #define CONV_DYN_FLAG_BUFSIZE CONV32_DYN_FLAG_BUFSIZE 6404734Sab196087 #define CONV_DYN_FLAG1_BUFSIZE CONV32_DYN_FLAG1_BUFSIZE 6414734Sab196087 #define CONV_DYN_FEATURE1_BUFSIZE CONV32_DYN_FEATURE1_BUFSIZE 6424734Sab196087 #define CONV_BND_TYPE_BUFSIZE CONV32_BND_TYPE_BUFSIZE 6434734Sab196087 #define CONV_BND_OBJ_BUFSIZE CONV32_BND_OBJ_BUFSIZE 6444734Sab196087 #define CONV_PHDR_FLAGS_BUFSIZE CONV32_PHDR_FLAGS_BUFSIZE 6454734Sab196087 #define CONV_SEC_FLAGS_BUFSIZE CONV32_SEC_FLAGS_BUFSIZE 6465088Sab196087 #define CONV_SYMINFO_FLAGS_BUFSIZE CONV32_SYMINFO_FLAGS_BUFSIZE 6474734Sab196087 6484734Sab196087 #define Conv_inv_buf_t Conv32_inv_buf_t 6494734Sab196087 #define Conv_ehdr_flags_buf_t Conv32_ehdr_flags_buf_t 6504734Sab196087 #define Conv_reject_desc_buf_t Conv32_reject_desc_buf_t 6514734Sab196087 #define Conv_cap_val_hw1_buf_t Conv32_cap_val_hw1_buf_t 6524734Sab196087 #define Conv_cap_val_sf1_buf_t Conv32_cap_val_sf1_buf_t 6534734Sab196087 #define Conv_cap_val_buf_t Conv32_cap_val_buf_t 6544734Sab196087 #define Conv_config_feat_buf_t Conv32_config_feat_buf_t 6554734Sab196087 #define Conv_config_obj_buf_t Conv32_config_obj_buf_t 6564734Sab196087 #define Conv_dl_mode_buf_t Conv32_dl_mode_buf_t 6574734Sab196087 #define Conv_dl_flag_buf_t Conv32_dl_flag_buf_t 6584734Sab196087 #define Conv_grphdl_flags_buf_t Conv32_grphdl_flags_buf_t 6594734Sab196087 #define Conv_grpdesc_flags_buf_t Conv32_grpdesc_flags_buf_t 6604734Sab196087 #define Conv_seg_flags_buf_t Conv32_seg_flags_buf_t 6614734Sab196087 #define Conv_dyn_posflag1_buf_t Conv32_dyn_posflag1_buf_t 6624734Sab196087 #define Conv_dyn_flag_buf_t Conv32_dyn_flag_buf_t 6634734Sab196087 #define Conv_dyn_flag1_buf_t Conv32_dyn_flag1_buf_t 6644734Sab196087 #define Conv_dyn_feature1_buf_t Conv32_dyn_feature1_buf_t 6654734Sab196087 #define Conv_bnd_type_buf_t Conv32_bnd_type_buf_t 6664734Sab196087 #define Conv_bnd_obj_buf_t Conv32_bnd_obj_buf_t 6674734Sab196087 #define Conv_phdr_flags_buf_t Conv32_phdr_flags_buf_t 6684734Sab196087 #define Conv_sec_flags_buf_t Conv32_sec_flags_buf_t 6694734Sab196087 #define Conv_dwarf_ehe_buf_t Conv32_dwarf_ehe_buf_t 6705088Sab196087 #define Conv_syminfo_flags_buf_t Conv32_syminfo_flags_buf_t 6716635Sab196087 #define Conv_cnote_pr_flags_buf_t Conv32_cnote_pr_flags_buf_t 6726635Sab196087 #define Conv_cnote_old_pr_flags_buf_t Conv32_cnote_old_pr_flags_buf_t 6736635Sab196087 #define Conv_cnote_proc_flag_buf_t Conv32_cnote_proc_flag_buf_t 6746635Sab196087 #define Conv_cnote_sigset_buf_t Conv32_cnote_sigset_buf_t 6756635Sab196087 #define Conv_cnote_fltset_buf_t Conv32_cnote_fltset_buf_t 6766635Sab196087 #define Conv_cnote_sysset_buf_t Conv32_cnote_sysset_buf_t 6776635Sab196087 #define Conv_cnote_sa_flags_buf_t Conv32_cnote_sa_flags_buf_t 6786635Sab196087 #define Conv_cnote_ss_flags_buf_t Conv32_cnote_ss_flags_buf_t 6796635Sab196087 #define Conv_cnote_cc_content_buf_t Conv32_cnote_cc_content_buf_t 6806635Sab196087 #define Conv_cnote_auxv_af_buf_t Conv32_cnote_auxv_af_buf_t 6817682SAli.Bahrami@Sun.COM #define Conv_ver_flags_buf_t Conv32_ver_flags_buf_t 6821618Srie #endif 6831618Srie 6844734Sab196087 6854734Sab196087 6862850Srie 6872850Srie /* 6885088Sab196087 * Many conversion routines accept a fmt_flags argument of this type 6895088Sab196087 * to allow the caller to modify the output. There are two parts to 6905088Sab196087 * this value: 6915088Sab196087 * 6925088Sab196087 * (1) Format requests (decimal vs hex, etc...) 6935088Sab196087 * (2) The low order bits specified by CONV_MASK_FMT_ALT 6945088Sab196087 * and retrieved by CONV_TYPE_FMT_ALT are integer 6955088Sab196087 * values that specify that an alternate set of 6965088Sab196087 * strings should be used. This is necessary because 6975088Sab196087 * different utilities evolved to use different strings, 6985088Sab196087 * and there are backward compatability guarantees in 6995088Sab196087 * place that prevent changing them. 7005088Sab196087 * 7015088Sab196087 * These values are designed such that a caller can always supply a 7025088Sab196087 * simple 0 in order to receive "default" behavior. 7031618Srie */ 7045088Sab196087 typedef int Conv_fmt_flags_t; 7055088Sab196087 7065088Sab196087 /* 7075088Sab196087 * The bottom 8 bits of Conv_fmt_flags_t are used to encode 7085088Sab196087 * alternative strings. 7095088Sab196087 * 7105088Sab196087 * If a given conversion routine does not support alternative strings 7115088Sab196087 * for a given CONV_FMT_ALT type, it silently ignores the request and 7125088Sab196087 * supplies the default set. This means that a utility like dump(1) is 7135088Sab196087 * free to specify its special type in every conversion routine call, 7145088Sab196087 * without regard to whether it has any special meaning for that particular 7155088Sab196087 * routine. It will receive its special strings if there are any, and 7165088Sab196087 * the defaults otherwise. 7175088Sab196087 */ 7185088Sab196087 #define CONV_MASK_FMT_ALT 0xff 7195088Sab196087 #define CONV_TYPE_FMT_ALT(fmt_flags) (fmt_flags & CONV_MASK_FMT_ALT) 7205088Sab196087 7215088Sab196087 #define CONV_FMT_ALT_DEFAULT 0 /* "Standard" strings */ 7225088Sab196087 #define CONV_FMT_ALT_DUMP 1 /* Style of strings used by dump(1) */ 7235088Sab196087 #define CONV_FMT_ALT_FILE 2 /* Style of strings used by file(1) */ 7245088Sab196087 #define CONV_FMT_ALT_CRLE 3 /* Style of strings used by crle(1) */ 7255088Sab196087 #define CONV_FMT_ALT_FULLNAME 4 /* Strings should be full #define */ 7265088Sab196087 /* (e.g. STB_LOCAL, not LOCL) */ 7275088Sab196087 7285088Sab196087 /* 7295088Sab196087 * Flags that alter standard formatting for conversion routines. 7305088Sab196087 * These bits start after the range occupied by CONV_MASK_FMT_ALT. 7315088Sab196087 */ 7325088Sab196087 #define CONV_FMT_DECIMAL 0x0100 /* conv_invalid_val() should print */ 7331976Sab196087 /* integer print as decimal */ 7341976Sab196087 /* (default is hex) */ 7355088Sab196087 #define CONV_FMT_SPACE 0x0200 /* conv_invalid_val() should append */ 7361976Sab196087 /* a space after the number. */ 7375088Sab196087 #define CONV_FMT_NOBKT 0x0400 /* conv_expn_field() should omit */ 7385088Sab196087 /* prefix and suffix strings */ 7391976Sab196087 7401618Srie 7411618Srie /* 7421618Srie * The expansion of bit-field data items is driven from a value descriptor and 7431618Srie * the conv_expn_field() routine. 7441618Srie */ 7451618Srie typedef struct { 7461618Srie Xword v_val; /* expansion value */ 7471618Srie const char *v_msg; /* associated message string */ 7481618Srie } Val_desc; 7491618Srie 7501618Srie /* 7512352Sab196087 * conv_expn_field() is willing to supply default strings for the 7522352Sab196087 * prefix, separator, and suffix arguments, if they are passed as NULL. 7532352Sab196087 * The caller needs to know how much room to allow for these items. 7542352Sab196087 * These values supply those sizes. 7552352Sab196087 */ 7562352Sab196087 #define CONV_EXPN_FIELD_DEF_PREFIX_SIZE 2 /* Default is "[ " */ 7572352Sab196087 #define CONV_EXPN_FIELD_DEF_SEP_SIZE 1 /* Default is " " */ 7582352Sab196087 #define CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 2 /* Default is " ]" */ 7592352Sab196087 7602352Sab196087 /* 7612352Sab196087 * conv_expn_field() requires a large number of inputs, many of which 7622352Sab196087 * can be NULL to accept default behavior. An argument of the following 7632352Sab196087 * type is used to supply them. 7642352Sab196087 */ 7652352Sab196087 typedef struct { 7662352Sab196087 char *buf; /* Buffer to receive generated string */ 7672352Sab196087 size_t bufsize; /* sizeof(buf) */ 7682352Sab196087 const Val_desc *vdp; /* Array of value descriptors, giving the */ 7692352Sab196087 /* possible bit values, and their */ 7702352Sab196087 /* corresponding strings. Note that the */ 7712352Sab196087 /* final element must contain only NULL */ 7722352Sab196087 /* values. This terminates the list. */ 7732352Sab196087 const char **lead_str; /* NULL, or array of pointers to strings to */ 7742352Sab196087 /* be output at the head of the list. */ 7752352Sab196087 /* Last entry must be NULL. */ 7762352Sab196087 Xword oflags; /* Bits for which output strings are desired */ 7772352Sab196087 Xword rflags; /* Bits for which a numeric value should be */ 7782352Sab196087 /* output if vdp does not provide str. */ 7792352Sab196087 /* Must be a proper subset of oflags */ 7802352Sab196087 const char *prefix; /* NULL, or string to prefix output with */ 7812352Sab196087 /* If NULL, "[ " is used. */ 7822352Sab196087 const char *sep; /* NULL, or string to separate output items */ 7832352Sab196087 /* with. If NULL, " " is used. */ 7842352Sab196087 const char *suffix; /* NULL, or string to suffix output with */ 7852352Sab196087 /* If NULL, " ]" is used. */ 7862352Sab196087 } CONV_EXPN_FIELD_ARG; 7872352Sab196087 7886635Sab196087 7896635Sab196087 /* 7906635Sab196087 * Callback function for conv_str_to_c_literal(). A user supplied function 7916635Sab196087 * of this type is called by conv_str_to_c_literal() in order to dispatch 7926635Sab196087 * the translated output characters. 7936635Sab196087 * 7946635Sab196087 * buf - Pointer to output text 7956635Sab196087 * n - # of characters to output 7966635Sab196087 * uvalue - User value argument to conv_str_to_c_literal(), 7976635Sab196087 * passed through without interpretation. 7986635Sab196087 */ 7996635Sab196087 typedef void Conv_str_to_c_literal_func_t(const void *ptr, 8006635Sab196087 size_t size, void *uvalue); 8016635Sab196087 8022352Sab196087 /* 8031618Srie * Define all generic interfaces. 8040Sstevel@tonic-gate */ 8052647Srie extern uchar_t conv_check_native(char **, char **); 8064734Sab196087 extern const char *conv_config_feat(int, Conv_config_feat_buf_t *); 8074734Sab196087 extern const char *conv_config_obj(ushort_t, Conv_config_obj_buf_t *); 8081618Srie extern const char *conv_config_upm(const char *, const char *, 8091618Srie const char *, size_t); 8106635Sab196087 extern const char *conv_cnote_auxv_af(Word, Conv_fmt_flags_t, 8116635Sab196087 Conv_cnote_auxv_af_buf_t *); 8126635Sab196087 extern const char *conv_cnote_auxv_type(Word, Conv_fmt_flags_t, 8136635Sab196087 Conv_inv_buf_t *); 8146635Sab196087 extern const char *conv_cnote_cc_content(Lword, Conv_fmt_flags_t, 8156635Sab196087 Conv_cnote_cc_content_buf_t *); 8166635Sab196087 extern const char *conv_cnote_errno(int, Conv_fmt_flags_t, 8176635Sab196087 Conv_inv_buf_t *); 8186635Sab196087 extern const char *conv_cnote_fault(Word, Conv_fmt_flags_t, 8196635Sab196087 Conv_inv_buf_t *); 8206635Sab196087 extern const char *conv_cnote_fltset(uint32_t *, int, 8216635Sab196087 Conv_fmt_flags_t, Conv_cnote_fltset_buf_t *); 8226635Sab196087 extern const char *conv_cnote_old_pr_flags(int, Conv_fmt_flags_t, 8236635Sab196087 Conv_cnote_old_pr_flags_buf_t *); 8246635Sab196087 extern const char *conv_cnote_pr_dmodel(Word, Conv_fmt_flags_t, 8256635Sab196087 Conv_inv_buf_t *); 8266635Sab196087 extern const char *conv_cnote_pr_flags(int, Conv_fmt_flags_t, 8276635Sab196087 Conv_cnote_pr_flags_buf_t *); 8286635Sab196087 extern const char *conv_cnote_proc_flag(int, Conv_fmt_flags_t, 8296635Sab196087 Conv_cnote_proc_flag_buf_t *); 8306635Sab196087 extern const char *conv_cnote_pr_regname(Half, int, Conv_fmt_flags_t, 8316635Sab196087 Conv_inv_buf_t *inv_buf); 8326635Sab196087 extern const char *conv_cnote_pr_stype(Word, Conv_fmt_flags_t, 8336635Sab196087 Conv_inv_buf_t *); 8346635Sab196087 extern const char *conv_cnote_pr_what(short, short, Conv_fmt_flags_t, 8356635Sab196087 Conv_inv_buf_t *); 8366635Sab196087 extern const char *conv_cnote_pr_why(short, Conv_fmt_flags_t, 8376635Sab196087 Conv_inv_buf_t *); 8386635Sab196087 extern const char *conv_cnote_priv(int, Conv_fmt_flags_t, 8396635Sab196087 Conv_inv_buf_t *); 8406635Sab196087 extern const char *conv_cnote_psetid(int, Conv_fmt_flags_t, 8416635Sab196087 Conv_inv_buf_t *); 8426635Sab196087 extern const char *conv_cnote_sa_flags(int, Conv_fmt_flags_t, 8436635Sab196087 Conv_cnote_sa_flags_buf_t *); 8446635Sab196087 extern const char *conv_cnote_signal(Word, Conv_fmt_flags_t, 8456635Sab196087 Conv_inv_buf_t *); 8466635Sab196087 extern const char *conv_cnote_si_code(Half, int, int, Conv_fmt_flags_t, 8476635Sab196087 Conv_inv_buf_t *); 8486635Sab196087 extern const char *conv_cnote_sigset(uint32_t *, int, 8496635Sab196087 Conv_fmt_flags_t, Conv_cnote_sigset_buf_t *); 8506635Sab196087 extern const char *conv_cnote_ss_flags(int, Conv_fmt_flags_t, 8516635Sab196087 Conv_cnote_ss_flags_buf_t *); 8526635Sab196087 extern const char *conv_cnote_syscall(Word, Conv_fmt_flags_t, 8536635Sab196087 Conv_inv_buf_t *); 8546635Sab196087 extern const char *conv_cnote_sysset(uint32_t *, int, 8556635Sab196087 Conv_fmt_flags_t, Conv_cnote_sysset_buf_t *); 8566635Sab196087 extern const char *conv_cnote_type(Word, Conv_fmt_flags_t, 8576635Sab196087 Conv_inv_buf_t *); 8584734Sab196087 extern const char *conv_def_tag(Symref, Conv_inv_buf_t *); 8591618Srie extern const char *conv_demangle_name(const char *); 8605088Sab196087 extern const char *conv_dl_flag(int, Conv_fmt_flags_t, 8615088Sab196087 Conv_dl_flag_buf_t *); 8624734Sab196087 extern const char *conv_dl_mode(int, int, Conv_dl_mode_buf_t *); 863*9085SAli.Bahrami@Sun.COM extern const char *conv_dwarf_cfa(uchar_t, Conv_fmt_flags_t, 864*9085SAli.Bahrami@Sun.COM Conv_inv_buf_t *); 8654734Sab196087 extern const char *conv_dwarf_ehe(uint_t, Conv_dwarf_ehe_buf_t *); 866*9085SAli.Bahrami@Sun.COM extern const char *conv_dwarf_regname(Half, Word, Conv_fmt_flags_t, 867*9085SAli.Bahrami@Sun.COM int *, Conv_inv_buf_t *); 8684734Sab196087 extern const char *conv_elfdata_type(Elf_Type, Conv_inv_buf_t *); 8694734Sab196087 extern const char *conv_grphdl_flags(uint_t, Conv_grphdl_flags_buf_t *); 8704734Sab196087 extern const char *conv_grpdesc_flags(uint_t, Conv_grpdesc_flags_buf_t *); 8710Sstevel@tonic-gate extern Isa_desc *conv_isalist(void); 8720Sstevel@tonic-gate extern const char *conv_lddstub(int); 8734734Sab196087 extern const char *conv_seg_flags(Half, Conv_seg_flags_buf_t *); 8740Sstevel@tonic-gate extern int conv_sys_eclass(); 8756635Sab196087 extern void conv_str_to_c_literal(const char *buf, size_t n, 8766635Sab196087 Conv_str_to_c_literal_func_t *cb_func, 8776635Sab196087 void *uvalue); 8780Sstevel@tonic-gate extern Uts_desc *conv_uts(void); 8797682SAli.Bahrami@Sun.COM extern const char *conv_ver_flags(Half, Conv_fmt_flags_t, 8807682SAli.Bahrami@Sun.COM Conv_ver_flags_buf_t *); 8814734Sab196087 extern const char *conv_ver_index(Versym, int, Conv_inv_buf_t *); 8824734Sab196087 8831618Srie 8841618Srie /* 8851618Srie * Define all class specific routines. 8861618Srie */ 8871618Srie #if defined(_ELF64) 8881618Srie #define conv_bnd_obj conv64_bnd_obj 8891618Srie #define conv_bnd_type conv64_bnd_type 8901618Srie #define conv_cap_tag conv64_cap_tag 8911618Srie #define conv_cap_val conv64_cap_val 8921618Srie #define conv_cap_val_hw1 conv64_cap_val_hw1 8931618Srie #define conv_cap_val_sf1 conv64_cap_val_sf1 8941618Srie #define conv_dyn_feature1 conv64_dyn_feature1 8951618Srie #define conv_dyn_flag1 conv64_dyn_flag1 8961618Srie #define conv_dyn_flag conv64_dyn_flag 8971618Srie #define conv_dyn_posflag1 conv64_dyn_posflag1 8981618Srie #define conv_dyn_tag conv64_dyn_tag 8991618Srie #define conv_ehdr_class conv64_ehdr_class 9001618Srie #define conv_ehdr_data conv64_ehdr_data 9011618Srie #define conv_ehdr_flags conv64_ehdr_flags 9021618Srie #define conv_ehdr_mach conv64_ehdr_mach 9033850Sab196087 #define conv_ehdr_osabi conv64_ehdr_osabi 9041618Srie #define conv_ehdr_type conv64_ehdr_type 9051618Srie #define conv_ehdr_vers conv64_ehdr_vers 9061618Srie #define conv_expn_field conv64_expn_field 9071618Srie #define conv_invalid_val conv64_invalid_val 9081618Srie #define conv_phdr_flags conv64_phdr_flags 9091618Srie #define conv_phdr_type conv64_phdr_type 9101618Srie #define conv_reject_desc conv64_reject_desc 9111618Srie #define conv_reloc_type conv64_reloc_type 9124734Sab196087 #define conv_reloc_type_static conv64_reloc_type_static 9131618Srie #define conv_reloc_386_type conv64_reloc_386_type 9141618Srie #define conv_reloc_amd64_type conv64_reloc_amd64_type 9151618Srie #define conv_reloc_SPARC_type conv64_reloc_SPARC_type 9161618Srie #define conv_sec_flags conv64_sec_flags 9172647Srie #define conv_sec_linkinfo conv64_sec_linkinfo 9181618Srie #define conv_sec_type conv64_sec_type 9191618Srie #define conv_sym_info_bind conv64_sym_info_bind 9201618Srie #define conv_sym_info_type conv64_sym_info_type 9211618Srie #define conv_sym_shndx conv64_sym_shndx 9221618Srie #define conv_sym_other conv64_sym_other 9235088Sab196087 #define conv_sym_other_vis conv64_sym_other_vis 9241618Srie #define conv_sym_value conv64_sym_value 9251618Srie #define conv_sym_SPARC_value conv64_sym_SPARC_value 9265088Sab196087 #define conv_syminfo_flags conv64_syminfo_flags 9271618Srie #else 9281618Srie #define conv_bnd_obj conv32_bnd_obj 9291618Srie #define conv_bnd_type conv32_bnd_type 9301618Srie #define conv_cap_tag conv32_cap_tag 9311618Srie #define conv_cap_val conv32_cap_val 9321618Srie #define conv_cap_val_hw1 conv32_cap_val_hw1 9331618Srie #define conv_cap_val_sf1 conv32_cap_val_sf1 9341618Srie #define conv_dyn_feature1 conv32_dyn_feature1 9351618Srie #define conv_dyn_flag1 conv32_dyn_flag1 9361618Srie #define conv_dyn_flag conv32_dyn_flag 9371618Srie #define conv_dyn_posflag1 conv32_dyn_posflag1 9381618Srie #define conv_dyn_tag conv32_dyn_tag 9391618Srie #define conv_ehdr_class conv32_ehdr_class 9401618Srie #define conv_ehdr_data conv32_ehdr_data 9411618Srie #define conv_ehdr_flags conv32_ehdr_flags 9421618Srie #define conv_ehdr_mach conv32_ehdr_mach 9433850Sab196087 #define conv_ehdr_osabi conv32_ehdr_osabi 9441618Srie #define conv_ehdr_type conv32_ehdr_type 9451618Srie #define conv_ehdr_vers conv32_ehdr_vers 9461618Srie #define conv_expn_field conv32_expn_field 9471618Srie #define conv_invalid_val conv32_invalid_val 9481618Srie #define conv_phdr_flags conv32_phdr_flags 9491618Srie #define conv_phdr_type conv32_phdr_type 9501618Srie #define conv_reject_desc conv32_reject_desc 9511618Srie #define conv_reloc_type conv32_reloc_type 9524734Sab196087 #define conv_reloc_type_static conv32_reloc_type_static 9531618Srie #define conv_reloc_386_type conv32_reloc_386_type 9541618Srie #define conv_reloc_amd64_type conv32_reloc_amd64_type 9551618Srie #define conv_reloc_SPARC_type conv32_reloc_SPARC_type 9561618Srie #define conv_sec_flags conv32_sec_flags 9572647Srie #define conv_sec_linkinfo conv32_sec_linkinfo 9581618Srie #define conv_sec_type conv32_sec_type 9591618Srie #define conv_sym_info_bind conv32_sym_info_bind 9601618Srie #define conv_sym_info_type conv32_sym_info_type 9611618Srie #define conv_sym_shndx conv32_sym_shndx 9621618Srie #define conv_sym_other conv32_sym_other 9635088Sab196087 #define conv_sym_other_vis conv32_sym_other_vis 9641618Srie #define conv_sym_value conv32_sym_value 9651618Srie #define conv_sym_SPARC_value conv32_sym_SPARC_value 9665088Sab196087 #define conv_syminfo_flags conv32_syminfo_flags 9671618Srie #endif 9681618Srie 9694734Sab196087 extern const char *conv_bnd_obj(uint_t, Conv_bnd_obj_buf_t *); 9704734Sab196087 extern const char *conv_bnd_type(uint_t, Conv_bnd_type_buf_t *); 9714734Sab196087 extern const char *conv_cap_tag(Xword, Conv_inv_buf_t *); 9724734Sab196087 extern const char *conv_cap_val(Xword, Xword, Half, Conv_cap_val_buf_t *); 9735088Sab196087 extern const char *conv_cap_val_hw1(Xword, Half, Conv_fmt_flags_t, 9744734Sab196087 Conv_cap_val_hw1_buf_t *); 9755088Sab196087 extern const char *conv_cap_val_sf1(Xword, Half, Conv_fmt_flags_t, 9764734Sab196087 Conv_cap_val_sf1_buf_t *); 9775088Sab196087 extern const char *conv_dyn_flag1(Xword, Conv_fmt_flags_t, 9785088Sab196087 Conv_dyn_flag1_buf_t *); 9795088Sab196087 extern const char *conv_dyn_flag(Xword, Conv_fmt_flags_t, 9805088Sab196087 Conv_dyn_flag_buf_t *); 9815088Sab196087 extern const char *conv_dyn_posflag1(Xword, Conv_fmt_flags_t, 9824734Sab196087 Conv_dyn_posflag1_buf_t *); 9835088Sab196087 extern const char *conv_dyn_tag(Xword, Half, Conv_fmt_flags_t, 9845088Sab196087 Conv_inv_buf_t *); 9855088Sab196087 extern const char *conv_dyn_feature1(Xword, Conv_fmt_flags_t, 9864734Sab196087 Conv_dyn_feature1_buf_t *); 9875088Sab196087 extern const char *conv_ehdr_class(uchar_t, Conv_fmt_flags_t, 9885088Sab196087 Conv_inv_buf_t *); 9895088Sab196087 extern const char *conv_ehdr_data(uchar_t, Conv_fmt_flags_t, 9905088Sab196087 Conv_inv_buf_t *); 9915088Sab196087 extern const char *conv_ehdr_flags(Half, Word, Conv_fmt_flags_t, 9925088Sab196087 Conv_ehdr_flags_buf_t *); 9935088Sab196087 extern const char *conv_ehdr_mach(Half, Conv_fmt_flags_t, 9945088Sab196087 Conv_inv_buf_t *); 9955088Sab196087 extern const char *conv_ehdr_osabi(uchar_t, Conv_fmt_flags_t, 9965088Sab196087 Conv_inv_buf_t *); 9975088Sab196087 extern const char *conv_ehdr_type(Half, Conv_fmt_flags_t, 9985088Sab196087 Conv_inv_buf_t *); 9995088Sab196087 extern const char *conv_ehdr_vers(Word, Conv_fmt_flags_t, 10005088Sab196087 Conv_inv_buf_t *); 10015088Sab196087 extern int conv_expn_field(CONV_EXPN_FIELD_ARG *, 10025088Sab196087 Conv_fmt_flags_t); 10035088Sab196087 extern const char *conv_invalid_val(Conv_inv_buf_t *, Xword, 10045088Sab196087 Conv_fmt_flags_t); 10055088Sab196087 extern const char *conv_phdr_flags(Word, Conv_fmt_flags_t fmt_flags, 10065088Sab196087 Conv_phdr_flags_buf_t *); 10075088Sab196087 extern const char *conv_phdr_type(Half, Word, Conv_fmt_flags_t, 10085088Sab196087 Conv_inv_buf_t *); 10096206Sab196087 extern const char *conv_reject_desc(Rej_desc *, Conv_reject_desc_buf_t *, 10106206Sab196087 Half mach); 10115088Sab196087 extern const char *conv_reloc_type(Half, Word, Conv_fmt_flags_t, 10125088Sab196087 Conv_inv_buf_t *); 10135088Sab196087 extern const char *conv_reloc_type_static(Half, Word, Conv_fmt_flags_t); 10145088Sab196087 extern const char *conv_reloc_386_type(Word, Conv_fmt_flags_t, 10155088Sab196087 Conv_inv_buf_t *); 10165088Sab196087 extern const char *conv_reloc_amd64_type(Word, Conv_fmt_flags_t, 10175088Sab196087 Conv_inv_buf_t *); 10185088Sab196087 extern const char *conv_reloc_SPARC_type(Word, Conv_fmt_flags_t, 10195088Sab196087 Conv_inv_buf_t *); 10205088Sab196087 extern const char *conv_sec_flags(Xword, Conv_fmt_flags_t, 10215088Sab196087 Conv_sec_flags_buf_t *); 10224734Sab196087 extern const char *conv_sec_linkinfo(Word, Xword, Conv_inv_buf_t *); 10235088Sab196087 extern const char *conv_sec_type(Half, Word, Conv_fmt_flags_t, 10245088Sab196087 Conv_inv_buf_t *); 10255088Sab196087 extern const char *conv_sym_info_bind(uchar_t, Conv_fmt_flags_t, 10265088Sab196087 Conv_inv_buf_t *); 10275088Sab196087 extern const char *conv_sym_info_type(Half, uchar_t, Conv_fmt_flags_t, 10284734Sab196087 Conv_inv_buf_t *); 10294734Sab196087 extern const char *conv_sym_shndx(Half, Conv_inv_buf_t *); 10304734Sab196087 extern const char *conv_sym_other(uchar_t, Conv_inv_buf_t *); 10315088Sab196087 extern const char *conv_sym_other_vis(uchar_t, Conv_fmt_flags_t, 10325088Sab196087 Conv_inv_buf_t *); 10334734Sab196087 extern const char *conv_sym_value(Half, uchar_t, Addr, Conv_inv_buf_t *); 10345088Sab196087 extern const char *conv_sym_SPARC_value(Addr, Conv_fmt_flags_t, 10355088Sab196087 Conv_inv_buf_t *); 10366635Sab196087 extern const char *conv_syminfo_flags(Xword, Conv_fmt_flags_t, 10376635Sab196087 Conv_syminfo_flags_buf_t *); 10380Sstevel@tonic-gate 10390Sstevel@tonic-gate #ifdef __cplusplus 10400Sstevel@tonic-gate } 10410Sstevel@tonic-gate #endif 10420Sstevel@tonic-gate 10430Sstevel@tonic-gate #endif /* _CONV_H */ 1044