xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/symbols_sparc_machelf.c (revision 9273:9a0603d78ad3)
1*9273SAli.Bahrami@Sun.COM /*
2*9273SAli.Bahrami@Sun.COM  * CDDL HEADER START
3*9273SAli.Bahrami@Sun.COM  *
4*9273SAli.Bahrami@Sun.COM  * The contents of this file are subject to the terms of the
5*9273SAli.Bahrami@Sun.COM  * Common Development and Distribution License (the "License").
6*9273SAli.Bahrami@Sun.COM  * You may not use this file except in compliance with the License.
7*9273SAli.Bahrami@Sun.COM  *
8*9273SAli.Bahrami@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9273SAli.Bahrami@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*9273SAli.Bahrami@Sun.COM  * See the License for the specific language governing permissions
11*9273SAli.Bahrami@Sun.COM  * and limitations under the License.
12*9273SAli.Bahrami@Sun.COM  *
13*9273SAli.Bahrami@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*9273SAli.Bahrami@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9273SAli.Bahrami@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*9273SAli.Bahrami@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*9273SAli.Bahrami@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9273SAli.Bahrami@Sun.COM  *
19*9273SAli.Bahrami@Sun.COM  * CDDL HEADER END
20*9273SAli.Bahrami@Sun.COM  */
21*9273SAli.Bahrami@Sun.COM 
22*9273SAli.Bahrami@Sun.COM /*
23*9273SAli.Bahrami@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*9273SAli.Bahrami@Sun.COM  * Use is subject to license terms.
25*9273SAli.Bahrami@Sun.COM  */
26*9273SAli.Bahrami@Sun.COM 
27*9273SAli.Bahrami@Sun.COM #include <stdio.h>
28*9273SAli.Bahrami@Sun.COM #include "_conv.h"
29*9273SAli.Bahrami@Sun.COM #include "symbols_sparc_msg.h"
30*9273SAli.Bahrami@Sun.COM #include <sys/elf_SPARC.h>
31*9273SAli.Bahrami@Sun.COM 
32*9273SAli.Bahrami@Sun.COM /*
33*9273SAli.Bahrami@Sun.COM  * SPARC specific register symbols
34*9273SAli.Bahrami@Sun.COM  */
35*9273SAli.Bahrami@Sun.COM 
36*9273SAli.Bahrami@Sun.COM static const Msg registers[] = { 0,
37*9273SAli.Bahrami@Sun.COM 	MSG_STO_REGISTERG1,	MSG_STO_REGISTERG2, 	MSG_STO_REGISTERG3,
38*9273SAli.Bahrami@Sun.COM 	MSG_STO_REGISTERG4,	MSG_STO_REGISTERG5, 	MSG_STO_REGISTERG6,
39*9273SAli.Bahrami@Sun.COM 	MSG_STO_REGISTERG7
40*9273SAli.Bahrami@Sun.COM };
41*9273SAli.Bahrami@Sun.COM 
42*9273SAli.Bahrami@Sun.COM const char *
conv_sym_SPARC_value(Addr val,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)43*9273SAli.Bahrami@Sun.COM conv_sym_SPARC_value(Addr val, Conv_fmt_flags_t fmt_flags,
44*9273SAli.Bahrami@Sun.COM     Conv_inv_buf_t *inv_buf)
45*9273SAli.Bahrami@Sun.COM {
46*9273SAli.Bahrami@Sun.COM 	if ((val < STO_SPARC_REGISTER_G1) || (val > STO_SPARC_REGISTER_G7)) {
47*9273SAli.Bahrami@Sun.COM 		return (conv_invalid_val(inv_buf, val, fmt_flags));
48*9273SAli.Bahrami@Sun.COM 	} else {
49*9273SAli.Bahrami@Sun.COM 		return (MSG_ORIG(registers[val]));
50*9273SAli.Bahrami@Sun.COM 	}
51*9273SAli.Bahrami@Sun.COM }
52