1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _CTF_H 28*0Sstevel@tonic-gate #define _CTF_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <sys/types.h> 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate #ifdef __cplusplus 35*0Sstevel@tonic-gate extern "C" { 36*0Sstevel@tonic-gate #endif 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate /* 39*0Sstevel@tonic-gate * CTF - Compact ANSI-C Type Format 40*0Sstevel@tonic-gate * 41*0Sstevel@tonic-gate * This file format can be used to compactly represent the information needed 42*0Sstevel@tonic-gate * by a debugger to interpret the ANSI-C types used by a given program. 43*0Sstevel@tonic-gate * Traditionally, this kind of information is generated by the compiler when 44*0Sstevel@tonic-gate * invoked with the -g flag and is stored in "stabs" strings or in the more 45*0Sstevel@tonic-gate * modern DWARF format. CTF provides a representation of only the information 46*0Sstevel@tonic-gate * that is relevant to debugging a complex, optimized C program such as the 47*0Sstevel@tonic-gate * operating system kernel in a form that is significantly more compact than 48*0Sstevel@tonic-gate * the equivalent stabs or DWARF representation. The format is data-model 49*0Sstevel@tonic-gate * independent, so consumers do not need different code depending on whether 50*0Sstevel@tonic-gate * they are 32-bit or 64-bit programs. CTF assumes that a standard ELF symbol 51*0Sstevel@tonic-gate * table is available for use in the debugger, and uses the structure and data 52*0Sstevel@tonic-gate * of the symbol table to avoid storing redundant information. The CTF data 53*0Sstevel@tonic-gate * may be compressed on disk or in memory, indicated by a bit in the header. 54*0Sstevel@tonic-gate * CTF may be interpreted in a raw disk file, or it may be stored in an ELF 55*0Sstevel@tonic-gate * section, typically named .SUNW_ctf. Data structures are aligned so that 56*0Sstevel@tonic-gate * a raw CTF file or CTF ELF section may be manipulated using mmap(2). 57*0Sstevel@tonic-gate * 58*0Sstevel@tonic-gate * The CTF file or section itself has the following structure: 59*0Sstevel@tonic-gate * 60*0Sstevel@tonic-gate * +--------+--------+---------+----------+-------+--------+ 61*0Sstevel@tonic-gate * | file | type | data | function | data | string | 62*0Sstevel@tonic-gate * | header | labels | objects | info | types | table | 63*0Sstevel@tonic-gate * +--------+--------+---------+----------+-------+--------+ 64*0Sstevel@tonic-gate * 65*0Sstevel@tonic-gate * The file header stores a magic number and version information, encoding 66*0Sstevel@tonic-gate * flags, and the byte offset of each of the sections relative to the end of the 67*0Sstevel@tonic-gate * header itself. If the CTF data has been uniquified against another set of 68*0Sstevel@tonic-gate * CTF data, a reference to that data also appears in the the header. This 69*0Sstevel@tonic-gate * reference is the name of the label corresponding to the types uniquified 70*0Sstevel@tonic-gate * against. 71*0Sstevel@tonic-gate * 72*0Sstevel@tonic-gate * Following the header is a list of labels, used to group the types included in 73*0Sstevel@tonic-gate * the data types section. Each label is accompanied by a type ID i. A given 74*0Sstevel@tonic-gate * label refers to the group of types whose IDs are in the range [0, i]. 75*0Sstevel@tonic-gate * 76*0Sstevel@tonic-gate * Data object and function records are stored in the same order as they appear 77*0Sstevel@tonic-gate * in the corresponding symbol table, except that symbols marked SHN_UNDEF are 78*0Sstevel@tonic-gate * not stored and symbols that have no type data are padded out with zeroes. 79*0Sstevel@tonic-gate * For each data object, the type ID (a small integer) is recorded. For each 80*0Sstevel@tonic-gate * function, the type ID of the return type and argument types is recorded. 81*0Sstevel@tonic-gate * 82*0Sstevel@tonic-gate * The data types section is a list of variable size records that represent each 83*0Sstevel@tonic-gate * type, in order by their ID. The types themselves form a directed graph, 84*0Sstevel@tonic-gate * where each node may contain one or more outgoing edges to other type nodes, 85*0Sstevel@tonic-gate * denoted by their ID. 86*0Sstevel@tonic-gate * 87*0Sstevel@tonic-gate * Strings are recorded as a string table ID (0 or 1) and a byte offset into the 88*0Sstevel@tonic-gate * string table. String table 0 is the internal CTF string table. String table 89*0Sstevel@tonic-gate * 1 is the external string table, which is the string table associated with the 90*0Sstevel@tonic-gate * ELF symbol table for this object. CTF does not record any strings that are 91*0Sstevel@tonic-gate * already in the symbol table, and the CTF string table does not contain any 92*0Sstevel@tonic-gate * duplicated strings. 93*0Sstevel@tonic-gate * 94*0Sstevel@tonic-gate * If the CTF data has been merged with another parent CTF object, some outgoing 95*0Sstevel@tonic-gate * edges may refer to type nodes that exist in another CTF object. The debugger 96*0Sstevel@tonic-gate * and libctf library are responsible for connecting the appropriate objects 97*0Sstevel@tonic-gate * together so that the full set of types can be explored and manipulated. 98*0Sstevel@tonic-gate */ 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gate #define CTF_MAX_TYPE 0xffff /* max type identifier value */ 101*0Sstevel@tonic-gate #define CTF_MAX_NAME 0x7fffffff /* max offset into a string table */ 102*0Sstevel@tonic-gate #define CTF_MAX_VLEN 0x3ff /* max struct, union, enum members or args */ 103*0Sstevel@tonic-gate #define CTF_MAX_INTOFF 0xff /* max offset of intrinsic value in bits */ 104*0Sstevel@tonic-gate #define CTF_MAX_INTBITS 0xffff /* max size of an intrinsic in bits */ 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gate /* See ctf_type_t */ 107*0Sstevel@tonic-gate #define CTF_MAX_SIZE 0xfffe /* max size of a type in bytes */ 108*0Sstevel@tonic-gate #define CTF_LSIZE_SENT 0xffff /* sentinel for ctt_size */ 109*0Sstevel@tonic-gate #define CTF_MAX_LSIZE UINT64_MAX 110*0Sstevel@tonic-gate 111*0Sstevel@tonic-gate typedef struct ctf_preamble { 112*0Sstevel@tonic-gate ushort_t ctp_magic; /* magic number (CTF_MAGIC) */ 113*0Sstevel@tonic-gate uchar_t ctp_version; /* data format version number (CTF_VERSION) */ 114*0Sstevel@tonic-gate uchar_t ctp_flags; /* flags (see below) */ 115*0Sstevel@tonic-gate } ctf_preamble_t; 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate typedef struct ctf_header { 118*0Sstevel@tonic-gate ctf_preamble_t cth_preamble; 119*0Sstevel@tonic-gate uint_t cth_parlabel; /* ref to name of parent lbl uniq'd against */ 120*0Sstevel@tonic-gate uint_t cth_parname; /* ref to basename of parent */ 121*0Sstevel@tonic-gate uint_t cth_lbloff; /* offset of label section */ 122*0Sstevel@tonic-gate uint_t cth_objtoff; /* offset of object section */ 123*0Sstevel@tonic-gate uint_t cth_funcoff; /* offset of function section */ 124*0Sstevel@tonic-gate uint_t cth_typeoff; /* offset of type section */ 125*0Sstevel@tonic-gate uint_t cth_stroff; /* offset of string section */ 126*0Sstevel@tonic-gate uint_t cth_strlen; /* length of string section in bytes */ 127*0Sstevel@tonic-gate } ctf_header_t; 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gate #define cth_magic cth_preamble.ctp_magic 130*0Sstevel@tonic-gate #define cth_version cth_preamble.ctp_version 131*0Sstevel@tonic-gate #define cth_flags cth_preamble.ctp_flags 132*0Sstevel@tonic-gate 133*0Sstevel@tonic-gate #ifdef CTF_OLD_VERSIONS 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate typedef struct ctf_header_v1 { 136*0Sstevel@tonic-gate ctf_preamble_t cth_preamble; 137*0Sstevel@tonic-gate uint_t cth_objtoff; 138*0Sstevel@tonic-gate uint_t cth_funcoff; 139*0Sstevel@tonic-gate uint_t cth_typeoff; 140*0Sstevel@tonic-gate uint_t cth_stroff; 141*0Sstevel@tonic-gate uint_t cth_strlen; 142*0Sstevel@tonic-gate } ctf_header_v1_t; 143*0Sstevel@tonic-gate 144*0Sstevel@tonic-gate #endif /* CTF_OLD_VERSIONS */ 145*0Sstevel@tonic-gate 146*0Sstevel@tonic-gate #define CTF_MAGIC 0xcff1 /* magic number identifying header */ 147*0Sstevel@tonic-gate 148*0Sstevel@tonic-gate /* data format version number */ 149*0Sstevel@tonic-gate #define CTF_VERSION_1 1 150*0Sstevel@tonic-gate #define CTF_VERSION_2 2 151*0Sstevel@tonic-gate #define CTF_VERSION CTF_VERSION_2 /* current version */ 152*0Sstevel@tonic-gate 153*0Sstevel@tonic-gate #define CTF_F_COMPRESS 0x1 /* data buffer is compressed */ 154*0Sstevel@tonic-gate 155*0Sstevel@tonic-gate typedef struct ctf_lblent { 156*0Sstevel@tonic-gate uint_t ctl_label; /* ref to name of label */ 157*0Sstevel@tonic-gate uint_t ctl_typeidx; /* last type associated with this label */ 158*0Sstevel@tonic-gate } ctf_lblent_t; 159*0Sstevel@tonic-gate 160*0Sstevel@tonic-gate typedef struct ctf_stype { 161*0Sstevel@tonic-gate uint_t ctt_name; /* reference to name in string table */ 162*0Sstevel@tonic-gate ushort_t ctt_info; /* encoded kind, variant length (see below) */ 163*0Sstevel@tonic-gate union { 164*0Sstevel@tonic-gate ushort_t _size; /* size of entire type in bytes */ 165*0Sstevel@tonic-gate ushort_t _type; /* reference to another type */ 166*0Sstevel@tonic-gate } _u; 167*0Sstevel@tonic-gate } ctf_stype_t; 168*0Sstevel@tonic-gate 169*0Sstevel@tonic-gate /* 170*0Sstevel@tonic-gate * type sizes, measured in bytes, come in two flavors. 99% of them fit within 171*0Sstevel@tonic-gate * (USHRT_MAX - 1), and thus can be stored in the ctt_size member of a 172*0Sstevel@tonic-gate * ctf_stype_t. The maximum value for these sizes is CTF_MAX_SIZE. The sizes 173*0Sstevel@tonic-gate * larger than CTF_MAX_SIZE must be stored in the ctt_lsize member of a 174*0Sstevel@tonic-gate * ctf_type_t. Use of this member is indicated by the presence of 175*0Sstevel@tonic-gate * CTF_LSIZE_SENT in ctt_size. 176*0Sstevel@tonic-gate */ 177*0Sstevel@tonic-gate typedef struct ctf_type { 178*0Sstevel@tonic-gate uint_t ctt_name; /* reference to name in string table */ 179*0Sstevel@tonic-gate ushort_t ctt_info; /* encoded kind, variant length (see below) */ 180*0Sstevel@tonic-gate union { 181*0Sstevel@tonic-gate ushort_t _size; /* always CTF_LSIZE_SENT */ 182*0Sstevel@tonic-gate ushort_t _type; /* do not use */ 183*0Sstevel@tonic-gate } _u; 184*0Sstevel@tonic-gate uint_t ctt_lsizehi; /* high 32 bits of type size in bytes */ 185*0Sstevel@tonic-gate uint_t ctt_lsizelo; /* low 32 bits of type size in bytes */ 186*0Sstevel@tonic-gate } ctf_type_t; 187*0Sstevel@tonic-gate 188*0Sstevel@tonic-gate #define ctt_size _u._size /* for fundamental types that have a size */ 189*0Sstevel@tonic-gate #define ctt_type _u._type /* for types that reference another type */ 190*0Sstevel@tonic-gate 191*0Sstevel@tonic-gate /* 192*0Sstevel@tonic-gate * The following macros compose and decompose values for ctt_info and 193*0Sstevel@tonic-gate * ctt_name, as well as other structures that contain name references. 194*0Sstevel@tonic-gate * 195*0Sstevel@tonic-gate * ------------------------ 196*0Sstevel@tonic-gate * ctt_info: | kind | isroot | vlen | 197*0Sstevel@tonic-gate * ------------------------ 198*0Sstevel@tonic-gate * 15 11 10 9 0 199*0Sstevel@tonic-gate * 200*0Sstevel@tonic-gate * kind = CTF_INFO_KIND(c.ctt_info); <-- CTF_K_* value (see below) 201*0Sstevel@tonic-gate * vlen = CTF_INFO_VLEN(c.ctt_info); <-- length of variable data list 202*0Sstevel@tonic-gate * 203*0Sstevel@tonic-gate * stid = CTF_NAME_STID(c.ctt_name); <-- string table id number (0 or 1) 204*0Sstevel@tonic-gate * offset = CTF_NAME_OFFSET(c.ctt_name); <-- string table byte offset 205*0Sstevel@tonic-gate * 206*0Sstevel@tonic-gate * c.ctt_info = CTF_TYPE_INFO(kind, vlen); 207*0Sstevel@tonic-gate * c.ctt_name = CTF_TYPE_NAME(stid, offset); 208*0Sstevel@tonic-gate */ 209*0Sstevel@tonic-gate 210*0Sstevel@tonic-gate #define CTF_INFO_KIND(info) (((info) & 0xf800) >> 11) 211*0Sstevel@tonic-gate #define CTF_INFO_ISROOT(info) (((info) & 0x0400) >> 10) 212*0Sstevel@tonic-gate #define CTF_INFO_VLEN(info) (((info) & CTF_MAX_VLEN)) 213*0Sstevel@tonic-gate 214*0Sstevel@tonic-gate #define CTF_NAME_STID(name) ((name) >> 31) 215*0Sstevel@tonic-gate #define CTF_NAME_OFFSET(name) ((name) & 0x7fffffff) 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gate #define CTF_TYPE_INFO(kind, isroot, vlen) \ 218*0Sstevel@tonic-gate (((kind) << 11) | (((isroot) ? 1 : 0) << 10) | ((vlen) & CTF_MAX_VLEN)) 219*0Sstevel@tonic-gate 220*0Sstevel@tonic-gate #define CTF_TYPE_NAME(stid, offset) \ 221*0Sstevel@tonic-gate (((stid) << 31) | ((offset) & 0x7fffffff)) 222*0Sstevel@tonic-gate 223*0Sstevel@tonic-gate #define CTF_TYPE_ISPARENT(id) ((id) < 0x8000) 224*0Sstevel@tonic-gate #define CTF_TYPE_ISCHILD(id) ((id) > 0x7fff) 225*0Sstevel@tonic-gate 226*0Sstevel@tonic-gate #define CTF_TYPE_TO_INDEX(id) ((id) & 0x7fff) 227*0Sstevel@tonic-gate #define CTF_INDEX_TO_TYPE(id, child) ((child) ? ((id) | 0x8000) : (id)) 228*0Sstevel@tonic-gate #define CTF_PARENT_SHIFT 15 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate #define CTF_STRTAB_0 0 /* symbolic define for string table id 0 */ 231*0Sstevel@tonic-gate #define CTF_STRTAB_1 1 /* symbolic define for string table id 1 */ 232*0Sstevel@tonic-gate 233*0Sstevel@tonic-gate #define CTF_TYPE_LSIZE(cttp) \ 234*0Sstevel@tonic-gate (((uint64_t)(cttp)->ctt_lsizehi) << 32 | (cttp)->ctt_lsizelo) 235*0Sstevel@tonic-gate #define CTF_SIZE_TO_LSIZE_HI(size) ((uint32_t)((uint64_t)(size) >> 32)) 236*0Sstevel@tonic-gate #define CTF_SIZE_TO_LSIZE_LO(size) ((uint32_t)(size)) 237*0Sstevel@tonic-gate 238*0Sstevel@tonic-gate #ifdef CTF_OLD_VERSIONS 239*0Sstevel@tonic-gate 240*0Sstevel@tonic-gate #define CTF_INFO_KIND_V1(info) (((info) & 0xf000) >> 12) 241*0Sstevel@tonic-gate #define CTF_INFO_ISROOT_V1(info) (((info) & 0x0800) >> 11) 242*0Sstevel@tonic-gate #define CTF_INFO_VLEN_V1(info) (((info) & 0x07ff)) 243*0Sstevel@tonic-gate 244*0Sstevel@tonic-gate #define CTF_TYPE_INFO_V1(kind, isroot, vlen) \ 245*0Sstevel@tonic-gate (((kind) << 12) | (((isroot) ? 1 : 0) << 11) | ((vlen) & 0x07ff)) 246*0Sstevel@tonic-gate 247*0Sstevel@tonic-gate #endif /* CTF_OLD_VERSIONS */ 248*0Sstevel@tonic-gate 249*0Sstevel@tonic-gate /* 250*0Sstevel@tonic-gate * Values for CTF_TYPE_KIND(). If the kind has an associated data list, 251*0Sstevel@tonic-gate * CTF_INFO_VLEN() will extract the number of elements in the list, and 252*0Sstevel@tonic-gate * the type of each element is shown in the comments below. 253*0Sstevel@tonic-gate */ 254*0Sstevel@tonic-gate #define CTF_K_UNKNOWN 0 /* unknown type (used for padding) */ 255*0Sstevel@tonic-gate #define CTF_K_INTEGER 1 /* variant data is CTF_INT_DATA() (see below) */ 256*0Sstevel@tonic-gate #define CTF_K_FLOAT 2 /* variant data is CTF_FP_DATA() (see below) */ 257*0Sstevel@tonic-gate #define CTF_K_POINTER 3 /* ctt_type is referenced type */ 258*0Sstevel@tonic-gate #define CTF_K_ARRAY 4 /* variant data is single ctf_array_t */ 259*0Sstevel@tonic-gate #define CTF_K_FUNCTION 5 /* ctt_type is return type, variant data is */ 260*0Sstevel@tonic-gate /* list of argument types (ushort_t's) */ 261*0Sstevel@tonic-gate #define CTF_K_STRUCT 6 /* variant data is list of ctf_member_t's */ 262*0Sstevel@tonic-gate #define CTF_K_UNION 7 /* variant data is list of ctf_member_t's */ 263*0Sstevel@tonic-gate #define CTF_K_ENUM 8 /* variant data is list of ctf_enum_t's */ 264*0Sstevel@tonic-gate #define CTF_K_FORWARD 9 /* no additional data; ctt_name is tag */ 265*0Sstevel@tonic-gate #define CTF_K_TYPEDEF 10 /* ctt_type is referenced type */ 266*0Sstevel@tonic-gate #define CTF_K_VOLATILE 11 /* ctt_type is base type */ 267*0Sstevel@tonic-gate #define CTF_K_CONST 12 /* ctt_type is base type */ 268*0Sstevel@tonic-gate #define CTF_K_RESTRICT 13 /* ctt_type is base type */ 269*0Sstevel@tonic-gate 270*0Sstevel@tonic-gate #define CTF_K_MAX 31 /* Maximum possible CTF_K_* value */ 271*0Sstevel@tonic-gate 272*0Sstevel@tonic-gate /* 273*0Sstevel@tonic-gate * Values for ctt_type when kind is CTF_K_INTEGER. The flags, offset in bits, 274*0Sstevel@tonic-gate * and size in bits are encoded as a single word using the following macros. 275*0Sstevel@tonic-gate */ 276*0Sstevel@tonic-gate #define CTF_INT_ENCODING(data) (((data) & 0xff000000) >> 24) 277*0Sstevel@tonic-gate #define CTF_INT_OFFSET(data) (((data) & 0x00ff0000) >> 16) 278*0Sstevel@tonic-gate #define CTF_INT_BITS(data) (((data) & 0x0000ffff)) 279*0Sstevel@tonic-gate 280*0Sstevel@tonic-gate #define CTF_INT_DATA(encoding, offset, bits) \ 281*0Sstevel@tonic-gate (((encoding) << 24) | ((offset) << 16) | (bits)) 282*0Sstevel@tonic-gate 283*0Sstevel@tonic-gate #define CTF_INT_SIGNED 0x01 /* integer is signed (otherwise unsigned) */ 284*0Sstevel@tonic-gate #define CTF_INT_CHAR 0x02 /* character display format */ 285*0Sstevel@tonic-gate #define CTF_INT_BOOL 0x04 /* boolean display format */ 286*0Sstevel@tonic-gate #define CTF_INT_VARARGS 0x08 /* varargs display format */ 287*0Sstevel@tonic-gate 288*0Sstevel@tonic-gate /* 289*0Sstevel@tonic-gate * Values for ctt_type when kind is CTF_K_FLOAT. The encoding, offset in bits, 290*0Sstevel@tonic-gate * and size in bits are encoded as a single word using the following macros. 291*0Sstevel@tonic-gate */ 292*0Sstevel@tonic-gate #define CTF_FP_ENCODING(data) (((data) & 0xff000000) >> 24) 293*0Sstevel@tonic-gate #define CTF_FP_OFFSET(data) (((data) & 0x00ff0000) >> 16) 294*0Sstevel@tonic-gate #define CTF_FP_BITS(data) (((data) & 0x0000ffff)) 295*0Sstevel@tonic-gate 296*0Sstevel@tonic-gate #define CTF_FP_DATA(encoding, offset, bits) \ 297*0Sstevel@tonic-gate (((encoding) << 24) | ((offset) << 16) | (bits)) 298*0Sstevel@tonic-gate 299*0Sstevel@tonic-gate #define CTF_FP_SINGLE 1 /* IEEE 32-bit float encoding */ 300*0Sstevel@tonic-gate #define CTF_FP_DOUBLE 2 /* IEEE 64-bit float encoding */ 301*0Sstevel@tonic-gate #define CTF_FP_CPLX 3 /* Complex encoding */ 302*0Sstevel@tonic-gate #define CTF_FP_DCPLX 4 /* Double complex encoding */ 303*0Sstevel@tonic-gate #define CTF_FP_LDCPLX 5 /* Long double complex encoding */ 304*0Sstevel@tonic-gate #define CTF_FP_LDOUBLE 6 /* Long double encoding */ 305*0Sstevel@tonic-gate #define CTF_FP_INTRVL 7 /* Interval (2x32-bit) encoding */ 306*0Sstevel@tonic-gate #define CTF_FP_DINTRVL 8 /* Double interval (2x64-bit) encoding */ 307*0Sstevel@tonic-gate #define CTF_FP_LDINTRVL 9 /* Long double interval (2x128-bit) encoding */ 308*0Sstevel@tonic-gate #define CTF_FP_IMAGRY 10 /* Imaginary (32-bit) encoding */ 309*0Sstevel@tonic-gate #define CTF_FP_DIMAGRY 11 /* Long imaginary (64-bit) encoding */ 310*0Sstevel@tonic-gate #define CTF_FP_LDIMAGRY 12 /* Long double imaginary (128-bit) encoding */ 311*0Sstevel@tonic-gate 312*0Sstevel@tonic-gate #define CTF_FP_MAX 12 /* Maximum possible CTF_FP_* value */ 313*0Sstevel@tonic-gate 314*0Sstevel@tonic-gate typedef struct ctf_array { 315*0Sstevel@tonic-gate ushort_t cta_contents; /* reference to type of array contents */ 316*0Sstevel@tonic-gate ushort_t cta_index; /* reference to type of array index */ 317*0Sstevel@tonic-gate uint_t cta_nelems; /* number of elements */ 318*0Sstevel@tonic-gate } ctf_array_t; 319*0Sstevel@tonic-gate 320*0Sstevel@tonic-gate /* 321*0Sstevel@tonic-gate * Most structure members have bit offsets that can be expressed using a 322*0Sstevel@tonic-gate * short. Some don't. ctf_member_t is used for structs which cannot 323*0Sstevel@tonic-gate * contain any of these large offsets, whereas ctf_lmember_t is used in the 324*0Sstevel@tonic-gate * latter case. If ctt_size for a given struct is >= 8192 bytes, all members 325*0Sstevel@tonic-gate * will be stored as type ctf_lmember_t. 326*0Sstevel@tonic-gate */ 327*0Sstevel@tonic-gate 328*0Sstevel@tonic-gate #define CTF_LSTRUCT_THRESH 8192 329*0Sstevel@tonic-gate 330*0Sstevel@tonic-gate typedef struct ctf_member { 331*0Sstevel@tonic-gate uint_t ctm_name; /* reference to name in string table */ 332*0Sstevel@tonic-gate ushort_t ctm_type; /* reference to type of member */ 333*0Sstevel@tonic-gate ushort_t ctm_offset; /* offset of this member in bits */ 334*0Sstevel@tonic-gate } ctf_member_t; 335*0Sstevel@tonic-gate 336*0Sstevel@tonic-gate typedef struct ctf_lmember { 337*0Sstevel@tonic-gate uint_t ctlm_name; /* reference to name in string table */ 338*0Sstevel@tonic-gate ushort_t ctlm_type; /* reference to type of member */ 339*0Sstevel@tonic-gate ushort_t ctlm_pad; /* padding */ 340*0Sstevel@tonic-gate uint_t ctlm_offsethi; /* high 32 bits of member offset in bits */ 341*0Sstevel@tonic-gate uint_t ctlm_offsetlo; /* low 32 bits of member offset in bits */ 342*0Sstevel@tonic-gate } ctf_lmember_t; 343*0Sstevel@tonic-gate 344*0Sstevel@tonic-gate #define CTF_LMEM_OFFSET(ctlmp) \ 345*0Sstevel@tonic-gate (((uint64_t)(ctlmp)->ctlm_offsethi) << 32 | (ctlmp)->ctlm_offsetlo) 346*0Sstevel@tonic-gate #define CTF_OFFSET_TO_LMEMHI(offset) ((uint32_t)((uint64_t)(offset) >> 32)) 347*0Sstevel@tonic-gate #define CTF_OFFSET_TO_LMEMLO(offset) ((uint32_t)(offset)) 348*0Sstevel@tonic-gate 349*0Sstevel@tonic-gate typedef struct ctf_enum { 350*0Sstevel@tonic-gate uint_t cte_name; /* reference to name in string table */ 351*0Sstevel@tonic-gate int cte_value; /* value associated with this name */ 352*0Sstevel@tonic-gate } ctf_enum_t; 353*0Sstevel@tonic-gate 354*0Sstevel@tonic-gate #ifdef __cplusplus 355*0Sstevel@tonic-gate } 356*0Sstevel@tonic-gate #endif 357*0Sstevel@tonic-gate 358*0Sstevel@tonic-gate #endif /* _CTF_H */ 359