1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
/* Register names and numbers for mips DWARF.
Copyright (C) 2006 Red Hat, Inc.
Copyright (C) 2024 CIP United Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
it under the terms of either
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version
or both in parallel, as here.
elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <assert.h>
#include <dwarf.h>
#include <string.h>
#define BACKEND mips_
#include "libebl_CPU.h"
#include <system.h>
ssize_t
mips_register_info (Ebl *ebl __attribute__ ((unused)),
int regno, char *name, size_t namelen,
const char **prefix, const char **setname,
int *bits, int *type)
{
if (name == NULL)
return 72;
if (regno < 0 || regno > 71 || namelen < 4)
return -1;
*prefix = "$";
if (regno < 38)
{
*setname = "integer";
*type = DW_ATE_signed;
*bits = 32;
}
else
{
*setname = "FPU";
*type = DW_ATE_float;
*bits = 64;
}
if (regno < 32)
{
if (regno < 10)
{
name[0] = regno + '0';
namelen = 1;
}
else
{
name[0] = (regno / 10) + '0';
name[1] = (regno % 10) + '0';
namelen = 2;
}
if (regno == 28 || regno == 29 || regno == 31)
*type = DW_ATE_address;
}
else if (regno == 32)
{
return stpcpy (name, "lo") + 1 - name;
}
else if (regno == 33)
{
return stpcpy (name, "hi") + 1 - name;
}
else if (regno == 34)
{
return stpcpy (name, "pc") + 1 - name;
}
else if (regno == 35)
{
*type = DW_ATE_address;
return stpcpy (name, "bad") + 1 - name;
}
else if (regno == 36)
{
return stpcpy (name, "sr") + 1 - name;
}
else if (regno == 37)
{
*type = DW_ATE_address;
return stpcpy (name, "cause") + 1 - name;
}
else if (regno < 70)
{
name[0] = 'f';
if (regno < 38 + 10)
{
name[1] = (regno - 38) + '0';
namelen = 2;
}
else
{
name[1] = (regno - 38) / 10 + '0';
name[2] = (regno - 38) % 10 + '0';
namelen = 3;
}
}
else if (regno == 70)
{
return stpcpy (name, "fsr") + 1 - name;
}
else if (regno == 71)
{
return stpcpy (name, "fir") + 1 - name;
}
name[namelen++] = '\0';
return namelen;
}
|