| 1 | /* SHmedia opcode support. -*- C -*- |
| 2 | |
| 3 | Copyright 2000 Free Software Foundation, Inc. |
| 4 | |
| 5 | Contributed by Red Hat Inc; developed under contract from Hitachi |
| 6 | Semiconductor (America) Inc. |
| 7 | |
| 8 | This file is part of the GNU Binutils. |
| 9 | |
| 10 | This program is free software; you can redistribute it and/or modify |
| 11 | it under the terms of the GNU General Public License as published by |
| 12 | the Free Software Foundation; either version 2 of the License, or |
| 13 | (at your option) any later version. |
| 14 | |
| 15 | This program is distributed in the hope that it will be useful, |
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | GNU General Public License for more details. |
| 19 | |
| 20 | You should have received a copy of the GNU General Public License |
| 21 | along with this program; if not, write to the Free Software |
| 22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 23 | |
| 24 | */ |
| 25 | /* This file is an addendum to sh-media.cpu. Heavy use of C code isn't |
| 26 | appropriate in .cpu files, so it resides here. This especially applies |
| 27 | to assembly/disassembly where parsing/printing can be quite involved. |
| 28 | Such things aren't really part of the specification of the cpu, per se, |
| 29 | so .cpu files provide the general framework and .opc files handle the |
| 30 | nitty-gritty details as necessary. |
| 31 | |
| 32 | Each section is delimited with start and end markers. |
| 33 | |
| 34 | <arch>-opc.h additions use: "-- opc.h" |
| 35 | <arch>-opc.c additions use: "-- opc.c" |
| 36 | <arch>-asm.c additions use: "-- asm.c" |
| 37 | <arch>-dis.c additions use: "-- dis.c" |
| 38 | <arch>-ibd.h additions use: "-- ibd.h" |
| 39 | */ |
| 40 | \f |
| 41 | /* -- opc.h */ |
| 42 | |
| 43 | /* Allows reason codes to be output when assembler errors occur. */ |
| 44 | #define CGEN_VERBOSE_ASSEMBLER_ERRORS |
| 45 | |
| 46 | /* Override disassembly hashing - there are variable bits in the top |
| 47 | byte of these instructions. */ |
| 48 | #define CGEN_DIS_HASH_SIZE 8 |
| 49 | #define CGEN_DIS_HASH(buf,value) (((* (unsigned char*) (buf)) >> 6) % CGEN_DIS_HASH_SIZE) |
| 50 | |
| 51 | /* -- asm.c */ |
| 52 | |
| 53 | static const char * |
| 54 | parse_fsd (cd, strp, opindex, valuep) |
| 55 | CGEN_CPU_DESC cd; |
| 56 | const char **strp; |
| 57 | int opindex; |
| 58 | long *valuep; |
| 59 | { |
| 60 | abort(); |
| 61 | } |
| 62 | |
| 63 | /* -- dis.c */ |
| 64 | |
| 65 | static void |
| 66 | print_likely (cd, dis_info, value, attrs, pc, length) |
| 67 | CGEN_CPU_DESC cd; |
| 68 | PTR dis_info; |
| 69 | long value; |
| 70 | unsigned int attrs; |
| 71 | bfd_vma pc; |
| 72 | int length; |
| 73 | { |
| 74 | disassemble_info *info = (disassemble_info *) dis_info; |
| 75 | (*info->fprintf_func) (info->stream, (value) ? "/l" : "/u"); |
| 76 | } |
| 77 | |
| 78 | /* -- */ |