/src/elfutils/backends/m68k_regs.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* Register names and numbers for M68K DWARF. |
2 | | This file is part of elfutils. |
3 | | |
4 | | This file is free software; you can redistribute it and/or modify |
5 | | it under the terms of either |
6 | | |
7 | | * the GNU Lesser General Public License as published by the Free |
8 | | Software Foundation; either version 3 of the License, or (at |
9 | | your option) any later version |
10 | | |
11 | | or |
12 | | |
13 | | * the GNU General Public License as published by the Free |
14 | | Software Foundation; either version 2 of the License, or (at |
15 | | your option) any later version |
16 | | |
17 | | or both in parallel, as here. |
18 | | |
19 | | elfutils is distributed in the hope that it will be useful, but |
20 | | WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22 | | General Public License for more details. |
23 | | |
24 | | You should have received copies of the GNU General Public License and |
25 | | the GNU Lesser General Public License along with this program. If |
26 | | not, see <http://www.gnu.org/licenses/>. */ |
27 | | |
28 | | #ifdef HAVE_CONFIG_H |
29 | | # include <config.h> |
30 | | #endif |
31 | | |
32 | | #include <stdio.h> |
33 | | #include <string.h> |
34 | | #include <dwarf.h> |
35 | | |
36 | | #define BACKEND m68k_ |
37 | | #include "libebl_CPU.h" |
38 | | |
39 | | ssize_t |
40 | | m68k_register_info (Ebl *ebl __attribute__ ((unused)), |
41 | | int regno, char *name, size_t namelen, |
42 | | const char **prefix, const char **setname, |
43 | | int *bits, int *type) |
44 | 0 | { |
45 | 0 | if (name == NULL) |
46 | 0 | return 25; |
47 | | |
48 | 0 | if (regno < 0 || regno > 24 || namelen < 5) |
49 | 0 | return -1; |
50 | | |
51 | 0 | *prefix = "%"; |
52 | 0 | *setname = "integer"; |
53 | 0 | *bits = 32; |
54 | |
|
55 | 0 | switch (regno) |
56 | 0 | { |
57 | 0 | case 0 ... 7: |
58 | 0 | *type = DW_ATE_signed; |
59 | 0 | name[0] = 'd'; |
60 | 0 | name[1] = regno + '0'; |
61 | 0 | namelen = 2; |
62 | 0 | break; |
63 | | |
64 | 0 | case 8 ... 15: |
65 | 0 | *type = DW_ATE_address; |
66 | 0 | name[0] = 'a'; |
67 | 0 | name[1] = regno - 8 + '0'; |
68 | 0 | namelen = 2; |
69 | 0 | break; |
70 | | |
71 | 0 | case 16 ... 23: |
72 | 0 | *type = DW_ATE_float; |
73 | 0 | *setname = "FPU"; |
74 | 0 | *bits = 96; |
75 | 0 | name[0] = 'f'; |
76 | 0 | name[1] = 'p'; |
77 | 0 | name[2] = regno - 16 + '0'; |
78 | 0 | namelen = 3; |
79 | 0 | break; |
80 | | |
81 | 0 | case 24: |
82 | 0 | *type = DW_ATE_address; |
83 | 0 | name[0] = 'p'; |
84 | 0 | name[1] = 'c'; |
85 | 0 | namelen = 2; |
86 | 0 | break; |
87 | | |
88 | | /* Can't happen. */ |
89 | 0 | default: |
90 | 0 | *setname = NULL; |
91 | 0 | return 0; |
92 | 0 | } |
93 | | |
94 | 0 | name[namelen++] = '\0'; |
95 | 0 | return namelen; |
96 | 0 | } |