pn.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /* Print GOULD PN (PowerNode) instructions for GDB, the GNU debugger.
  2. Copyright (C) 1986-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. GDB is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GDB is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GDB; see the file COPYING3. If not, write to
  14. the Free Software Foundation, 51 Franklin Street - Fifth Floor,
  15. Boston, MA 02110-1301, USA. */
  16. struct gld_opcode
  17. {
  18. char *name;
  19. unsigned long opcode;
  20. unsigned long mask;
  21. char *args;
  22. int length;
  23. };
  24. /* We store four bytes of opcode for all opcodes because that
  25. is the most any of them need. The actual length of an instruction
  26. is always at least 2 bytes, and at most four. The length of the
  27. instruction is based on the opcode.
  28. The mask component is a mask saying which bits must match
  29. particular opcode in order for an instruction to be an instance
  30. of that opcode.
  31. The args component is a string containing characters
  32. that are used to format the arguments to the instruction. */
  33. /* Kinds of operands:
  34. r Register in first field
  35. R Register in second field
  36. b Base register in first field
  37. B Base register in second field
  38. v Vector register in first field
  39. V Vector register in first field
  40. A Optional address register (base register)
  41. X Optional index register
  42. I Immediate data (16bits signed)
  43. O Offset field (16bits signed)
  44. h Offset field (15bits signed)
  45. d Offset field (14bits signed)
  46. S Shift count field
  47. any other characters are printed as is...
  48. */
  49. /* The assembler requires that this array be sorted as follows:
  50. all instances of the same mnemonic must be consecutive.
  51. All instances of the same mnemonic with the same number of operands
  52. must be consecutive.
  53. */
  54. struct gld_opcode gld_opcodes[] =
  55. {
  56. { "abm", 0xa0080000, 0xfc080000, "f,xOA,X", 4 },
  57. { "abr", 0x18080000, 0xfc0c0000, "r,f", 2 },
  58. { "aci", 0xfc770000, 0xfc7f8000, "r,I", 4 },
  59. { "adfd", 0xe0080002, 0xfc080002, "r,xOA,X", 4 },
  60. { "adfw", 0xe0080000, 0xfc080000, "r,xOA,X", 4 },
  61. { "adi", 0xc8010000, 0xfc7f0000, "r,I", 4 },
  62. { "admb", 0xb8080000, 0xfc080000, "r,xOA,X", 4 },
  63. { "admd", 0xb8000002, 0xfc080002, "r,xOA,X", 4 },
  64. { "admh", 0xb8000001, 0xfc080001, "r,xOA,X", 4 },
  65. { "admw", 0xb8000000, 0xfc080000, "r,xOA,X", 4 },
  66. { "adr", 0x38000000, 0xfc0f0000, "r,R", 2 },
  67. { "adrfd", 0x38090000, 0xfc0f0000, "r,R", 2 },
  68. { "adrfw", 0x38010000, 0xfc0f0000, "r,R", 2 },
  69. { "adrm", 0x38080000, 0xfc0f0000, "r,R", 2 },
  70. { "ai", 0xfc030000, 0xfc07ffff, "I", 4 },
  71. { "anmb", 0x84080000, 0xfc080000, "r,xOA,X", 4 },
  72. { "anmd", 0x84000002, 0xfc080002, "r,xOA,X", 4 },
  73. { "anmh", 0x84000001, 0xfc080001, "r,xOA,X", 4 },
  74. { "anmw", 0x84000000, 0xfc080000, "r,xOA,X", 4 },
  75. { "anr", 0x04000000, 0xfc0f0000, "r,R", 2 },
  76. { "armb", 0xe8080000, 0xfc080000, "r,xOA,X", 4 },
  77. { "armd", 0xe8000002, 0xfc080002, "r,xOA,X", 4 },
  78. { "armh", 0xe8000001, 0xfc080001, "r,xOA,X", 4 },
  79. { "armw", 0xe8000000, 0xfc080000, "r,xOA,X", 4 },
  80. { "bcf", 0xf0000000, 0xfc080000, "I,xOA,X", 4 },
  81. { "bct", 0xec000000, 0xfc080000, "I,xOA,X", 4 },
  82. { "bei", 0x00060000, 0xffff0000, "", 2 },
  83. { "bft", 0xf0000000, 0xff880000, "xOA,X", 4 },
  84. { "bib", 0xf4000000, 0xfc780000, "r,xOA", 4 },
  85. { "bid", 0xf4600000, 0xfc780000, "r,xOA", 4 },
  86. { "bih", 0xf4200000, 0xfc780000, "r,xOA", 4 },
  87. { "biw", 0xf4400000, 0xfc780000, "r,xOA", 4 },
  88. { "bl", 0xf8800000, 0xff880000, "xOA,X", 4 },
  89. { "bsub", 0x5c080000, 0xff8f0000, "", 2 },
  90. { "bsubm", 0x28080000, 0xfc080000, "", 4 },
  91. { "bu", 0xec000000, 0xff880000, "xOA,X", 4 },
  92. { "call", 0x28080000, 0xfc0f0000, "", 2 },
  93. { "callm", 0x5c080000, 0xff880000, "", 4 },
  94. { "camb", 0x90080000, 0xfc080000, "r,xOA,X", 4 },
  95. { "camd", 0x90000002, 0xfc080002, "r,xOA,X", 4 },
  96. { "camh", 0x90000001, 0xfc080001, "r,xOA,X", 4 },
  97. { "camw", 0x90000000, 0xfc080000, "r.xOA,X", 4 },
  98. { "car", 0x10000000, 0xfc0f0000, "r,R", 2 },
  99. { "cd", 0xfc060000, 0xfc070000, "r,f", 4 },
  100. { "cea", 0x000f0000, 0xffff0000, "", 2 },
  101. { "ci", 0xc8050000, 0xfc7f0000, "r,I", 4 },
  102. { "cmc", 0x040a0000, 0xfc7f0000, "r", 2 },
  103. { "cmmb", 0x94080000, 0xfc080000, "r,xOA,X", 4 },
  104. { "cmmd", 0x94000002, 0xfc080002, "r,xOA,X", 4 },
  105. { "cmmh", 0x94000001, 0xfc080001, "r,xOA,X", 4 },
  106. { "cmmw", 0x94000000, 0xfc080000, "r,xOA,X", 4 },
  107. { "cmr", 0x14000000, 0xfc0f0000, "r,R", 2 },
  108. { "daci", 0xfc7f0000, 0xfc7f8000, "r,I", 4 },
  109. { "dae", 0x000e0000, 0xffff0000, "", 2 },
  110. { "dai", 0xfc040000, 0xfc07ffff, "I", 4 },
  111. { "dci", 0xfc6f0000, 0xfc7f8000, "r,I", 4 },
  112. { "di", 0xfc010000, 0xfc07ffff, "I", 4 },
  113. { "dvfd", 0xe4000002, 0xfc080002, "r,xOA,X", 4 },
  114. { "dvfw", 0xe4000000, 0xfc080000, "r,xOA,X", 4 },
  115. { "dvi", 0xc8040000, 0xfc7f0000, "r,I", 4 },
  116. { "dvmb", 0xc4080000, 0xfc080000, "r,xOA,X", 4 },
  117. { "dvmh", 0xc4000001, 0xfc080001, "r,xOA,X", 4 },
  118. { "dvmw", 0xc4000000, 0xfc080000, "r,xOA,X", 4 },
  119. { "dvr", 0x380a0000, 0xfc0f0000, "r,R", 2 },
  120. { "dvrfd", 0x380c0000, 0xfc0f0000, "r,R", 4 },
  121. { "dvrfw", 0x38040000, 0xfc0f0000, "r,xOA,X", 4 },
  122. { "eae", 0x00080000, 0xffff0000, "", 2 },
  123. { "eci", 0xfc670000, 0xfc7f8080, "r,I", 4 },
  124. { "ecwcs", 0xfc4f0000, 0xfc7f8000, "", 4 },
  125. { "ei", 0xfc000000, 0xfc07ffff, "I", 4 },
  126. { "eomb", 0x8c080000, 0xfc080000, "r,xOA,X", 4 },
  127. { "eomd", 0x8c000002, 0xfc080002, "r,xOA,X", 4 },
  128. { "eomh", 0x8c000001, 0xfc080001, "r,xOA,X", 4 },
  129. { "eomw", 0x8c000000, 0xfc080000, "r,xOA,X", 4 },
  130. { "eor", 0x0c000000, 0xfc0f0000, "r,R", 2 },
  131. { "eorm", 0x0c080000, 0xfc0f0000, "r,R", 2 },
  132. { "es", 0x00040000, 0xfc7f0000, "r", 2 },
  133. { "exm", 0xa8000000, 0xff880000, "xOA,X", 4 },
  134. { "exr", 0xc8070000, 0xfc7f0000, "r", 2 },
  135. { "exrr", 0xc8070002, 0xfc7f0002, "r", 2 },
  136. { "fixd", 0x380d0000, 0xfc0f0000, "r,R", 2 },
  137. { "fixw", 0x38050000, 0xfc0f0000, "r,R", 2 },
  138. { "fltd", 0x380f0000, 0xfc0f0000, "r,R", 2 },
  139. { "fltw", 0x38070000, 0xfc0f0000, "r,R", 2 },
  140. { "grio", 0xfc3f0000, 0xfc7f8000, "r,I", 4 },
  141. { "halt", 0x00000000, 0xffff0000, "", 2 },
  142. { "hio", 0xfc370000, 0xfc7f8000, "r,I", 4 },
  143. { "jwcs", 0xfa080000, 0xff880000, "xOA,X", 4 },
  144. { "la", 0x50000000, 0xfc000000, "r,xOA,X", 4 },
  145. { "labr", 0x58080000, 0xfc080000, "b,xOA,X", 4 },
  146. { "lb", 0xac080000, 0xfc080000, "r,xOA,X", 4 },
  147. { "lcs", 0x00030000, 0xfc7f0000, "r", 2 },
  148. { "ld", 0xac000002, 0xfc080002, "r,xOA,X", 4 },
  149. { "lear", 0x80000000, 0xfc080000, "r,xOA,X", 4 },
  150. { "lf", 0xcc000000, 0xfc080000, "r,xOA,X", 4 },
  151. { "lfbr", 0xcc080000, 0xfc080000, "b,xOA,X", 4 },
  152. { "lh", 0xac000001, 0xfc080001, "r,xOA,X", 4 },
  153. { "li", 0xc8000000, 0xfc7f0000, "r,I", 4 },
  154. { "lmap", 0x2c070000, 0xfc7f0000, "r", 2 },
  155. { "lmb", 0xb0080000, 0xfc080000, "r,xOA,X", 4 },
  156. { "lmd", 0xb0000002, 0xfc080002, "r,xOA,X", 4 },
  157. { "lmh", 0xb0000001, 0xfc080001, "r,xOA,X", 4 },
  158. { "lmw", 0xb0000000, 0xfc080000, "r,xOA,X", 4 },
  159. { "lnb", 0xb4080000, 0xfc080000, "r,xOA,X", 4 },
  160. { "lnd", 0xb4000002, 0xfc080002, "r,xOA,X", 4 },
  161. { "lnh", 0xb4000001, 0xfc080001, "r,xOA,X", 4 },
  162. { "lnw", 0xb4000000, 0xfc080000, "r,xOA,X", 4 },
  163. { "lpsd", 0xf9800000, 0xff880000, "r,xOA,X", 4 },
  164. { "lpsdcm", 0xfa800000, 0xff880000, "r,xOA,X", 4 },
  165. { "lw", 0xac000000, 0xfc080000, "r,xOA,X", 4 },
  166. { "lwbr", 0x5c000000, 0xfc080000, "b,xOA,X", 4 },
  167. { "mpfd", 0xe4080002, 0xfc080002, "r,xOA,X", 4 },
  168. { "mpfw", 0xe4080000, 0xfc080000, "r,xOA,X", 4 },
  169. { "mpi", 0xc8030000, 0xfc7f0000, "r,I", 4 },
  170. { "mpmb", 0xc0080000, 0xfc080000, "r,xOA,X", 4 },
  171. { "mpmh", 0xc0000001, 0xfc080001, "r,xOA,X", 4 },
  172. { "mpmw", 0xc0000000, 0xfc080000, "r,xOA,X", 4 },
  173. { "mpr", 0x38020000, 0xfc0f0000, "r,R", 2 },
  174. { "mprfd", 0x380e0000, 0xfc0f0000, "r,R", 2 },
  175. { "mprfw", 0x38060000, 0xfc0f0000, "r,R", 2 },
  176. { "nop", 0x00020000, 0xffff0000, "", 2 },
  177. { "ormb", 0x88080000, 0xfc080000, "r,xOA,X", 4 },
  178. { "ormd", 0x88000002, 0xfc080002, "r,xOA,X", 4 },
  179. { "ormh", 0x88000001, 0xfc080001, "r,xOA,X", 4 },
  180. { "ormw", 0x88000000, 0xfc080000, "r,xOA,X", 4 },
  181. { "orr", 0x08000000, 0xfc0f0000, "r,R", 2 },
  182. { "orrm", 0x08080000, 0xfc0f0000, "r,R", 2 },
  183. { "rdsts", 0x00090000, 0xfc7f0000, "r", 2 },
  184. { "return", 0x280e0000, 0xfc7f0000, "", 2 },
  185. { "ri", 0xfc020000, 0xfc07ffff, "I", 4 },
  186. { "rnd", 0x00050000, 0xfc7f0000, "r", 2 },
  187. { "rpswt", 0x040b0000, 0xfc7f0000, "r", 2 },
  188. { "rschnl", 0xfc2f0000, 0xfc7f8000, "r,I", 4 },
  189. { "rsctl", 0xfc470000, 0xfc7f8000, "r,I", 4 },
  190. { "rwcs", 0x000b0000, 0xfc0f0000, "r,R", 2 },
  191. { "sacz", 0x10080000, 0xfc0f0000, "r,R", 2 },
  192. { "sbm", 0x98080000, 0xfc080000, "f,xOA,X", 4 },
  193. { "sbr", 0x18000000, 0xfc0c0000, "r,f", 4 },
  194. { "sea", 0x000d0000, 0xffff0000, "", 2 },
  195. { "setcpu", 0x2c090000, 0xfc7f0000, "r", 2 },
  196. { "sio", 0xfc170000, 0xfc7f8000, "r,I", 4 },
  197. { "sipu", 0x000a0000, 0xffff0000, "", 2 },
  198. { "sla", 0x1c400000, 0xfc600000, "r,S", 2 },
  199. { "slad", 0x20400000, 0xfc600000, "r,S", 2 },
  200. { "slc", 0x24400000, 0xfc600000, "r,S", 2 },
  201. { "sll", 0x1c600000, 0xfc600000, "r,S", 2 },
  202. { "slld", 0x20600000, 0xfc600000, "r,S", 2 },
  203. { "smc", 0x04070000, 0xfc070000, "", 2 },
  204. { "sra", 0x1c000000, 0xfc600000, "r,S", 2 },
  205. { "srad", 0x20000000, 0xfc600000, "r,S", 2 },
  206. { "src", 0x24000000, 0xfc600000, "r,S", 2 },
  207. { "srl", 0x1c200000, 0xfc600000, "r,S", 2 },
  208. { "srld", 0x20200000, 0xfc600000, "r,S", 2 },
  209. { "stb", 0xd4080000, 0xfc080000, "r,xOA,X", 4 },
  210. { "std", 0xd4000002, 0xfc080002, "r,xOA,X", 4 },
  211. { "stf", 0xdc000000, 0xfc080000, "r,xOA,X", 4 },
  212. { "stfbr", 0x54000000, 0xfc080000, "b,xOA,X", 4 },
  213. { "sth", 0xd4000001, 0xfc080001, "r,xOA,X", 4 },
  214. { "stmb", 0xd8080000, 0xfc080000, "r,xOA,X", 4 },
  215. { "stmd", 0xd8000002, 0xfc080002, "r,xOA,X", 4 },
  216. { "stmh", 0xd8000001, 0xfc080001, "r,xOA,X", 4 },
  217. { "stmw", 0xd8000000, 0xfc080000, "r,xOA,X", 4 },
  218. { "stpio", 0xfc270000, 0xfc7f8000, "r,I", 4 },
  219. { "stw", 0xd4000000, 0xfc080000, "r,xOA,X", 4 },
  220. { "stwbr", 0x54000000, 0xfc080000, "b,xOA,X", 4 },
  221. { "suabr", 0x58000000, 0xfc080000, "b,xOA,X", 4 },
  222. { "sufd", 0xe0000002, 0xfc080002, "r,xOA,X", 4 },
  223. { "sufw", 0xe0000000, 0xfc080000, "r,xOA,X", 4 },
  224. { "sui", 0xc8020000, 0xfc7f0000, "r,I", 4 },
  225. { "sumb", 0xbc080000, 0xfc080000, "r,xOA,X", 4 },
  226. { "sumd", 0xbc000002, 0xfc080002, "r,xOA,X", 4 },
  227. { "sumh", 0xbc000001, 0xfc080001, "r,xOA,X", 4 },
  228. { "sumw", 0xbc000000, 0xfc080000, "r,xOA,X", 4 },
  229. { "sur", 0x3c000000, 0xfc0f0000, "r,R", 2 },
  230. { "surfd", 0x380b0000, 0xfc0f0000, "r,xOA,X", 4 },
  231. { "surfw", 0x38030000, 0xfc0f0000, "r,R", 2 },
  232. { "surm", 0x3c080000, 0xfc0f0000, "r,R", 2 },
  233. { "svc", 0xc8060000, 0xffff0000, "", 4 },
  234. { "tbm", 0xa4080000, 0xfc080000, "f,xOA,X", 4 },
  235. { "tbr", 0x180c0000, 0xfc0c0000, "r,f", 2 },
  236. { "tbrr", 0x2c020000, 0xfc0f0000, "r,B", 2 },
  237. { "tccr", 0x28040000, 0xfc7f0000, "", 2 },
  238. { "td", 0xfc050000, 0xfc070000, "r,f", 4 },
  239. { "tio", 0xfc1f0000, 0xfc7f8000, "r,I", 4 },
  240. { "tmapr", 0x2c0a0000, 0xfc0f0000, "r,R", 2 },
  241. { "tpcbr", 0x280c0000, 0xfc7f0000, "r", 2 },
  242. { "trbr", 0x2c010000, 0xfc0f0000, "b,R", 2 },
  243. { "trc", 0x2c030000, 0xfc0f0000, "r,R", 2 },
  244. { "trcc", 0x28050000, 0xfc7f0000, "", 2 },
  245. { "trcm", 0x2c0b0000, 0xfc0f0000, "r,R", 2 },
  246. { "trn", 0x2c040000, 0xfc0f0000, "r,R", 2 },
  247. { "trnm", 0x2c0c0000, 0xfc0f0000, "r,R", 2 },
  248. { "trr", 0x2c000000, 0xfc0f0000, "r,R", 2 },
  249. { "trrm", 0x2c080000, 0xfc0f0000, "r,R", 2 },
  250. { "trsc", 0x2c0e0000, 0xfc0f0000, "r,R", 2 },
  251. { "trsw", 0x28000000, 0xfc7f0000, "r", 2 },
  252. { "tscr", 0x2c0f0000, 0xfc0f0000, "r,R", 2 },
  253. { "uei", 0x00070000, 0xffff0000, "", 2 },
  254. { "wait", 0x00010000, 0xffff0000, "", 2 },
  255. { "wcwcs", 0xfc5f0000, 0xfc7f8000, "", 4 },
  256. { "wwcs", 0x000c0000, 0xfc0f0000, "r,R", 2 },
  257. { "xcbr", 0x28020000, 0xfc0f0000, "b,B", 2 },
  258. { "xcr", 0x2c050000, 0xfc0f0000, "r,R", 2 },
  259. { "xcrm", 0x2c0d0000, 0xfc0f0000, "r,R", 2 },
  260. { "zbm", 0x9c080000, 0xfc080000, "f,xOA,X", 4 },
  261. { "zbr", 0x18040000, 0xfc0c0000, "r,f", 2 },
  262. { "zmb", 0xf8080000, 0xfc080000, "r,xOA,X", 4 },
  263. { "zmd", 0xf8000002, 0xfc080002, "r,xOA,X", 4 },
  264. { "zmh", 0xf8000001, 0xfc080001, "r,xOA,X", 4 },
  265. { "zmw", 0xf8000000, 0xfc080000, "r,xOA,X", 4 },
  266. { "zr", 0x0c000000, 0xfc0f0000, "r", 2 },
  267. };
  268. int numopcodes = sizeof(gld_opcodes) / sizeof(gld_opcodes[0]);
  269. struct gld_opcode *endop = gld_opcodes + sizeof(gld_opcodes) /
  270. sizeof(gld_opcodes[0]);