mn10300.h 4.7 KB

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