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 { 45 if (name == NULL) 46 return 25; 47 48 if (regno < 0 || regno > 24 || namelen < 5) 49 return -1; 50 51 *prefix = "%"; 52 *setname = "integer"; 53 *bits = 32; 54 55 switch (regno) 56 { 57 case 0 ... 7: 58 *type = DW_ATE_signed; 59 name[0] = 'd'; 60 name[1] = regno + '0'; 61 namelen = 2; 62 break; 63 64 case 8 ... 15: 65 *type = DW_ATE_address; 66 name[0] = 'a'; 67 name[1] = regno - 8 + '0'; 68 namelen = 2; 69 break; 70 71 case 16 ... 23: 72 *type = DW_ATE_float; 73 *setname = "FPU"; 74 *bits = 96; 75 name[0] = 'f'; 76 name[1] = 'p'; 77 name[2] = regno - 16 + '0'; 78 namelen = 3; 79 break; 80 81 case 24: 82 *type = DW_ATE_address; 83 name[0] = 'p'; 84 name[1] = 'c'; 85 namelen = 2; 86 break; 87 88 /* Can't happen. */ 89 default: 90 *setname = NULL; 91 return 0; 92 } 93 94 name[namelen++] = '\0'; 95 return namelen; 96 } 97