summaryrefslogtreecommitdiff
path: root/backends/sparc_regs.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2006-10-10 00:25:21 +0000
committerRoland McGrath <roland@redhat.com>2006-10-10 00:25:21 +0000
commitc373d850ec9ca342f4c71d5e287c8d8bf0723cd6 (patch)
treec8f9ea814866cdfb30ac9506ccddbc8629ebe345 /backends/sparc_regs.c
parent1dee360aa30fecd20f403f98fd1cb9e543afcca7 (diff)
downloadelfutils-c373d850ec9ca342f4c71d5e287c8d8bf0723cd6.tar.gz
2006-10-09 Roland McGrath <roland@redhat.com>
* ia64_symbol.c (ia64_reloc_simple_type): Treat SECREL types as simple.
Diffstat (limited to 'backends/sparc_regs.c')
-rw-r--r--backends/sparc_regs.c50
1 files changed, 41 insertions, 9 deletions
diff --git a/backends/sparc_regs.c b/backends/sparc_regs.c
index 820878e1..b3e9e201 100644
--- a/backends/sparc_regs.c
+++ b/backends/sparc_regs.c
@@ -28,45 +28,77 @@
#endif
#include <string.h>
+#include <dwarf.h>
#define BACKEND sparc_
#include "libebl_CPU.h"
ssize_t
-sparc_register_name (Ebl *ebl,
+sparc_register_info (Ebl *ebl,
int regno, char *name, size_t namelen,
- const char **prefix, const char **setname)
+ const char **prefix, const char **setname,
+ int *bits, int *type)
{
- const int nfp = ebl->machine == EM_SPARC ? 32 : 64;
+ const int nfp = 32 + (ebl->machine == EM_SPARC ? 0 : 16);
+ const int nspec = ebl->machine == EM_SPARC ? 8 : 6;
if (name == NULL)
- return 32 + nfp;
+ return 32 + nfp + nspec;
- if (regno < 0 || regno >= 32 + nfp || namelen < 4)
+ if (regno < 0 || regno >= 32 + nfp + nspec || namelen < 6)
return -1;
+ *bits = ebl->machine == EM_SPARC ? 32 : 64;
+ *type = DW_ATE_signed;
+
*prefix = "%";
+ if (regno >= 32 + nfp)
+ {
+ regno -= 32 + nfp;
+ static const char names[2][8][6] =
+ {
+ { "y", "psr", "wim", "tbr", "pc", "npc", "fsr", "csr" }, /* v8 */
+ { "pc", "npc", "state", "fsr", "fprs", "y" } /* v9 */
+ };
+ *setname = "control";
+ *type = DW_ATE_unsigned;
+ if ((ebl->machine != EM_SPARC ? 0 : 4) + 1 - (unsigned int) regno <= 1)
+ *type = DW_ATE_address;
+ return stpncpy (name, names[ebl->machine != EM_SPARC][regno],
+ namelen) + 1 - name;
+ }
+
if (regno < 32)
{
*setname = "integer";
name[0] = "goli"[regno >> 3];
name[1] = (regno & 7) + '0';
namelen = 2;
+ if ((regno & 8) && (regno & 7) == 6)
+ *type = DW_ATE_address;
}
else
{
*setname = "FPU";
+ *type = DW_ATE_float;
+
+ regno -= 32;
+ if (regno >= 32)
+ regno = 32 + 2 * (regno - 32);
+ else
+ *bits = 32;
+
name[0] = 'f';
- if (regno < 32 + 10)
+ if (regno < 10)
{
- name[1] = (regno - 32) + '0';
+ name[1] = regno + '0';
namelen = 2;
}
else
{
- name[1] = (regno - 32) / 10 + '0';
- name[2] = (regno - 32) % 10 + '0';
+ name[1] = regno / 10 + '0';
+ name[2] = regno % 10 + '0';
namelen = 3;
}
}