1 /* Register names and numbers for PowerPC DWARF.
2 Copyright (C) 2005, 2006, 2007 Red Hat, Inc.
3 This file is part of Red Hat elfutils.
5 Red Hat elfutils is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by the
7 Free Software Foundation; version 2 of the License.
9 Red Hat elfutils is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License along
15 with Red Hat elfutils; if not, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
18 Red Hat elfutils is an included package of the Open Invention Network.
19 An included package of the Open Invention Network is a package for which
20 Open Invention Network licensees cross-license their patents. No patent
21 license is granted, either expressly or impliedly, by designation as an
22 included package. Should you wish to participate in the Open Invention
23 Network licensing program, please visit www.openinventionnetwork.com
24 <http://www.openinventionnetwork.com>. */
34 #include "libebl_CPU.h"
37 ppc_register_info (Ebl *ebl __attribute__ ((unused)),
38 int regno, char *name, size_t namelen,
39 const char **prefix, const char **setname,
45 if (regno < 0 || regno > 1155 || namelen < 8)
49 *bits = ebl->machine == EM_PPC64 ? 64 : 32;
50 *type = (regno < 32 ? DW_ATE_signed
51 : regno < 64 ? DW_ATE_float : DW_ATE_unsigned);
53 if (regno < 32 || regno == 64 || regno == 66)
55 else if (regno < 64 || regno == 65)
58 if (ebl->machine != EM_PPC64 && regno < 64)
61 else if (regno == 67 || regno == 356 || regno == 612 || regno >= 1124)
64 *bits = regno >= 1124 ? 128 : 32;
67 *setname = "privileged";
73 name[1] = regno + '0';
79 name[1] = regno / 10 + '0';
80 name[2] = regno % 10 + '0';
84 case 32 + 0 ... 32 + 9:
86 name[1] = (regno - 32) + '0';
90 case 32 + 10 ... 32 + 31:
92 name[1] = (regno - 32) / 10 + '0';
93 name[2] = (regno - 32) % 10 + '0';
98 return stpcpy (name, "cr") + 1 - name;
100 return stpcpy (name, "fpscr") + 1 - name;
102 return stpcpy (name, "msr") + 1 - name;
103 case 67: /* XXX unofficial assignment */
104 return stpcpy (name, "vscr") + 1 - name;
106 case 70 + 0 ... 70 + 9:
109 name[2] = (regno - 70) + '0';
113 case 70 + 10 ... 70 + 15:
116 name[2] = (regno - 70) / 10 + '0';
117 name[3] = (regno - 70) % 10 + '0';
122 return stpcpy (name, "xer") + 1 - name;
124 return stpcpy (name, "lr") + 1 - name;
126 return stpcpy (name, "ctr") + 1 - name;
128 return stpcpy (name, "dsisr") + 1 - name;
130 return stpcpy (name, "dar") + 1 - name;
132 return stpcpy (name, "dec") + 1 - name;
134 return stpcpy (name, "vrsave") + 1 - name;
136 return stpcpy (name, "spefscr") + 1 - name;
139 return stpcpy (name, "mq") + 1 - name;
145 name[3] = (regno - 100) + '0';
155 name[3] = (regno - 100) / 10 + '0';
156 name[4] = (regno - 100) % 10 + '0';
166 name[3] = (regno - 100) / 100 + '0';
167 name[4] = ((regno - 100) % 100 / 10) + '0';
168 name[5] = (regno - 100) % 10 + '0';
172 case 1124 + 0 ... 1124 + 9:
175 name[2] = (regno - 1124) + '0';
179 case 1124 + 10 ... 1124 + 31:
182 name[2] = (regno - 1124) / 10 + '0';
183 name[3] = (regno - 1124) % 10 + '0';
192 name[namelen++] = '\0';
196 __typeof (ppc_register_info)
197 ppc64_register_info __attribute__ ((alias ("ppc_register_info")));