Print this page
uts: Allow for address space randomisation.
Randomise the base addresses of shared objects, non-fixed mappings, the
stack and the heap. Introduce a service, svc:/system/process-security,
and a tool psecflags(1) to control and observe it
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/sgs/include/conv.h
+++ new/usr/src/cmd/sgs/include/conv.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 1988 AT&T
24 24 * All Rights Reserved
25 25 *
26 26 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
27 27 * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
28 28 */
29 29
30 30 #ifndef _CONV_H
31 31 #define _CONV_H
32 32
33 33 /*
34 34 * Global include file for conversion library.
35 35 */
36 36
37 37 #include <stdlib.h>
38 38 #include <libelf.h>
39 39 #include <dlfcn.h>
40 40 #include <libld.h>
41 41 #include <sgs.h>
42 42 #include <sgsmsg.h>
43 43
44 44 #ifdef __cplusplus
45 45 extern "C" {
46 46 #endif
47 47
48 48 /*
49 49 * Configuration features available - maintained here (instead of debug.h)
50 50 * to save libconv from having to include debug.h which results in numerous
51 51 * "declared but not used or defined" lint errors.
52 52 */
53 53 #define CONF_EDLIBPATH 0x000100 /* ELF default library path */
54 54 #define CONF_ESLIBPATH 0x000200 /* ELF secure library path */
55 55 #define CONF_ADLIBPATH 0x000400 /* AOUT default library path */
56 56 #define CONF_ASLIBPATH 0x000800 /* AOUT secure library path */
57 57 #define CONF_DIRCFG 0x001000 /* directory configuration available */
58 58 #define CONF_OBJALT 0x002000 /* object alternatives available */
59 59 #define CONF_MEMRESV 0x004000 /* memory reservation required */
60 60 #define CONF_ENVS 0x008000 /* environment variables available */
61 61 #define CONF_FLTR 0x010000 /* filter information available */
62 62 #define CONF_FEATMSK 0xffff00
63 63
64 64
65 65 /*
66 66 * Valid flags for conv_strproc_extract_value().
67 67 */
68 68 #define CONV_SPEXV_F_NOTRIM 0x0001 /* Do not trim whitespace around '=' */
69 69 #define CONV_SPEXV_F_UCASE 0x0002 /* Convert value to uppercase */
70 70 #define CONV_SPEXV_F_NULLOK 0x0004 /* Empty ("") value is OK */
71 71
72 72 /*
73 73 * Buffer types:
74 74 *
75 75 * Many of the routines in this module require the user to supply a
76 76 * buffer into which the desired strings may be written. These are
77 77 * all arrays of characters, and might be defined as simple arrays
78 78 * of char. The problem with that approach is that when such an array
79 79 * is passed to a function, the C language considers it to have the
80 80 * type (char *), without any regard to its length. Not all of our
81 81 * buffers have the same length, and we want to ensure that the compiler
82 82 * will refuse to compile code that passes the wrong type of buffer to
83 83 * a given routine. The solution is to define the buffers as unions
84 84 * that contain the needed array, and then to pass the given union
85 85 * by address. The compiler will catch attempts to pass the wrong type
86 86 * of pointer, and the size of a structure/union is implicit in its type.
87 87 *
88 88 * A nice side effect of this approach is that we can use a union with
89 89 * multiple buffers to handle the cases where a given routine needs
90 90 * more than one type of buffer. The end result is a single buffer large
91 91 * enough to handle any of the subcases, but no larger.
92 92 */
93 93
94 94 /*
95 95 * Size of buffer used by conv_invalid_val():
96 96 *
97 97 * Various values that can't be matched to a symbolic definition are converted
98 98 * to a numeric string.
99 99 *
100 100 * The buffer size reflects the maximum number of digits needed to
101 101 * display an integer as text, plus a trailing null, and with room for
102 102 * a leading "0x" if hexidecimal display is selected.
103 103 *
104 104 * The 32-bit version of this requires 12 characters, and the 64-bit version
105 105 * needs 22. By using the larger value for both, we can have a single
106 106 * definition, which is necessary for code that is ELFCLASS independent. A
107 107 * nice side benefit is that it lets us dispense with a large number of 32/64
108 108 * buffer size definitions that build off CONV_INV_BUFSIZE, and the macros
109 109 * that would then be needed.
110 110 */
111 111 #define CONV_INV_BUFSIZE 22
112 112 typedef union {
113 113 char buf[CONV_INV_BUFSIZE];
114 114 } Conv_inv_buf_t;
115 115
116 116 /* conv_ehdr_flags() */
117 117 #define CONV_EHDR_FLAGS_BUFSIZE 91
118 118 typedef union {
119 119 Conv_inv_buf_t inv_buf;
120 120 char buf[CONV_EHDR_FLAGS_BUFSIZE];
121 121 } Conv_ehdr_flags_buf_t;
122 122
123 123 /* conv_reject_desc() */
124 124 typedef union {
125 125 Conv_inv_buf_t inv_buf;
126 126 Conv_ehdr_flags_buf_t flags_buf;
127 127 } Conv_reject_desc_buf_t;
128 128
129 129 /*
130 130 * conv_la_bind()
131 131 */
132 132 #define CONV_LA_BIND_BUFSIZE 56
133 133 typedef union {
134 134 Conv_inv_buf_t inv_buf;
135 135 char buf[CONV_LA_BIND_BUFSIZE];
136 136 } Conv_la_bind_buf_t;
137 137
138 138 /*
139 139 * conv_la_search()
140 140 */
141 141 #define CONV_LA_SEARCH_BUFSIZE 111
142 142 typedef union {
143 143 Conv_inv_buf_t inv_buf;
144 144 char buf[CONV_LA_SEARCH_BUFSIZE];
145 145 } Conv_la_search_buf_t;
146 146
147 147 /*
148 148 * conv_la_symbind()
149 149 */
150 150 #define CONV_LA_SYMBIND_BUFSIZE 113
151 151 typedef union {
152 152 Conv_inv_buf_t inv_buf;
153 153 char buf[CONV_LA_SYMBIND_BUFSIZE];
154 154 } Conv_la_symbind_buf_t;
155 155
156 156 /*
157 157 * conv_cap_val_hw/sf()
158 158 *
159 159 * These sizes are based on the maximum number of capabilities that exist.
160 160 * See common/elfcap.
161 161 */
162 162 #define CONV_CAP_VAL_HW1_BUFSIZE 195
163 163 typedef union {
164 164 Conv_inv_buf_t inv_buf;
165 165 char buf[CONV_CAP_VAL_HW1_BUFSIZE];
166 166 } Conv_cap_val_hw1_buf_t;
167 167
168 168 #define CONV_CAP_VAL_HW2_BUFSIZE CONV_INV_BUFSIZE /* for now */
169 169 typedef union {
170 170 Conv_inv_buf_t inv_buf;
171 171 char buf[CONV_CAP_VAL_HW2_BUFSIZE];
172 172 } Conv_cap_val_hw2_buf_t;
173 173
174 174 #define CONV_CAP_VAL_SF1_BUFSIZE 45
175 175 typedef union {
176 176 Conv_inv_buf_t inv_buf;
177 177 char buf[CONV_CAP_VAL_SF1_BUFSIZE];
178 178 } Conv_cap_val_sf1_buf_t;
179 179
180 180 /* conv_cap_val_buf() */
181 181 typedef union {
182 182 Conv_inv_buf_t inv_buf;
183 183 Conv_cap_val_hw1_buf_t cap_val_hw1_buf;
184 184 Conv_cap_val_sf1_buf_t cap_val_sf1_buf;
185 185 Conv_cap_val_hw2_buf_t cap_val_hw2_buf;
186 186 } Conv_cap_val_buf_t;
187 187
188 188 /* conv_config_feat() */
189 189 #define CONV_CONFIG_FEAT_BUFSIZE 204
190 190 typedef union {
191 191 Conv_inv_buf_t inv_buf;
192 192 char buf[CONV_CONFIG_FEAT_BUFSIZE];
193 193 } Conv_config_feat_buf_t;
194 194
195 195 /* conv_config_obj() */
196 196 #define CONV_CONFIG_OBJ_BUFSIZE 164
197 197 typedef union {
198 198 Conv_inv_buf_t inv_buf;
199 199 char buf[CONV_CONFIG_OBJ_BUFSIZE];
200 200 } Conv_config_obj_buf_t;
201 201
202 202 /* conv_dl_mode() */
203 203 #define CONV_DL_MODE_BUFSIZE 132
204 204 typedef union {
205 205 Conv_inv_buf_t inv_buf;
206 206 char buf[CONV_DL_MODE_BUFSIZE];
207 207 } Conv_dl_mode_buf_t;
208 208
209 209 /* conv_dl_flag() */
210 210 #define CONV_DL_FLAG_BUFSIZE 185
211 211 typedef union {
212 212 Conv_inv_buf_t inv_buf;
213 213 char buf[CONV_DL_FLAG_BUFSIZE];
214 214 } Conv_dl_flag_buf_t;
215 215
216 216 /* conv_grphdl_flags() */
217 217 #define CONV_GRPHDL_FLAGS_BUFSIZE 78
218 218 typedef union {
219 219 Conv_inv_buf_t inv_buf;
220 220 char buf[CONV_GRPHDL_FLAGS_BUFSIZE];
221 221 } Conv_grphdl_flags_buf_t;
222 222
223 223 /* conv_grpdesc_flags() */
224 224 #define CONV_GRPDESC_FLAGS_BUFSIZE 91
225 225 typedef union {
226 226 Conv_inv_buf_t inv_buf;
227 227 char buf[CONV_GRPDESC_FLAGS_BUFSIZE];
228 228 } Conv_grpdesc_flags_buf_t;
229 229
230 230 /* conv_seg_flags() */
231 231 #define CONV_SEG_FLAGS_BUFSIZE 241
232 232 typedef union {
233 233 Conv_inv_buf_t inv_buf;
234 234 char buf[CONV_SEG_FLAGS_BUFSIZE];
235 235 } Conv_seg_flags_buf_t;
236 236
237 237 /* conv_dyn_posflag1() */
238 238 #define CONV_DYN_POSFLAG1_BUFSIZE 72
239 239 typedef union {
240 240 Conv_inv_buf_t inv_buf;
241 241 char buf[CONV_DYN_POSFLAG1_BUFSIZE];
242 242 } Conv_dyn_posflag1_buf_t;
243 243
244 244 /* conv_dyn_flag() */
245 245 #define CONV_DYN_FLAG_BUFSIZE 85
246 246 typedef union {
247 247 Conv_inv_buf_t inv_buf;
248 248 char buf[CONV_DYN_FLAG_BUFSIZE];
249 249 } Conv_dyn_flag_buf_t;
250 250
251 251 /* conv_dyn_flag1() */
252 252 #define CONV_DYN_FLAG1_BUFSIZE 361
253 253 typedef union {
254 254 Conv_inv_buf_t inv_buf;
255 255 char buf[CONV_DYN_FLAG1_BUFSIZE];
256 256 } Conv_dyn_flag1_buf_t;
257 257
258 258 /* conv_dyn_feature1() */
259 259 #define CONV_DYN_FEATURE1_BUFSIZE 54
260 260 typedef union {
261 261 Conv_inv_buf_t inv_buf;
262 262 char buf[CONV_DYN_FEATURE1_BUFSIZE];
263 263 } Conv_dyn_feature1_buf_t;
264 264
265 265 /* conv_bnd_type() */
266 266 #define CONV_BND_TYPE_BUFSIZE 51
267 267 typedef union {
268 268 Conv_inv_buf_t inv_buf;
269 269 char buf[CONV_BND_TYPE_BUFSIZE];
270 270 } Conv_bnd_type_buf_t;
271 271
272 272 /* conv_bnd_obj() */
273 273 #define CONV_BND_OBJ_BUFSIZE 60
274 274 typedef union {
275 275 Conv_inv_buf_t inv_buf;
276 276 char buf[CONV_BND_OBJ_BUFSIZE];
277 277 } Conv_bnd_obj_buf_t;
278 278
279 279 /* conv_phdr_flags() */
280 280 #define CONV_PHDR_FLAGS_BUFSIZE 88
281 281 typedef union {
282 282 Conv_inv_buf_t inv_buf;
283 283 char buf[CONV_PHDR_FLAGS_BUFSIZE];
284 284 } Conv_phdr_flags_buf_t;
285 285
286 286 /* conv_sec_flags() */
287 287 #define CONV_SEC_FLAGS_BUFSIZE 190
288 288 typedef union {
289 289 Conv_inv_buf_t inv_buf;
290 290 char buf[CONV_SEC_FLAGS_BUFSIZE];
291 291 } Conv_sec_flags_buf_t;
292 292
293 293 /* conv_dwarf_ehe() */
294 294 #define CONV_DWARF_EHE_BUFSIZE 43
295 295 typedef union {
296 296 Conv_inv_buf_t inv_buf;
297 297 char buf[CONV_DWARF_EHE_BUFSIZE];
298 298 } Conv_dwarf_ehe_buf_t;
299 299
300 300 /* conv_syminfo_flags() */
301 301 #define CONV_SYMINFO_FLAGS_BUFSIZE 230
302 302 typedef union {
303 303 Conv_inv_buf_t inv_buf;
304 304 char buf[CONV_SYMINFO_FLAGS_BUFSIZE];
305 305 } Conv_syminfo_flags_buf_t;
306 306
307 307 /* conv_cnote_pr_flags() */
308 308 #define CONV_CNOTE_PR_FLAGS_BUFSIZE 254
309 309 typedef union {
310 310 Conv_inv_buf_t inv_buf;
311 311 char buf[CONV_CNOTE_PR_FLAGS_BUFSIZE];
312 312 } Conv_cnote_pr_flags_buf_t;
313 313
314 314 /* conv_cnote_old_pr_flags() */
315 315 #define CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE 174
316 316 typedef union {
317 317 Conv_inv_buf_t inv_buf;
↓ open down ↓ |
317 lines elided |
↑ open up ↑ |
318 318 char buf[CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE];
319 319 } Conv_cnote_old_pr_flags_buf_t;
320 320
321 321 /* conv_cnote_proc_flag() */
322 322 #define CONV_CNOTE_PROC_FLAG_BUFSIZE 39
323 323 typedef union {
324 324 Conv_inv_buf_t inv_buf;
325 325 char buf[CONV_CNOTE_PROC_FLAG_BUFSIZE];
326 326 } Conv_cnote_proc_flag_buf_t;
327 327
328 +/* conv_psecflags() */
329 +#define CONV_PSECFLAGS_BUFSIZE 31
330 +typedef union {
331 + Conv_inv_buf_t inv_buf;
332 + char buf[CONV_PSECFLAGS_BUFSIZE];
333 +} Conv_secflags_buf_t;
328 334
329 335 /* conv_cnote_sigset() */
330 336 #define CONV_CNOTE_SIGSET_BUFSIZE 639
331 337 typedef union {
332 338 Conv_inv_buf_t inv_buf;
333 339 char buf[CONV_CNOTE_SIGSET_BUFSIZE];
334 340 } Conv_cnote_sigset_buf_t;
335 341
336 342 /* conv_cnote_fltset() */
337 343 #define CONV_CNOTE_FLTSET_BUFSIZE 511
338 344 typedef union {
339 345 Conv_inv_buf_t inv_buf;
340 346 char buf[CONV_CNOTE_FLTSET_BUFSIZE];
341 347 } Conv_cnote_fltset_buf_t;
342 348
343 349 /* conv_cnote_sysset() */
344 350 #define CONV_CNOTE_SYSSET_BUFSIZE 3195
345 351 typedef union {
346 352 Conv_inv_buf_t inv_buf;
347 353 char buf[CONV_CNOTE_SYSSET_BUFSIZE];
348 354 } Conv_cnote_sysset_buf_t;
349 355
350 356 /* conv_cnote_sa_flags() */
351 357 #define CONV_CNOTE_SA_FLAGS_BUFSIZE 109
352 358 typedef union {
353 359 Conv_inv_buf_t inv_buf;
354 360 char buf[CONV_CNOTE_SA_FLAGS_BUFSIZE];
355 361 } Conv_cnote_sa_flags_buf_t;
356 362
357 363 /* conv_cnote_ss_flags() */
358 364 #define CONV_CNOTE_SS_FLAGS_BUFSIZE 48
359 365 typedef union {
360 366 Conv_inv_buf_t inv_buf;
361 367 char buf[CONV_CNOTE_SS_FLAGS_BUFSIZE];
362 368 } Conv_cnote_ss_flags_buf_t;
363 369
364 370 /* conv_cnote_cc_content() */
365 371 #define CONV_CNOTE_CC_CONTENT_BUFSIZE 97
366 372 typedef union {
367 373 Conv_inv_buf_t inv_buf;
368 374 char buf[CONV_CNOTE_CC_CONTENT_BUFSIZE];
369 375 } Conv_cnote_cc_content_buf_t;
370 376
371 377 /* conv_cnote_auxv_af() */
372 378 #define CONV_CNOTE_AUXV_AF_BUFSIZE 73
373 379 typedef union {
374 380 Conv_inv_buf_t inv_buf;
375 381 char buf[CONV_CNOTE_AUXV_AF_BUFSIZE];
376 382 } Conv_cnote_auxv_af_buf_t;
377 383
378 384 /* conv_ver_flags() */
379 385 #define CONV_VER_FLAGS_BUFSIZE 41
380 386 typedef union {
381 387 Conv_inv_buf_t inv_buf;
382 388 char buf[CONV_VER_FLAGS_BUFSIZE];
383 389 } Conv_ver_flags_buf_t;
384 390
385 391 /* conv_ent_flags() */
386 392 #define CONV_ENT_FLAGS_BUFSIZE 69
387 393 typedef union {
388 394 Conv_inv_buf_t inv_buf;
389 395 char buf[CONV_ENT_FLAGS_BUFSIZE];
390 396 } Conv_ent_flags_buf_t;
391 397
392 398 /* conv_ent_files_flags() */
393 399 #define CONV_ENT_FILES_FLAGS_BUFSIZE 89
394 400 typedef union {
395 401 Conv_inv_buf_t inv_buf;
396 402 char buf[CONV_ENT_FILES_FLAGS_BUFSIZE];
397 403 } Conv_ent_files_flags_buf_t;
398 404
399 405 /*
400 406 * conv_time()
401 407 *
402 408 * This size is based on the maximum "hour.min.sec.fraction: " time that
403 409 * would be expected of ld().
404 410 */
405 411 #define CONV_TIME_BUFSIZE 18
406 412 typedef union {
407 413 char buf[CONV_TIME_BUFSIZE];
408 414 } Conv_time_buf_t;
409 415
410 416 /*
411 417 * Many conversion routines accept a fmt_flags argument of this type
412 418 * to allow the caller to modify the output. There are two parts to
413 419 * this value:
414 420 *
415 421 * (1) Format requests (decimal vs hex, etc...)
416 422 * (2) The low order bits specified by CONV_MASK_FMT_ALT
417 423 * and retrieved by CONV_TYPE_FMT_ALT are integer
418 424 * values that specify that an alternate set of
419 425 * strings should be used.
420 426 *
421 427 * The fmt_flags value is designed such that a caller can always
422 428 * supply a 0 in order to receive default behavior.
423 429 */
424 430 typedef int Conv_fmt_flags_t;
425 431
426 432 /*
427 433 * Type used to represent ELF constants within libconv. This relies on
428 434 * the fact that there are no ELF constants that need more than 32-bits,
429 435 * nor are there any signed values.
430 436 */
431 437 typedef uint32_t Conv_elfvalue_t;
432 438
433 439 /*
434 440 * Most conversion routines are able to provide strings in one of
435 441 * several alternative styles. The bottom 8 bits of Conv_fmt_flags_t
436 442 * are used to specify which strings should be used for a given call
437 443 * to a conversion routine:
438 444 *
439 445 * DEFAULT
440 446 * The default string style used by a given conversion routine is
441 447 * an independent choice made by that routine. Different routines
442 448 * make different choices, based largely on historical usage and
443 449 * the perceived common case. It may be an alias for one of the
444 450 * specific styles listed below, or it may be unique.
445 451 *
446 452 * DUMP
447 453 * Style of strings used by dump(1).
448 454 *
449 455 * FILE
450 456 * Style of strings used by file(1).
451 457 *
452 458 * CRLE
453 459 * Style of strings used by crle(1).
454 460 *
455 461 * CF
456 462 * Canonical Form: The string is exactly the same as the name
457 463 * of the #define macro that defines it in the public header files.
458 464 * (e.g. STB_LOCAL, not LOCL, LOCAL, LOC, or any other variation).
459 465 *
460 466 * CFNP
461 467 * No Prefix Canonical Form: The same strings supplied by CF,
462 468 * but without their standard prefix. (e.g. LOCAL, instead of STT_LOCAL).
463 469 *
464 470 * NF
465 471 * Natural Form: The form of the strings that might typically be entered
466 472 * via a keyboard by an interactive user. These are usually the strings
467 473 * from CFNP, converted to lowercase, although in some cases they may
468 474 * take some other "natural" form. In command completion applications,
469 475 * lowercase strings appear less formal, and are easier on the eye.
470 476 *
471 477 * Every routine is required to have a default style. The others are optional,
472 478 * and may not be provided if not needed. If a given conversion routine does
473 479 * not support alternative strings for a given CONV_FMT_ALT type, it silently
474 480 * ignores the request and supplies the default set. This means that a utility
475 481 * like dump(1) is free to specify a style like DUMP to every conversion
476 482 * routine. It will receive its special strings if there are any, and
477 483 * the defaults otherwise.
478 484 */
479 485 #define CONV_MASK_FMT_ALT 0xff
480 486 #define CONV_TYPE_FMT_ALT(fmt_flags) (fmt_flags & CONV_MASK_FMT_ALT)
481 487
482 488 #define CONV_FMT_ALT_DEFAULT 0 /* "Standard" strings */
483 489 #define CONV_FMT_ALT_DUMP 1 /* dump(1) */
484 490 #define CONV_FMT_ALT_FILE 2 /* file(1) */
485 491 #define CONV_FMT_ALT_CRLE 3 /* crle(1) */
486 492 #define CONV_FMT_ALT_CF 4 /* Canonical Form */
487 493 #define CONV_FMT_ALT_CFNP 5 /* No Prefix Canonical Form */
488 494 #define CONV_FMT_ALT_NF 6 /* Natural Form */
489 495
490 496 /*
491 497 * Flags that alter standard formatting for conversion routines.
492 498 * These bits start after the range occupied by CONV_MASK_FMT_ALT.
493 499 */
494 500 #define CONV_FMT_DECIMAL 0x0100 /* conv_invalid_val() should print */
495 501 /* integer print as decimal */
496 502 /* (default is hex) */
497 503 #define CONV_FMT_SPACE 0x0200 /* conv_invalid_val() should append */
498 504 /* a space after the number. */
499 505 #define CONV_FMT_NOBKT 0x0400 /* conv_expn_field() should omit */
500 506 /* prefix and suffix strings */
501 507
502 508 /*
503 509 * A Val_desc structure is used to associate an ELF constant and
504 510 * the message code (Msg) for the string that corresponds to it.
505 511 *
506 512 * Val_desc2 adds v_osabi and v_mach fields to Val_desc, which allows
507 513 * for non-generic mappings that apply only to a specific OSABI/machine.
508 514 * Setting v_osabi to 0 (ELFOSABI_NONE) specifies that any OSABI matches.
509 515 * Similarly, setting v_mach to 0 (EM_MACH) matches any machine. Hence,
510 516 * setting v_osabi and v_mach to 0 in a Val_desc2 results in a generic item,
511 517 * and is equivalent to simply using a Val_desc.
512 518 *
513 519 * These structs are used in two different contexts:
514 520 *
515 521 * 1) To expand bit-field data items, using conv_expn_field() to
516 522 * process a NULL terminated array of Val_desc, or conv_expn_field2()
517 523 * to process a null terminated array of Val_desc2.
518 524 *
519 525 * 2) To represent sparse ranges of non-bitfield values, referenced via
520 526 * conv_ds_vd_t or conv_ds_vd2_t descriptors, as described below.
521 527 */
522 528 typedef struct {
523 529 Conv_elfvalue_t v_val; /* expansion value */
524 530 Msg v_msg; /* associated message string code */
525 531 } Val_desc;
526 532 typedef struct {
527 533 Conv_elfvalue_t v_val; /* expansion value */
528 534 uchar_t v_osabi; /* OSABI to which entry applies */
529 535 Half v_mach; /* Machine to which entry applies */
530 536 Msg v_msg; /* associated message string code */
531 537 } Val_desc2;
532 538
533 539 /*
534 540 * The conv_ds_XXX_t structs are used to pull together the information used
535 541 * to map non-bitfield values to strings. They are a variant family, sharing
536 542 * the same initial fields, with a generic "header" definition that can be
537 543 * used to read those common fields and determine which subcase is being
538 544 * seen. We do this instead of using a single struct containing a type code
539 545 * and a union in order to allow for static compile-time initialization.
540 546 *
541 547 * conv_ds_t is the base type, containing the initial fields common to all
542 548 * the variants. Variables of type conv_ds_t are never instantiated. This
543 549 * type exists only to provide a common pointer type that can reference
544 550 * any of the variants safely. In C++, it would be a virtual base class.
545 551 * The fields common to all the variants are:
546 552 *
547 553 * ds_type: Identifies the variant
548 554 * ds_baseval/ds_topval: The lower and upper bound of the range
549 555 * of values represented by this conv_ds_XXX_t descriptor.
550 556 *
551 557 * There are three different variants:
552 558 * conv_ds_msg_t (ds_type == CONV_DS_MSGARR)
553 559 * This structure references an array of message codes corresponding
554 560 * to consecutive ELF values. The first item in the array is the Msg
555 561 * code for the value given by ds_baseval. Consecutive strings follow
556 562 * in consecutive order. The final item corresponds to the value given
557 563 * by ds_topval. Zero (0) Msg values can be used to represent missing
558 564 * values. Entries with a 0 are quietly ignored.
559 565 *
560 566 * conv_ds_vd_t (ds_type == CONV_DS_VD)
561 567 * This structure employs a NULL terminated array of Val_desc structs.
562 568 * Each Val_desc supplies a mapping from a value in the range
563 569 * (ds_baseval <= value <= ds_topval). The values described need not
564 570 * be consecutive, and can be sparse. ds_baseval does not need to
565 571 * correspond to the first item, and ds_topval need not correspond to
566 572 * the final item.
567 573 *
568 574 * conv_ds_vd2_t (ds_type == CONV_DS_VD2)
569 575 * This structure employs a NULL terminated array of Val_desc2 structs,
570 576 * rather than Val_desc, adding the ability to specify OSABI and machine
571 577 * as part of the value/string mapping. It is otherwise the same thing
572 578 * as CONV_DS_VD.
573 579 */
574 580 typedef enum {
575 581 CONV_DS_MSGARR = 0, /* Array of Msg */
576 582 CONV_DS_VD = 1, /* Null terminated array of Val_desc */
577 583 CONV_DS_VD2 = 2, /* Null terminated array of Val_desc2 */
578 584 } conv_ds_type_t;
579 585
580 586 #define CONV_DS_COMMON_FIELDS \
581 587 conv_ds_type_t ds_type; /* Type of data structure used */ \
582 588 uint32_t ds_baseval; /* Value of first item */ \
583 589 uint32_t ds_topval /* Value of last item */
584 590
585 591 typedef struct { /* Virtual base type --- do not instantiate */
586 592 CONV_DS_COMMON_FIELDS;
587 593 } conv_ds_t;
588 594 typedef struct {
589 595 CONV_DS_COMMON_FIELDS;
590 596 const Msg *ds_msg;
591 597 } conv_ds_msg_t;
592 598 typedef struct {
593 599 CONV_DS_COMMON_FIELDS;
594 600 const Val_desc *ds_vd;
595 601 } conv_ds_vd_t;
596 602 typedef struct {
597 603 CONV_DS_COMMON_FIELDS;
598 604 const Val_desc2 *ds_vd2;
599 605 } conv_ds_vd2_t;
600 606
601 607 /*
602 608 * The initialization of conv_ds_msg_t can be completely derived from
603 609 * its base value and the array of Msg codes. CONV_DS_MSG_INIT() is used
604 610 * to do that.
605 611 */
606 612 #define CONV_DS_MSG_INIT(_baseval, _arr) \
607 613 CONV_DS_MSGARR, _baseval, \
608 614 _baseval + (sizeof (_arr) / sizeof (_arr[0])) - 1, _arr
609 615
610 616 /*
611 617 * Null terminated arrays of pointers to conv_ds_XXX_t structs are processed
612 618 * by conv_map_ds() to convert ELF constants to their symbolic names, and by
613 619 * conv_iter_ds() to iterate over all the available value/name combinations.
614 620 *
615 621 * These pointers are formed by casting the address of the specific
616 622 * variant types (described above) to generic base type pointer.
617 623 * CONV_DS_ADDR() is a convenience macro to take the address of
618 624 * one of these variants and turn it into a generic pointer.
619 625 */
620 626 #define CONV_DS_ADDR(_item) ((conv_ds_t *)&(_item))
621 627
622 628 /*
623 629 * Type used by libconv to represent osabi values passed to iteration
624 630 * functions. The type in the ELF header is uchar_t. However, every possible
625 631 * value 0-255 has a valid meaning, leaving us no extra value to assign
626 632 * to mean "ALL". Using Half for osabi leaves us the top byte to use for
627 633 * out of bound values.
628 634 *
629 635 * Non-iteration functions, and any code that does not need to use
630 636 * CONV_OSABI_ALL, should use uchar_t for osabi.
631 637 */
632 638 typedef Half conv_iter_osabi_t;
633 639
634 640 /*
635 641 * Many of the iteration functions accept an osabi or mach argument,
636 642 * used to specify the type of object being processed. The following
637 643 * values can be used to specify a wildcard that matches any item. Their
638 644 * values are carefully chosen to ensure that they cannot be interpreted
639 645 * as an otherwise valid osabi or machine.
640 646 */
641 647 #define CONV_OSABI_ALL 1024 /* Larger than can be represented by uchar_t */
642 648 #define CONV_MACH_ALL EM_NUM /* Never a valid machine type */
643 649
644 650 /*
645 651 * We compare Val_Desc2 descriptors with a specified osabi and machine
646 652 * to determine whether to use it or not. This macro encapsulates that logic.
647 653 *
648 654 * We consider an osabi to match when any of the following things hold:
649 655 *
650 656 * - The descriptor osabi is ELFOSABI_NONE.
651 657 * - The supplied osabi and the descriptor osabi match
652 658 * - The supplied osabi is ELFOSABI_NONE, and the descriptor osabi is
653 659 * ELFOSABI_SOLARIS. Many operating systems, Solaris included,
654 660 * produce or have produced ELFOSABI_NONE native objects, if only
655 661 * because OSABI ranges are not an original ELF feature. We
656 662 * give our own objects the home field advantage.
657 663 * - Iteration Only: An osabi value of CONV_OSABI_ALL is specified.
658 664 *
659 665 * We consider a machine to match when any of the following things hold:
660 666 *
661 667 * - The descriptor mach is EM_NONE.
662 668 * - The supplied mach and the descriptor mach match
663 669 * - Iteration Only: A mach value of CONV_MACH_ALL is specified.
664 670 *
665 671 * The special extra _ALL case for iteration is handled by defining a separate
666 672 * macro with the extra CONV_xxx_ALL tests.
667 673 */
668 674 #define CONV_VD2_SKIP_OSABI(_osabi, _vdp) \
669 675 ((_vdp->v_osabi != ELFOSABI_NONE) && (_vdp->v_osabi != osabi) && \
670 676 ((_osabi != ELFOSABI_NONE) || (_vdp->v_osabi != ELFOSABI_SOLARIS)))
671 677
672 678 #define CONV_VD2_SKIP_MACH(_mach, _vdp) \
673 679 ((_vdp->v_mach != EM_NONE) && (_vdp->v_mach != _mach))
674 680
675 681 #define CONV_VD2_SKIP(_osabi, _mach, _vdp) \
676 682 (CONV_VD2_SKIP_OSABI(_osabi, _vdp) || CONV_VD2_SKIP_MACH(_mach, _vdp))
677 683
678 684 #define CONV_ITER_VD2_SKIP(_osabi, _mach, _vdp) \
679 685 ((CONV_VD2_SKIP_OSABI(_osabi, _vdp) && (_osabi != CONV_OSABI_ALL)) || \
680 686 (CONV_VD2_SKIP_MACH(_mach, _vdp) && (_mach != CONV_MACH_ALL)))
681 687
682 688
683 689 /*
684 690 * Possible return values from iteration functions.
685 691 */
686 692 typedef enum {
687 693 CONV_ITER_DONE, /* Stop: No more iterations are desired */
688 694 CONV_ITER_CONT /* Continue with following iterations */
689 695 } conv_iter_ret_t;
690 696
691 697 /*
692 698 * Prototype for caller supplied callback function to iteration functions.
693 699 */
694 700 typedef conv_iter_ret_t (* conv_iter_cb_t)(const char *str,
695 701 Conv_elfvalue_t value, void *uvalue);
696 702
697 703 /*
698 704 * User value block employed by conv_iter_strtol()
699 705 */
700 706 typedef struct {
701 707 const char *csl_str; /* String to search for */
702 708 size_t csl_strlen; /* # chars in csl_str to examine */
703 709 int csl_found; /* Init to 0, set to 1 if item found */
704 710 Conv_elfvalue_t csl_value; /* If csl_found, resulting value */
705 711 } conv_strtol_uvalue_t;
706 712
707 713 /*
708 714 * conv_expn_field() is willing to supply default strings for the
709 715 * prefix, separator, and suffix arguments, if they are passed as NULL.
710 716 * The caller needs to know how much room to allow for these items.
711 717 * These values supply those sizes.
712 718 */
713 719 #define CONV_EXPN_FIELD_DEF_PREFIX_SIZE 2 /* Default is "[ " */
714 720 #define CONV_EXPN_FIELD_DEF_SEP_SIZE 1 /* Default is " " */
715 721 #define CONV_EXPN_FIELD_DEF_SUFFIX_SIZE 2 /* Default is " ]" */
716 722
717 723 /*
718 724 * conv_expn_field() requires a large number of inputs, many of which
719 725 * can be NULL to accept default behavior. An argument of the following
720 726 * type is used to supply them.
721 727 */
722 728 typedef struct {
723 729 char *buf; /* Buffer to receive generated string */
724 730 size_t bufsize; /* sizeof(buf) */
725 731 const char **lead_str; /* NULL, or array of pointers to strings to */
726 732 /* be output at the head of the list. */
727 733 /* Last entry must be NULL. */
728 734 Xword oflags; /* Bits for which output strings are desired */
729 735 Xword rflags; /* Bits for which a numeric value should be */
730 736 /* output if vdp does not provide str. */
731 737 /* Must be a proper subset of oflags */
732 738 const char *prefix; /* NULL, or string to prefix output with */
733 739 /* If NULL, "[ " is used. */
734 740 const char *sep; /* NULL, or string to separate output items */
735 741 /* with. If NULL, " " is used. */
736 742 const char *suffix; /* NULL, or string to suffix output with */
737 743 /* If NULL, " ]" is used. */
738 744 } CONV_EXPN_FIELD_ARG;
739 745
740 746 /*
741 747 * Callback function for conv_str_to_c_literal(). A user supplied function
742 748 * of this type is called by conv_str_to_c_literal() in order to dispatch
743 749 * the translated output characters.
744 750 *
745 751 * buf - Pointer to output text
746 752 * n - # of characters to output
747 753 * uvalue - User value argument to conv_str_to_c_literal(),
748 754 * passed through without interpretation.
749 755 */
750 756 typedef void Conv_str_to_c_literal_func_t(const void *ptr,
751 757 size_t size, void *uvalue);
752 758
753 759 /*
754 760 * Generic miscellaneous interfaces
755 761 */
756 762 extern uchar_t conv_check_native(char **, char **);
757 763 extern const char *conv_lddstub(int);
758 764 extern int conv_strproc_isspace(int);
759 765 extern char *conv_strproc_trim(char *);
760 766 extern Boolean conv_strproc_extract_value(char *, size_t, int,
761 767 const char **);
762 768 extern int conv_sys_eclass(void);
763 769 extern int conv_translate_c_esc(char **);
764 770
765 771 /*
766 772 * Generic core formatting and iteration functionality
767 773 */
768 774 extern conv_iter_ret_t _conv_iter_ds(conv_iter_osabi_t, Half,
769 775 const conv_ds_t **, conv_iter_cb_t, void *,
770 776 const char *);
771 777 extern conv_iter_ret_t _conv_iter_ds_msg(const conv_ds_msg_t *,
772 778 conv_iter_cb_t, void *, const char *);
773 779 extern conv_iter_ret_t _conv_iter_vd(const Val_desc *, conv_iter_cb_t,
774 780 void *, const char *);
775 781 extern conv_iter_ret_t _conv_iter_vd2(conv_iter_osabi_t, Half,
776 782 const Val_desc2 *, conv_iter_cb_t, void *,
777 783 const char *);
778 784 extern int conv_iter_strtol_init(const char *,
779 785 conv_strtol_uvalue_t *);
780 786 extern conv_iter_ret_t conv_iter_strtol(const char *, Conv_elfvalue_t, void *);
781 787 extern const char *_conv_map_ds(uchar_t, Half, Conv_elfvalue_t,
782 788 const conv_ds_t **, Conv_fmt_flags_t,
783 789 Conv_inv_buf_t *, const char *);
784 790
785 791
786 792 /*
787 793 * Generic formatting interfaces.
788 794 */
789 795 extern const char *conv_bnd_obj(uint_t, Conv_bnd_obj_buf_t *);
790 796 extern const char *conv_bnd_type(uint_t, Conv_bnd_type_buf_t *);
791 797 extern const char *conv_config_feat(int, Conv_config_feat_buf_t *);
792 798 extern const char *conv_config_obj(ushort_t, Conv_config_obj_buf_t *);
793 799 extern const char *conv_config_upm(const char *, const char *,
794 800 const char *, size_t);
795 801 extern const char *conv_cnote_auxv_af(Word, Conv_fmt_flags_t,
796 802 Conv_cnote_auxv_af_buf_t *);
797 803 extern const char *conv_cnote_auxv_type(Word, Conv_fmt_flags_t,
798 804 Conv_inv_buf_t *);
799 805 extern const char *conv_cnote_cc_content(Lword, Conv_fmt_flags_t,
800 806 Conv_cnote_cc_content_buf_t *);
801 807 extern const char *conv_cnote_errno(int, Conv_fmt_flags_t,
802 808 Conv_inv_buf_t *);
803 809 extern const char *conv_cnote_fault(Word, Conv_fmt_flags_t,
804 810 Conv_inv_buf_t *);
805 811 extern const char *conv_cnote_fltset(uint32_t *, int,
806 812 Conv_fmt_flags_t, Conv_cnote_fltset_buf_t *);
807 813 extern const char *conv_cnote_old_pr_flags(int, Conv_fmt_flags_t,
808 814 Conv_cnote_old_pr_flags_buf_t *);
809 815 extern const char *conv_cnote_pr_dmodel(Word, Conv_fmt_flags_t,
810 816 Conv_inv_buf_t *);
811 817 extern const char *conv_cnote_pr_flags(int, Conv_fmt_flags_t,
812 818 Conv_cnote_pr_flags_buf_t *);
813 819 extern const char *conv_cnote_proc_flag(int, Conv_fmt_flags_t,
814 820 Conv_cnote_proc_flag_buf_t *);
↓ open down ↓ |
477 lines elided |
↑ open up ↑ |
815 821 extern const char *conv_cnote_pr_regname(Half, int, Conv_fmt_flags_t,
816 822 Conv_inv_buf_t *inv_buf);
817 823 extern const char *conv_cnote_pr_stype(Word, Conv_fmt_flags_t,
818 824 Conv_inv_buf_t *);
819 825 extern const char *conv_cnote_pr_what(short, short, Conv_fmt_flags_t,
820 826 Conv_inv_buf_t *);
821 827 extern const char *conv_cnote_pr_why(short, Conv_fmt_flags_t,
822 828 Conv_inv_buf_t *);
823 829 extern const char *conv_cnote_priv(int, Conv_fmt_flags_t,
824 830 Conv_inv_buf_t *);
831 +extern const char *conv_psecflags(int, Conv_fmt_flags_t,
832 + Conv_secflags_buf_t *);
825 833 extern const char *conv_cnote_psetid(int, Conv_fmt_flags_t,
826 834 Conv_inv_buf_t *);
827 835 extern const char *conv_cnote_sa_flags(int, Conv_fmt_flags_t,
828 836 Conv_cnote_sa_flags_buf_t *);
829 837 extern const char *conv_cnote_signal(Word, Conv_fmt_flags_t,
830 838 Conv_inv_buf_t *);
831 839 extern const char *conv_cnote_si_code(Half, int, int, Conv_fmt_flags_t,
832 840 Conv_inv_buf_t *);
833 841 extern const char *conv_cnote_sigset(uint32_t *, int,
834 842 Conv_fmt_flags_t, Conv_cnote_sigset_buf_t *);
835 843 extern const char *conv_cnote_ss_flags(int, Conv_fmt_flags_t,
836 844 Conv_cnote_ss_flags_buf_t *);
837 845 extern const char *conv_cnote_syscall(Word, Conv_fmt_flags_t,
838 846 Conv_inv_buf_t *);
839 847 extern const char *conv_cnote_sysset(uint32_t *, int,
840 848 Conv_fmt_flags_t, Conv_cnote_sysset_buf_t *);
841 849 extern const char *conv_cnote_fileflags(uint32_t, Conv_fmt_flags_t,
842 850 char *, size_t);
843 851 extern const char *conv_cnote_filemode(uint32_t, Conv_fmt_flags_t,
844 852 char *, size_t);
845 853 extern const char *conv_cnote_type(Word, Conv_fmt_flags_t,
846 854 Conv_inv_buf_t *);
847 855 extern const char *conv_def_tag(Symref, Conv_inv_buf_t *);
848 856 extern const char *conv_demangle_name(const char *);
849 857 extern const char *conv_dl_flag(int, Conv_fmt_flags_t,
850 858 Conv_dl_flag_buf_t *);
851 859 extern const char *conv_dl_info(int);
852 860 extern const char *conv_dl_mode(int, int, Conv_dl_mode_buf_t *);
853 861 extern const char *conv_dwarf_cfa(uchar_t, Conv_fmt_flags_t,
854 862 Conv_inv_buf_t *);
855 863 extern const char *conv_dwarf_ehe(uint_t, Conv_dwarf_ehe_buf_t *);
856 864 extern const char *conv_dwarf_regname(Half, Word, Conv_fmt_flags_t,
857 865 int *, Conv_inv_buf_t *);
858 866 extern const char *conv_ehdr_abivers(uchar_t, Word, Conv_fmt_flags_t,
859 867 Conv_inv_buf_t *);
860 868 extern const char *conv_ehdr_class(uchar_t, Conv_fmt_flags_t,
861 869 Conv_inv_buf_t *);
862 870 extern const char *conv_ehdr_data(uchar_t, Conv_fmt_flags_t,
863 871 Conv_inv_buf_t *);
864 872 extern const char *conv_ehdr_flags(Half, Word, Conv_fmt_flags_t,
865 873 Conv_ehdr_flags_buf_t *);
866 874 extern const char *conv_ehdr_mach(Half, Conv_fmt_flags_t,
867 875 Conv_inv_buf_t *);
868 876 extern const char *conv_ehdr_osabi(uchar_t, Conv_fmt_flags_t,
869 877 Conv_inv_buf_t *);
870 878 extern const char *conv_ehdr_type(uchar_t, Half, Conv_fmt_flags_t,
871 879 Conv_inv_buf_t *);
872 880 extern const char *conv_ehdr_vers(Word, Conv_fmt_flags_t,
873 881 Conv_inv_buf_t *);
874 882 extern const char *conv_elfdata_type(Elf_Type, Conv_inv_buf_t *);
875 883 extern const char *conv_ent_flags(ec_flags_t, Conv_ent_flags_buf_t *);
876 884 extern const char *conv_ent_files_flags(Word, Conv_fmt_flags_t fmt_flags,
877 885 Conv_ent_files_flags_buf_t *);
878 886 extern const char *conv_la_activity(uint_t, Conv_fmt_flags_t,
879 887 Conv_inv_buf_t *);
880 888 extern const char *conv_la_bind(uint_t, Conv_la_bind_buf_t *);
881 889 extern const char *conv_la_search(uint_t, Conv_la_search_buf_t *);
882 890 extern const char *conv_la_symbind(uint_t, Conv_la_symbind_buf_t *);
883 891 extern const char *conv_grphdl_flags(uint_t, Conv_grphdl_flags_buf_t *);
884 892 extern const char *conv_grpdesc_flags(uint_t, Conv_grpdesc_flags_buf_t *);
885 893 extern Isa_desc *conv_isalist(void);
886 894 extern const char *conv_mapfile_version(Word, Conv_fmt_flags_t,
887 895 Conv_inv_buf_t *);
888 896 extern const char *conv_phdr_flags(uchar_t, Word, Conv_fmt_flags_t,
889 897 Conv_phdr_flags_buf_t *);
890 898 extern const char *conv_phdr_type(uchar_t, Half, Word, Conv_fmt_flags_t,
891 899 Conv_inv_buf_t *);
892 900 extern const char *conv_reject_desc(Rej_desc *, Conv_reject_desc_buf_t *,
893 901 Half mach);
894 902 extern const char *conv_reloc_type(Half, Word, Conv_fmt_flags_t,
895 903 Conv_inv_buf_t *);
896 904 extern const char *conv_reloc_type_static(Half, Word, Conv_fmt_flags_t);
897 905 extern const char *conv_reloc_386_type(Word, Conv_fmt_flags_t,
898 906 Conv_inv_buf_t *);
899 907 extern const char *conv_reloc_amd64_type(Word, Conv_fmt_flags_t,
900 908 Conv_inv_buf_t *);
901 909 extern const char *conv_reloc_SPARC_type(Word, Conv_fmt_flags_t,
902 910 Conv_inv_buf_t *);
903 911 extern const char *conv_sec_type(uchar_t, Half, Word, Conv_fmt_flags_t,
904 912 Conv_inv_buf_t *);
905 913 extern const char *conv_seg_flags(sg_flags_t, Conv_seg_flags_buf_t *);
906 914 extern void conv_str_to_c_literal(const char *buf, size_t n,
907 915 Conv_str_to_c_literal_func_t *cb_func,
908 916 void *uvalue);
909 917 extern const char *conv_sym_info_bind(uchar_t, Conv_fmt_flags_t,
910 918 Conv_inv_buf_t *);
911 919 extern const char *conv_sym_info_type(Half, uchar_t, Conv_fmt_flags_t,
912 920 Conv_inv_buf_t *);
913 921 extern const char *conv_sym_shndx(uchar_t, Half, Half, Conv_fmt_flags_t,
914 922 Conv_inv_buf_t *);
915 923 extern const char *conv_sym_other(uchar_t, Conv_inv_buf_t *);
916 924 extern const char *conv_sym_other_vis(uchar_t, Conv_fmt_flags_t,
917 925 Conv_inv_buf_t *);
918 926 extern const char *conv_syminfo_boundto(Half, Conv_fmt_flags_t,
919 927 Conv_inv_buf_t *);
920 928 extern const char *conv_syminfo_flags(Half, Conv_fmt_flags_t,
921 929 Conv_syminfo_flags_buf_t *);
922 930 extern const char *conv_time(struct timeval *, struct timeval *,
923 931 Conv_time_buf_t *);
924 932 extern Uts_desc *conv_uts(void);
925 933 extern const char *conv_ver_flags(Half, Conv_fmt_flags_t,
926 934 Conv_ver_flags_buf_t *);
927 935 extern const char *conv_ver_index(Versym, int, Conv_inv_buf_t *);
928 936
929 937
930 938 /*
931 939 * Generic iteration interfaces.
932 940 */
933 941 extern conv_iter_ret_t conv_iter_cap_tags(Conv_fmt_flags_t, conv_iter_cb_t,
934 942 void *);
935 943 extern conv_iter_ret_t conv_iter_cap_val_hw1(Half, Conv_fmt_flags_t,
936 944 conv_iter_cb_t, void *);
937 945 extern conv_iter_ret_t conv_iter_cap_val_hw2(Half, Conv_fmt_flags_t,
938 946 conv_iter_cb_t, void *);
939 947 extern conv_iter_ret_t conv_iter_cap_val_sf1(Conv_fmt_flags_t, conv_iter_cb_t,
940 948 void *);
941 949
942 950 extern conv_iter_ret_t conv_iter_dyn_feature1(Conv_fmt_flags_t, conv_iter_cb_t,
943 951 void *);
944 952 extern conv_iter_ret_t conv_iter_dyn_flag(Conv_fmt_flags_t, conv_iter_cb_t,
945 953 void *);
946 954 extern conv_iter_ret_t conv_iter_dyn_flag1(Conv_fmt_flags_t, conv_iter_cb_t,
947 955 void *);
948 956 extern conv_iter_ret_t conv_iter_dyn_posflag1(Conv_fmt_flags_t, conv_iter_cb_t,
949 957 void *);
950 958 extern conv_iter_ret_t conv_iter_dyn_tag(conv_iter_osabi_t, Half,
951 959 Conv_fmt_flags_t, conv_iter_cb_t, void *);
952 960
953 961 extern conv_iter_ret_t conv_iter_ehdr_abivers(conv_iter_osabi_t,
954 962 Conv_fmt_flags_t, conv_iter_cb_t, void *);
955 963 extern conv_iter_ret_t conv_iter_ehdr_class(Conv_fmt_flags_t, conv_iter_cb_t,
956 964 void *);
957 965 extern conv_iter_ret_t conv_iter_ehdr_data(Conv_fmt_flags_t, conv_iter_cb_t,
958 966 void *);
959 967 extern conv_iter_ret_t conv_iter_ehdr_eident(Conv_fmt_flags_t, conv_iter_cb_t,
960 968 void *);
961 969 extern conv_iter_ret_t conv_iter_ehdr_flags(Half, Conv_fmt_flags_t,
962 970 conv_iter_cb_t, void *);
963 971 extern conv_iter_ret_t conv_iter_ehdr_mach(Conv_fmt_flags_t, conv_iter_cb_t,
964 972 void *);
965 973 extern conv_iter_ret_t conv_iter_ehdr_osabi(Conv_fmt_flags_t, conv_iter_cb_t,
966 974 void *);
967 975 extern conv_iter_ret_t conv_iter_ehdr_type(conv_iter_osabi_t, Conv_fmt_flags_t,
968 976 conv_iter_cb_t, void *);
969 977 extern conv_iter_ret_t conv_iter_ehdr_vers(Conv_fmt_flags_t, conv_iter_cb_t,
970 978 void *);
971 979
972 980 extern conv_iter_ret_t conv_iter_phdr_flags(conv_iter_osabi_t,
973 981 Conv_fmt_flags_t, conv_iter_cb_t, void *);
974 982 extern conv_iter_ret_t conv_iter_phdr_type(conv_iter_osabi_t, Conv_fmt_flags_t,
975 983 conv_iter_cb_t, void *);
976 984
977 985 extern conv_iter_ret_t conv_iter_sec_flags(conv_iter_osabi_t, Half,
978 986 Conv_fmt_flags_t, conv_iter_cb_t, void *);
979 987 extern conv_iter_ret_t conv_iter_sec_symtab(conv_iter_osabi_t,
980 988 Conv_fmt_flags_t, conv_iter_cb_t, void *);
981 989 extern conv_iter_ret_t conv_iter_sec_type(conv_iter_osabi_t, Half,
982 990 Conv_fmt_flags_t, conv_iter_cb_t, void *);
983 991
984 992 extern conv_iter_ret_t conv_iter_sym_info_bind(Conv_fmt_flags_t,
985 993 conv_iter_cb_t, void *);
986 994 extern conv_iter_ret_t conv_iter_sym_other_vis(Conv_fmt_flags_t,
987 995 conv_iter_cb_t, void *);
988 996 extern conv_iter_ret_t conv_iter_sym_shndx(conv_iter_osabi_t, Half,
989 997 Conv_fmt_flags_t, conv_iter_cb_t, void *);
990 998 extern conv_iter_ret_t conv_iter_sym_info_type(Half, Conv_fmt_flags_t,
991 999 conv_iter_cb_t, void *);
992 1000
993 1001 extern conv_iter_ret_t conv_iter_syminfo_boundto(Conv_fmt_flags_t,
994 1002 conv_iter_cb_t, void *);
995 1003 extern conv_iter_ret_t conv_iter_syminfo_flags(Conv_fmt_flags_t,
996 1004 conv_iter_cb_t, void *);
997 1005
998 1006 /*
999 1007 * Define all class specific routines.
1000 1008 */
1001 1009 #if defined(_ELF64)
1002 1010 #define conv_cap_tag conv64_cap_tag
1003 1011 #define conv_cap_val conv64_cap_val
1004 1012 #define conv_cap_val_hw1 conv64_cap_val_hw1
1005 1013 #define conv_cap_val_hw2 conv64_cap_val_hw2
1006 1014 #define conv_cap_val_sf1 conv64_cap_val_sf1
1007 1015 #define conv_dyn_feature1 conv64_dyn_feature1
1008 1016 #define conv_dyn_flag1 conv64_dyn_flag1
1009 1017 #define conv_dyn_flag conv64_dyn_flag
1010 1018 #define conv_dyn_posflag1 conv64_dyn_posflag1
1011 1019 #define conv_dyn_tag conv64_dyn_tag
1012 1020 #define _conv_expn_field _conv64_expn_field
1013 1021 #define _conv_expn_field2 _conv64_expn_field2
1014 1022 #define conv_invalid_val conv64_invalid_val
1015 1023 #define conv_sec_flags conv64_sec_flags
1016 1024 #define conv_sec_linkinfo conv64_sec_linkinfo
1017 1025 #define conv_sym_value conv64_sym_value
1018 1026 #define conv_sym_SPARC_value conv64_sym_SPARC_value
1019 1027 #else
1020 1028 #define conv_cap_tag conv32_cap_tag
1021 1029 #define conv_cap_val conv32_cap_val
1022 1030 #define conv_cap_val_hw1 conv32_cap_val_hw1
1023 1031 #define conv_cap_val_hw2 conv32_cap_val_hw2
1024 1032 #define conv_cap_val_sf1 conv32_cap_val_sf1
1025 1033 #define conv_dyn_feature1 conv32_dyn_feature1
1026 1034 #define conv_dyn_flag1 conv32_dyn_flag1
1027 1035 #define conv_dyn_flag conv32_dyn_flag
1028 1036 #define conv_dyn_posflag1 conv32_dyn_posflag1
1029 1037 #define conv_dyn_tag conv32_dyn_tag
1030 1038 #define _conv_expn_field _conv32_expn_field
1031 1039 #define _conv_expn_field2 _conv32_expn_field2
1032 1040 #define conv_invalid_val conv32_invalid_val
1033 1041 #define conv_sec_flags conv32_sec_flags
1034 1042 #define conv_sec_linkinfo conv32_sec_linkinfo
1035 1043 #define conv_sym_value conv32_sym_value
1036 1044 #define conv_sym_SPARC_value conv32_sym_SPARC_value
1037 1045 #endif
1038 1046
1039 1047 /*
1040 1048 * ELFCLASS-specific core formatting functionality
1041 1049 */
1042 1050 extern int _conv_expn_field(CONV_EXPN_FIELD_ARG *,
1043 1051 const Val_desc *, Conv_fmt_flags_t, const char *);
1044 1052 extern int _conv_expn_field2(CONV_EXPN_FIELD_ARG *, uchar_t,
1045 1053 Half, const Val_desc2 *, Conv_fmt_flags_t,
1046 1054 const char *);
1047 1055 extern const char *conv_invalid_val(Conv_inv_buf_t *, Xword,
1048 1056 Conv_fmt_flags_t);
1049 1057
1050 1058 /*
1051 1059 * ELFCLASS-specific formatting interfaces.
1052 1060 */
1053 1061 extern const char *conv_cap_tag(Xword, Conv_fmt_flags_t,
1054 1062 Conv_inv_buf_t *);
1055 1063 extern const char *conv_cap_val(Xword, Xword, Half, Conv_fmt_flags_t,
1056 1064 Conv_cap_val_buf_t *);
1057 1065 extern const char *conv_cap_val_hw1(Xword, Half, Conv_fmt_flags_t,
1058 1066 Conv_cap_val_hw1_buf_t *);
1059 1067 extern const char *conv_cap_val_hw2(Xword, Half, Conv_fmt_flags_t,
1060 1068 Conv_cap_val_hw2_buf_t *);
1061 1069 extern const char *conv_cap_val_sf1(Xword, Half, Conv_fmt_flags_t,
1062 1070 Conv_cap_val_sf1_buf_t *);
1063 1071 extern const char *conv_dyn_flag1(Xword, Conv_fmt_flags_t,
1064 1072 Conv_dyn_flag1_buf_t *);
1065 1073 extern const char *conv_dyn_flag(Xword, Conv_fmt_flags_t,
1066 1074 Conv_dyn_flag_buf_t *);
1067 1075 extern const char *conv_dyn_posflag1(Xword, Conv_fmt_flags_t,
1068 1076 Conv_dyn_posflag1_buf_t *);
1069 1077 extern const char *conv_dyn_tag(Xword, uchar_t, Half, Conv_fmt_flags_t,
1070 1078 Conv_inv_buf_t *);
1071 1079 extern const char *conv_dyn_feature1(Xword, Conv_fmt_flags_t,
1072 1080 Conv_dyn_feature1_buf_t *);
1073 1081 extern const char *conv_sec_flags(uchar_t osabi, Half mach, Xword,
1074 1082 Conv_fmt_flags_t, Conv_sec_flags_buf_t *);
1075 1083 extern const char *conv_sec_linkinfo(Word, Xword, Conv_inv_buf_t *);
1076 1084 extern const char *conv_sym_value(Half, uchar_t, Addr, Conv_inv_buf_t *);
1077 1085 extern const char *conv_sym_SPARC_value(Addr, Conv_fmt_flags_t,
1078 1086 Conv_inv_buf_t *);
1079 1087
1080 1088 /*
1081 1089 * Define macros for _conv_XXX() routines that accept local_sgs_msg as the
1082 1090 * final argument. The macros hide that argument from the caller's view and
1083 1091 * supply the SGS message array for the file from which the macro is used
1084 1092 * in its place. This trick is used to allow these functions to access the
1085 1093 * message strings from any source file they are called from.
1086 1094 */
1087 1095 #define conv_expn_field(_arg, _vdp, _fmt_flags) \
1088 1096 _conv_expn_field(_arg, _vdp, _fmt_flags, MSG_SGS_LOCAL_ARRAY)
1089 1097
1090 1098 #define conv_expn_field2(_arg, _osabi, _mach, _vdp, _fmt_flags) \
1091 1099 _conv_expn_field2(_arg, _osabi, _mach, _vdp, _fmt_flags, \
1092 1100 MSG_SGS_LOCAL_ARRAY)
1093 1101
1094 1102 #define conv_iter_ds(_osabi, _mach, _dsp, _func, _uvalue) \
1095 1103 _conv_iter_ds(_osabi, _mach, _dsp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY)
1096 1104
1097 1105 #define conv_iter_vd(_vdp, _func, _uvalue) \
1098 1106 _conv_iter_vd(_vdp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY)
1099 1107
1100 1108 #define conv_iter_vd2(_osabi, _mach, _vdp, _func, _uvalue) \
1101 1109 _conv_iter_vd2(_osabi, _mach, _vdp, _func, _uvalue, MSG_SGS_LOCAL_ARRAY)
1102 1110
1103 1111 #define conv_map_ds(_osabi, _mach, _value, _dsp, _fmt_flags, _inv_buf) \
1104 1112 _conv_map_ds(_osabi, _mach, _value, _dsp, _fmt_flags, _inv_buf, \
1105 1113 MSG_SGS_LOCAL_ARRAY)
1106 1114
1107 1115
1108 1116 #ifdef __cplusplus
1109 1117 }
1110 1118 #endif
1111 1119
1112 1120 #endif /* _CONV_H */
↓ open down ↓ |
278 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX