4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami/*
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * CDDL HEADER START
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami *
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * The contents of this file are subject to the terms of the
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * Common Development and Distribution License (the "License").
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * You may not use this file except in compliance with the License.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami *
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * or http://www.opensolaris.org/os/licensing.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * See the License for the specific language governing permissions
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * and limitations under the License.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami *
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * When distributing Covered Code, include this CDDL HEADER in each
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * If applicable, add the following below this CDDL HEADER, with the
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * fields enclosed by brackets "[]" replaced with your own identifying
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * information: Portions Copyright [yyyy] [name of copyright owner]
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami *
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * CDDL HEADER END
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami/*
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * Use is subject to license terms.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami/*
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami * String conversion routines for symbol attributes.
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami */
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami#include <stdio.h>
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami#include <_machelf.h>
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami#include <sys/elf_SPARC.h>
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami#include <sys/elf_amd64.h>
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami#include "_conv.h"
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami#include "symbols_msg.h"
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahramiconst char *
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahramiconv_sym_value(Half mach, uchar_t type, Addr value, Conv_inv_buf_t *inv_buf)
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami{
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami if (((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami (mach == EM_SPARCV9)) && (type == STT_SPARC_REGISTER))
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (conv_sym_SPARC_value(value, 0, inv_buf));
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami (void) snprintf(inv_buf->buf, sizeof (inv_buf->buf),
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami MSG_ORIG(MSG_SYM_FMT_VAL), EC_ADDR(value));
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami return (inv_buf->buf);
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahrami}