4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
34 Dbg_cap_candidate(Lm_list
*lml
, const char *name
)
36 if (DBG_NOTCLASS(DBG_C_CAP
| DBG_C_FILES
))
39 dbg_print(lml
, MSG_INTL(MSG_CAP_CANDIDATE
), name
);
43 Dbg_cap_filter(Lm_list
*lml
, const char *dir
, Rt_map
*flmp
)
45 if (DBG_NOTCLASS(DBG_C_CAP
| DBG_C_FILES
))
48 Dbg_util_nl(lml
, DBG_NL_STD
);
50 dbg_print(lml
, MSG_INTL(MSG_CAP_FILTER_1
), dir
, NAME(flmp
));
52 dbg_print(lml
, MSG_INTL(MSG_CAP_FILTER_2
), dir
);
56 Dbg_cap_identical(Lm_list
*lml
, const char *file1
, const char *file2
)
58 if (DBG_NOTCLASS(DBG_C_CAP
| DBG_C_FILES
))
61 dbg_print(lml
, MSG_INTL(MSG_CAP_IDENTICAL
), file1
, file2
);
65 Dbg_cap_val(Lm_list
*lml
, Syscapset
*sys
, Syscapset
*alt
, Half mach
)
67 Conv_cap_val_buf_t cap_val_buf
;
69 if ((sys
->sc_plat
== NULL
) && (sys
->sc_mach
== NULL
) &&
70 (sys
->sc_hw_2
== 0) && (sys
->sc_hw_1
== 0) &&
74 Dbg_util_nl(lml
, DBG_NL_FRC
);
77 * Print any capabilities in precedence order.
80 dbg_print(lml
, MSG_INTL(MSG_CAP_SYS_PLAT
), sys
->sc_plat
);
83 dbg_print(lml
, MSG_INTL(MSG_CAP_SYS_MACH
), sys
->sc_mach
);
86 dbg_print(lml
, MSG_INTL(MSG_CAP_SYS_HW_2
),
87 conv_cap_val_hw2(sys
->sc_hw_2
, mach
, 0,
88 &cap_val_buf
.cap_val_hw2_buf
));
91 dbg_print(lml
, MSG_INTL(MSG_CAP_SYS_HW_1
),
92 conv_cap_val_hw1(sys
->sc_hw_1
, mach
, 0,
93 &cap_val_buf
.cap_val_hw1_buf
));
96 dbg_print(lml
, MSG_INTL(MSG_CAP_SYS_SF_1
),
97 conv_cap_val_sf1(sys
->sc_sf_1
, mach
, 0,
98 &cap_val_buf
.cap_val_sf1_buf
));
102 Dbg_util_nl(lml
, DBG_NL_FRC
);
103 if (alt
->sc_plat
!= sys
->sc_plat
) {
104 dbg_print(lml
, MSG_INTL(MSG_CAP_ALT_PLAT
),
107 if (alt
->sc_mach
!= sys
->sc_mach
) {
108 dbg_print(lml
, MSG_INTL(MSG_CAP_ALT_MACH
),
111 if (alt
->sc_hw_2
!= sys
->sc_hw_2
) {
112 dbg_print(lml
, MSG_INTL(MSG_CAP_ALT_HW_2
),
113 conv_cap_val_hw2(alt
->sc_hw_2
, mach
, 0,
114 &cap_val_buf
.cap_val_hw2_buf
));
116 if (alt
->sc_hw_1
!= sys
->sc_hw_1
) {
117 dbg_print(lml
, MSG_INTL(MSG_CAP_ALT_HW_1
),
118 conv_cap_val_hw1(alt
->sc_hw_1
, mach
, 0,
119 &cap_val_buf
.cap_val_hw1_buf
));
121 if (alt
->sc_sf_1
!= sys
->sc_sf_1
) {
122 dbg_print(lml
, MSG_INTL(MSG_CAP_ALT_SF_1
),
123 conv_cap_val_sf1(alt
->sc_sf_1
, mach
, 0,
124 &cap_val_buf
.cap_val_sf1_buf
));
128 Dbg_util_nl(lml
, DBG_NL_FRC
);
132 * This version takes a pointer to a Capmask, and will report the exclusion
133 * bits if they exist.
136 Dbg_cap_ptr_entry(Lm_list
*lml
, dbg_state_t dbg_state
, Xword tag
,
139 Conv_inv_buf_t inv_buf
;
141 if (DBG_NOTCLASS(DBG_C_CAP
))
144 dbg_print(lml
, MSG_INTL(MSG_CAP_SEC_ENTRY
), Dbg_state_str(dbg_state
),
145 conv_cap_tag(tag
, 0, &inv_buf
), ptr
);
149 * This version takes a pointer to a CapMask, and will report the exclusion
150 * bits if they exist.
153 Dbg_cap_val_entry(Lm_list
*lml
, dbg_state_t dbg_state
, Xword tag
, Xword val
,
156 Conv_inv_buf_t inv_buf
;
157 Conv_cap_val_buf_t cap_val_buf
;
159 if (DBG_NOTCLASS(DBG_C_CAP
))
162 dbg_print(lml
, MSG_INTL(MSG_CAP_SEC_ENTRY
), Dbg_state_str(dbg_state
),
163 conv_cap_tag(tag
, 0, &inv_buf
), conv_cap_val(tag
, val
, mach
, 0,
168 Dbg_cap_sec_title(Lm_list
*lml
, const char *name
)
170 if (DBG_NOTCLASS(DBG_C_CAP
))
173 Dbg_util_nl(lml
, DBG_NL_STD
);
174 dbg_print(lml
, MSG_INTL(MSG_CAP_SEC_TITLE
), name
);
178 Dbg_cap_mapfile_title(Lm_list
*lml
, Lineno lineno
)
180 if (DBG_NOTCLASS(DBG_C_MAP
| DBG_C_CAP
))
183 dbg_print(lml
, MSG_INTL(MSG_MAP_CAP
), EC_LINENO(lineno
));
187 Dbg_cap_id(Lm_list
*lml
, Lineno lineno
, const char *oid
, const char *nid
)
189 Dbg_cap_mapfile_title(lml
, lineno
);
190 Dbg_cap_ptr_entry(lml
, DBG_STATE_CURRENT
, CA_SUNW_ID
, oid
);
191 Dbg_cap_ptr_entry(lml
, DBG_STATE_NEW
, CA_SUNW_ID
, nid
);
192 Dbg_cap_ptr_entry(lml
, DBG_STATE_RESOLVED
, CA_SUNW_ID
, nid
);
196 Dbg_cap_post_title(Lm_list
*lml
, int *title
)
198 if (DBG_NOTCLASS(DBG_C_CAP
))
201 Dbg_util_nl(lml
, DBG_NL_STD
);
203 dbg_print(lml
, MSG_INTL(MSG_CAP_POST_TITLE
));
207 Elf_cap_title(Lm_list
*lml
)
209 dbg_print(lml
, MSG_INTL(MSG_CAP_ELF_TITLE
));
213 Elf_cap_entry(Lm_list
*lml
, Cap
*cap
, int ndx
, const char *str
, size_t str_size
,
216 Conv_inv_buf_t inv_buf
;
217 Conv_cap_val_buf_t cap_val_buf
;
218 char index
[INDEX_STR_SIZE
];
220 (void) snprintf(index
, INDEX_STR_SIZE
, MSG_ORIG(MSG_FMT_INDEX
), ndx
);
222 switch (cap
->c_tag
) {
226 /* If offset is in range, format as a string */
227 if (str
&& (cap
->c_un
.c_ptr
< str_size
)) {
228 str
+= cap
->c_un
.c_ptr
;
233 /* Format numerically */
234 str
= conv_cap_val(cap
->c_tag
, cap
->c_un
.c_val
, mach
, 0,
238 dbg_print(lml
, MSG_INTL(MSG_CAP_ELF_ENTRY
), index
,
239 conv_cap_tag(cap
->c_tag
, 0, &inv_buf
), str
);