|
Packit |
032894 |
/* Object attribute tags for SPARC.
|
|
Packit |
032894 |
Copyright (C) 2015 Oracle, Inc.
|
|
Packit |
032894 |
This file is part of elfutils.
|
|
Packit |
032894 |
|
|
Packit |
032894 |
This file is free software; you can redistribute it and/or modify
|
|
Packit |
032894 |
it under the terms of either
|
|
Packit |
032894 |
|
|
Packit |
032894 |
* the GNU Lesser General Public License as published by the Free
|
|
Packit |
032894 |
Software Foundation; either version 3 of the License, or (at
|
|
Packit |
032894 |
your option) any later version
|
|
Packit |
032894 |
|
|
Packit |
032894 |
or
|
|
Packit |
032894 |
|
|
Packit |
032894 |
* the GNU General Public License as published by the Free
|
|
Packit |
032894 |
Software Foundation; either version 2 of the License, or (at
|
|
Packit |
032894 |
your option) any later version
|
|
Packit |
032894 |
|
|
Packit |
032894 |
or both in parallel, as here.
|
|
Packit |
032894 |
|
|
Packit |
032894 |
elfutils is distributed in the hope that it will be useful, but
|
|
Packit |
032894 |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
032894 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
032894 |
General Public License for more details.
|
|
Packit |
032894 |
|
|
Packit |
032894 |
You should have received copies of the GNU General Public License and
|
|
Packit |
032894 |
the GNU Lesser General Public License along with this program. If
|
|
Packit |
032894 |
not, see <http://www.gnu.org/licenses/>. */
|
|
Packit |
032894 |
|
|
Packit |
032894 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
032894 |
# include <config.h>
|
|
Packit |
032894 |
#endif
|
|
Packit |
032894 |
|
|
Packit |
032894 |
#include <string.h>
|
|
Packit |
032894 |
#include <dwarf.h>
|
|
Packit |
032894 |
|
|
Packit |
032894 |
#define BACKEND sparc_
|
|
Packit |
032894 |
#include "libebl_CPU.h"
|
|
Packit |
032894 |
|
|
Packit |
032894 |
bool
|
|
Packit |
032894 |
sparc_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
|
|
Packit |
032894 |
const char *vendor, int tag, uint64_t value,
|
|
Packit |
032894 |
const char **tag_name, const char **value_name)
|
|
Packit |
032894 |
{
|
|
Packit |
032894 |
static const char *hwcaps[32] =
|
|
Packit |
032894 |
{
|
|
Packit |
032894 |
"mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",
|
|
Packit |
032894 |
"asi_blk_init", "fmaf", "vis3", "hpc", "random", "trans",
|
|
Packit |
032894 |
"fjfmau", "ima", "asi_cache_sparing", "aes", "des", "kasumi",
|
|
Packit |
032894 |
"camellia", "md5", "sha1", "sha256", "sha512", "mpmul", "mont",
|
|
Packit |
032894 |
"pause", "cbcond", "crc32c", "resv30", "resv31"
|
|
Packit |
032894 |
};
|
|
Packit |
032894 |
|
|
Packit |
032894 |
|
|
Packit |
032894 |
static const char *hwcaps2[32] =
|
|
Packit |
032894 |
{
|
|
Packit |
032894 |
"fjathplus", "vis3b", "adp", "sparc5", "mwait", "xmpmul", "xmont",
|
|
Packit |
032894 |
"nsec", "resv8", "resv9" , "resv10", "resv11", "fjathhpc", "fjdes",
|
|
Packit |
032894 |
"fjaes", "resv15", "resv16", "resv17", "resv18", "resv19", "resv20",
|
|
Packit |
032894 |
"resv21", "resv22", "resv23", "resv24", "resv25", "resv26", "resv27",
|
|
Packit |
032894 |
"resv28", "resv29", "resv30", "resv31",
|
|
Packit |
032894 |
};
|
|
Packit |
032894 |
|
|
Packit |
032894 |
/* NAME should be big enough to hold any possible comma-separated
|
|
Packit |
032894 |
list (no repetitions allowed) of attribute names from one of the
|
|
Packit |
032894 |
arrays above. */
|
|
Packit |
032894 |
static char name[32*17+32+1];
|
|
Packit |
032894 |
name[0] = '\0';
|
|
Packit |
032894 |
|
|
Packit |
032894 |
if (!strcmp (vendor, "gnu"))
|
|
Packit |
032894 |
switch (tag)
|
|
Packit |
032894 |
{
|
|
Packit |
032894 |
case 4:
|
|
Packit |
032894 |
case 8:
|
|
Packit |
032894 |
{
|
|
Packit |
032894 |
const char **caps;
|
|
Packit |
032894 |
int cap;
|
|
Packit |
032894 |
|
|
Packit |
032894 |
if (tag == 4)
|
|
Packit |
032894 |
{
|
|
Packit |
032894 |
*tag_name = "GNU_Sparc_HWCAPS";
|
|
Packit |
032894 |
caps = hwcaps;
|
|
Packit |
032894 |
}
|
|
Packit |
032894 |
else
|
|
Packit |
032894 |
{
|
|
Packit |
032894 |
*tag_name = "GNU_Sparc_HWCAPS2";
|
|
Packit |
032894 |
caps = hwcaps2;
|
|
Packit |
032894 |
}
|
|
Packit |
032894 |
|
|
Packit |
032894 |
char *s = name;
|
|
Packit |
032894 |
for (cap = 0; cap < 32; cap++)
|
|
Packit |
032894 |
if (value & (1U << cap))
|
|
Packit |
032894 |
{
|
|
Packit |
032894 |
if (*s != '\0')
|
|
Packit |
032894 |
s = strcat (s, ",");
|
|
Packit |
032894 |
s = strcat (s, caps[cap]);
|
|
Packit |
032894 |
}
|
|
Packit |
032894 |
|
|
Packit |
032894 |
*value_name = s;
|
|
Packit |
032894 |
return true;
|
|
Packit |
032894 |
}
|
|
Packit |
032894 |
}
|
|
Packit |
032894 |
|
|
Packit |
032894 |
return false;
|
|
Packit |
032894 |
}
|
|
Packit |
032894 |
|