]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
2006-01-11 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Thu, 12 Jan 2006 03:08:35 +0000 (03:08 +0000)
committerRoland McGrath <roland@redhat.com>
Thu, 12 Jan 2006 03:08:35 +0000 (03:08 +0000)
* s390_regs.c: New file.
* Makefile.am (s390_SRCS): Add it.
* s390_init.c (s390_init): Install register_name hook.

backends/ChangeLog
backends/Makefile.am
backends/s390_init.c
backends/s390_regs.c [new file with mode: 0644]

index c51190d118f02e27873b646fbf8d6b16c49ccdfb..c7f82a979315bb6fe7aeaa2e0e97648a08562b98 100644 (file)
@@ -1,5 +1,9 @@
 2006-01-11  Roland McGrath  <roland@redhat.com>
 
+       * s390_regs.c: New file.
+       * Makefile.am (s390_SRCS): Add it.
+       * s390_init.c (s390_init): Install register_name hook.
+
        * s390_reloc.def: Update bits per
        Martin Schwidefsky <schwidefsky@de.ibm.com>.
 
index 9503d9d20c1e5ff9f8ea53d2b46a1203c3713f30..7719b6f27d9e1a48cdc57ae88ec4b3591b16e4fe 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 ##
-## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
 ##
 ## This program is Open Source software; you can redistribute it and/or
 ## modify it under the terms of the Open Software License version 1.0 as
@@ -96,7 +96,7 @@ ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c ppc_regs.c
 libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS)
 am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os)
 
-s390_SRCS = s390_init.c s390_symbol.c
+s390_SRCS = s390_init.c s390_symbol.c s390_regs.c
 libebl_s390_pic_a_SOURCES = $(s390_SRCS)
 am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os)
 
index 64b373b487de3436efa7ab6e7add47670e408b1a..d39495cf42703883657a31991f11bf3353f0d294 100644 (file)
@@ -1,5 +1,5 @@
 /* Initialization of S/390 specific backend library.
-   Copyright (C) 2005 Red Hat, Inc.
+   Copyright (C) 2005, 2006 Red Hat, Inc.
 
    This program is Open Source software; you can redistribute it and/or
    modify it under the terms of the Open Software License version 1.0 as
@@ -38,6 +38,7 @@ s390_init (elf, machine, eh, ehlen)
   eh->name = "IBM S/390";
   s390_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
+  HOOK (eh, register_name);
 
   return MODVERSION;
 }
diff --git a/backends/s390_regs.c b/backends/s390_regs.c
new file mode 100644 (file)
index 0000000..a0133e4
--- /dev/null
@@ -0,0 +1,116 @@
+/* Register names and numbers for S/390 DWARF.
+   Copyright (C) 2006 Red Hat, Inc.
+
+   This program is Open Source software; you can redistribute it and/or
+   modify it under the terms of the Open Software License version 1.0 as
+   published by the Open Source Initiative.
+
+   You should have received a copy of the Open Software License along
+   with this program; if not, you may obtain a copy of the Open Software
+   License version 1.0 from http://www.opensource.org/licenses/osl.php or
+   by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
+   3001 King Ranch Road, Ukiah, CA 95482.   */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+
+#define BACKEND s390_
+#include "libebl_CPU.h"
+
+
+/*
+zseries (64)
+
+0-15   gpr0-gpr15      x
+16-19  fpr[0246]
+20-24  fpr[13578]
+25-27  fpr1[024]
+28     fpr9
+29-31  fpr1[135]
+32-47  cr0-cr15        x
+48-63  ar0-ar15        x
+64     psw_mask
+65     psw_address
+*/
+
+
+ssize_t
+s390_register_name (Ebl *ebl __attribute__ ((unused)),
+                   int regno, char *name, size_t namelen,
+                   const char **prefix, const char **setname)
+{
+  if (name == NULL)
+    return 66;
+
+  if (regno < 0 || regno > 65 || namelen < 7)
+    return -1;
+
+  *prefix = "%";
+
+  if (regno < 16)
+    *setname = "integer";
+  else if (regno < 32)
+    *setname = "FPU";
+  else if (regno < 48 || regno > 63)
+    *setname = "control";      /* XXX ? */
+  else
+    *setname = "address";      /* XXX ? */
+
+  switch (regno)
+    {
+    case 0 ... 9:
+      name[0] = 'r';
+      name[1] = regno + '0';
+      namelen = 2;
+      break;
+
+    case 10 ... 15:
+      name[0] = 'r';
+      name[1] = '1';
+      name[2] = regno - 10 + '0';
+      namelen = 3;
+      break;
+
+    case 16 ... 31:
+      name[0] = 'f';
+      regno = (regno & 8) | ((regno & 4) >> 2) | ((regno & 3) << 1);
+      namelen = 1;
+      if (regno >= 10)
+       {
+         regno -= 10;
+         name[namelen++] = '1';
+       }
+      name[namelen++] = regno + '0';
+      break;
+
+    case 32 + 0 ... 32 + 9:
+    case 48 + 0 ... 48 + 9:
+      name[0] = regno < 48 ? 'c' : 'a';
+      name[1] = (regno & 15) + '0';
+      namelen = 2;
+      break;
+
+    case 32 + 10 ... 32 + 15:
+    case 48 + 10 ... 48 + 15:
+      name[0] = regno < 48 ? 'c' : 'a';
+      name[1] = '1';
+      name[2] = (regno & 15) - 10 + '0';
+      namelen = 3;
+      break;
+
+    case 64:
+      return stpcpy (name, "pswm") - name;
+    case 65:
+      return stpcpy (name, "pswa") - name;
+
+    default:
+      *setname = NULL;
+      return 0;
+    }
+
+  name[namelen++] = '\0';
+  return namelen;
+}