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 /* 23*9273SAli.Bahrami@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 241618Srie * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef __CONV_DOT_H 280Sstevel@tonic-gate #define __CONV_DOT_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate /* 310Sstevel@tonic-gate * Local include file for conversion library. 320Sstevel@tonic-gate */ 330Sstevel@tonic-gate #include <conv.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate /* 401618Srie * Some format strings differ depending on whether they are used for 32-bit 411618Srie * or 64-bit values. 420Sstevel@tonic-gate */ 431618Srie #if defined(_ELF64) 441618Srie #define MSG_GBL_FMT_DEC MSG_GBL_FMT_DEC_64 451618Srie #define MSG_GBL_FMT_DECS MSG_GBL_FMT_DECS_64 461618Srie #define MSG_GBL_FMT_HEX MSG_GBL_FMT_HEX_64 471618Srie #define MSG_GBL_FMT_HEXS MSG_GBL_FMT_HEXS_64 481618Srie 491618Srie #define MSG_SYM_FMT_VAL MSG_SYM_FMT_VAL_64 501618Srie #else 511618Srie #define MSG_GBL_FMT_DEC MSG_GBL_FMT_DEC_32 521618Srie #define MSG_GBL_FMT_DECS MSG_GBL_FMT_DECS_32 531618Srie #define MSG_GBL_FMT_HEX MSG_GBL_FMT_HEX_32 541618Srie #define MSG_GBL_FMT_HEXS MSG_GBL_FMT_HEXS_32 551618Srie 561618Srie #define MSG_SYM_FMT_VAL MSG_SYM_FMT_VAL_32 571618Srie #endif 580Sstevel@tonic-gate 591976Sab196087 601976Sab196087 /* 61*9273SAli.Bahrami@Sun.COM * There are routines in libconv that are built once for each ELFCLASS 62*9273SAli.Bahrami@Sun.COM * because they are formatting Xword values. However, all ELF constants 63*9273SAli.Bahrami@Sun.COM * lie in 32-bit ranges, due to the need be usable for ELFCLASS32. Hence, 64*9273SAli.Bahrami@Sun.COM * the value of the ELFCLASS64 support here is purely to detect unexpected 65*9273SAli.Bahrami@Sun.COM * garbage values above the 32-bit range. 661976Sab196087 * 67*9273SAli.Bahrami@Sun.COM * The CONV_XWORD_64TEST() macro tests the upper half of an ELFCLASS64 Xword, 68*9273SAli.Bahrami@Sun.COM * and formats the value in hex if non-zero bits are seen. For ELFCLASS32, 69*9273SAli.Bahrami@Sun.COM * it is a no-op. 701976Sab196087 */ 71*9273SAli.Bahrami@Sun.COM #ifdef _ELF64 72*9273SAli.Bahrami@Sun.COM #define CONV_XWORD_64TEST(_value, _fmt_flags, _inv_buf) \ 73*9273SAli.Bahrami@Sun.COM if (_value & 0xffffffff00000000) \ 74*9273SAli.Bahrami@Sun.COM return (conv_invalid_val(_inv_buf, _value, _fmt_flags)) 75*9273SAli.Bahrami@Sun.COM #else 76*9273SAli.Bahrami@Sun.COM #define CONV_XWORD_64TEST(_value, _fmt_flags, _inv_buf) 77*9273SAli.Bahrami@Sun.COM #endif 78*9273SAli.Bahrami@Sun.COM 791976Sab196087 801976Sab196087 /* # of elements in an array */ 811976Sab196087 #define ARRAY_NELTS(arr) (sizeof (arr) / sizeof (*arr)) 821976Sab196087 83*9273SAli.Bahrami@Sun.COM /* 84*9273SAli.Bahrami@Sun.COM * Functions intended for use inter-file, within libconv only 85*9273SAli.Bahrami@Sun.COM */ 86*9273SAli.Bahrami@Sun.COM extern const conv_ds_t **conv_cap_tag_strings(Conv_fmt_flags_t); 87*9273SAli.Bahrami@Sun.COM extern const Val_desc *conv_dyn_feature1_strings(Conv_fmt_flags_t); 88*9273SAli.Bahrami@Sun.COM extern const Val_desc *conv_dyn_flag_strings(Conv_fmt_flags_t); 89*9273SAli.Bahrami@Sun.COM extern const Val_desc *conv_dyn_flag1_strings(Conv_fmt_flags_t); 90*9273SAli.Bahrami@Sun.COM extern const Val_desc *conv_dyn_posflag1_strings(Conv_fmt_flags_t); 91*9273SAli.Bahrami@Sun.COM extern const conv_ds_t **conv_dyn_tag_strings(conv_iter_osabi_t, Half, 92*9273SAli.Bahrami@Sun.COM Conv_fmt_flags_t); 93*9273SAli.Bahrami@Sun.COM extern const Val_desc2 *conv_sec_flags_strings(Conv_fmt_flags_t); 941976Sab196087 951976Sab196087 960Sstevel@tonic-gate #ifdef __cplusplus 970Sstevel@tonic-gate } 980Sstevel@tonic-gate #endif 990Sstevel@tonic-gate 1000Sstevel@tonic-gate #endif /* __CONV_DOT_H */ 101