/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <msg.h>
#include <_elfdump.h>
#include <struct_layout.h>
#include <conv.h>
/*
* Functions for extracting and formatting numeric values from
* structure data.
*/
/*
* Extract the integral field into the value union given and
* perform any necessary byte swapping to make the result readable
* on the elfdump host.
*/
void
{
/* Copy the value bytes into our union */
fdesc->slf_eltlen);
/* Do byte swapping as necessary */
if (do_swap) {
switch (fdesc->slf_eltlen) {
case 2:
break;
case 4:
break;
case 8:
break;
}
}
}
/*
* Extract the given integer field, and return its value, cast
* to Word. Note that this operation must not be used on values
* that can be negative, or larger than 32-bits, as information
* can be lost.
*/
{
sl_data_t v;
/* Extract the value from the raw data */
switch (fdesc->slf_eltlen) {
case 1:
case 2:
case 4:
case 8:
}
} else {
switch (fdesc->slf_eltlen) {
case 1:
case 2:
case 4:
case 8:
}
}
/* This should not be reached */
assert(0);
return (0);
}
/*
* Extract the given integer field, and return its value, cast
* to Lword. Note that this operation must not be used on values
* that can be negative, as information can be lost.
*/
{
sl_data_t v;
/* Extract the value from the raw data */
switch (fdesc->slf_eltlen) {
case 1:
case 2:
case 4:
case 8:
}
} else {
switch (fdesc->slf_eltlen) {
case 1:
case 2:
case 4:
case 8:
}
}
/* This should not be reached */
assert(0);
return (0);
}
/*
* Extract the given integer field, and return its value, cast
* to int32_t. Note that this operation must not be used on unsigned
* values larger than 31-bits, or on signed values larger than 32-bits,
* as information can be lost.
*/
{
sl_data_t v;
/* Extract the value from the raw data */
switch (fdesc->slf_eltlen) {
case 1:
case 2:
case 4:
case 8:
}
} else {
switch (fdesc->slf_eltlen) {
case 1:
case 2:
case 4:
case 8:
}
}
/* This should not be reached */
assert(0);
return (0);
}
/*
* Extract the integral field and format it into the supplied buffer.
*/
const char *
{
/*
* These static arrays are indexed by [fdesc->slf_sign][fmt_type]
* to get a format string to use for the specified combination.
*/
{
},
{
}
};
{
},
{
}
};
{
},
{
}
};
{
},
{
}
};
sl_data_t v;
/* Extract the value from the raw data */
/*
* Format into the buffer. Note that we depend on the signed
* and unsigned versions of each width being equivalent as long
* as the format specifies the proper formatting.
*/
switch (fdesc->slf_eltlen) {
case 1:
break;
case 2:
break;
case 4:
break;
case 8:
break;
}
return (buf);
}
/*
* Return structure layout definition for the given machine type,
* or NULL if the specified machine is not supported.
*/
const sl_arch_layout_t *
{
switch (mach) {
case EM_386:
return (struct_layout_i386());
case EM_AMD64:
return (struct_layout_amd64());
case EM_SPARC:
case EM_SPARC32PLUS:
return (struct_layout_sparc());
case EM_SPARCV9:
return (struct_layout_sparcv9());
}
/* Unsupported architecture */
return (NULL);
}