xref: /titanic_41/usr/src/cmd/sgs/liblddbg/common/cap.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include	"_synonyms.h"
29 
30 #include	"msg.h"
31 #include	"_debug.h"
32 #include	"libld.h"
33 
34 #if	!defined(_ELF64)
35 
36 void
37 Dbg_cap_hw_candidate(const char *name)
38 {
39 	if (DBG_NOTCLASS(DBG_CAP | DBG_FILES))
40 		return;
41 
42 	dbg_print(MSG_INTL(MSG_CAP_HW_CANDIDATE), name);
43 }
44 
45 void
46 Dbg_cap_hw_filter(const char *dir, const char *filtee)
47 {
48 	if (DBG_NOTCLASS(DBG_CAP | DBG_FILES))
49 		return;
50 
51 	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
52 	if (filtee)
53 		dbg_print(MSG_INTL(MSG_CAP_HWFILTR_1), dir, filtee);
54 	else
55 		dbg_print(MSG_INTL(MSG_CAP_HWFILTR_2), dir);
56 }
57 
58 void
59 Dbg_cap_sec_title(const char *file)
60 {
61 	if (DBG_NOTCLASS(DBG_CAP))
62 		return;
63 
64 	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
65 	dbg_print(MSG_INTL(MSG_CAP_SEC_TITLE), file);
66 }
67 
68 void
69 Gelf_cap_title(void)
70 {
71 	dbg_print(MSG_INTL(MSG_CAP_ELF_TITLE));
72 }
73 
74 void
75 Gelf_cap_print(GElf_Cap * cap, int ndx, Half mach)
76 {
77 	char	index[10];
78 
79 	(void) sprintf(index, MSG_ORIG(MSG_FMT_INDEX), ndx);
80 	dbg_print(MSG_INTL(MSG_CAP_ELF_ENTRY), index,
81 	    conv_captag_str(cap->c_tag),
82 	    conv_capval_str(cap->c_tag, cap->c_un.c_val, mach));
83 }
84 
85 #endif
86 
87 static const Msg captype[] = {
88 	MSG_STR_INITIAL,		/* MSG_INTL(MSG_STR_INITIAL) */
89 	MSG_STR_IGNORE,			/* MSG_INTL(MSG_STR_IGNORE) */
90 	MSG_STR_OLD,			/* MSG_INTL(MSG_STR_OLD) */
91 	MSG_STR_NEW,			/* MSG_INTL(MSG_STR_NEW) */
92 	MSG_STR_RESOLVED		/* MSG_INTL(MSG_STR_RESOLVED) */
93 };
94 
95 void
96 Dbg_cap_sec_entry(uint_t type, Xword tag, Xword val, Half mach)
97 {
98 	if (DBG_NOTCLASS(DBG_CAP))
99 		return;
100 
101 	dbg_print(MSG_INTL(MSG_CAP_SEC_ENTRY), MSG_INTL(captype[type]),
102 	    conv_captag_str(tag), conv_capval_str(tag, val, mach));
103 }
104 
105 void
106 Dbg_cap_mapfile(Xword tag, Xword val, Half mach)
107 {
108 	if (DBG_NOTCLASS(DBG_MAP | DBG_CAP))
109 		return;
110 
111 	dbg_print(MSG_INTL(MSG_MAP_CAP));
112 	Dbg_cap_sec_entry(DBG_CAP_INITIAL, tag, val, mach);
113 }
114 
115 void
116 Dbg_cap_hw_1(Xword val, Half mach)
117 {
118 	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
119 	dbg_print(MSG_INTL(MSG_CAP_HW_1), conv_hwcap_1_str(val, mach));
120 	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
121 }
122