| 1 | /* SHmedia opcode support. -*- C -*- |
| 2 | |
| 3 | Copyright 2000, 2005, 2007, 2009 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 3 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., 51 Franklin Street - Fifth Floor, Boston, |
| 23 | MA 02110-1301, USA. */ |
| 24 | |
| 25 | |
| 26 | /* This file is an addendum to sh-media.cpu. Heavy use of C code isn't |
| 27 | appropriate in .cpu files, so it resides here. This especially applies |
| 28 | to assembly/disassembly where parsing/printing can be quite involved. |
| 29 | Such things aren't really part of the specification of the cpu, per se, |
| 30 | so .cpu files provide the general framework and .opc files handle the |
| 31 | nitty-gritty details as necessary. |
| 32 | |
| 33 | Each section is delimited with start and end markers. |
| 34 | |
| 35 | <arch>-opc.h additions use: "-- opc.h" |
| 36 | <arch>-opc.c additions use: "-- opc.c" |
| 37 | <arch>-asm.c additions use: "-- asm.c" |
| 38 | <arch>-dis.c additions use: "-- dis.c" |
| 39 | <arch>-ibd.h additions use: "-- ibd.h" */ |
| 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 (CGEN_CPU_DESC cd, |
| 55 | const char ** strp, |
| 56 | int opindex, |
| 57 | long * valuep) |
| 58 | { |
| 59 | abort (); |
| 60 | } |
| 61 | |
| 62 | /* -- dis.c */ |
| 63 | |
| 64 | static void |
| 65 | print_likely (CGEN_CPU_DESC cd, |
| 66 | void * dis_info, |
| 67 | long value, |
| 68 | unsigned int attrs, |
| 69 | bfd_vma pc, |
| 70 | int length) |
| 71 | { |
| 72 | disassemble_info *info = (disassemble_info *) dis_info; |
| 73 | |
| 74 | (*info->fprintf_func) (info->stream, (value) ? "/l" : "/u"); |
| 75 | } |
| 76 | |
| 77 | /* -- */ |