2
0

cris-dis.c 80 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871
  1. /* Disassembler code for CRIS.
  2. Copyright 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
  3. Contributed by Axis Communications AB, Lund, Sweden.
  4. Written by Hans-Peter Nilsson.
  5. This file is part of the GNU binutils and GDB, the GNU debugger.
  6. This program is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by the
  8. Free Software Foundation; either version 2, or (at your option) any later
  9. version.
  10. This program is distributed in the hope that it will be useful, but WITHOUT
  11. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, see <http://www.gnu.org/licenses/>. */
  16. #include "qemu-common.h"
  17. #include "dis-asm.h"
  18. //#include "sysdep.h"
  19. #include "target-cris/opcode-cris.h"
  20. //#include "libiberty.h"
  21. #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
  22. /* cris-opc.c -- Table of opcodes for the CRIS processor.
  23. Copyright 2000, 2001, 2004 Free Software Foundation, Inc.
  24. Contributed by Axis Communications AB, Lund, Sweden.
  25. Originally written for GAS 1.38.1 by Mikael Asker.
  26. Reorganized by Hans-Peter Nilsson.
  27. This file is part of GAS, GDB and the GNU binutils.
  28. GAS, GDB, and GNU binutils is free software; you can redistribute it
  29. and/or modify it under the terms of the GNU General Public License as
  30. published by the Free Software Foundation; either version 2, or (at your
  31. option) any later version.
  32. GAS, GDB, and GNU binutils are distributed in the hope that they will be
  33. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  34. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  35. GNU General Public License for more details.
  36. You should have received a copy of the GNU General Public License
  37. along with this program; if not, see <http://www.gnu.org/licenses/>. */
  38. #ifndef NULL
  39. #define NULL (0)
  40. #endif
  41. /* This table isn't used for CRISv32 and the size of immediate operands. */
  42. const struct cris_spec_reg
  43. cris_spec_regs[] =
  44. {
  45. {"bz", 0, 1, cris_ver_v32p, NULL},
  46. {"p0", 0, 1, 0, NULL},
  47. {"vr", 1, 1, 0, NULL},
  48. {"p1", 1, 1, 0, NULL},
  49. {"pid", 2, 1, cris_ver_v32p, NULL},
  50. {"p2", 2, 1, cris_ver_v32p, NULL},
  51. {"p2", 2, 1, cris_ver_warning, NULL},
  52. {"srs", 3, 1, cris_ver_v32p, NULL},
  53. {"p3", 3, 1, cris_ver_v32p, NULL},
  54. {"p3", 3, 1, cris_ver_warning, NULL},
  55. {"wz", 4, 2, cris_ver_v32p, NULL},
  56. {"p4", 4, 2, 0, NULL},
  57. {"ccr", 5, 2, cris_ver_v0_10, NULL},
  58. {"exs", 5, 4, cris_ver_v32p, NULL},
  59. {"p5", 5, 2, cris_ver_v0_10, NULL},
  60. {"p5", 5, 4, cris_ver_v32p, NULL},
  61. {"dcr0",6, 2, cris_ver_v0_3, NULL},
  62. {"eda", 6, 4, cris_ver_v32p, NULL},
  63. {"p6", 6, 2, cris_ver_v0_3, NULL},
  64. {"p6", 6, 4, cris_ver_v32p, NULL},
  65. {"dcr1/mof", 7, 4, cris_ver_v10p,
  66. "Register `dcr1/mof' with ambiguous size specified. Guessing 4 bytes"},
  67. {"dcr1/mof", 7, 2, cris_ver_v0_3,
  68. "Register `dcr1/mof' with ambiguous size specified. Guessing 2 bytes"},
  69. {"mof", 7, 4, cris_ver_v10p, NULL},
  70. {"dcr1",7, 2, cris_ver_v0_3, NULL},
  71. {"p7", 7, 4, cris_ver_v10p, NULL},
  72. {"p7", 7, 2, cris_ver_v0_3, NULL},
  73. {"dz", 8, 4, cris_ver_v32p, NULL},
  74. {"p8", 8, 4, 0, NULL},
  75. {"ibr", 9, 4, cris_ver_v0_10, NULL},
  76. {"ebp", 9, 4, cris_ver_v32p, NULL},
  77. {"p9", 9, 4, 0, NULL},
  78. {"irp", 10, 4, cris_ver_v0_10, NULL},
  79. {"erp", 10, 4, cris_ver_v32p, NULL},
  80. {"p10", 10, 4, 0, NULL},
  81. {"srp", 11, 4, 0, NULL},
  82. {"p11", 11, 4, 0, NULL},
  83. /* For disassembly use only. Accept at assembly with a warning. */
  84. {"bar/dtp0", 12, 4, cris_ver_warning,
  85. "Ambiguous register `bar/dtp0' specified"},
  86. {"nrp", 12, 4, cris_ver_v32p, NULL},
  87. {"bar", 12, 4, cris_ver_v8_10, NULL},
  88. {"dtp0",12, 4, cris_ver_v0_3, NULL},
  89. {"p12", 12, 4, 0, NULL},
  90. /* For disassembly use only. Accept at assembly with a warning. */
  91. {"dccr/dtp1",13, 4, cris_ver_warning,
  92. "Ambiguous register `dccr/dtp1' specified"},
  93. {"ccs", 13, 4, cris_ver_v32p, NULL},
  94. {"dccr",13, 4, cris_ver_v8_10, NULL},
  95. {"dtp1",13, 4, cris_ver_v0_3, NULL},
  96. {"p13", 13, 4, 0, NULL},
  97. {"brp", 14, 4, cris_ver_v3_10, NULL},
  98. {"usp", 14, 4, cris_ver_v32p, NULL},
  99. {"p14", 14, 4, cris_ver_v3p, NULL},
  100. {"usp", 15, 4, cris_ver_v10, NULL},
  101. {"spc", 15, 4, cris_ver_v32p, NULL},
  102. {"p15", 15, 4, cris_ver_v10p, NULL},
  103. {NULL, 0, 0, cris_ver_version_all, NULL}
  104. };
  105. /* Add version specifiers to this table when necessary.
  106. The (now) regular coding of register names suggests a simpler
  107. implementation. */
  108. const struct cris_support_reg cris_support_regs[] =
  109. {
  110. {"s0", 0},
  111. {"s1", 1},
  112. {"s2", 2},
  113. {"s3", 3},
  114. {"s4", 4},
  115. {"s5", 5},
  116. {"s6", 6},
  117. {"s7", 7},
  118. {"s8", 8},
  119. {"s9", 9},
  120. {"s10", 10},
  121. {"s11", 11},
  122. {"s12", 12},
  123. {"s13", 13},
  124. {"s14", 14},
  125. {"s15", 15},
  126. {NULL, 0}
  127. };
  128. /* All CRIS opcodes are 16 bits.
  129. - The match component is a mask saying which bits must match a
  130. particular opcode in order for an instruction to be an instance
  131. of that opcode.
  132. - The args component is a string containing characters symbolically
  133. matching the operands of an instruction. Used for both assembly
  134. and disassembly.
  135. Operand-matching characters:
  136. [ ] , space
  137. Verbatim.
  138. A The string "ACR" (case-insensitive).
  139. B Not really an operand. It causes a "BDAP -size,SP" prefix to be
  140. output for the PUSH alias-instructions and recognizes a push-
  141. prefix at disassembly. This letter isn't recognized for v32.
  142. Must be followed by a R or P letter.
  143. ! Non-match pattern, will not match if there's a prefix insn.
  144. b Non-matching operand, used for branches with 16-bit
  145. displacement. Only recognized by the disassembler.
  146. c 5-bit unsigned immediate in bits <4:0>.
  147. C 4-bit unsigned immediate in bits <3:0>.
  148. d At assembly, optionally (as in put other cases before this one)
  149. ".d" or ".D" at the start of the operands, followed by one space
  150. character. At disassembly, nothing.
  151. D General register in bits <15:12> and <3:0>.
  152. f List of flags in bits <15:12> and <3:0>.
  153. i 6-bit signed immediate in bits <5:0>.
  154. I 6-bit unsigned immediate in bits <5:0>.
  155. M Size modifier (B, W or D) for CLEAR instructions.
  156. m Size modifier (B, W or D) in bits <5:4>
  157. N A 32-bit dword, like in the difference between s and y.
  158. This has no effect on bits in the opcode. Can also be expressed
  159. as "[pc+]" in input.
  160. n As N, but PC-relative (to the start of the instruction).
  161. o [-128..127] word offset in bits <7:1> and <0>. Used by 8-bit
  162. branch instructions.
  163. O [-128..127] offset in bits <7:0>. Also matches a comma and a
  164. general register after the expression, in bits <15:12>. Used
  165. only for the BDAP prefix insn (in v32 the ADDOQ insn; same opcode).
  166. P Special register in bits <15:12>.
  167. p Indicates that the insn is a prefix insn. Must be first
  168. character.
  169. Q As O, but don't relax; force an 8-bit offset.
  170. R General register in bits <15:12>.
  171. r General register in bits <3:0>.
  172. S Source operand in bit <10> and a prefix; a 3-operand prefix
  173. without side-effect.
  174. s Source operand in bits <10> and <3:0>, optionally with a
  175. side-effect prefix, except [pc] (the name, not R15 as in ACR)
  176. isn't allowed for v32 and higher.
  177. T Support register in bits <15:12>.
  178. u 4-bit (PC-relative) unsigned immediate word offset in bits <3:0>.
  179. U Relaxes to either u or n, instruction is assumed LAPCQ or LAPC.
  180. Not recognized at disassembly.
  181. x Register-dot-modifier, for example "r5.w" in bits <15:12> and <5:4>.
  182. y Like 's' but do not allow an integer at assembly.
  183. Y The difference s-y; only an integer is allowed.
  184. z Size modifier (B or W) in bit <4>. */
  185. /* Please note the order of the opcodes in this table is significant.
  186. The assembler requires that all instances of the same mnemonic must
  187. be consecutive. If they aren't, the assembler might not recognize
  188. them, or may indicate an internal error.
  189. The disassembler should not normally care about the order of the
  190. opcodes, but will prefer an earlier alternative if the "match-score"
  191. (see cris-dis.c) is computed as equal.
  192. It should not be significant for proper execution that this table is
  193. in alphabetical order, but please follow that convention for an easy
  194. overview. */
  195. const struct cris_opcode
  196. cris_opcodes[] =
  197. {
  198. {"abs", 0x06B0, 0x0940, "r,R", 0, SIZE_NONE, 0,
  199. cris_abs_op},
  200. {"add", 0x0600, 0x09c0, "m r,R", 0, SIZE_NONE, 0,
  201. cris_reg_mode_add_sub_cmp_and_or_move_op},
  202. {"add", 0x0A00, 0x01c0, "m s,R", 0, SIZE_FIELD, 0,
  203. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  204. {"add", 0x0A00, 0x01c0, "m S,D", 0, SIZE_NONE,
  205. cris_ver_v0_10,
  206. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  207. {"add", 0x0a00, 0x05c0, "m S,R,r", 0, SIZE_NONE,
  208. cris_ver_v0_10,
  209. cris_three_operand_add_sub_cmp_and_or_op},
  210. {"add", 0x0A00, 0x01c0, "m s,R", 0, SIZE_FIELD,
  211. cris_ver_v32p,
  212. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  213. {"addc", 0x0570, 0x0A80, "r,R", 0, SIZE_FIX_32,
  214. cris_ver_v32p,
  215. cris_not_implemented_op},
  216. {"addc", 0x09A0, 0x0250, "s,R", 0, SIZE_FIX_32,
  217. cris_ver_v32p,
  218. cris_not_implemented_op},
  219. {"addi", 0x0540, 0x0A80, "x,r,A", 0, SIZE_NONE,
  220. cris_ver_v32p,
  221. cris_addi_op},
  222. {"addi", 0x0500, 0x0Ac0, "x,r", 0, SIZE_NONE, 0,
  223. cris_addi_op},
  224. /* This collates after "addo", but we want to disassemble as "addoq",
  225. not "addo". */
  226. {"addoq", 0x0100, 0x0E00, "Q,A", 0, SIZE_NONE,
  227. cris_ver_v32p,
  228. cris_not_implemented_op},
  229. {"addo", 0x0940, 0x0280, "m s,R,A", 0, SIZE_FIELD_SIGNED,
  230. cris_ver_v32p,
  231. cris_not_implemented_op},
  232. /* This must be located after the insn above, lest we misinterpret
  233. "addo.b -1,r0,acr" as "addo .b-1,r0,acr". FIXME: Sounds like a
  234. parser bug. */
  235. {"addo", 0x0100, 0x0E00, "O,A", 0, SIZE_NONE,
  236. cris_ver_v32p,
  237. cris_not_implemented_op},
  238. {"addq", 0x0200, 0x0Dc0, "I,R", 0, SIZE_NONE, 0,
  239. cris_quick_mode_add_sub_op},
  240. {"adds", 0x0420, 0x0Bc0, "z r,R", 0, SIZE_NONE, 0,
  241. cris_reg_mode_add_sub_cmp_and_or_move_op},
  242. /* FIXME: SIZE_FIELD_SIGNED and all necessary changes. */
  243. {"adds", 0x0820, 0x03c0, "z s,R", 0, SIZE_FIELD, 0,
  244. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  245. {"adds", 0x0820, 0x03c0, "z S,D", 0, SIZE_NONE,
  246. cris_ver_v0_10,
  247. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  248. {"adds", 0x0820, 0x07c0, "z S,R,r", 0, SIZE_NONE,
  249. cris_ver_v0_10,
  250. cris_three_operand_add_sub_cmp_and_or_op},
  251. {"addu", 0x0400, 0x0be0, "z r,R", 0, SIZE_NONE, 0,
  252. cris_reg_mode_add_sub_cmp_and_or_move_op},
  253. /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
  254. {"addu", 0x0800, 0x03e0, "z s,R", 0, SIZE_FIELD, 0,
  255. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  256. {"addu", 0x0800, 0x03e0, "z S,D", 0, SIZE_NONE,
  257. cris_ver_v0_10,
  258. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  259. {"addu", 0x0800, 0x07e0, "z S,R,r", 0, SIZE_NONE,
  260. cris_ver_v0_10,
  261. cris_three_operand_add_sub_cmp_and_or_op},
  262. {"and", 0x0700, 0x08C0, "m r,R", 0, SIZE_NONE, 0,
  263. cris_reg_mode_add_sub_cmp_and_or_move_op},
  264. {"and", 0x0B00, 0x00C0, "m s,R", 0, SIZE_FIELD, 0,
  265. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  266. {"and", 0x0B00, 0x00C0, "m S,D", 0, SIZE_NONE,
  267. cris_ver_v0_10,
  268. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  269. {"and", 0x0B00, 0x04C0, "m S,R,r", 0, SIZE_NONE,
  270. cris_ver_v0_10,
  271. cris_three_operand_add_sub_cmp_and_or_op},
  272. {"andq", 0x0300, 0x0CC0, "i,R", 0, SIZE_NONE, 0,
  273. cris_quick_mode_and_cmp_move_or_op},
  274. {"asr", 0x0780, 0x0840, "m r,R", 0, SIZE_NONE, 0,
  275. cris_asr_op},
  276. {"asrq", 0x03a0, 0x0c40, "c,R", 0, SIZE_NONE, 0,
  277. cris_asrq_op},
  278. {"ax", 0x15B0, 0xEA4F, "", 0, SIZE_NONE, 0,
  279. cris_ax_ei_setf_op},
  280. /* FIXME: Should use branch #defines. */
  281. {"b", 0x0dff, 0x0200, "b", 1, SIZE_NONE, 0,
  282. cris_sixteen_bit_offset_branch_op},
  283. {"ba",
  284. BA_QUICK_OPCODE,
  285. 0x0F00+(0xF-CC_A)*0x1000, "o", 1, SIZE_NONE, 0,
  286. cris_eight_bit_offset_branch_op},
  287. /* Needs to come after the usual "ba o", which might be relaxed to
  288. this one. */
  289. {"ba", BA_DWORD_OPCODE,
  290. 0xffff & (~BA_DWORD_OPCODE), "n", 0, SIZE_FIX_32,
  291. cris_ver_v32p,
  292. cris_none_reg_mode_jump_op},
  293. {"bas", 0x0EBF, 0x0140, "n,P", 0, SIZE_FIX_32,
  294. cris_ver_v32p,
  295. cris_none_reg_mode_jump_op},
  296. {"basc", 0x0EFF, 0x0100, "n,P", 0, SIZE_FIX_32,
  297. cris_ver_v32p,
  298. cris_none_reg_mode_jump_op},
  299. {"bcc",
  300. BRANCH_QUICK_OPCODE+CC_CC*0x1000,
  301. 0x0f00+(0xF-CC_CC)*0x1000, "o", 1, SIZE_NONE, 0,
  302. cris_eight_bit_offset_branch_op},
  303. {"bcs",
  304. BRANCH_QUICK_OPCODE+CC_CS*0x1000,
  305. 0x0f00+(0xF-CC_CS)*0x1000, "o", 1, SIZE_NONE, 0,
  306. cris_eight_bit_offset_branch_op},
  307. {"bdap",
  308. BDAP_INDIR_OPCODE, BDAP_INDIR_Z_BITS, "pm s,R", 0, SIZE_FIELD_SIGNED,
  309. cris_ver_v0_10,
  310. cris_bdap_prefix},
  311. {"bdap",
  312. BDAP_QUICK_OPCODE, BDAP_QUICK_Z_BITS, "pO", 0, SIZE_NONE,
  313. cris_ver_v0_10,
  314. cris_quick_mode_bdap_prefix},
  315. {"beq",
  316. BRANCH_QUICK_OPCODE+CC_EQ*0x1000,
  317. 0x0f00+(0xF-CC_EQ)*0x1000, "o", 1, SIZE_NONE, 0,
  318. cris_eight_bit_offset_branch_op},
  319. /* This is deliberately put before "bext" to trump it, even though not
  320. in alphabetical order, since we don't do excluding version checks
  321. for v0..v10. */
  322. {"bwf",
  323. BRANCH_QUICK_OPCODE+CC_EXT*0x1000,
  324. 0x0f00+(0xF-CC_EXT)*0x1000, "o", 1, SIZE_NONE,
  325. cris_ver_v10,
  326. cris_eight_bit_offset_branch_op},
  327. {"bext",
  328. BRANCH_QUICK_OPCODE+CC_EXT*0x1000,
  329. 0x0f00+(0xF-CC_EXT)*0x1000, "o", 1, SIZE_NONE,
  330. cris_ver_v0_3,
  331. cris_eight_bit_offset_branch_op},
  332. {"bge",
  333. BRANCH_QUICK_OPCODE+CC_GE*0x1000,
  334. 0x0f00+(0xF-CC_GE)*0x1000, "o", 1, SIZE_NONE, 0,
  335. cris_eight_bit_offset_branch_op},
  336. {"bgt",
  337. BRANCH_QUICK_OPCODE+CC_GT*0x1000,
  338. 0x0f00+(0xF-CC_GT)*0x1000, "o", 1, SIZE_NONE, 0,
  339. cris_eight_bit_offset_branch_op},
  340. {"bhi",
  341. BRANCH_QUICK_OPCODE+CC_HI*0x1000,
  342. 0x0f00+(0xF-CC_HI)*0x1000, "o", 1, SIZE_NONE, 0,
  343. cris_eight_bit_offset_branch_op},
  344. {"bhs",
  345. BRANCH_QUICK_OPCODE+CC_HS*0x1000,
  346. 0x0f00+(0xF-CC_HS)*0x1000, "o", 1, SIZE_NONE, 0,
  347. cris_eight_bit_offset_branch_op},
  348. {"biap", BIAP_OPCODE, BIAP_Z_BITS, "pm r,R", 0, SIZE_NONE,
  349. cris_ver_v0_10,
  350. cris_biap_prefix},
  351. {"ble",
  352. BRANCH_QUICK_OPCODE+CC_LE*0x1000,
  353. 0x0f00+(0xF-CC_LE)*0x1000, "o", 1, SIZE_NONE, 0,
  354. cris_eight_bit_offset_branch_op},
  355. {"blo",
  356. BRANCH_QUICK_OPCODE+CC_LO*0x1000,
  357. 0x0f00+(0xF-CC_LO)*0x1000, "o", 1, SIZE_NONE, 0,
  358. cris_eight_bit_offset_branch_op},
  359. {"bls",
  360. BRANCH_QUICK_OPCODE+CC_LS*0x1000,
  361. 0x0f00+(0xF-CC_LS)*0x1000, "o", 1, SIZE_NONE, 0,
  362. cris_eight_bit_offset_branch_op},
  363. {"blt",
  364. BRANCH_QUICK_OPCODE+CC_LT*0x1000,
  365. 0x0f00+(0xF-CC_LT)*0x1000, "o", 1, SIZE_NONE, 0,
  366. cris_eight_bit_offset_branch_op},
  367. {"bmi",
  368. BRANCH_QUICK_OPCODE+CC_MI*0x1000,
  369. 0x0f00+(0xF-CC_MI)*0x1000, "o", 1, SIZE_NONE, 0,
  370. cris_eight_bit_offset_branch_op},
  371. {"bmod", 0x0ab0, 0x0140, "s,R", 0, SIZE_FIX_32,
  372. cris_ver_sim_v0_10,
  373. cris_not_implemented_op},
  374. {"bmod", 0x0ab0, 0x0140, "S,D", 0, SIZE_NONE,
  375. cris_ver_sim_v0_10,
  376. cris_not_implemented_op},
  377. {"bmod", 0x0ab0, 0x0540, "S,R,r", 0, SIZE_NONE,
  378. cris_ver_sim_v0_10,
  379. cris_not_implemented_op},
  380. {"bne",
  381. BRANCH_QUICK_OPCODE+CC_NE*0x1000,
  382. 0x0f00+(0xF-CC_NE)*0x1000, "o", 1, SIZE_NONE, 0,
  383. cris_eight_bit_offset_branch_op},
  384. {"bound", 0x05c0, 0x0A00, "m r,R", 0, SIZE_NONE, 0,
  385. cris_two_operand_bound_op},
  386. /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
  387. {"bound", 0x09c0, 0x0200, "m s,R", 0, SIZE_FIELD,
  388. cris_ver_v0_10,
  389. cris_two_operand_bound_op},
  390. /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
  391. {"bound", 0x0dcf, 0x0200, "m Y,R", 0, SIZE_FIELD, 0,
  392. cris_two_operand_bound_op},
  393. {"bound", 0x09c0, 0x0200, "m S,D", 0, SIZE_NONE,
  394. cris_ver_v0_10,
  395. cris_two_operand_bound_op},
  396. {"bound", 0x09c0, 0x0600, "m S,R,r", 0, SIZE_NONE,
  397. cris_ver_v0_10,
  398. cris_three_operand_bound_op},
  399. {"bpl",
  400. BRANCH_QUICK_OPCODE+CC_PL*0x1000,
  401. 0x0f00+(0xF-CC_PL)*0x1000, "o", 1, SIZE_NONE, 0,
  402. cris_eight_bit_offset_branch_op},
  403. {"break", 0xe930, 0x16c0, "C", 0, SIZE_NONE,
  404. cris_ver_v3p,
  405. cris_break_op},
  406. {"bsb",
  407. BRANCH_QUICK_OPCODE+CC_EXT*0x1000,
  408. 0x0f00+(0xF-CC_EXT)*0x1000, "o", 1, SIZE_NONE,
  409. cris_ver_v32p,
  410. cris_eight_bit_offset_branch_op},
  411. {"bsr", 0xBEBF, 0x4140, "n", 0, SIZE_FIX_32,
  412. cris_ver_v32p,
  413. cris_none_reg_mode_jump_op},
  414. {"bsrc", 0xBEFF, 0x4100, "n", 0, SIZE_FIX_32,
  415. cris_ver_v32p,
  416. cris_none_reg_mode_jump_op},
  417. {"bstore", 0x0af0, 0x0100, "s,R", 0, SIZE_FIX_32,
  418. cris_ver_warning,
  419. cris_not_implemented_op},
  420. {"bstore", 0x0af0, 0x0100, "S,D", 0, SIZE_NONE,
  421. cris_ver_warning,
  422. cris_not_implemented_op},
  423. {"bstore", 0x0af0, 0x0500, "S,R,r", 0, SIZE_NONE,
  424. cris_ver_warning,
  425. cris_not_implemented_op},
  426. {"btst", 0x04F0, 0x0B00, "r,R", 0, SIZE_NONE, 0,
  427. cris_btst_nop_op},
  428. {"btstq", 0x0380, 0x0C60, "c,R", 0, SIZE_NONE, 0,
  429. cris_btst_nop_op},
  430. {"bvc",
  431. BRANCH_QUICK_OPCODE+CC_VC*0x1000,
  432. 0x0f00+(0xF-CC_VC)*0x1000, "o", 1, SIZE_NONE, 0,
  433. cris_eight_bit_offset_branch_op},
  434. {"bvs",
  435. BRANCH_QUICK_OPCODE+CC_VS*0x1000,
  436. 0x0f00+(0xF-CC_VS)*0x1000, "o", 1, SIZE_NONE, 0,
  437. cris_eight_bit_offset_branch_op},
  438. {"clear", 0x0670, 0x3980, "M r", 0, SIZE_NONE, 0,
  439. cris_reg_mode_clear_op},
  440. {"clear", 0x0A70, 0x3180, "M y", 0, SIZE_NONE, 0,
  441. cris_none_reg_mode_clear_test_op},
  442. {"clear", 0x0A70, 0x3180, "M S", 0, SIZE_NONE,
  443. cris_ver_v0_10,
  444. cris_none_reg_mode_clear_test_op},
  445. {"clearf", 0x05F0, 0x0A00, "f", 0, SIZE_NONE, 0,
  446. cris_clearf_di_op},
  447. {"cmp", 0x06C0, 0x0900, "m r,R", 0, SIZE_NONE, 0,
  448. cris_reg_mode_add_sub_cmp_and_or_move_op},
  449. {"cmp", 0x0Ac0, 0x0100, "m s,R", 0, SIZE_FIELD, 0,
  450. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  451. {"cmp", 0x0Ac0, 0x0100, "m S,D", 0, SIZE_NONE,
  452. cris_ver_v0_10,
  453. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  454. {"cmpq", 0x02C0, 0x0D00, "i,R", 0, SIZE_NONE, 0,
  455. cris_quick_mode_and_cmp_move_or_op},
  456. /* FIXME: SIZE_FIELD_SIGNED and all necessary changes. */
  457. {"cmps", 0x08e0, 0x0300, "z s,R", 0, SIZE_FIELD, 0,
  458. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  459. {"cmps", 0x08e0, 0x0300, "z S,D", 0, SIZE_NONE,
  460. cris_ver_v0_10,
  461. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  462. /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
  463. {"cmpu", 0x08c0, 0x0320, "z s,R" , 0, SIZE_FIELD, 0,
  464. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  465. {"cmpu", 0x08c0, 0x0320, "z S,D", 0, SIZE_NONE,
  466. cris_ver_v0_10,
  467. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  468. {"di", 0x25F0, 0xDA0F, "", 0, SIZE_NONE, 0,
  469. cris_clearf_di_op},
  470. {"dip", DIP_OPCODE, DIP_Z_BITS, "ps", 0, SIZE_FIX_32,
  471. cris_ver_v0_10,
  472. cris_dip_prefix},
  473. {"div", 0x0980, 0x0640, "m R,r", 0, SIZE_FIELD, 0,
  474. cris_not_implemented_op},
  475. {"dstep", 0x06f0, 0x0900, "r,R", 0, SIZE_NONE, 0,
  476. cris_dstep_logshift_mstep_neg_not_op},
  477. {"ei", 0x25B0, 0xDA4F, "", 0, SIZE_NONE, 0,
  478. cris_ax_ei_setf_op},
  479. {"fidxd", 0x0ab0, 0xf540, "[r]", 0, SIZE_NONE,
  480. cris_ver_v32p,
  481. cris_not_implemented_op},
  482. {"fidxi", 0x0d30, 0xF2C0, "[r]", 0, SIZE_NONE,
  483. cris_ver_v32p,
  484. cris_not_implemented_op},
  485. {"ftagd", 0x1AB0, 0xE540, "[r]", 0, SIZE_NONE,
  486. cris_ver_v32p,
  487. cris_not_implemented_op},
  488. {"ftagi", 0x1D30, 0xE2C0, "[r]", 0, SIZE_NONE,
  489. cris_ver_v32p,
  490. cris_not_implemented_op},
  491. {"halt", 0xF930, 0x06CF, "", 0, SIZE_NONE,
  492. cris_ver_v32p,
  493. cris_not_implemented_op},
  494. {"jas", 0x09B0, 0x0640, "r,P", 0, SIZE_NONE,
  495. cris_ver_v32p,
  496. cris_reg_mode_jump_op},
  497. {"jas", 0x0DBF, 0x0240, "N,P", 0, SIZE_FIX_32,
  498. cris_ver_v32p,
  499. cris_reg_mode_jump_op},
  500. {"jasc", 0x0B30, 0x04C0, "r,P", 0, SIZE_NONE,
  501. cris_ver_v32p,
  502. cris_reg_mode_jump_op},
  503. {"jasc", 0x0F3F, 0x00C0, "N,P", 0, SIZE_FIX_32,
  504. cris_ver_v32p,
  505. cris_reg_mode_jump_op},
  506. {"jbrc", 0x69b0, 0x9640, "r", 0, SIZE_NONE,
  507. cris_ver_v8_10,
  508. cris_reg_mode_jump_op},
  509. {"jbrc", 0x6930, 0x92c0, "s", 0, SIZE_FIX_32,
  510. cris_ver_v8_10,
  511. cris_none_reg_mode_jump_op},
  512. {"jbrc", 0x6930, 0x92c0, "S", 0, SIZE_NONE,
  513. cris_ver_v8_10,
  514. cris_none_reg_mode_jump_op},
  515. {"jir", 0xA9b0, 0x5640, "r", 0, SIZE_NONE,
  516. cris_ver_v8_10,
  517. cris_reg_mode_jump_op},
  518. {"jir", 0xA930, 0x52c0, "s", 0, SIZE_FIX_32,
  519. cris_ver_v8_10,
  520. cris_none_reg_mode_jump_op},
  521. {"jir", 0xA930, 0x52c0, "S", 0, SIZE_NONE,
  522. cris_ver_v8_10,
  523. cris_none_reg_mode_jump_op},
  524. {"jirc", 0x29b0, 0xd640, "r", 0, SIZE_NONE,
  525. cris_ver_v8_10,
  526. cris_reg_mode_jump_op},
  527. {"jirc", 0x2930, 0xd2c0, "s", 0, SIZE_FIX_32,
  528. cris_ver_v8_10,
  529. cris_none_reg_mode_jump_op},
  530. {"jirc", 0x2930, 0xd2c0, "S", 0, SIZE_NONE,
  531. cris_ver_v8_10,
  532. cris_none_reg_mode_jump_op},
  533. {"jsr", 0xB9b0, 0x4640, "r", 0, SIZE_NONE, 0,
  534. cris_reg_mode_jump_op},
  535. {"jsr", 0xB930, 0x42c0, "s", 0, SIZE_FIX_32,
  536. cris_ver_v0_10,
  537. cris_none_reg_mode_jump_op},
  538. {"jsr", 0xBDBF, 0x4240, "N", 0, SIZE_FIX_32,
  539. cris_ver_v32p,
  540. cris_none_reg_mode_jump_op},
  541. {"jsr", 0xB930, 0x42c0, "S", 0, SIZE_NONE,
  542. cris_ver_v0_10,
  543. cris_none_reg_mode_jump_op},
  544. {"jsrc", 0x39b0, 0xc640, "r", 0, SIZE_NONE,
  545. cris_ver_v8_10,
  546. cris_reg_mode_jump_op},
  547. {"jsrc", 0x3930, 0xc2c0, "s", 0, SIZE_FIX_32,
  548. cris_ver_v8_10,
  549. cris_none_reg_mode_jump_op},
  550. {"jsrc", 0x3930, 0xc2c0, "S", 0, SIZE_NONE,
  551. cris_ver_v8_10,
  552. cris_none_reg_mode_jump_op},
  553. {"jsrc", 0xBB30, 0x44C0, "r", 0, SIZE_NONE,
  554. cris_ver_v32p,
  555. cris_reg_mode_jump_op},
  556. {"jsrc", 0xBF3F, 0x40C0, "N", 0, SIZE_FIX_32,
  557. cris_ver_v32p,
  558. cris_reg_mode_jump_op},
  559. {"jump", 0x09b0, 0xF640, "r", 0, SIZE_NONE, 0,
  560. cris_reg_mode_jump_op},
  561. {"jump",
  562. JUMP_INDIR_OPCODE, JUMP_INDIR_Z_BITS, "s", 0, SIZE_FIX_32,
  563. cris_ver_v0_10,
  564. cris_none_reg_mode_jump_op},
  565. {"jump",
  566. JUMP_INDIR_OPCODE, JUMP_INDIR_Z_BITS, "S", 0, SIZE_NONE,
  567. cris_ver_v0_10,
  568. cris_none_reg_mode_jump_op},
  569. {"jump", 0x09F0, 0x060F, "P", 0, SIZE_NONE,
  570. cris_ver_v32p,
  571. cris_none_reg_mode_jump_op},
  572. {"jump",
  573. JUMP_PC_INCR_OPCODE_V32,
  574. (0xffff & ~JUMP_PC_INCR_OPCODE_V32), "N", 0, SIZE_FIX_32,
  575. cris_ver_v32p,
  576. cris_none_reg_mode_jump_op},
  577. {"jmpu", 0x8930, 0x72c0, "s", 0, SIZE_FIX_32,
  578. cris_ver_v10,
  579. cris_none_reg_mode_jump_op},
  580. {"jmpu", 0x8930, 0x72c0, "S", 0, SIZE_NONE,
  581. cris_ver_v10,
  582. cris_none_reg_mode_jump_op},
  583. {"lapc", 0x0970, 0x0680, "U,R", 0, SIZE_NONE,
  584. cris_ver_v32p,
  585. cris_not_implemented_op},
  586. {"lapc", 0x0D7F, 0x0280, "dn,R", 0, SIZE_FIX_32,
  587. cris_ver_v32p,
  588. cris_not_implemented_op},
  589. {"lapcq", 0x0970, 0x0680, "u,R", 0, SIZE_NONE,
  590. cris_ver_v32p,
  591. cris_addi_op},
  592. {"lsl", 0x04C0, 0x0B00, "m r,R", 0, SIZE_NONE, 0,
  593. cris_dstep_logshift_mstep_neg_not_op},
  594. {"lslq", 0x03c0, 0x0C20, "c,R", 0, SIZE_NONE, 0,
  595. cris_dstep_logshift_mstep_neg_not_op},
  596. {"lsr", 0x07C0, 0x0800, "m r,R", 0, SIZE_NONE, 0,
  597. cris_dstep_logshift_mstep_neg_not_op},
  598. {"lsrq", 0x03e0, 0x0C00, "c,R", 0, SIZE_NONE, 0,
  599. cris_dstep_logshift_mstep_neg_not_op},
  600. {"lz", 0x0730, 0x08C0, "r,R", 0, SIZE_NONE,
  601. cris_ver_v3p,
  602. cris_not_implemented_op},
  603. {"mcp", 0x07f0, 0x0800, "P,r", 0, SIZE_NONE,
  604. cris_ver_v32p,
  605. cris_not_implemented_op},
  606. {"move", 0x0640, 0x0980, "m r,R", 0, SIZE_NONE, 0,
  607. cris_reg_mode_add_sub_cmp_and_or_move_op},
  608. {"move", 0x0A40, 0x0180, "m s,R", 0, SIZE_FIELD, 0,
  609. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  610. {"move", 0x0A40, 0x0180, "m S,D", 0, SIZE_NONE,
  611. cris_ver_v0_10,
  612. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  613. {"move", 0x0630, 0x09c0, "r,P", 0, SIZE_NONE, 0,
  614. cris_move_to_preg_op},
  615. {"move", 0x0670, 0x0980, "P,r", 0, SIZE_NONE, 0,
  616. cris_reg_mode_move_from_preg_op},
  617. {"move", 0x0BC0, 0x0000, "m R,y", 0, SIZE_FIELD, 0,
  618. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  619. {"move", 0x0BC0, 0x0000, "m D,S", 0, SIZE_NONE,
  620. cris_ver_v0_10,
  621. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  622. {"move",
  623. MOVE_M_TO_PREG_OPCODE, MOVE_M_TO_PREG_ZBITS,
  624. "s,P", 0, SIZE_SPEC_REG, 0,
  625. cris_move_to_preg_op},
  626. {"move", 0x0A30, 0x01c0, "S,P", 0, SIZE_NONE,
  627. cris_ver_v0_10,
  628. cris_move_to_preg_op},
  629. {"move", 0x0A70, 0x0180, "P,y", 0, SIZE_SPEC_REG, 0,
  630. cris_none_reg_mode_move_from_preg_op},
  631. {"move", 0x0A70, 0x0180, "P,S", 0, SIZE_NONE,
  632. cris_ver_v0_10,
  633. cris_none_reg_mode_move_from_preg_op},
  634. {"move", 0x0B70, 0x0480, "r,T", 0, SIZE_NONE,
  635. cris_ver_v32p,
  636. cris_not_implemented_op},
  637. {"move", 0x0F70, 0x0080, "T,r", 0, SIZE_NONE,
  638. cris_ver_v32p,
  639. cris_not_implemented_op},
  640. {"movem", 0x0BF0, 0x0000, "R,y", 0, SIZE_FIX_32, 0,
  641. cris_move_reg_to_mem_movem_op},
  642. {"movem", 0x0BF0, 0x0000, "D,S", 0, SIZE_NONE,
  643. cris_ver_v0_10,
  644. cris_move_reg_to_mem_movem_op},
  645. {"movem", 0x0BB0, 0x0040, "s,R", 0, SIZE_FIX_32, 0,
  646. cris_move_mem_to_reg_movem_op},
  647. {"movem", 0x0BB0, 0x0040, "S,D", 0, SIZE_NONE,
  648. cris_ver_v0_10,
  649. cris_move_mem_to_reg_movem_op},
  650. {"moveq", 0x0240, 0x0D80, "i,R", 0, SIZE_NONE, 0,
  651. cris_quick_mode_and_cmp_move_or_op},
  652. {"movs", 0x0460, 0x0B80, "z r,R", 0, SIZE_NONE, 0,
  653. cris_reg_mode_add_sub_cmp_and_or_move_op},
  654. /* FIXME: SIZE_FIELD_SIGNED and all necessary changes. */
  655. {"movs", 0x0860, 0x0380, "z s,R", 0, SIZE_FIELD, 0,
  656. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  657. {"movs", 0x0860, 0x0380, "z S,D", 0, SIZE_NONE,
  658. cris_ver_v0_10,
  659. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  660. {"movu", 0x0440, 0x0Ba0, "z r,R", 0, SIZE_NONE, 0,
  661. cris_reg_mode_add_sub_cmp_and_or_move_op},
  662. /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
  663. {"movu", 0x0840, 0x03a0, "z s,R", 0, SIZE_FIELD, 0,
  664. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  665. {"movu", 0x0840, 0x03a0, "z S,D", 0, SIZE_NONE,
  666. cris_ver_v0_10,
  667. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  668. {"mstep", 0x07f0, 0x0800, "r,R", 0, SIZE_NONE,
  669. cris_ver_v0_10,
  670. cris_dstep_logshift_mstep_neg_not_op},
  671. {"muls", 0x0d00, 0x02c0, "m r,R", 0, SIZE_NONE,
  672. cris_ver_v10p,
  673. cris_muls_op},
  674. {"mulu", 0x0900, 0x06c0, "m r,R", 0, SIZE_NONE,
  675. cris_ver_v10p,
  676. cris_mulu_op},
  677. {"neg", 0x0580, 0x0A40, "m r,R", 0, SIZE_NONE, 0,
  678. cris_dstep_logshift_mstep_neg_not_op},
  679. {"nop", NOP_OPCODE, NOP_Z_BITS, "", 0, SIZE_NONE,
  680. cris_ver_v0_10,
  681. cris_btst_nop_op},
  682. {"nop", NOP_OPCODE_V32, NOP_Z_BITS_V32, "", 0, SIZE_NONE,
  683. cris_ver_v32p,
  684. cris_btst_nop_op},
  685. {"not", 0x8770, 0x7880, "r", 0, SIZE_NONE, 0,
  686. cris_dstep_logshift_mstep_neg_not_op},
  687. {"or", 0x0740, 0x0880, "m r,R", 0, SIZE_NONE, 0,
  688. cris_reg_mode_add_sub_cmp_and_or_move_op},
  689. {"or", 0x0B40, 0x0080, "m s,R", 0, SIZE_FIELD, 0,
  690. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  691. {"or", 0x0B40, 0x0080, "m S,D", 0, SIZE_NONE,
  692. cris_ver_v0_10,
  693. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  694. {"or", 0x0B40, 0x0480, "m S,R,r", 0, SIZE_NONE,
  695. cris_ver_v0_10,
  696. cris_three_operand_add_sub_cmp_and_or_op},
  697. {"orq", 0x0340, 0x0C80, "i,R", 0, SIZE_NONE, 0,
  698. cris_quick_mode_and_cmp_move_or_op},
  699. {"pop", 0x0E6E, 0x0191, "!R", 0, SIZE_NONE,
  700. cris_ver_v0_10,
  701. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  702. {"pop", 0x0e3e, 0x01c1, "!P", 0, SIZE_NONE,
  703. cris_ver_v0_10,
  704. cris_none_reg_mode_move_from_preg_op},
  705. {"push", 0x0FEE, 0x0011, "BR", 0, SIZE_NONE,
  706. cris_ver_v0_10,
  707. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  708. {"push", 0x0E7E, 0x0181, "BP", 0, SIZE_NONE,
  709. cris_ver_v0_10,
  710. cris_move_to_preg_op},
  711. {"rbf", 0x3b30, 0xc0c0, "y", 0, SIZE_NONE,
  712. cris_ver_v10,
  713. cris_not_implemented_op},
  714. {"rbf", 0x3b30, 0xc0c0, "S", 0, SIZE_NONE,
  715. cris_ver_v10,
  716. cris_not_implemented_op},
  717. {"rfe", 0x2930, 0xD6CF, "", 0, SIZE_NONE,
  718. cris_ver_v32p,
  719. cris_not_implemented_op},
  720. {"rfg", 0x4930, 0xB6CF, "", 0, SIZE_NONE,
  721. cris_ver_v32p,
  722. cris_not_implemented_op},
  723. {"rfn", 0x5930, 0xA6CF, "", 0, SIZE_NONE,
  724. cris_ver_v32p,
  725. cris_not_implemented_op},
  726. {"ret", 0xB67F, 0x4980, "", 1, SIZE_NONE,
  727. cris_ver_v0_10,
  728. cris_reg_mode_move_from_preg_op},
  729. {"ret", 0xB9F0, 0x460F, "", 1, SIZE_NONE,
  730. cris_ver_v32p,
  731. cris_reg_mode_move_from_preg_op},
  732. {"retb", 0xe67f, 0x1980, "", 1, SIZE_NONE,
  733. cris_ver_v0_10,
  734. cris_reg_mode_move_from_preg_op},
  735. {"rete", 0xA9F0, 0x560F, "", 1, SIZE_NONE,
  736. cris_ver_v32p,
  737. cris_reg_mode_move_from_preg_op},
  738. {"reti", 0xA67F, 0x5980, "", 1, SIZE_NONE,
  739. cris_ver_v0_10,
  740. cris_reg_mode_move_from_preg_op},
  741. {"retn", 0xC9F0, 0x360F, "", 1, SIZE_NONE,
  742. cris_ver_v32p,
  743. cris_reg_mode_move_from_preg_op},
  744. {"sbfs", 0x3b70, 0xc080, "y", 0, SIZE_NONE,
  745. cris_ver_v10,
  746. cris_not_implemented_op},
  747. {"sbfs", 0x3b70, 0xc080, "S", 0, SIZE_NONE,
  748. cris_ver_v10,
  749. cris_not_implemented_op},
  750. {"sa",
  751. 0x0530+CC_A*0x1000,
  752. 0x0AC0+(0xf-CC_A)*0x1000, "r", 0, SIZE_NONE, 0,
  753. cris_scc_op},
  754. {"ssb",
  755. 0x0530+CC_EXT*0x1000,
  756. 0x0AC0+(0xf-CC_EXT)*0x1000, "r", 0, SIZE_NONE,
  757. cris_ver_v32p,
  758. cris_scc_op},
  759. {"scc",
  760. 0x0530+CC_CC*0x1000,
  761. 0x0AC0+(0xf-CC_CC)*0x1000, "r", 0, SIZE_NONE, 0,
  762. cris_scc_op},
  763. {"scs",
  764. 0x0530+CC_CS*0x1000,
  765. 0x0AC0+(0xf-CC_CS)*0x1000, "r", 0, SIZE_NONE, 0,
  766. cris_scc_op},
  767. {"seq",
  768. 0x0530+CC_EQ*0x1000,
  769. 0x0AC0+(0xf-CC_EQ)*0x1000, "r", 0, SIZE_NONE, 0,
  770. cris_scc_op},
  771. {"setf", 0x05b0, 0x0A40, "f", 0, SIZE_NONE, 0,
  772. cris_ax_ei_setf_op},
  773. {"sfe", 0x3930, 0xC6CF, "", 0, SIZE_NONE,
  774. cris_ver_v32p,
  775. cris_not_implemented_op},
  776. /* Need to have "swf" in front of "sext" so it is the one displayed in
  777. disassembly. */
  778. {"swf",
  779. 0x0530+CC_EXT*0x1000,
  780. 0x0AC0+(0xf-CC_EXT)*0x1000, "r", 0, SIZE_NONE,
  781. cris_ver_v10,
  782. cris_scc_op},
  783. {"sext",
  784. 0x0530+CC_EXT*0x1000,
  785. 0x0AC0+(0xf-CC_EXT)*0x1000, "r", 0, SIZE_NONE,
  786. cris_ver_v0_3,
  787. cris_scc_op},
  788. {"sge",
  789. 0x0530+CC_GE*0x1000,
  790. 0x0AC0+(0xf-CC_GE)*0x1000, "r", 0, SIZE_NONE, 0,
  791. cris_scc_op},
  792. {"sgt",
  793. 0x0530+CC_GT*0x1000,
  794. 0x0AC0+(0xf-CC_GT)*0x1000, "r", 0, SIZE_NONE, 0,
  795. cris_scc_op},
  796. {"shi",
  797. 0x0530+CC_HI*0x1000,
  798. 0x0AC0+(0xf-CC_HI)*0x1000, "r", 0, SIZE_NONE, 0,
  799. cris_scc_op},
  800. {"shs",
  801. 0x0530+CC_HS*0x1000,
  802. 0x0AC0+(0xf-CC_HS)*0x1000, "r", 0, SIZE_NONE, 0,
  803. cris_scc_op},
  804. {"sle",
  805. 0x0530+CC_LE*0x1000,
  806. 0x0AC0+(0xf-CC_LE)*0x1000, "r", 0, SIZE_NONE, 0,
  807. cris_scc_op},
  808. {"slo",
  809. 0x0530+CC_LO*0x1000,
  810. 0x0AC0+(0xf-CC_LO)*0x1000, "r", 0, SIZE_NONE, 0,
  811. cris_scc_op},
  812. {"sls",
  813. 0x0530+CC_LS*0x1000,
  814. 0x0AC0+(0xf-CC_LS)*0x1000, "r", 0, SIZE_NONE, 0,
  815. cris_scc_op},
  816. {"slt",
  817. 0x0530+CC_LT*0x1000,
  818. 0x0AC0+(0xf-CC_LT)*0x1000, "r", 0, SIZE_NONE, 0,
  819. cris_scc_op},
  820. {"smi",
  821. 0x0530+CC_MI*0x1000,
  822. 0x0AC0+(0xf-CC_MI)*0x1000, "r", 0, SIZE_NONE, 0,
  823. cris_scc_op},
  824. {"sne",
  825. 0x0530+CC_NE*0x1000,
  826. 0x0AC0+(0xf-CC_NE)*0x1000, "r", 0, SIZE_NONE, 0,
  827. cris_scc_op},
  828. {"spl",
  829. 0x0530+CC_PL*0x1000,
  830. 0x0AC0+(0xf-CC_PL)*0x1000, "r", 0, SIZE_NONE, 0,
  831. cris_scc_op},
  832. {"sub", 0x0680, 0x0940, "m r,R", 0, SIZE_NONE, 0,
  833. cris_reg_mode_add_sub_cmp_and_or_move_op},
  834. {"sub", 0x0a80, 0x0140, "m s,R", 0, SIZE_FIELD, 0,
  835. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  836. {"sub", 0x0a80, 0x0140, "m S,D", 0, SIZE_NONE,
  837. cris_ver_v0_10,
  838. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  839. {"sub", 0x0a80, 0x0540, "m S,R,r", 0, SIZE_NONE,
  840. cris_ver_v0_10,
  841. cris_three_operand_add_sub_cmp_and_or_op},
  842. {"subq", 0x0280, 0x0d40, "I,R", 0, SIZE_NONE, 0,
  843. cris_quick_mode_add_sub_op},
  844. {"subs", 0x04a0, 0x0b40, "z r,R", 0, SIZE_NONE, 0,
  845. cris_reg_mode_add_sub_cmp_and_or_move_op},
  846. /* FIXME: SIZE_FIELD_SIGNED and all necessary changes. */
  847. {"subs", 0x08a0, 0x0340, "z s,R", 0, SIZE_FIELD, 0,
  848. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  849. {"subs", 0x08a0, 0x0340, "z S,D", 0, SIZE_NONE,
  850. cris_ver_v0_10,
  851. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  852. {"subs", 0x08a0, 0x0740, "z S,R,r", 0, SIZE_NONE,
  853. cris_ver_v0_10,
  854. cris_three_operand_add_sub_cmp_and_or_op},
  855. {"subu", 0x0480, 0x0b60, "z r,R", 0, SIZE_NONE, 0,
  856. cris_reg_mode_add_sub_cmp_and_or_move_op},
  857. /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
  858. {"subu", 0x0880, 0x0360, "z s,R", 0, SIZE_FIELD, 0,
  859. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  860. {"subu", 0x0880, 0x0360, "z S,D", 0, SIZE_NONE,
  861. cris_ver_v0_10,
  862. cris_none_reg_mode_add_sub_cmp_and_or_move_op},
  863. {"subu", 0x0880, 0x0760, "z S,R,r", 0, SIZE_NONE,
  864. cris_ver_v0_10,
  865. cris_three_operand_add_sub_cmp_and_or_op},
  866. {"svc",
  867. 0x0530+CC_VC*0x1000,
  868. 0x0AC0+(0xf-CC_VC)*0x1000, "r", 0, SIZE_NONE, 0,
  869. cris_scc_op},
  870. {"svs",
  871. 0x0530+CC_VS*0x1000,
  872. 0x0AC0+(0xf-CC_VS)*0x1000, "r", 0, SIZE_NONE, 0,
  873. cris_scc_op},
  874. /* The insn "swapn" is the same as "not" and will be disassembled as
  875. such, but the swap* family of mnmonics are generally v8-and-higher
  876. only, so count it in. */
  877. {"swapn", 0x8770, 0x7880, "r", 0, SIZE_NONE,
  878. cris_ver_v8p,
  879. cris_not_implemented_op},
  880. {"swapw", 0x4770, 0xb880, "r", 0, SIZE_NONE,
  881. cris_ver_v8p,
  882. cris_not_implemented_op},
  883. {"swapnw", 0xc770, 0x3880, "r", 0, SIZE_NONE,
  884. cris_ver_v8p,
  885. cris_not_implemented_op},
  886. {"swapb", 0x2770, 0xd880, "r", 0, SIZE_NONE,
  887. cris_ver_v8p,
  888. cris_not_implemented_op},
  889. {"swapnb", 0xA770, 0x5880, "r", 0, SIZE_NONE,
  890. cris_ver_v8p,
  891. cris_not_implemented_op},
  892. {"swapwb", 0x6770, 0x9880, "r", 0, SIZE_NONE,
  893. cris_ver_v8p,
  894. cris_not_implemented_op},
  895. {"swapnwb", 0xE770, 0x1880, "r", 0, SIZE_NONE,
  896. cris_ver_v8p,
  897. cris_not_implemented_op},
  898. {"swapr", 0x1770, 0xe880, "r", 0, SIZE_NONE,
  899. cris_ver_v8p,
  900. cris_not_implemented_op},
  901. {"swapnr", 0x9770, 0x6880, "r", 0, SIZE_NONE,
  902. cris_ver_v8p,
  903. cris_not_implemented_op},
  904. {"swapwr", 0x5770, 0xa880, "r", 0, SIZE_NONE,
  905. cris_ver_v8p,
  906. cris_not_implemented_op},
  907. {"swapnwr", 0xd770, 0x2880, "r", 0, SIZE_NONE,
  908. cris_ver_v8p,
  909. cris_not_implemented_op},
  910. {"swapbr", 0x3770, 0xc880, "r", 0, SIZE_NONE,
  911. cris_ver_v8p,
  912. cris_not_implemented_op},
  913. {"swapnbr", 0xb770, 0x4880, "r", 0, SIZE_NONE,
  914. cris_ver_v8p,
  915. cris_not_implemented_op},
  916. {"swapwbr", 0x7770, 0x8880, "r", 0, SIZE_NONE,
  917. cris_ver_v8p,
  918. cris_not_implemented_op},
  919. {"swapnwbr", 0xf770, 0x0880, "r", 0, SIZE_NONE,
  920. cris_ver_v8p,
  921. cris_not_implemented_op},
  922. {"test", 0x0640, 0x0980, "m D", 0, SIZE_NONE,
  923. cris_ver_v0_10,
  924. cris_reg_mode_test_op},
  925. {"test", 0x0b80, 0xf040, "m y", 0, SIZE_FIELD, 0,
  926. cris_none_reg_mode_clear_test_op},
  927. {"test", 0x0b80, 0xf040, "m S", 0, SIZE_NONE,
  928. cris_ver_v0_10,
  929. cris_none_reg_mode_clear_test_op},
  930. {"xor", 0x07B0, 0x0840, "r,R", 0, SIZE_NONE, 0,
  931. cris_xor_op},
  932. {NULL, 0, 0, NULL, 0, 0, 0, cris_not_implemented_op}
  933. };
  934. /* Condition-names, indexed by the CC_* numbers as found in cris.h. */
  935. const char * const
  936. cris_cc_strings[] =
  937. {
  938. "hs",
  939. "lo",
  940. "ne",
  941. "eq",
  942. "vc",
  943. "vs",
  944. "pl",
  945. "mi",
  946. "ls",
  947. "hi",
  948. "ge",
  949. "lt",
  950. "gt",
  951. "le",
  952. "a",
  953. /* This is a placeholder. In v0, this would be "ext". In v32, this
  954. is "sb". See cris_conds15. */
  955. "wf"
  956. };
  957. /* Different names and semantics for condition 1111 (0xf). */
  958. const struct cris_cond15 cris_cond15s[] =
  959. {
  960. /* FIXME: In what version did condition "ext" disappear? */
  961. {"ext", cris_ver_v0_3},
  962. {"wf", cris_ver_v10},
  963. {"sb", cris_ver_v32p},
  964. {NULL, 0}
  965. };
  966. /*
  967. * Local variables:
  968. * eval: (c-set-style "gnu")
  969. * indent-tabs-mode: t
  970. * End:
  971. */
  972. /* No instruction will be disassembled longer than this. In theory, and
  973. in silicon, address prefixes can be cascaded. In practice, cascading
  974. is not used by GCC, and not supported by the assembler. */
  975. #ifndef MAX_BYTES_PER_CRIS_INSN
  976. #define MAX_BYTES_PER_CRIS_INSN 8
  977. #endif
  978. /* Whether or not to decode prefixes, folding it into the following
  979. instruction. FIXME: Make this optional later. */
  980. #ifndef PARSE_PREFIX
  981. #define PARSE_PREFIX 1
  982. #endif
  983. /* Sometimes we prefix all registers with this character. */
  984. #define REGISTER_PREFIX_CHAR '$'
  985. /* Whether or not to trace the following sequence:
  986. sub* X,r%d
  987. bound* Y,r%d
  988. adds.w [pc+r%d.w],pc
  989. This is the assembly form of a switch-statement in C.
  990. The "sub is optional. If there is none, then X will be zero.
  991. X is the value of the first case,
  992. Y is the number of cases (including default).
  993. This results in case offsets printed on the form:
  994. case N: -> case_address
  995. where N is an estimation on the corresponding 'case' operand in C,
  996. and case_address is where execution of that case continues after the
  997. sequence presented above.
  998. The old style of output was to print the offsets as instructions,
  999. which made it hard to follow "case"-constructs in the disassembly,
  1000. and caused a lot of annoying warnings about undefined instructions.
  1001. FIXME: Make this optional later. */
  1002. #ifndef TRACE_CASE
  1003. #define TRACE_CASE (disdata->trace_case)
  1004. #endif
  1005. enum cris_disass_family
  1006. { cris_dis_v0_v10, cris_dis_common_v10_v32, cris_dis_v32 };
  1007. /* Stored in the disasm_info->private_data member. */
  1008. struct cris_disasm_data
  1009. {
  1010. /* Whether to print something less confusing if we find something
  1011. matching a switch-construct. */
  1012. bfd_boolean trace_case;
  1013. /* Whether this code is flagged as crisv32. FIXME: Should be an enum
  1014. that includes "compatible". */
  1015. enum cris_disass_family distype;
  1016. };
  1017. /* Value of first element in switch. */
  1018. static long case_offset = 0;
  1019. /* How many more case-offsets to print. */
  1020. static long case_offset_counter = 0;
  1021. /* Number of case offsets. */
  1022. static long no_of_case_offsets = 0;
  1023. /* Candidate for next case_offset. */
  1024. static long last_immediate = 0;
  1025. static int cris_constraint
  1026. (const char *, unsigned, unsigned, struct cris_disasm_data *);
  1027. /* Parse disassembler options and store state in info. FIXME: For the
  1028. time being, we abuse static variables. */
  1029. static bfd_boolean
  1030. cris_parse_disassembler_options (disassemble_info *info,
  1031. enum cris_disass_family distype)
  1032. {
  1033. struct cris_disasm_data *disdata;
  1034. info->private_data = calloc (1, sizeof (struct cris_disasm_data));
  1035. disdata = (struct cris_disasm_data *) info->private_data;
  1036. if (disdata == NULL)
  1037. return false;
  1038. /* Default true. */
  1039. disdata->trace_case
  1040. = (info->disassembler_options == NULL
  1041. || (strcmp (info->disassembler_options, "nocase") != 0));
  1042. disdata->distype = distype;
  1043. return true;
  1044. }
  1045. static const struct cris_spec_reg *
  1046. spec_reg_info (unsigned int sreg, enum cris_disass_family distype)
  1047. {
  1048. int i;
  1049. for (i = 0; cris_spec_regs[i].name != NULL; i++)
  1050. {
  1051. if (cris_spec_regs[i].number == sreg)
  1052. {
  1053. if (distype == cris_dis_v32)
  1054. switch (cris_spec_regs[i].applicable_version)
  1055. {
  1056. case cris_ver_warning:
  1057. case cris_ver_version_all:
  1058. case cris_ver_v3p:
  1059. case cris_ver_v8p:
  1060. case cris_ver_v10p:
  1061. case cris_ver_v32p:
  1062. /* No ambiguous sizes or register names with CRISv32. */
  1063. if (cris_spec_regs[i].warning == NULL)
  1064. return &cris_spec_regs[i];
  1065. default:
  1066. ;
  1067. }
  1068. else if (cris_spec_regs[i].applicable_version != cris_ver_v32p)
  1069. return &cris_spec_regs[i];
  1070. }
  1071. }
  1072. return NULL;
  1073. }
  1074. /* Return the number of bits in the argument. */
  1075. static int
  1076. number_of_bits (unsigned int val)
  1077. {
  1078. int bits;
  1079. for (bits = 0; val != 0; val &= val - 1)
  1080. bits++;
  1081. return bits;
  1082. }
  1083. /* Get an entry in the opcode-table. */
  1084. static const struct cris_opcode *
  1085. get_opcode_entry (unsigned int insn,
  1086. unsigned int prefix_insn,
  1087. struct cris_disasm_data *disdata)
  1088. {
  1089. /* For non-prefixed insns, we keep a table of pointers, indexed by the
  1090. insn code. Each entry is initialized when found to be NULL. */
  1091. static const struct cris_opcode **opc_table = NULL;
  1092. const struct cris_opcode *max_matchedp = NULL;
  1093. const struct cris_opcode **prefix_opc_table = NULL;
  1094. /* We hold a table for each prefix that need to be handled differently. */
  1095. static const struct cris_opcode **dip_prefixes = NULL;
  1096. static const struct cris_opcode **bdapq_m1_prefixes = NULL;
  1097. static const struct cris_opcode **bdapq_m2_prefixes = NULL;
  1098. static const struct cris_opcode **bdapq_m4_prefixes = NULL;
  1099. static const struct cris_opcode **rest_prefixes = NULL;
  1100. /* Allocate and clear the opcode-table. */
  1101. if (opc_table == NULL)
  1102. {
  1103. opc_table = g_new0(const struct cris_opcode *, 65536);
  1104. dip_prefixes = g_new0(const struct cris_opcode *, 65536);
  1105. bdapq_m1_prefixes = g_new0(const struct cris_opcode *, 65536);
  1106. bdapq_m2_prefixes = g_new0(const struct cris_opcode *, 65536);
  1107. bdapq_m4_prefixes = g_new0(const struct cris_opcode *, 65536);
  1108. rest_prefixes = g_new0(const struct cris_opcode *, 65536);
  1109. }
  1110. /* Get the right table if this is a prefix.
  1111. This code is connected to cris_constraints in that it knows what
  1112. prefixes play a role in recognition of patterns; the necessary
  1113. state is reflected by which table is used. If constraints
  1114. involving match or non-match of prefix insns are changed, then this
  1115. probably needs changing too. */
  1116. if (prefix_insn != NO_CRIS_PREFIX)
  1117. {
  1118. const struct cris_opcode *popcodep
  1119. = (opc_table[prefix_insn] != NULL
  1120. ? opc_table[prefix_insn]
  1121. : get_opcode_entry (prefix_insn, NO_CRIS_PREFIX, disdata));
  1122. if (popcodep == NULL)
  1123. return NULL;
  1124. if (popcodep->match == BDAP_QUICK_OPCODE)
  1125. {
  1126. /* Since some offsets are recognized with "push" macros, we
  1127. have to have different tables for them. */
  1128. int offset = (prefix_insn & 255);
  1129. if (offset > 127)
  1130. offset -= 256;
  1131. switch (offset)
  1132. {
  1133. case -4:
  1134. prefix_opc_table = bdapq_m4_prefixes;
  1135. break;
  1136. case -2:
  1137. prefix_opc_table = bdapq_m2_prefixes;
  1138. break;
  1139. case -1:
  1140. prefix_opc_table = bdapq_m1_prefixes;
  1141. break;
  1142. default:
  1143. prefix_opc_table = rest_prefixes;
  1144. break;
  1145. }
  1146. }
  1147. else if (popcodep->match == DIP_OPCODE)
  1148. /* We don't allow postincrement when the prefix is DIP, so use a
  1149. different table for DIP. */
  1150. prefix_opc_table = dip_prefixes;
  1151. else
  1152. prefix_opc_table = rest_prefixes;
  1153. }
  1154. if (prefix_insn != NO_CRIS_PREFIX
  1155. && prefix_opc_table[insn] != NULL)
  1156. max_matchedp = prefix_opc_table[insn];
  1157. else if (prefix_insn == NO_CRIS_PREFIX && opc_table[insn] != NULL)
  1158. max_matchedp = opc_table[insn];
  1159. else
  1160. {
  1161. const struct cris_opcode *opcodep;
  1162. int max_level_of_match = -1;
  1163. for (opcodep = cris_opcodes;
  1164. opcodep->name != NULL;
  1165. opcodep++)
  1166. {
  1167. int level_of_match;
  1168. if (disdata->distype == cris_dis_v32)
  1169. {
  1170. switch (opcodep->applicable_version)
  1171. {
  1172. case cris_ver_version_all:
  1173. break;
  1174. case cris_ver_v0_3:
  1175. case cris_ver_v0_10:
  1176. case cris_ver_v3_10:
  1177. case cris_ver_sim_v0_10:
  1178. case cris_ver_v8_10:
  1179. case cris_ver_v10:
  1180. case cris_ver_warning:
  1181. continue;
  1182. case cris_ver_v3p:
  1183. case cris_ver_v8p:
  1184. case cris_ver_v10p:
  1185. case cris_ver_v32p:
  1186. break;
  1187. case cris_ver_v8:
  1188. abort ();
  1189. default:
  1190. abort ();
  1191. }
  1192. }
  1193. else
  1194. {
  1195. switch (opcodep->applicable_version)
  1196. {
  1197. case cris_ver_version_all:
  1198. case cris_ver_v0_3:
  1199. case cris_ver_v3p:
  1200. case cris_ver_v0_10:
  1201. case cris_ver_v8p:
  1202. case cris_ver_v8_10:
  1203. case cris_ver_v10:
  1204. case cris_ver_sim_v0_10:
  1205. case cris_ver_v10p:
  1206. case cris_ver_warning:
  1207. break;
  1208. case cris_ver_v32p:
  1209. continue;
  1210. case cris_ver_v8:
  1211. abort ();
  1212. default:
  1213. abort ();
  1214. }
  1215. }
  1216. /* We give a double lead for bits matching the template in
  1217. cris_opcodes. Not even, because then "move p8,r10" would
  1218. be given 2 bits lead over "clear.d r10". When there's a
  1219. tie, the first entry in the table wins. This is
  1220. deliberate, to avoid a more complicated recognition
  1221. formula. */
  1222. if ((opcodep->match & insn) == opcodep->match
  1223. && (opcodep->lose & insn) == 0
  1224. && ((level_of_match
  1225. = cris_constraint (opcodep->args,
  1226. insn,
  1227. prefix_insn,
  1228. disdata))
  1229. >= 0)
  1230. && ((level_of_match
  1231. += 2 * number_of_bits (opcodep->match
  1232. | opcodep->lose))
  1233. > max_level_of_match))
  1234. {
  1235. max_matchedp = opcodep;
  1236. max_level_of_match = level_of_match;
  1237. /* If there was a full match, never mind looking
  1238. further. */
  1239. if (level_of_match >= 2 * 16)
  1240. break;
  1241. }
  1242. }
  1243. /* Fill in the new entry.
  1244. If there are changes to the opcode-table involving prefixes, and
  1245. disassembly then does not work correctly, try removing the
  1246. else-clause below that fills in the prefix-table. If that
  1247. helps, you need to change the prefix_opc_table setting above, or
  1248. something related. */
  1249. if (prefix_insn == NO_CRIS_PREFIX)
  1250. opc_table[insn] = max_matchedp;
  1251. else
  1252. prefix_opc_table[insn] = max_matchedp;
  1253. }
  1254. return max_matchedp;
  1255. }
  1256. /* Return -1 if the constraints of a bitwise-matched instruction say
  1257. that there is no match. Otherwise return a nonnegative number
  1258. indicating the confidence in the match (higher is better). */
  1259. static int
  1260. cris_constraint (const char *cs,
  1261. unsigned int insn,
  1262. unsigned int prefix_insn,
  1263. struct cris_disasm_data *disdata)
  1264. {
  1265. int retval = 0;
  1266. int tmp;
  1267. int prefix_ok = 0;
  1268. const char *s;
  1269. for (s = cs; *s; s++)
  1270. switch (*s)
  1271. {
  1272. case '!':
  1273. /* Do not recognize "pop" if there's a prefix and then only for
  1274. v0..v10. */
  1275. if (prefix_insn != NO_CRIS_PREFIX
  1276. || disdata->distype != cris_dis_v0_v10)
  1277. return -1;
  1278. break;
  1279. case 'U':
  1280. /* Not recognized at disassembly. */
  1281. return -1;
  1282. case 'M':
  1283. /* Size modifier for "clear", i.e. special register 0, 4 or 8.
  1284. Check that it is one of them. Only special register 12 could
  1285. be mismatched, but checking for matches is more logical than
  1286. checking for mismatches when there are only a few cases. */
  1287. tmp = ((insn >> 12) & 0xf);
  1288. if (tmp != 0 && tmp != 4 && tmp != 8)
  1289. return -1;
  1290. break;
  1291. case 'm':
  1292. if ((insn & 0x30) == 0x30)
  1293. return -1;
  1294. break;
  1295. case 'S':
  1296. /* A prefix operand without side-effect. */
  1297. if (prefix_insn != NO_CRIS_PREFIX && (insn & 0x400) == 0)
  1298. {
  1299. prefix_ok = 1;
  1300. break;
  1301. }
  1302. else
  1303. return -1;
  1304. case 's':
  1305. case 'y':
  1306. case 'Y':
  1307. /* If this is a prefixed insn with postincrement (side-effect),
  1308. the prefix must not be DIP. */
  1309. if (prefix_insn != NO_CRIS_PREFIX)
  1310. {
  1311. if (insn & 0x400)
  1312. {
  1313. const struct cris_opcode *prefix_opcodep
  1314. = get_opcode_entry (prefix_insn, NO_CRIS_PREFIX, disdata);
  1315. if (prefix_opcodep->match == DIP_OPCODE)
  1316. return -1;
  1317. }
  1318. prefix_ok = 1;
  1319. }
  1320. break;
  1321. case 'B':
  1322. /* If we don't fall through, then the prefix is ok. */
  1323. prefix_ok = 1;
  1324. /* A "push" prefix. Check for valid "push" size.
  1325. In case of special register, it may be != 4. */
  1326. if (prefix_insn != NO_CRIS_PREFIX)
  1327. {
  1328. /* Match the prefix insn to BDAPQ. */
  1329. const struct cris_opcode *prefix_opcodep
  1330. = get_opcode_entry (prefix_insn, NO_CRIS_PREFIX, disdata);
  1331. if (prefix_opcodep->match == BDAP_QUICK_OPCODE)
  1332. {
  1333. int pushsize = (prefix_insn & 255);
  1334. if (pushsize > 127)
  1335. pushsize -= 256;
  1336. if (s[1] == 'P')
  1337. {
  1338. unsigned int spec_reg = (insn >> 12) & 15;
  1339. const struct cris_spec_reg *sregp
  1340. = spec_reg_info (spec_reg, disdata->distype);
  1341. /* For a special-register, the "prefix size" must
  1342. match the size of the register. */
  1343. if (sregp && sregp->reg_size == (unsigned int) -pushsize)
  1344. break;
  1345. }
  1346. else if (s[1] == 'R')
  1347. {
  1348. if ((insn & 0x30) == 0x20 && pushsize == -4)
  1349. break;
  1350. }
  1351. /* FIXME: Should abort here; next constraint letter
  1352. *must* be 'P' or 'R'. */
  1353. }
  1354. }
  1355. return -1;
  1356. case 'D':
  1357. retval = (((insn >> 12) & 15) == (insn & 15));
  1358. if (!retval)
  1359. return -1;
  1360. else
  1361. retval += 4;
  1362. break;
  1363. case 'P':
  1364. {
  1365. const struct cris_spec_reg *sregp
  1366. = spec_reg_info ((insn >> 12) & 15, disdata->distype);
  1367. /* Since we match four bits, we will give a value of 4-1 = 3
  1368. in a match. If there is a corresponding exact match of a
  1369. special register in another pattern, it will get a value of
  1370. 4, which will be higher. This should be correct in that an
  1371. exact pattern would match better than a general pattern.
  1372. Note that there is a reason for not returning zero; the
  1373. pattern for "clear" is partly matched in the bit-pattern
  1374. (the two lower bits must be zero), while the bit-pattern
  1375. for a move from a special register is matched in the
  1376. register constraint. */
  1377. if (sregp != NULL)
  1378. {
  1379. retval += 3;
  1380. break;
  1381. }
  1382. else
  1383. return -1;
  1384. }
  1385. }
  1386. if (prefix_insn != NO_CRIS_PREFIX && ! prefix_ok)
  1387. return -1;
  1388. return retval;
  1389. }
  1390. /* Format number as hex with a leading "0x" into outbuffer. */
  1391. static char *
  1392. format_hex (unsigned long number,
  1393. char *outbuffer,
  1394. struct cris_disasm_data *disdata)
  1395. {
  1396. /* Truncate negative numbers on >32-bit hosts. */
  1397. number &= 0xffffffff;
  1398. sprintf (outbuffer, "0x%lx", number);
  1399. /* Save this value for the "case" support. */
  1400. if (TRACE_CASE)
  1401. last_immediate = number;
  1402. return outbuffer + strlen (outbuffer);
  1403. }
  1404. /* Format number as decimal into outbuffer. Parameter signedp says
  1405. whether the number should be formatted as signed (!= 0) or
  1406. unsigned (== 0). */
  1407. static char *
  1408. format_dec (long number, char *outbuffer, int signedp)
  1409. {
  1410. last_immediate = number;
  1411. sprintf (outbuffer, signedp ? "%ld" : "%lu", number);
  1412. return outbuffer + strlen (outbuffer);
  1413. }
  1414. /* Format the name of the general register regno into outbuffer. */
  1415. static char *
  1416. format_reg (struct cris_disasm_data *disdata,
  1417. int regno,
  1418. char *outbuffer_start,
  1419. bfd_boolean with_reg_prefix)
  1420. {
  1421. char *outbuffer = outbuffer_start;
  1422. if (with_reg_prefix)
  1423. *outbuffer++ = REGISTER_PREFIX_CHAR;
  1424. switch (regno)
  1425. {
  1426. case 15:
  1427. /* For v32, there is no context in which we output PC. */
  1428. if (disdata->distype == cris_dis_v32)
  1429. strcpy (outbuffer, "acr");
  1430. else
  1431. strcpy (outbuffer, "pc");
  1432. break;
  1433. case 14:
  1434. strcpy (outbuffer, "sp");
  1435. break;
  1436. default:
  1437. sprintf (outbuffer, "r%d", regno);
  1438. break;
  1439. }
  1440. return outbuffer_start + strlen (outbuffer_start);
  1441. }
  1442. /* Format the name of a support register into outbuffer. */
  1443. static char *
  1444. format_sup_reg (unsigned int regno,
  1445. char *outbuffer_start,
  1446. bfd_boolean with_reg_prefix)
  1447. {
  1448. char *outbuffer = outbuffer_start;
  1449. int i;
  1450. if (with_reg_prefix)
  1451. *outbuffer++ = REGISTER_PREFIX_CHAR;
  1452. for (i = 0; cris_support_regs[i].name != NULL; i++)
  1453. if (cris_support_regs[i].number == regno)
  1454. {
  1455. sprintf (outbuffer, "%s", cris_support_regs[i].name);
  1456. return outbuffer_start + strlen (outbuffer_start);
  1457. }
  1458. /* There's supposed to be register names covering all numbers, though
  1459. some may be generic names. */
  1460. sprintf (outbuffer, "format_sup_reg-BUG");
  1461. return outbuffer_start + strlen (outbuffer_start);
  1462. }
  1463. /* Return the length of an instruction. */
  1464. static unsigned
  1465. bytes_to_skip (unsigned int insn,
  1466. const struct cris_opcode *matchedp,
  1467. enum cris_disass_family distype,
  1468. const struct cris_opcode *prefix_matchedp)
  1469. {
  1470. /* Each insn is a word plus "immediate" operands. */
  1471. unsigned to_skip = 2;
  1472. const char *template = matchedp->args;
  1473. const char *s;
  1474. for (s = template; *s; s++)
  1475. if ((*s == 's' || *s == 'N' || *s == 'Y')
  1476. && (insn & 0x400) && (insn & 15) == 15
  1477. && prefix_matchedp == NULL)
  1478. {
  1479. /* Immediate via [pc+], so we have to check the size of the
  1480. operand. */
  1481. int mode_size = 1 << ((insn >> 4) & (*template == 'z' ? 1 : 3));
  1482. if (matchedp->imm_oprnd_size == SIZE_FIX_32)
  1483. to_skip += 4;
  1484. else if (matchedp->imm_oprnd_size == SIZE_SPEC_REG)
  1485. {
  1486. const struct cris_spec_reg *sregp
  1487. = spec_reg_info ((insn >> 12) & 15, distype);
  1488. /* FIXME: Improve error handling; should have been caught
  1489. earlier. */
  1490. if (sregp == NULL)
  1491. return 2;
  1492. /* PC is incremented by two, not one, for a byte. Except on
  1493. CRISv32, where constants are always DWORD-size for
  1494. special registers. */
  1495. to_skip +=
  1496. distype == cris_dis_v32 ? 4 : (sregp->reg_size + 1) & ~1;
  1497. }
  1498. else
  1499. to_skip += (mode_size + 1) & ~1;
  1500. }
  1501. else if (*s == 'n')
  1502. to_skip += 4;
  1503. else if (*s == 'b')
  1504. to_skip += 2;
  1505. return to_skip;
  1506. }
  1507. /* Print condition code flags. */
  1508. static char *
  1509. print_flags (struct cris_disasm_data *disdata, unsigned int insn, char *cp)
  1510. {
  1511. /* Use the v8 (Etrax 100) flag definitions for disassembly.
  1512. The differences with v0 (Etrax 1..4) vs. Svinto are:
  1513. v0 'd' <=> v8 'm'
  1514. v0 'e' <=> v8 'b'.
  1515. FIXME: Emit v0..v3 flag names somehow. */
  1516. static const char v8_fnames[] = "cvznxibm";
  1517. static const char v32_fnames[] = "cvznxiup";
  1518. const char *fnames
  1519. = disdata->distype == cris_dis_v32 ? v32_fnames : v8_fnames;
  1520. unsigned char flagbits = (((insn >> 8) & 0xf0) | (insn & 15));
  1521. int i;
  1522. for (i = 0; i < 8; i++)
  1523. if (flagbits & (1 << i))
  1524. *cp++ = fnames[i];
  1525. return cp;
  1526. }
  1527. /* Print out an insn with its operands, and update the info->insn_type
  1528. fields. The prefix_opcodep and the rest hold a prefix insn that is
  1529. supposed to be output as an address mode. */
  1530. static void
  1531. print_with_operands (const struct cris_opcode *opcodep,
  1532. unsigned int insn,
  1533. unsigned char *buffer,
  1534. bfd_vma addr,
  1535. disassemble_info *info,
  1536. /* If a prefix insn was before this insn (and is supposed
  1537. to be output as an address), here is a description of
  1538. it. */
  1539. const struct cris_opcode *prefix_opcodep,
  1540. unsigned int prefix_insn,
  1541. unsigned char *prefix_buffer,
  1542. bfd_boolean with_reg_prefix)
  1543. {
  1544. /* Get a buffer of somewhat reasonable size where we store
  1545. intermediate parts of the insn. */
  1546. char temp[sizeof (".d [$r13=$r12-2147483648],$r10") * 2];
  1547. char *tp = temp;
  1548. static const char mode_char[] = "bwd?";
  1549. const char *s;
  1550. const char *cs;
  1551. struct cris_disasm_data *disdata
  1552. = (struct cris_disasm_data *) info->private_data;
  1553. /* Print out the name first thing we do. */
  1554. (*info->fprintf_func) (info->stream, "%s", opcodep->name);
  1555. cs = opcodep->args;
  1556. s = cs;
  1557. /* Ignore any prefix indicator. */
  1558. if (*s == 'p')
  1559. s++;
  1560. if (*s == 'm' || *s == 'M' || *s == 'z')
  1561. {
  1562. *tp++ = '.';
  1563. /* Get the size-letter. */
  1564. *tp++ = *s == 'M'
  1565. ? (insn & 0x8000 ? 'd'
  1566. : insn & 0x4000 ? 'w' : 'b')
  1567. : mode_char[(insn >> 4) & (*s == 'z' ? 1 : 3)];
  1568. /* Ignore the size and the space character that follows. */
  1569. s += 2;
  1570. }
  1571. /* Add a space if this isn't a long-branch, because for those will add
  1572. the condition part of the name later. */
  1573. if (opcodep->match != (BRANCH_PC_LOW + BRANCH_INCR_HIGH * 256))
  1574. *tp++ = ' ';
  1575. /* Fill in the insn-type if deducible from the name (and there's no
  1576. better way). */
  1577. if (opcodep->name[0] == 'j')
  1578. {
  1579. if (CONST_STRNEQ (opcodep->name, "jsr"))
  1580. /* It's "jsr" or "jsrc". */
  1581. info->insn_type = dis_jsr;
  1582. else
  1583. /* Any other jump-type insn is considered a branch. */
  1584. info->insn_type = dis_branch;
  1585. }
  1586. /* We might know some more fields right now. */
  1587. info->branch_delay_insns = opcodep->delayed;
  1588. /* Handle operands. */
  1589. for (; *s; s++)
  1590. {
  1591. switch (*s)
  1592. {
  1593. case 'T':
  1594. tp = format_sup_reg ((insn >> 12) & 15, tp, with_reg_prefix);
  1595. break;
  1596. case 'A':
  1597. if (with_reg_prefix)
  1598. *tp++ = REGISTER_PREFIX_CHAR;
  1599. *tp++ = 'a';
  1600. *tp++ = 'c';
  1601. *tp++ = 'r';
  1602. break;
  1603. case '[':
  1604. case ']':
  1605. case ',':
  1606. *tp++ = *s;
  1607. break;
  1608. case '!':
  1609. /* Ignore at this point; used at earlier stages to avoid
  1610. recognition if there's a prefix at something that in other
  1611. ways looks like a "pop". */
  1612. break;
  1613. case 'd':
  1614. /* Ignore. This is an optional ".d " on the large one of
  1615. relaxable insns. */
  1616. break;
  1617. case 'B':
  1618. /* This was the prefix that made this a "push". We've already
  1619. handled it by recognizing it, so signal that the prefix is
  1620. handled by setting it to NULL. */
  1621. prefix_opcodep = NULL;
  1622. break;
  1623. case 'D':
  1624. case 'r':
  1625. tp = format_reg (disdata, insn & 15, tp, with_reg_prefix);
  1626. break;
  1627. case 'R':
  1628. tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix);
  1629. break;
  1630. case 'n':
  1631. {
  1632. /* Like N but pc-relative to the start of the insn. */
  1633. unsigned long number
  1634. = (buffer[2] + buffer[3] * 256 + buffer[4] * 65536
  1635. + buffer[5] * 0x1000000 + addr);
  1636. /* Finish off and output previous formatted bytes. */
  1637. *tp = 0;
  1638. if (temp[0])
  1639. (*info->fprintf_func) (info->stream, "%s", temp);
  1640. tp = temp;
  1641. (*info->print_address_func) ((bfd_vma) number, info);
  1642. }
  1643. break;
  1644. case 'u':
  1645. {
  1646. /* Like n but the offset is bits <3:0> in the instruction. */
  1647. unsigned long number = (buffer[0] & 0xf) * 2 + addr;
  1648. /* Finish off and output previous formatted bytes. */
  1649. *tp = 0;
  1650. if (temp[0])
  1651. (*info->fprintf_func) (info->stream, "%s", temp);
  1652. tp = temp;
  1653. (*info->print_address_func) ((bfd_vma) number, info);
  1654. }
  1655. break;
  1656. case 'N':
  1657. case 'y':
  1658. case 'Y':
  1659. case 'S':
  1660. case 's':
  1661. /* Any "normal" memory operand. */
  1662. if ((insn & 0x400) && (insn & 15) == 15 && prefix_opcodep == NULL)
  1663. {
  1664. /* We're looking at [pc+], i.e. we need to output an immediate
  1665. number, where the size can depend on different things. */
  1666. long number;
  1667. int signedp
  1668. = ((*cs == 'z' && (insn & 0x20))
  1669. || opcodep->match == BDAP_QUICK_OPCODE);
  1670. int nbytes;
  1671. if (opcodep->imm_oprnd_size == SIZE_FIX_32)
  1672. nbytes = 4;
  1673. else if (opcodep->imm_oprnd_size == SIZE_SPEC_REG)
  1674. {
  1675. const struct cris_spec_reg *sregp
  1676. = spec_reg_info ((insn >> 12) & 15, disdata->distype);
  1677. /* A NULL return should have been as a non-match earlier,
  1678. so catch it as an internal error in the error-case
  1679. below. */
  1680. if (sregp == NULL)
  1681. /* Whatever non-valid size. */
  1682. nbytes = 42;
  1683. else
  1684. /* PC is always incremented by a multiple of two.
  1685. For CRISv32, immediates are always 4 bytes for
  1686. special registers. */
  1687. nbytes = disdata->distype == cris_dis_v32
  1688. ? 4 : (sregp->reg_size + 1) & ~1;
  1689. }
  1690. else
  1691. {
  1692. int mode_size = 1 << ((insn >> 4) & (*cs == 'z' ? 1 : 3));
  1693. if (mode_size == 1)
  1694. nbytes = 2;
  1695. else
  1696. nbytes = mode_size;
  1697. }
  1698. switch (nbytes)
  1699. {
  1700. case 1:
  1701. number = buffer[2];
  1702. if (signedp && number > 127)
  1703. number -= 256;
  1704. break;
  1705. case 2:
  1706. number = buffer[2] + buffer[3] * 256;
  1707. if (signedp && number > 32767)
  1708. number -= 65536;
  1709. break;
  1710. case 4:
  1711. number
  1712. = buffer[2] + buffer[3] * 256 + buffer[4] * 65536
  1713. + buffer[5] * 0x1000000;
  1714. break;
  1715. default:
  1716. strcpy (tp, "bug");
  1717. tp += 3;
  1718. number = 42;
  1719. }
  1720. if ((*cs == 'z' && (insn & 0x20))
  1721. || (opcodep->match == BDAP_QUICK_OPCODE
  1722. && (nbytes <= 2 || buffer[1 + nbytes] == 0)))
  1723. tp = format_dec (number, tp, signedp);
  1724. else
  1725. {
  1726. unsigned int highbyte = (number >> 24) & 0xff;
  1727. /* Either output this as an address or as a number. If it's
  1728. a dword with the same high-byte as the address of the
  1729. insn, assume it's an address, and also if it's a non-zero
  1730. non-0xff high-byte. If this is a jsr or a jump, then
  1731. it's definitely an address. */
  1732. if (nbytes == 4
  1733. && (highbyte == ((addr >> 24) & 0xff)
  1734. || (highbyte != 0 && highbyte != 0xff)
  1735. || info->insn_type == dis_branch
  1736. || info->insn_type == dis_jsr))
  1737. {
  1738. /* Finish off and output previous formatted bytes. */
  1739. *tp = 0;
  1740. tp = temp;
  1741. if (temp[0])
  1742. (*info->fprintf_func) (info->stream, "%s", temp);
  1743. (*info->print_address_func) ((bfd_vma) number, info);
  1744. info->target = number;
  1745. }
  1746. else
  1747. tp = format_hex (number, tp, disdata);
  1748. }
  1749. }
  1750. else
  1751. {
  1752. /* Not an immediate number. Then this is a (possibly
  1753. prefixed) memory operand. */
  1754. if (info->insn_type != dis_nonbranch)
  1755. {
  1756. int mode_size
  1757. = 1 << ((insn >> 4)
  1758. & (opcodep->args[0] == 'z' ? 1 : 3));
  1759. int size;
  1760. info->insn_type = dis_dref;
  1761. info->flags |= CRIS_DIS_FLAG_MEMREF;
  1762. if (opcodep->imm_oprnd_size == SIZE_FIX_32)
  1763. size = 4;
  1764. else if (opcodep->imm_oprnd_size == SIZE_SPEC_REG)
  1765. {
  1766. const struct cris_spec_reg *sregp
  1767. = spec_reg_info ((insn >> 12) & 15, disdata->distype);
  1768. /* FIXME: Improve error handling; should have been caught
  1769. earlier. */
  1770. if (sregp == NULL)
  1771. size = 4;
  1772. else
  1773. size = sregp->reg_size;
  1774. }
  1775. else
  1776. size = mode_size;
  1777. info->data_size = size;
  1778. }
  1779. *tp++ = '[';
  1780. if (prefix_opcodep
  1781. /* We don't match dip with a postincremented field
  1782. as a side-effect address mode. */
  1783. && ((insn & 0x400) == 0
  1784. || prefix_opcodep->match != DIP_OPCODE))
  1785. {
  1786. if (insn & 0x400)
  1787. {
  1788. tp = format_reg (disdata, insn & 15, tp, with_reg_prefix);
  1789. *tp++ = '=';
  1790. }
  1791. /* We mainly ignore the prefix format string when the
  1792. address-mode syntax is output. */
  1793. switch (prefix_opcodep->match)
  1794. {
  1795. case DIP_OPCODE:
  1796. /* It's [r], [r+] or [pc+]. */
  1797. if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15)
  1798. {
  1799. /* It's [pc+]. This cannot possibly be anything
  1800. but an address. */
  1801. unsigned long number
  1802. = prefix_buffer[2] + prefix_buffer[3] * 256
  1803. + prefix_buffer[4] * 65536
  1804. + prefix_buffer[5] * 0x1000000;
  1805. info->target = (bfd_vma) number;
  1806. /* Finish off and output previous formatted
  1807. data. */
  1808. *tp = 0;
  1809. tp = temp;
  1810. if (temp[0])
  1811. (*info->fprintf_func) (info->stream, "%s", temp);
  1812. (*info->print_address_func) ((bfd_vma) number, info);
  1813. }
  1814. else
  1815. {
  1816. /* For a memref in an address, we use target2.
  1817. In this case, target is zero. */
  1818. info->flags
  1819. |= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG
  1820. | CRIS_DIS_FLAG_MEM_TARGET2_MEM);
  1821. info->target2 = prefix_insn & 15;
  1822. *tp++ = '[';
  1823. tp = format_reg (disdata, prefix_insn & 15, tp,
  1824. with_reg_prefix);
  1825. if (prefix_insn & 0x400)
  1826. *tp++ = '+';
  1827. *tp++ = ']';
  1828. }
  1829. break;
  1830. case BDAP_QUICK_OPCODE:
  1831. {
  1832. int number;
  1833. number = prefix_buffer[0];
  1834. if (number > 127)
  1835. number -= 256;
  1836. /* Output "reg+num" or, if num < 0, "reg-num". */
  1837. tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp,
  1838. with_reg_prefix);
  1839. if (number >= 0)
  1840. *tp++ = '+';
  1841. tp = format_dec (number, tp, 1);
  1842. info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG;
  1843. info->target = (prefix_insn >> 12) & 15;
  1844. info->target2 = (bfd_vma) number;
  1845. break;
  1846. }
  1847. case BIAP_OPCODE:
  1848. /* Output "r+R.m". */
  1849. tp = format_reg (disdata, prefix_insn & 15, tp,
  1850. with_reg_prefix);
  1851. *tp++ = '+';
  1852. tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp,
  1853. with_reg_prefix);
  1854. *tp++ = '.';
  1855. *tp++ = mode_char[(prefix_insn >> 4) & 3];
  1856. info->flags
  1857. |= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG
  1858. | CRIS_DIS_FLAG_MEM_TARGET_IS_REG
  1859. | ((prefix_insn & 0x8000)
  1860. ? CRIS_DIS_FLAG_MEM_TARGET2_MULT4
  1861. : ((prefix_insn & 0x8000)
  1862. ? CRIS_DIS_FLAG_MEM_TARGET2_MULT2 : 0)));
  1863. /* Is it the casejump? It's a "adds.w [pc+r%d.w],pc". */
  1864. if (insn == 0xf83f && (prefix_insn & ~0xf000) == 0x55f)
  1865. /* Then start interpreting data as offsets. */
  1866. case_offset_counter = no_of_case_offsets;
  1867. break;
  1868. case BDAP_INDIR_OPCODE:
  1869. /* Output "r+s.m", or, if "s" is [pc+], "r+s" or
  1870. "r-s". */
  1871. tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp,
  1872. with_reg_prefix);
  1873. if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15)
  1874. {
  1875. long number;
  1876. unsigned int nbytes;
  1877. /* It's a value. Get its size. */
  1878. int mode_size = 1 << ((prefix_insn >> 4) & 3);
  1879. if (mode_size == 1)
  1880. nbytes = 2;
  1881. else
  1882. nbytes = mode_size;
  1883. switch (nbytes)
  1884. {
  1885. case 1:
  1886. number = prefix_buffer[2];
  1887. if (number > 127)
  1888. number -= 256;
  1889. break;
  1890. case 2:
  1891. number = prefix_buffer[2] + prefix_buffer[3] * 256;
  1892. if (number > 32767)
  1893. number -= 65536;
  1894. break;
  1895. case 4:
  1896. number
  1897. = prefix_buffer[2] + prefix_buffer[3] * 256
  1898. + prefix_buffer[4] * 65536
  1899. + prefix_buffer[5] * 0x1000000;
  1900. break;
  1901. default:
  1902. strcpy (tp, "bug");
  1903. tp += 3;
  1904. number = 42;
  1905. }
  1906. info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG;
  1907. info->target2 = (bfd_vma) number;
  1908. /* If the size is dword, then assume it's an
  1909. address. */
  1910. if (nbytes == 4)
  1911. {
  1912. /* Finish off and output previous formatted
  1913. bytes. */
  1914. *tp++ = '+';
  1915. *tp = 0;
  1916. tp = temp;
  1917. (*info->fprintf_func) (info->stream, "%s", temp);
  1918. (*info->print_address_func) ((bfd_vma) number, info);
  1919. }
  1920. else
  1921. {
  1922. if (number >= 0)
  1923. *tp++ = '+';
  1924. tp = format_dec (number, tp, 1);
  1925. }
  1926. }
  1927. else
  1928. {
  1929. /* Output "r+[R].m" or "r+[R+].m". */
  1930. *tp++ = '+';
  1931. *tp++ = '[';
  1932. tp = format_reg (disdata, prefix_insn & 15, tp,
  1933. with_reg_prefix);
  1934. if (prefix_insn & 0x400)
  1935. *tp++ = '+';
  1936. *tp++ = ']';
  1937. *tp++ = '.';
  1938. *tp++ = mode_char[(prefix_insn >> 4) & 3];
  1939. info->flags
  1940. |= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG
  1941. | CRIS_DIS_FLAG_MEM_TARGET2_MEM
  1942. | CRIS_DIS_FLAG_MEM_TARGET_IS_REG
  1943. | (((prefix_insn >> 4) == 2)
  1944. ? 0
  1945. : (((prefix_insn >> 4) & 3) == 1
  1946. ? CRIS_DIS_FLAG_MEM_TARGET2_MEM_WORD
  1947. : CRIS_DIS_FLAG_MEM_TARGET2_MEM_BYTE)));
  1948. }
  1949. break;
  1950. default:
  1951. (*info->fprintf_func) (info->stream, "?prefix-bug");
  1952. }
  1953. /* To mark that the prefix is used, reset it. */
  1954. prefix_opcodep = NULL;
  1955. }
  1956. else
  1957. {
  1958. tp = format_reg (disdata, insn & 15, tp, with_reg_prefix);
  1959. info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG;
  1960. info->target = insn & 15;
  1961. if (insn & 0x400)
  1962. *tp++ = '+';
  1963. }
  1964. *tp++ = ']';
  1965. }
  1966. break;
  1967. case 'x':
  1968. tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix);
  1969. *tp++ = '.';
  1970. *tp++ = mode_char[(insn >> 4) & 3];
  1971. break;
  1972. case 'I':
  1973. tp = format_dec (insn & 63, tp, 0);
  1974. break;
  1975. case 'b':
  1976. {
  1977. int where = buffer[2] + buffer[3] * 256;
  1978. if (where > 32767)
  1979. where -= 65536;
  1980. where += addr + ((disdata->distype == cris_dis_v32) ? 0 : 4);
  1981. if (insn == BA_PC_INCR_OPCODE)
  1982. info->insn_type = dis_branch;
  1983. else
  1984. info->insn_type = dis_condbranch;
  1985. info->target = (bfd_vma) where;
  1986. *tp = 0;
  1987. tp = temp;
  1988. (*info->fprintf_func) (info->stream, "%s%s ",
  1989. temp, cris_cc_strings[insn >> 12]);
  1990. (*info->print_address_func) ((bfd_vma) where, info);
  1991. }
  1992. break;
  1993. case 'c':
  1994. tp = format_dec (insn & 31, tp, 0);
  1995. break;
  1996. case 'C':
  1997. tp = format_dec (insn & 15, tp, 0);
  1998. break;
  1999. case 'o':
  2000. {
  2001. long offset = insn & 0xfe;
  2002. bfd_vma target;
  2003. if (insn & 1)
  2004. offset |= ~0xff;
  2005. if (opcodep->match == BA_QUICK_OPCODE)
  2006. info->insn_type = dis_branch;
  2007. else
  2008. info->insn_type = dis_condbranch;
  2009. target = addr + ((disdata->distype == cris_dis_v32) ? 0 : 2) + offset;
  2010. info->target = target;
  2011. *tp = 0;
  2012. tp = temp;
  2013. (*info->fprintf_func) (info->stream, "%s", temp);
  2014. (*info->print_address_func) (target, info);
  2015. }
  2016. break;
  2017. case 'Q':
  2018. case 'O':
  2019. {
  2020. long number = buffer[0];
  2021. if (number > 127)
  2022. number = number - 256;
  2023. tp = format_dec (number, tp, 1);
  2024. *tp++ = ',';
  2025. tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix);
  2026. }
  2027. break;
  2028. case 'f':
  2029. tp = print_flags (disdata, insn, tp);
  2030. break;
  2031. case 'i':
  2032. tp = format_dec ((insn & 32) ? (insn & 31) | ~31L : insn & 31, tp, 1);
  2033. break;
  2034. case 'P':
  2035. {
  2036. const struct cris_spec_reg *sregp
  2037. = spec_reg_info ((insn >> 12) & 15, disdata->distype);
  2038. if (sregp->name == NULL)
  2039. /* Should have been caught as a non-match eariler. */
  2040. *tp++ = '?';
  2041. else
  2042. {
  2043. if (with_reg_prefix)
  2044. *tp++ = REGISTER_PREFIX_CHAR;
  2045. strcpy (tp, sregp->name);
  2046. tp += strlen (tp);
  2047. }
  2048. }
  2049. break;
  2050. default:
  2051. strcpy (tp, "???");
  2052. tp += 3;
  2053. }
  2054. }
  2055. *tp = 0;
  2056. if (prefix_opcodep)
  2057. (*info->fprintf_func) (info->stream, " (OOPS unused prefix \"%s: %s\")",
  2058. prefix_opcodep->name, prefix_opcodep->args);
  2059. (*info->fprintf_func) (info->stream, "%s", temp);
  2060. /* Get info for matching case-tables, if we don't have any active.
  2061. We assume that the last constant seen is used; either in the insn
  2062. itself or in a "move.d const,rN, sub.d rN,rM"-like sequence. */
  2063. if (TRACE_CASE && case_offset_counter == 0)
  2064. {
  2065. if (CONST_STRNEQ (opcodep->name, "sub"))
  2066. case_offset = last_immediate;
  2067. /* It could also be an "add", if there are negative case-values. */
  2068. else if (CONST_STRNEQ (opcodep->name, "add"))
  2069. /* The first case is the negated operand to the add. */
  2070. case_offset = -last_immediate;
  2071. /* A bound insn will tell us the number of cases. */
  2072. else if (CONST_STRNEQ (opcodep->name, "bound"))
  2073. no_of_case_offsets = last_immediate + 1;
  2074. /* A jump or jsr or branch breaks the chain of insns for a
  2075. case-table, so assume default first-case again. */
  2076. else if (info->insn_type == dis_jsr
  2077. || info->insn_type == dis_branch
  2078. || info->insn_type == dis_condbranch)
  2079. case_offset = 0;
  2080. }
  2081. }
  2082. /* Print the CRIS instruction at address memaddr on stream. Returns
  2083. length of the instruction, in bytes. Prefix register names with `$' if
  2084. WITH_REG_PREFIX. */
  2085. static int
  2086. print_insn_cris_generic (bfd_vma memaddr,
  2087. disassemble_info *info,
  2088. bfd_boolean with_reg_prefix)
  2089. {
  2090. int nbytes;
  2091. unsigned int insn;
  2092. const struct cris_opcode *matchedp;
  2093. int advance = 0;
  2094. struct cris_disasm_data *disdata
  2095. = (struct cris_disasm_data *) info->private_data;
  2096. /* No instruction will be disassembled as longer than this number of
  2097. bytes; stacked prefixes will not be expanded. */
  2098. unsigned char buffer[MAX_BYTES_PER_CRIS_INSN];
  2099. unsigned char *bufp;
  2100. int status = 0;
  2101. bfd_vma addr;
  2102. /* There will be an "out of range" error after the last instruction.
  2103. Reading pairs of bytes in decreasing number, we hope that we will get
  2104. at least the amount that we will consume.
  2105. If we can't get any data, or we do not get enough data, we print
  2106. the error message. */
  2107. nbytes = info->buffer_length;
  2108. if (nbytes > MAX_BYTES_PER_CRIS_INSN)
  2109. nbytes = MAX_BYTES_PER_CRIS_INSN;
  2110. status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);
  2111. /* If we did not get all we asked for, then clear the rest.
  2112. Hopefully this makes a reproducible result in case of errors. */
  2113. if (nbytes != MAX_BYTES_PER_CRIS_INSN)
  2114. memset (buffer + nbytes, 0, MAX_BYTES_PER_CRIS_INSN - nbytes);
  2115. addr = memaddr;
  2116. bufp = buffer;
  2117. /* Set some defaults for the insn info. */
  2118. info->insn_info_valid = 1;
  2119. info->branch_delay_insns = 0;
  2120. info->data_size = 0;
  2121. info->insn_type = dis_nonbranch;
  2122. info->flags = 0;
  2123. info->target = 0;
  2124. info->target2 = 0;
  2125. /* If we got any data, disassemble it. */
  2126. if (nbytes != 0)
  2127. {
  2128. matchedp = NULL;
  2129. insn = bufp[0] + bufp[1] * 256;
  2130. /* If we're in a case-table, don't disassemble the offsets. */
  2131. if (TRACE_CASE && case_offset_counter != 0)
  2132. {
  2133. info->insn_type = dis_noninsn;
  2134. advance += 2;
  2135. /* If to print data as offsets, then shortcut here. */
  2136. (*info->fprintf_func) (info->stream, "case %ld%s: -> ",
  2137. case_offset + no_of_case_offsets
  2138. - case_offset_counter,
  2139. case_offset_counter == 1 ? "/default" :
  2140. "");
  2141. (*info->print_address_func) ((bfd_vma)
  2142. ((short) (insn)
  2143. + (long) (addr
  2144. - (no_of_case_offsets
  2145. - case_offset_counter)
  2146. * 2)), info);
  2147. case_offset_counter--;
  2148. /* The default case start (without a "sub" or "add") must be
  2149. zero. */
  2150. if (case_offset_counter == 0)
  2151. case_offset = 0;
  2152. }
  2153. else if (insn == 0)
  2154. {
  2155. /* We're often called to disassemble zeroes. While this is a
  2156. valid "bcc .+2" insn, it is also useless enough and enough
  2157. of a nuiscance that we will just output "bcc .+2" for it
  2158. and signal it as a noninsn. */
  2159. (*info->fprintf_func) (info->stream,
  2160. disdata->distype == cris_dis_v32
  2161. ? "bcc ." : "bcc .+2");
  2162. info->insn_type = dis_noninsn;
  2163. advance += 2;
  2164. }
  2165. else
  2166. {
  2167. const struct cris_opcode *prefix_opcodep = NULL;
  2168. unsigned char *prefix_buffer = bufp;
  2169. unsigned int prefix_insn = insn;
  2170. int prefix_size = 0;
  2171. matchedp = get_opcode_entry (insn, NO_CRIS_PREFIX, disdata);
  2172. /* Check if we're supposed to write out prefixes as address
  2173. modes and if this was a prefix. */
  2174. if (matchedp != NULL && PARSE_PREFIX && matchedp->args[0] == 'p')
  2175. {
  2176. /* If it's a prefix, put it into the prefix vars and get the
  2177. main insn. */
  2178. prefix_size = bytes_to_skip (prefix_insn, matchedp,
  2179. disdata->distype, NULL);
  2180. prefix_opcodep = matchedp;
  2181. insn = bufp[prefix_size] + bufp[prefix_size + 1] * 256;
  2182. matchedp = get_opcode_entry (insn, prefix_insn, disdata);
  2183. if (matchedp != NULL)
  2184. {
  2185. addr += prefix_size;
  2186. bufp += prefix_size;
  2187. advance += prefix_size;
  2188. }
  2189. else
  2190. {
  2191. /* The "main" insn wasn't valid, at least not when
  2192. prefixed. Put back things enough to output the
  2193. prefix insn only, as a normal insn. */
  2194. matchedp = prefix_opcodep;
  2195. insn = prefix_insn;
  2196. prefix_opcodep = NULL;
  2197. }
  2198. }
  2199. if (matchedp == NULL)
  2200. {
  2201. (*info->fprintf_func) (info->stream, "??0x%x", insn);
  2202. advance += 2;
  2203. info->insn_type = dis_noninsn;
  2204. }
  2205. else
  2206. {
  2207. advance
  2208. += bytes_to_skip (insn, matchedp, disdata->distype,
  2209. prefix_opcodep);
  2210. /* The info_type and assorted fields will be set according
  2211. to the operands. */
  2212. print_with_operands (matchedp, insn, bufp, addr, info,
  2213. prefix_opcodep, prefix_insn,
  2214. prefix_buffer, with_reg_prefix);
  2215. }
  2216. }
  2217. }
  2218. else
  2219. info->insn_type = dis_noninsn;
  2220. /* If we read less than MAX_BYTES_PER_CRIS_INSN, i.e. we got an error
  2221. status when reading that much, and the insn decoding indicated a
  2222. length exceeding what we read, there is an error. */
  2223. if (status != 0 && (nbytes == 0 || advance > nbytes))
  2224. {
  2225. (*info->memory_error_func) (status, memaddr, info);
  2226. return -1;
  2227. }
  2228. /* Max supported insn size with one folded prefix insn. */
  2229. info->bytes_per_line = MAX_BYTES_PER_CRIS_INSN;
  2230. /* I would like to set this to a fixed value larger than the actual
  2231. number of bytes to print in order to avoid spaces between bytes,
  2232. but objdump.c (2.9.1) does not like that, so we print 16-bit
  2233. chunks, which is the next choice. */
  2234. info->bytes_per_chunk = 2;
  2235. /* Printing bytes in order of increasing addresses makes sense,
  2236. especially on a little-endian target.
  2237. This is completely the opposite of what you think; setting this to
  2238. BFD_ENDIAN_LITTLE will print bytes in order N..0 rather than the 0..N
  2239. we want. */
  2240. info->display_endian = BFD_ENDIAN_BIG;
  2241. return advance;
  2242. }
  2243. /* Disassemble, prefixing register names with `$'. CRIS v0..v10. */
  2244. static int
  2245. print_insn_cris_with_register_prefix (bfd_vma vma,
  2246. disassemble_info *info)
  2247. {
  2248. if (info->private_data == NULL
  2249. && !cris_parse_disassembler_options (info, cris_dis_v0_v10))
  2250. return -1;
  2251. return print_insn_cris_generic (vma, info, true);
  2252. }
  2253. /* Disassemble, prefixing register names with `$'. CRIS v32. */
  2254. static int
  2255. print_insn_crisv32_with_register_prefix (bfd_vma vma,
  2256. disassemble_info *info)
  2257. {
  2258. if (info->private_data == NULL
  2259. && !cris_parse_disassembler_options (info, cris_dis_v32))
  2260. return -1;
  2261. return print_insn_cris_generic (vma, info, true);
  2262. }
  2263. #if 0
  2264. /* Disassemble, prefixing register names with `$'.
  2265. Common v10 and v32 subset. */
  2266. static int
  2267. print_insn_crisv10_v32_with_register_prefix (bfd_vma vma,
  2268. disassemble_info *info)
  2269. {
  2270. if (info->private_data == NULL
  2271. && !cris_parse_disassembler_options (info, cris_dis_common_v10_v32))
  2272. return -1;
  2273. return print_insn_cris_generic (vma, info, true);
  2274. }
  2275. /* Disassemble, no prefixes on register names. CRIS v0..v10. */
  2276. static int
  2277. print_insn_cris_without_register_prefix (bfd_vma vma,
  2278. disassemble_info *info)
  2279. {
  2280. if (info->private_data == NULL
  2281. && !cris_parse_disassembler_options (info, cris_dis_v0_v10))
  2282. return -1;
  2283. return print_insn_cris_generic (vma, info, false);
  2284. }
  2285. /* Disassemble, no prefixes on register names. CRIS v32. */
  2286. static int
  2287. print_insn_crisv32_without_register_prefix (bfd_vma vma,
  2288. disassemble_info *info)
  2289. {
  2290. if (info->private_data == NULL
  2291. && !cris_parse_disassembler_options (info, cris_dis_v32))
  2292. return -1;
  2293. return print_insn_cris_generic (vma, info, false);
  2294. }
  2295. /* Disassemble, no prefixes on register names.
  2296. Common v10 and v32 subset. */
  2297. static int
  2298. print_insn_crisv10_v32_without_register_prefix (bfd_vma vma,
  2299. disassemble_info *info)
  2300. {
  2301. if (info->private_data == NULL
  2302. && !cris_parse_disassembler_options (info, cris_dis_common_v10_v32))
  2303. return -1;
  2304. return print_insn_cris_generic (vma, info, false);
  2305. }
  2306. #endif
  2307. int
  2308. print_insn_crisv10 (bfd_vma vma,
  2309. disassemble_info *info)
  2310. {
  2311. return print_insn_cris_with_register_prefix(vma, info);
  2312. }
  2313. int
  2314. print_insn_crisv32 (bfd_vma vma,
  2315. disassemble_info *info)
  2316. {
  2317. return print_insn_crisv32_with_register_prefix(vma, info);
  2318. }
  2319. /* Return a disassembler-function that prints registers with a `$' prefix,
  2320. or one that prints registers without a prefix.
  2321. FIXME: We should improve the solution to avoid the multitude of
  2322. functions seen above. */
  2323. #if 0
  2324. disassembler_ftype
  2325. cris_get_disassembler (bfd *abfd)
  2326. {
  2327. /* If there's no bfd in sight, we return what is valid as input in all
  2328. contexts if fed back to the assembler: disassembly *with* register
  2329. prefix. Unfortunately this will be totally wrong for v32. */
  2330. if (abfd == NULL)
  2331. return print_insn_cris_with_register_prefix;
  2332. if (bfd_get_symbol_leading_char (abfd) == 0)
  2333. {
  2334. if (bfd_get_mach (abfd) == bfd_mach_cris_v32)
  2335. return print_insn_crisv32_with_register_prefix;
  2336. if (bfd_get_mach (abfd) == bfd_mach_cris_v10_v32)
  2337. return print_insn_crisv10_v32_with_register_prefix;
  2338. /* We default to v10. This may be specifically specified in the
  2339. bfd mach, but is also the default setting. */
  2340. return print_insn_cris_with_register_prefix;
  2341. }
  2342. if (bfd_get_mach (abfd) == bfd_mach_cris_v32)
  2343. return print_insn_crisv32_without_register_prefix;
  2344. if (bfd_get_mach (abfd) == bfd_mach_cris_v10_v32)
  2345. return print_insn_crisv10_v32_without_register_prefix;
  2346. return print_insn_cris_without_register_prefix;
  2347. }
  2348. #endif
  2349. /* Local variables:
  2350. eval: (c-set-style "gnu")
  2351. indent-tabs-mode: t
  2352. End: */