| 1 | /* mn10300.h -- Header file for Matsushita 10300 opcode table | 
|---|
| 2 | Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc. | 
|---|
| 3 | Written by Jeff Law, Cygnus Support | 
|---|
| 4 |  | 
|---|
| 5 | This file is part of GDB, GAS, and the GNU binutils. | 
|---|
| 6 |  | 
|---|
| 7 | GDB, GAS, and the GNU binutils are free software; you can redistribute | 
|---|
| 8 | them and/or modify them under the terms of the GNU General Public | 
|---|
| 9 | License as published by the Free Software Foundation; either version | 
|---|
| 10 | 1, or (at your option) any later version. | 
|---|
| 11 |  | 
|---|
| 12 | GDB, GAS, and the GNU binutils are distributed in the hope that they | 
|---|
| 13 | will be useful, but WITHOUT ANY WARRANTY; without even the implied | 
|---|
| 14 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See | 
|---|
| 15 | the GNU General Public License for more details. | 
|---|
| 16 |  | 
|---|
| 17 | You should have received a copy of the GNU General Public License | 
|---|
| 18 | along with this file; see the file COPYING.  If not, write to the Free | 
|---|
| 19 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */ | 
|---|
| 20 |  | 
|---|
| 21 | #ifndef MN10300_H | 
|---|
| 22 | #define MN10300_H | 
|---|
| 23 |  | 
|---|
| 24 | /* The opcode table is an array of struct mn10300_opcode.  */ | 
|---|
| 25 |  | 
|---|
| 26 | #define MN10300_MAX_OPERANDS 8 | 
|---|
| 27 | struct mn10300_opcode | 
|---|
| 28 | { | 
|---|
| 29 | /* The opcode name.  */ | 
|---|
| 30 | const char *name; | 
|---|
| 31 |  | 
|---|
| 32 | /* The opcode itself.  Those bits which will be filled in with | 
|---|
| 33 | operands are zeroes.  */ | 
|---|
| 34 | unsigned long opcode; | 
|---|
| 35 |  | 
|---|
| 36 | /* The opcode mask.  This is used by the disassembler.  This is a | 
|---|
| 37 | mask containing ones indicating those bits which must match the | 
|---|
| 38 | opcode field, and zeroes indicating those bits which need not | 
|---|
| 39 | match (and are presumably filled in by operands).  */ | 
|---|
| 40 | unsigned long mask; | 
|---|
| 41 |  | 
|---|
| 42 | /* A bitmask.  For each operand, nonzero if it must not have the same | 
|---|
| 43 | register specification as all other operands with a nonzero bit in | 
|---|
| 44 | this flag.  ie 0x81 would indicate that operands 7 and 0 must not | 
|---|
| 45 | match.  Note that we count operands from left to right as they appear | 
|---|
| 46 | in the operands specification below.  */ | 
|---|
| 47 | unsigned int no_match_operands; | 
|---|
| 48 |  | 
|---|
| 49 | /* The format of this opcode.  */ | 
|---|
| 50 | unsigned char format; | 
|---|
| 51 |  | 
|---|
| 52 | /* Bitmask indicating what cpu variants this opcode is available on. | 
|---|
| 53 | We assume mn10300 base opcodes are available everywhere, so we only | 
|---|
| 54 | have to note opcodes which are available on other variants.  */ | 
|---|
| 55 | unsigned int machine; | 
|---|
| 56 |  | 
|---|
| 57 | /* An array of operand codes.  Each code is an index into the | 
|---|
| 58 | operand table.  They appear in the order which the operands must | 
|---|
| 59 | appear in assembly code, and are terminated by a zero.  */ | 
|---|
| 60 | unsigned char operands[MN10300_MAX_OPERANDS]; | 
|---|
| 61 | }; | 
|---|
| 62 |  | 
|---|
| 63 | /* The table itself is sorted by major opcode number, and is otherwise | 
|---|
| 64 | in the order in which the disassembler should consider | 
|---|
| 65 | instructions.  */ | 
|---|
| 66 | extern const struct mn10300_opcode mn10300_opcodes[]; | 
|---|
| 67 | extern const int mn10300_num_opcodes; | 
|---|
| 68 |  | 
|---|
| 69 |  | 
|---|
| 70 |  | 
|---|
| 71 | /* The operands table is an array of struct mn10300_operand.  */ | 
|---|
| 72 |  | 
|---|
| 73 | struct mn10300_operand | 
|---|
| 74 | { | 
|---|
| 75 | /* The number of bits in the operand.  */ | 
|---|
| 76 | int bits; | 
|---|
| 77 |  | 
|---|
| 78 | /* How far the operand is left shifted in the instruction.  */ | 
|---|
| 79 | int shift; | 
|---|
| 80 |  | 
|---|
| 81 | /* One bit syntax flags.  */ | 
|---|
| 82 | int flags; | 
|---|
| 83 | }; | 
|---|
| 84 |  | 
|---|
| 85 | /* Elements in the table are retrieved by indexing with values from | 
|---|
| 86 | the operands field of the mn10300_opcodes table.  */ | 
|---|
| 87 |  | 
|---|
| 88 | extern const struct mn10300_operand mn10300_operands[]; | 
|---|
| 89 |  | 
|---|
| 90 | /* Values defined for the flags field of a struct mn10300_operand.  */ | 
|---|
| 91 | #define MN10300_OPERAND_DREG 0x1 | 
|---|
| 92 |  | 
|---|
| 93 | #define MN10300_OPERAND_AREG 0x2 | 
|---|
| 94 |  | 
|---|
| 95 | #define MN10300_OPERAND_SP 0x4 | 
|---|
| 96 |  | 
|---|
| 97 | #define MN10300_OPERAND_PSW 0x8 | 
|---|
| 98 |  | 
|---|
| 99 | #define MN10300_OPERAND_MDR 0x10 | 
|---|
| 100 |  | 
|---|
| 101 | #define MN10300_OPERAND_SIGNED 0x20 | 
|---|
| 102 |  | 
|---|
| 103 | #define MN10300_OPERAND_PROMOTE 0x40 | 
|---|
| 104 |  | 
|---|
| 105 | #define MN10300_OPERAND_PAREN 0x80 | 
|---|
| 106 |  | 
|---|
| 107 | #define MN10300_OPERAND_REPEATED 0x100 | 
|---|
| 108 |  | 
|---|
| 109 | #define MN10300_OPERAND_EXTENDED 0x200 | 
|---|
| 110 |  | 
|---|
| 111 | #define MN10300_OPERAND_SPLIT 0x400 | 
|---|
| 112 |  | 
|---|
| 113 | #define MN10300_OPERAND_REG_LIST 0x800 | 
|---|
| 114 |  | 
|---|
| 115 | #define MN10300_OPERAND_PCREL 0x1000 | 
|---|
| 116 |  | 
|---|
| 117 | #define MN10300_OPERAND_MEMADDR 0x2000 | 
|---|
| 118 |  | 
|---|
| 119 | #define MN10300_OPERAND_RELAX 0x4000 | 
|---|
| 120 |  | 
|---|
| 121 | #define MN10300_OPERAND_USP 0x8000 | 
|---|
| 122 |  | 
|---|
| 123 | #define MN10300_OPERAND_SSP 0x10000 | 
|---|
| 124 |  | 
|---|
| 125 | #define MN10300_OPERAND_MSP 0x20000 | 
|---|
| 126 |  | 
|---|
| 127 | #define MN10300_OPERAND_PC 0x40000 | 
|---|
| 128 |  | 
|---|
| 129 | #define MN10300_OPERAND_EPSW 0x80000 | 
|---|
| 130 |  | 
|---|
| 131 | #define MN10300_OPERAND_RREG 0x100000 | 
|---|
| 132 |  | 
|---|
| 133 | #define MN10300_OPERAND_XRREG 0x200000 | 
|---|
| 134 |  | 
|---|
| 135 | #define MN10300_OPERAND_PLUS 0x400000 | 
|---|
| 136 |  | 
|---|
| 137 | #define MN10300_OPERAND_24BIT 0x800000 | 
|---|
| 138 |  | 
|---|
| 139 | /* Opcode Formats.  */ | 
|---|
| 140 | #define FMT_S0 1 | 
|---|
| 141 | #define FMT_S1 2 | 
|---|
| 142 | #define FMT_S2 3 | 
|---|
| 143 | #define FMT_S4 4 | 
|---|
| 144 | #define FMT_S6 5 | 
|---|
| 145 | #define FMT_D0 6 | 
|---|
| 146 | #define FMT_D1 7 | 
|---|
| 147 | #define FMT_D2 8 | 
|---|
| 148 | #define FMT_D4 9 | 
|---|
| 149 | #define FMT_D5 10 | 
|---|
| 150 | #define FMT_D6 11 | 
|---|
| 151 | #define FMT_D7 12 | 
|---|
| 152 | #define FMT_D8 13 | 
|---|
| 153 | #define FMT_D9 14 | 
|---|
| 154 | #define FMT_D10 15 | 
|---|
| 155 |  | 
|---|
| 156 | /* Variants of the mn10300 which have additional opcodes.  */ | 
|---|
| 157 | #define MN103 300 | 
|---|
| 158 | #define AM30  300 | 
|---|
| 159 |  | 
|---|
| 160 | #define AM33 330 | 
|---|
| 161 |  | 
|---|
| 162 | #endif /* MN10300_H */ | 
|---|