Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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