dis.c 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601
  1. /*
  2. * arch/s390/kernel/dis.c
  3. *
  4. * Disassemble s390 instructions.
  5. *
  6. * Copyright IBM Corp. 2007
  7. * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
  8. */
  9. #include <linux/sched.h>
  10. #include <linux/kernel.h>
  11. #include <linux/string.h>
  12. #include <linux/errno.h>
  13. #include <linux/ptrace.h>
  14. #include <linux/timer.h>
  15. #include <linux/mm.h>
  16. #include <linux/smp.h>
  17. #include <linux/init.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/delay.h>
  20. #include <linux/module.h>
  21. #include <linux/kallsyms.h>
  22. #include <linux/reboot.h>
  23. #include <linux/kprobes.h>
  24. #include <linux/kdebug.h>
  25. #include <asm/system.h>
  26. #include <asm/uaccess.h>
  27. #include <asm/io.h>
  28. #include <asm/atomic.h>
  29. #include <asm/mathemu.h>
  30. #include <asm/cpcmd.h>
  31. #include <asm/lowcore.h>
  32. #include <asm/debug.h>
  33. #include <asm/irq.h>
  34. #ifndef CONFIG_64BIT
  35. #define ONELONG "%08lx: "
  36. #else /* CONFIG_64BIT */
  37. #define ONELONG "%016lx: "
  38. #endif /* CONFIG_64BIT */
  39. #define OPERAND_GPR 0x1 /* Operand printed as %rx */
  40. #define OPERAND_FPR 0x2 /* Operand printed as %fx */
  41. #define OPERAND_AR 0x4 /* Operand printed as %ax */
  42. #define OPERAND_CR 0x8 /* Operand printed as %cx */
  43. #define OPERAND_DISP 0x10 /* Operand printed as displacement */
  44. #define OPERAND_BASE 0x20 /* Operand printed as base register */
  45. #define OPERAND_INDEX 0x40 /* Operand printed as index register */
  46. #define OPERAND_PCREL 0x80 /* Operand printed as pc-relative symbol */
  47. #define OPERAND_SIGNED 0x100 /* Operand printed as signed value */
  48. #define OPERAND_LENGTH 0x200 /* Operand printed as length (+1) */
  49. enum {
  50. UNUSED, /* Indicates the end of the operand list */
  51. R_8, /* GPR starting at position 8 */
  52. R_12, /* GPR starting at position 12 */
  53. R_16, /* GPR starting at position 16 */
  54. R_20, /* GPR starting at position 20 */
  55. R_24, /* GPR starting at position 24 */
  56. R_28, /* GPR starting at position 28 */
  57. R_32, /* GPR starting at position 32 */
  58. F_8, /* FPR starting at position 8 */
  59. F_12, /* FPR starting at position 12 */
  60. F_16, /* FPR starting at position 16 */
  61. F_20, /* FPR starting at position 16 */
  62. F_24, /* FPR starting at position 24 */
  63. F_28, /* FPR starting at position 28 */
  64. F_32, /* FPR starting at position 32 */
  65. A_8, /* Access reg. starting at position 8 */
  66. A_12, /* Access reg. starting at position 12 */
  67. A_24, /* Access reg. starting at position 24 */
  68. A_28, /* Access reg. starting at position 28 */
  69. C_8, /* Control reg. starting at position 8 */
  70. C_12, /* Control reg. starting at position 12 */
  71. B_16, /* Base register starting at position 16 */
  72. B_32, /* Base register starting at position 32 */
  73. X_12, /* Index register starting at position 12 */
  74. D_20, /* Displacement starting at position 20 */
  75. D_36, /* Displacement starting at position 36 */
  76. D20_20, /* 20 bit displacement starting at 20 */
  77. L4_8, /* 4 bit length starting at position 8 */
  78. L4_12, /* 4 bit length starting at position 12 */
  79. L8_8, /* 8 bit length starting at position 8 */
  80. U4_8, /* 4 bit unsigned value starting at 8 */
  81. U4_12, /* 4 bit unsigned value starting at 12 */
  82. U4_16, /* 4 bit unsigned value starting at 16 */
  83. U4_20, /* 4 bit unsigned value starting at 20 */
  84. U4_32, /* 4 bit unsigned value starting at 32 */
  85. U8_8, /* 8 bit unsigned value starting at 8 */
  86. U8_16, /* 8 bit unsigned value starting at 16 */
  87. U8_24, /* 8 bit unsigned value starting at 24 */
  88. U8_32, /* 8 bit unsigned value starting at 32 */
  89. I8_8, /* 8 bit signed value starting at 8 */
  90. I8_32, /* 8 bit signed value starting at 32 */
  91. I16_16, /* 16 bit signed value starting at 16 */
  92. I16_32, /* 32 bit signed value starting at 16 */
  93. U16_16, /* 16 bit unsigned value starting at 16 */
  94. U16_32, /* 32 bit unsigned value starting at 16 */
  95. J16_16, /* PC relative jump offset at 16 */
  96. J32_16, /* PC relative long offset at 16 */
  97. I32_16, /* 32 bit signed value starting at 16 */
  98. U32_16, /* 32 bit unsigned value starting at 16 */
  99. M_16, /* 4 bit optional mask starting at 16 */
  100. RO_28, /* optional GPR starting at position 28 */
  101. };
  102. /*
  103. * Enumeration of the different instruction formats.
  104. * For details consult the principles of operation.
  105. */
  106. enum {
  107. INSTR_INVALID,
  108. INSTR_E,
  109. INSTR_RIE_R0IU, INSTR_RIE_R0UU, INSTR_RIE_RRP, INSTR_RIE_RRPU,
  110. INSTR_RIE_RRUUU, INSTR_RIE_RUPI, INSTR_RIE_RUPU, INSTR_RIE_RRI0,
  111. INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU, INSTR_RIL_UP,
  112. INSTR_RIS_R0RDU, INSTR_RIS_R0UU, INSTR_RIS_RURDI, INSTR_RIS_RURDU,
  113. INSTR_RI_RI, INSTR_RI_RP, INSTR_RI_RU, INSTR_RI_UP,
  114. INSTR_RRE_00, INSTR_RRE_0R, INSTR_RRE_AA, INSTR_RRE_AR, INSTR_RRE_F0,
  115. INSTR_RRE_FF, INSTR_RRE_FR, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF,
  116. INSTR_RRE_RR, INSTR_RRE_RR_OPT,
  117. INSTR_RRF_0UFF, INSTR_RRF_F0FF, INSTR_RRF_F0FF2, INSTR_RRF_F0FR,
  118. INSTR_RRF_FFRU, INSTR_RRF_FUFF, INSTR_RRF_M0RR, INSTR_RRF_R0RR,
  119. INSTR_RRF_R0RR2, INSTR_RRF_RURR, INSTR_RRF_U0FF, INSTR_RRF_U0RF,
  120. INSTR_RRF_U0RR, INSTR_RRF_UUFF, INSTR_RRR_F0FF, INSTR_RRS_RRRDU,
  121. INSTR_RR_FF, INSTR_RR_R0, INSTR_RR_RR, INSTR_RR_U0, INSTR_RR_UR,
  122. INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD,
  123. INSTR_RSI_RRP,
  124. INSTR_RSL_R0RD,
  125. INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD, INSTR_RSY_RURD,
  126. INSTR_RSY_RDRM,
  127. INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD, INSTR_RS_RRRD,
  128. INSTR_RS_RURD,
  129. INSTR_RXE_FRRD, INSTR_RXE_RRRD,
  130. INSTR_RXF_FRRDF,
  131. INSTR_RXY_FRRD, INSTR_RXY_RRRD, INSTR_RXY_URRD,
  132. INSTR_RX_FRRD, INSTR_RX_RRRD, INSTR_RX_URRD,
  133. INSTR_SIL_RDI, INSTR_SIL_RDU,
  134. INSTR_SIY_IRD, INSTR_SIY_URD,
  135. INSTR_SI_URD,
  136. INSTR_SSE_RDRD,
  137. INSTR_SSF_RRDRD, INSTR_SSF_RRDRD2,
  138. INSTR_SS_L0RDRD, INSTR_SS_LIRDRD, INSTR_SS_LLRDRD, INSTR_SS_RRRDRD,
  139. INSTR_SS_RRRDRD2, INSTR_SS_RRRDRD3,
  140. INSTR_S_00, INSTR_S_RD,
  141. };
  142. struct operand {
  143. int bits; /* The number of bits in the operand. */
  144. int shift; /* The number of bits to shift. */
  145. int flags; /* One bit syntax flags. */
  146. };
  147. struct insn {
  148. const char name[5];
  149. unsigned char opfrag;
  150. unsigned char format;
  151. };
  152. static const struct operand operands[] =
  153. {
  154. [UNUSED] = { 0, 0, 0 },
  155. [R_8] = { 4, 8, OPERAND_GPR },
  156. [R_12] = { 4, 12, OPERAND_GPR },
  157. [R_16] = { 4, 16, OPERAND_GPR },
  158. [R_20] = { 4, 20, OPERAND_GPR },
  159. [R_24] = { 4, 24, OPERAND_GPR },
  160. [R_28] = { 4, 28, OPERAND_GPR },
  161. [R_32] = { 4, 32, OPERAND_GPR },
  162. [F_8] = { 4, 8, OPERAND_FPR },
  163. [F_12] = { 4, 12, OPERAND_FPR },
  164. [F_16] = { 4, 16, OPERAND_FPR },
  165. [F_20] = { 4, 16, OPERAND_FPR },
  166. [F_24] = { 4, 24, OPERAND_FPR },
  167. [F_28] = { 4, 28, OPERAND_FPR },
  168. [F_32] = { 4, 32, OPERAND_FPR },
  169. [A_8] = { 4, 8, OPERAND_AR },
  170. [A_12] = { 4, 12, OPERAND_AR },
  171. [A_24] = { 4, 24, OPERAND_AR },
  172. [A_28] = { 4, 28, OPERAND_AR },
  173. [C_8] = { 4, 8, OPERAND_CR },
  174. [C_12] = { 4, 12, OPERAND_CR },
  175. [B_16] = { 4, 16, OPERAND_BASE | OPERAND_GPR },
  176. [B_32] = { 4, 32, OPERAND_BASE | OPERAND_GPR },
  177. [X_12] = { 4, 12, OPERAND_INDEX | OPERAND_GPR },
  178. [D_20] = { 12, 20, OPERAND_DISP },
  179. [D_36] = { 12, 36, OPERAND_DISP },
  180. [D20_20] = { 20, 20, OPERAND_DISP | OPERAND_SIGNED },
  181. [L4_8] = { 4, 8, OPERAND_LENGTH },
  182. [L4_12] = { 4, 12, OPERAND_LENGTH },
  183. [L8_8] = { 8, 8, OPERAND_LENGTH },
  184. [U4_8] = { 4, 8, 0 },
  185. [U4_12] = { 4, 12, 0 },
  186. [U4_16] = { 4, 16, 0 },
  187. [U4_20] = { 4, 20, 0 },
  188. [U4_32] = { 4, 32, 0 },
  189. [U8_8] = { 8, 8, 0 },
  190. [U8_16] = { 8, 16, 0 },
  191. [U8_24] = { 8, 24, 0 },
  192. [U8_32] = { 8, 32, 0 },
  193. [I16_16] = { 16, 16, OPERAND_SIGNED },
  194. [U16_16] = { 16, 16, 0 },
  195. [U16_32] = { 16, 32, 0 },
  196. [J16_16] = { 16, 16, OPERAND_PCREL },
  197. [I16_32] = { 16, 32, OPERAND_SIGNED },
  198. [J32_16] = { 32, 16, OPERAND_PCREL },
  199. [I32_16] = { 32, 16, OPERAND_SIGNED },
  200. [U32_16] = { 32, 16, 0 },
  201. [M_16] = { 4, 16, 0 },
  202. [RO_28] = { 4, 28, OPERAND_GPR }
  203. };
  204. static const unsigned char formats[][7] = {
  205. [INSTR_E] = { 0xff, 0,0,0,0,0,0 },
  206. [INSTR_RIE_R0UU] = { 0xff, R_8,U16_16,U4_32,0,0,0 },
  207. [INSTR_RIE_RRPU] = { 0xff, R_8,R_12,U4_32,J16_16,0,0 },
  208. [INSTR_RIE_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 },
  209. [INSTR_RIE_RRUUU] = { 0xff, R_8,R_12,U8_16,U8_24,U8_32,0 },
  210. [INSTR_RIE_RUPI] = { 0xff, R_8,I8_32,U4_12,J16_16,0,0 },
  211. [INSTR_RIE_RRI0] = { 0xff, R_8,R_12,I16_16,0,0,0 },
  212. [INSTR_RIL_RI] = { 0x0f, R_8,I32_16,0,0,0,0 },
  213. [INSTR_RIL_RP] = { 0x0f, R_8,J32_16,0,0,0,0 },
  214. [INSTR_RIL_RU] = { 0x0f, R_8,U32_16,0,0,0,0 },
  215. [INSTR_RIL_UP] = { 0x0f, U4_8,J32_16,0,0,0,0 },
  216. [INSTR_RIS_R0RDU] = { 0xff, R_8,U8_32,D_20,B_16,0,0 },
  217. [INSTR_RIS_RURDI] = { 0xff, R_8,I8_32,U4_12,D_20,B_16,0 },
  218. [INSTR_RIS_RURDU] = { 0xff, R_8,U8_32,U4_12,D_20,B_16,0 },
  219. [INSTR_RI_RI] = { 0x0f, R_8,I16_16,0,0,0,0 },
  220. [INSTR_RI_RP] = { 0x0f, R_8,J16_16,0,0,0,0 },
  221. [INSTR_RI_RU] = { 0x0f, R_8,U16_16,0,0,0,0 },
  222. [INSTR_RI_UP] = { 0x0f, U4_8,J16_16,0,0,0,0 },
  223. [INSTR_RRE_00] = { 0xff, 0,0,0,0,0,0 },
  224. [INSTR_RRE_0R] = { 0xff, R_28,0,0,0,0,0 },
  225. [INSTR_RRE_AA] = { 0xff, A_24,A_28,0,0,0,0 },
  226. [INSTR_RRE_AR] = { 0xff, A_24,R_28,0,0,0,0 },
  227. [INSTR_RRE_F0] = { 0xff, F_24,0,0,0,0,0 },
  228. [INSTR_RRE_FF] = { 0xff, F_24,F_28,0,0,0,0 },
  229. [INSTR_RRE_FR] = { 0xff, F_24,R_28,0,0,0,0 },
  230. [INSTR_RRE_R0] = { 0xff, R_24,0,0,0,0,0 },
  231. [INSTR_RRE_RA] = { 0xff, R_24,A_28,0,0,0,0 },
  232. [INSTR_RRE_RF] = { 0xff, R_24,F_28,0,0,0,0 },
  233. [INSTR_RRE_RR] = { 0xff, R_24,R_28,0,0,0,0 },
  234. [INSTR_RRE_RR_OPT]= { 0xff, R_24,RO_28,0,0,0,0 },
  235. [INSTR_RRF_0UFF] = { 0xff, F_24,F_28,U4_20,0,0,0 },
  236. [INSTR_RRF_F0FF2] = { 0xff, F_24,F_16,F_28,0,0,0 },
  237. [INSTR_RRF_F0FF] = { 0xff, F_16,F_24,F_28,0,0,0 },
  238. [INSTR_RRF_F0FR] = { 0xff, F_24,F_16,R_28,0,0,0 },
  239. [INSTR_RRF_FFRU] = { 0xff, F_24,F_16,R_28,U4_20,0,0 },
  240. [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 },
  241. [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 },
  242. [INSTR_RRF_R0RR] = { 0xff, R_24,R_16,R_28,0,0,0 },
  243. [INSTR_RRF_R0RR2] = { 0xff, R_24,R_28,R_16,0,0,0 },
  244. [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 },
  245. [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 },
  246. [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 },
  247. [INSTR_RRF_U0RR] = { 0xff, R_24,R_28,U4_16,0,0,0 },
  248. [INSTR_RRF_UUFF] = { 0xff, F_24,U4_16,F_28,U4_20,0,0 },
  249. [INSTR_RRR_F0FF] = { 0xff, F_24,F_28,F_16,0,0,0 },
  250. [INSTR_RRS_RRRDU] = { 0xff, R_8,R_12,U4_32,D_20,B_16,0 },
  251. [INSTR_RR_FF] = { 0xff, F_8,F_12,0,0,0,0 },
  252. [INSTR_RR_R0] = { 0xff, R_8, 0,0,0,0,0 },
  253. [INSTR_RR_RR] = { 0xff, R_8,R_12,0,0,0,0 },
  254. [INSTR_RR_U0] = { 0xff, U8_8, 0,0,0,0,0 },
  255. [INSTR_RR_UR] = { 0xff, U4_8,R_12,0,0,0,0 },
  256. [INSTR_RSE_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 },
  257. [INSTR_RSE_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 },
  258. [INSTR_RSE_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
  259. [INSTR_RSI_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 },
  260. [INSTR_RSL_R0RD] = { 0xff, D_20,L4_8,B_16,0,0,0 },
  261. [INSTR_RSY_AARD] = { 0xff, A_8,A_12,D20_20,B_16,0,0 },
  262. [INSTR_RSY_CCRD] = { 0xff, C_8,C_12,D20_20,B_16,0,0 },
  263. [INSTR_RSY_RRRD] = { 0xff, R_8,R_12,D20_20,B_16,0,0 },
  264. [INSTR_RSY_RURD] = { 0xff, R_8,U4_12,D20_20,B_16,0,0 },
  265. [INSTR_RSY_RDRM] = { 0xff, R_8,D20_20,B_16,U4_12,0,0 },
  266. [INSTR_RS_AARD] = { 0xff, A_8,A_12,D_20,B_16,0,0 },
  267. [INSTR_RS_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 },
  268. [INSTR_RS_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 },
  269. [INSTR_RS_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 },
  270. [INSTR_RS_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
  271. [INSTR_RXE_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 },
  272. [INSTR_RXE_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 },
  273. [INSTR_RXF_FRRDF] = { 0xff, F_32,F_8,D_20,X_12,B_16,0 },
  274. [INSTR_RXY_FRRD] = { 0xff, F_8,D20_20,X_12,B_16,0,0 },
  275. [INSTR_RXY_RRRD] = { 0xff, R_8,D20_20,X_12,B_16,0,0 },
  276. [INSTR_RXY_URRD] = { 0xff, U4_8,D20_20,X_12,B_16,0,0 },
  277. [INSTR_RX_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 },
  278. [INSTR_RX_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 },
  279. [INSTR_RX_URRD] = { 0xff, U4_8,D_20,X_12,B_16,0,0 },
  280. [INSTR_SIL_RDI] = { 0xff, D_20,B_16,I16_32,0,0,0 },
  281. [INSTR_SIL_RDU] = { 0xff, D_20,B_16,U16_32,0,0,0 },
  282. [INSTR_SIY_IRD] = { 0xff, D20_20,B_16,I8_8,0,0,0 },
  283. [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 },
  284. [INSTR_SI_URD] = { 0xff, D_20,B_16,U8_8,0,0,0 },
  285. [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 },
  286. [INSTR_SSF_RRDRD] = { 0x00, D_20,B_16,D_36,B_32,R_8,0 },
  287. [INSTR_SSF_RRDRD2]= { 0x00, R_8,D_20,B_16,D_36,B_32,0 },
  288. [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 },
  289. [INSTR_SS_LIRDRD] = { 0xff, D_20,L4_8,B_16,D_36,B_32,U4_12 },
  290. [INSTR_SS_LLRDRD] = { 0xff, D_20,L4_8,B_16,D_36,L4_12,B_32 },
  291. [INSTR_SS_RRRDRD2]= { 0xff, R_8,D_20,B_16,R_12,D_36,B_32 },
  292. [INSTR_SS_RRRDRD3]= { 0xff, R_8,R_12,D_20,B_16,D_36,B_32 },
  293. [INSTR_SS_RRRDRD] = { 0xff, D_20,R_8,B_16,D_36,B_32,R_12 },
  294. [INSTR_S_00] = { 0xff, 0,0,0,0,0,0 },
  295. [INSTR_S_RD] = { 0xff, D_20,B_16,0,0,0,0 },
  296. };
  297. enum {
  298. LONG_INSN_ALGHSIK,
  299. LONG_INSN_ALHSIK,
  300. LONG_INSN_CLFHSI,
  301. LONG_INSN_CLGFRL,
  302. LONG_INSN_CLGHRL,
  303. LONG_INSN_CLGHSI,
  304. LONG_INSN_CLHHSI,
  305. LONG_INSN_LLGFRL,
  306. LONG_INSN_LLGHRL,
  307. LONG_INSN_POPCNT,
  308. LONG_INSN_RISBHG,
  309. LONG_INSN_RISBLG,
  310. };
  311. static char *long_insn_name[] = {
  312. [LONG_INSN_ALGHSIK] = "alghsik",
  313. [LONG_INSN_ALHSIK] = "alhsik",
  314. [LONG_INSN_CLFHSI] = "clfhsi",
  315. [LONG_INSN_CLGFRL] = "clgfrl",
  316. [LONG_INSN_CLGHRL] = "clghrl",
  317. [LONG_INSN_CLGHSI] = "clghsi",
  318. [LONG_INSN_CLHHSI] = "clhhsi",
  319. [LONG_INSN_LLGFRL] = "llgfrl",
  320. [LONG_INSN_LLGHRL] = "llghrl",
  321. [LONG_INSN_POPCNT] = "popcnt",
  322. [LONG_INSN_RISBHG] = "risbhg",
  323. [LONG_INSN_RISBLG] = "risblk",
  324. };
  325. static struct insn opcode[] = {
  326. #ifdef CONFIG_64BIT
  327. { "lmd", 0xef, INSTR_SS_RRRDRD3 },
  328. #endif
  329. { "spm", 0x04, INSTR_RR_R0 },
  330. { "balr", 0x05, INSTR_RR_RR },
  331. { "bctr", 0x06, INSTR_RR_RR },
  332. { "bcr", 0x07, INSTR_RR_UR },
  333. { "svc", 0x0a, INSTR_RR_U0 },
  334. { "bsm", 0x0b, INSTR_RR_RR },
  335. { "bassm", 0x0c, INSTR_RR_RR },
  336. { "basr", 0x0d, INSTR_RR_RR },
  337. { "mvcl", 0x0e, INSTR_RR_RR },
  338. { "clcl", 0x0f, INSTR_RR_RR },
  339. { "lpr", 0x10, INSTR_RR_RR },
  340. { "lnr", 0x11, INSTR_RR_RR },
  341. { "ltr", 0x12, INSTR_RR_RR },
  342. { "lcr", 0x13, INSTR_RR_RR },
  343. { "nr", 0x14, INSTR_RR_RR },
  344. { "clr", 0x15, INSTR_RR_RR },
  345. { "or", 0x16, INSTR_RR_RR },
  346. { "xr", 0x17, INSTR_RR_RR },
  347. { "lr", 0x18, INSTR_RR_RR },
  348. { "cr", 0x19, INSTR_RR_RR },
  349. { "ar", 0x1a, INSTR_RR_RR },
  350. { "sr", 0x1b, INSTR_RR_RR },
  351. { "mr", 0x1c, INSTR_RR_RR },
  352. { "dr", 0x1d, INSTR_RR_RR },
  353. { "alr", 0x1e, INSTR_RR_RR },
  354. { "slr", 0x1f, INSTR_RR_RR },
  355. { "lpdr", 0x20, INSTR_RR_FF },
  356. { "lndr", 0x21, INSTR_RR_FF },
  357. { "ltdr", 0x22, INSTR_RR_FF },
  358. { "lcdr", 0x23, INSTR_RR_FF },
  359. { "hdr", 0x24, INSTR_RR_FF },
  360. { "ldxr", 0x25, INSTR_RR_FF },
  361. { "lrdr", 0x25, INSTR_RR_FF },
  362. { "mxr", 0x26, INSTR_RR_FF },
  363. { "mxdr", 0x27, INSTR_RR_FF },
  364. { "ldr", 0x28, INSTR_RR_FF },
  365. { "cdr", 0x29, INSTR_RR_FF },
  366. { "adr", 0x2a, INSTR_RR_FF },
  367. { "sdr", 0x2b, INSTR_RR_FF },
  368. { "mdr", 0x2c, INSTR_RR_FF },
  369. { "ddr", 0x2d, INSTR_RR_FF },
  370. { "awr", 0x2e, INSTR_RR_FF },
  371. { "swr", 0x2f, INSTR_RR_FF },
  372. { "lper", 0x30, INSTR_RR_FF },
  373. { "lner", 0x31, INSTR_RR_FF },
  374. { "lter", 0x32, INSTR_RR_FF },
  375. { "lcer", 0x33, INSTR_RR_FF },
  376. { "her", 0x34, INSTR_RR_FF },
  377. { "ledr", 0x35, INSTR_RR_FF },
  378. { "lrer", 0x35, INSTR_RR_FF },
  379. { "axr", 0x36, INSTR_RR_FF },
  380. { "sxr", 0x37, INSTR_RR_FF },
  381. { "ler", 0x38, INSTR_RR_FF },
  382. { "cer", 0x39, INSTR_RR_FF },
  383. { "aer", 0x3a, INSTR_RR_FF },
  384. { "ser", 0x3b, INSTR_RR_FF },
  385. { "mder", 0x3c, INSTR_RR_FF },
  386. { "mer", 0x3c, INSTR_RR_FF },
  387. { "der", 0x3d, INSTR_RR_FF },
  388. { "aur", 0x3e, INSTR_RR_FF },
  389. { "sur", 0x3f, INSTR_RR_FF },
  390. { "sth", 0x40, INSTR_RX_RRRD },
  391. { "la", 0x41, INSTR_RX_RRRD },
  392. { "stc", 0x42, INSTR_RX_RRRD },
  393. { "ic", 0x43, INSTR_RX_RRRD },
  394. { "ex", 0x44, INSTR_RX_RRRD },
  395. { "bal", 0x45, INSTR_RX_RRRD },
  396. { "bct", 0x46, INSTR_RX_RRRD },
  397. { "bc", 0x47, INSTR_RX_URRD },
  398. { "lh", 0x48, INSTR_RX_RRRD },
  399. { "ch", 0x49, INSTR_RX_RRRD },
  400. { "ah", 0x4a, INSTR_RX_RRRD },
  401. { "sh", 0x4b, INSTR_RX_RRRD },
  402. { "mh", 0x4c, INSTR_RX_RRRD },
  403. { "bas", 0x4d, INSTR_RX_RRRD },
  404. { "cvd", 0x4e, INSTR_RX_RRRD },
  405. { "cvb", 0x4f, INSTR_RX_RRRD },
  406. { "st", 0x50, INSTR_RX_RRRD },
  407. { "lae", 0x51, INSTR_RX_RRRD },
  408. { "n", 0x54, INSTR_RX_RRRD },
  409. { "cl", 0x55, INSTR_RX_RRRD },
  410. { "o", 0x56, INSTR_RX_RRRD },
  411. { "x", 0x57, INSTR_RX_RRRD },
  412. { "l", 0x58, INSTR_RX_RRRD },
  413. { "c", 0x59, INSTR_RX_RRRD },
  414. { "a", 0x5a, INSTR_RX_RRRD },
  415. { "s", 0x5b, INSTR_RX_RRRD },
  416. { "m", 0x5c, INSTR_RX_RRRD },
  417. { "d", 0x5d, INSTR_RX_RRRD },
  418. { "al", 0x5e, INSTR_RX_RRRD },
  419. { "sl", 0x5f, INSTR_RX_RRRD },
  420. { "std", 0x60, INSTR_RX_FRRD },
  421. { "mxd", 0x67, INSTR_RX_FRRD },
  422. { "ld", 0x68, INSTR_RX_FRRD },
  423. { "cd", 0x69, INSTR_RX_FRRD },
  424. { "ad", 0x6a, INSTR_RX_FRRD },
  425. { "sd", 0x6b, INSTR_RX_FRRD },
  426. { "md", 0x6c, INSTR_RX_FRRD },
  427. { "dd", 0x6d, INSTR_RX_FRRD },
  428. { "aw", 0x6e, INSTR_RX_FRRD },
  429. { "sw", 0x6f, INSTR_RX_FRRD },
  430. { "ste", 0x70, INSTR_RX_FRRD },
  431. { "ms", 0x71, INSTR_RX_RRRD },
  432. { "le", 0x78, INSTR_RX_FRRD },
  433. { "ce", 0x79, INSTR_RX_FRRD },
  434. { "ae", 0x7a, INSTR_RX_FRRD },
  435. { "se", 0x7b, INSTR_RX_FRRD },
  436. { "mde", 0x7c, INSTR_RX_FRRD },
  437. { "me", 0x7c, INSTR_RX_FRRD },
  438. { "de", 0x7d, INSTR_RX_FRRD },
  439. { "au", 0x7e, INSTR_RX_FRRD },
  440. { "su", 0x7f, INSTR_RX_FRRD },
  441. { "ssm", 0x80, INSTR_S_RD },
  442. { "lpsw", 0x82, INSTR_S_RD },
  443. { "diag", 0x83, INSTR_RS_RRRD },
  444. { "brxh", 0x84, INSTR_RSI_RRP },
  445. { "brxle", 0x85, INSTR_RSI_RRP },
  446. { "bxh", 0x86, INSTR_RS_RRRD },
  447. { "bxle", 0x87, INSTR_RS_RRRD },
  448. { "srl", 0x88, INSTR_RS_R0RD },
  449. { "sll", 0x89, INSTR_RS_R0RD },
  450. { "sra", 0x8a, INSTR_RS_R0RD },
  451. { "sla", 0x8b, INSTR_RS_R0RD },
  452. { "srdl", 0x8c, INSTR_RS_R0RD },
  453. { "sldl", 0x8d, INSTR_RS_R0RD },
  454. { "srda", 0x8e, INSTR_RS_R0RD },
  455. { "slda", 0x8f, INSTR_RS_R0RD },
  456. { "stm", 0x90, INSTR_RS_RRRD },
  457. { "tm", 0x91, INSTR_SI_URD },
  458. { "mvi", 0x92, INSTR_SI_URD },
  459. { "ts", 0x93, INSTR_S_RD },
  460. { "ni", 0x94, INSTR_SI_URD },
  461. { "cli", 0x95, INSTR_SI_URD },
  462. { "oi", 0x96, INSTR_SI_URD },
  463. { "xi", 0x97, INSTR_SI_URD },
  464. { "lm", 0x98, INSTR_RS_RRRD },
  465. { "trace", 0x99, INSTR_RS_RRRD },
  466. { "lam", 0x9a, INSTR_RS_AARD },
  467. { "stam", 0x9b, INSTR_RS_AARD },
  468. { "mvcle", 0xa8, INSTR_RS_RRRD },
  469. { "clcle", 0xa9, INSTR_RS_RRRD },
  470. { "stnsm", 0xac, INSTR_SI_URD },
  471. { "stosm", 0xad, INSTR_SI_URD },
  472. { "sigp", 0xae, INSTR_RS_RRRD },
  473. { "mc", 0xaf, INSTR_SI_URD },
  474. { "lra", 0xb1, INSTR_RX_RRRD },
  475. { "stctl", 0xb6, INSTR_RS_CCRD },
  476. { "lctl", 0xb7, INSTR_RS_CCRD },
  477. { "cs", 0xba, INSTR_RS_RRRD },
  478. { "cds", 0xbb, INSTR_RS_RRRD },
  479. { "clm", 0xbd, INSTR_RS_RURD },
  480. { "stcm", 0xbe, INSTR_RS_RURD },
  481. { "icm", 0xbf, INSTR_RS_RURD },
  482. { "mvn", 0xd1, INSTR_SS_L0RDRD },
  483. { "mvc", 0xd2, INSTR_SS_L0RDRD },
  484. { "mvz", 0xd3, INSTR_SS_L0RDRD },
  485. { "nc", 0xd4, INSTR_SS_L0RDRD },
  486. { "clc", 0xd5, INSTR_SS_L0RDRD },
  487. { "oc", 0xd6, INSTR_SS_L0RDRD },
  488. { "xc", 0xd7, INSTR_SS_L0RDRD },
  489. { "mvck", 0xd9, INSTR_SS_RRRDRD },
  490. { "mvcp", 0xda, INSTR_SS_RRRDRD },
  491. { "mvcs", 0xdb, INSTR_SS_RRRDRD },
  492. { "tr", 0xdc, INSTR_SS_L0RDRD },
  493. { "trt", 0xdd, INSTR_SS_L0RDRD },
  494. { "ed", 0xde, INSTR_SS_L0RDRD },
  495. { "edmk", 0xdf, INSTR_SS_L0RDRD },
  496. { "pku", 0xe1, INSTR_SS_L0RDRD },
  497. { "unpku", 0xe2, INSTR_SS_L0RDRD },
  498. { "mvcin", 0xe8, INSTR_SS_L0RDRD },
  499. { "pka", 0xe9, INSTR_SS_L0RDRD },
  500. { "unpka", 0xea, INSTR_SS_L0RDRD },
  501. { "plo", 0xee, INSTR_SS_RRRDRD2 },
  502. { "srp", 0xf0, INSTR_SS_LIRDRD },
  503. { "mvo", 0xf1, INSTR_SS_LLRDRD },
  504. { "pack", 0xf2, INSTR_SS_LLRDRD },
  505. { "unpk", 0xf3, INSTR_SS_LLRDRD },
  506. { "zap", 0xf8, INSTR_SS_LLRDRD },
  507. { "cp", 0xf9, INSTR_SS_LLRDRD },
  508. { "ap", 0xfa, INSTR_SS_LLRDRD },
  509. { "sp", 0xfb, INSTR_SS_LLRDRD },
  510. { "mp", 0xfc, INSTR_SS_LLRDRD },
  511. { "dp", 0xfd, INSTR_SS_LLRDRD },
  512. { "", 0, INSTR_INVALID }
  513. };
  514. static struct insn opcode_01[] = {
  515. #ifdef CONFIG_64BIT
  516. { "sam64", 0x0e, INSTR_E },
  517. { "pfpo", 0x0a, INSTR_E },
  518. { "ptff", 0x04, INSTR_E },
  519. #endif
  520. { "pr", 0x01, INSTR_E },
  521. { "upt", 0x02, INSTR_E },
  522. { "sckpf", 0x07, INSTR_E },
  523. { "tam", 0x0b, INSTR_E },
  524. { "sam24", 0x0c, INSTR_E },
  525. { "sam31", 0x0d, INSTR_E },
  526. { "trap2", 0xff, INSTR_E },
  527. { "", 0, INSTR_INVALID }
  528. };
  529. static struct insn opcode_a5[] = {
  530. #ifdef CONFIG_64BIT
  531. { "iihh", 0x00, INSTR_RI_RU },
  532. { "iihl", 0x01, INSTR_RI_RU },
  533. { "iilh", 0x02, INSTR_RI_RU },
  534. { "iill", 0x03, INSTR_RI_RU },
  535. { "nihh", 0x04, INSTR_RI_RU },
  536. { "nihl", 0x05, INSTR_RI_RU },
  537. { "nilh", 0x06, INSTR_RI_RU },
  538. { "nill", 0x07, INSTR_RI_RU },
  539. { "oihh", 0x08, INSTR_RI_RU },
  540. { "oihl", 0x09, INSTR_RI_RU },
  541. { "oilh", 0x0a, INSTR_RI_RU },
  542. { "oill", 0x0b, INSTR_RI_RU },
  543. { "llihh", 0x0c, INSTR_RI_RU },
  544. { "llihl", 0x0d, INSTR_RI_RU },
  545. { "llilh", 0x0e, INSTR_RI_RU },
  546. { "llill", 0x0f, INSTR_RI_RU },
  547. #endif
  548. { "", 0, INSTR_INVALID }
  549. };
  550. static struct insn opcode_a7[] = {
  551. #ifdef CONFIG_64BIT
  552. { "tmhh", 0x02, INSTR_RI_RU },
  553. { "tmhl", 0x03, INSTR_RI_RU },
  554. { "brctg", 0x07, INSTR_RI_RP },
  555. { "lghi", 0x09, INSTR_RI_RI },
  556. { "aghi", 0x0b, INSTR_RI_RI },
  557. { "mghi", 0x0d, INSTR_RI_RI },
  558. { "cghi", 0x0f, INSTR_RI_RI },
  559. #endif
  560. { "tmlh", 0x00, INSTR_RI_RU },
  561. { "tmll", 0x01, INSTR_RI_RU },
  562. { "brc", 0x04, INSTR_RI_UP },
  563. { "bras", 0x05, INSTR_RI_RP },
  564. { "brct", 0x06, INSTR_RI_RP },
  565. { "lhi", 0x08, INSTR_RI_RI },
  566. { "ahi", 0x0a, INSTR_RI_RI },
  567. { "mhi", 0x0c, INSTR_RI_RI },
  568. { "chi", 0x0e, INSTR_RI_RI },
  569. { "", 0, INSTR_INVALID }
  570. };
  571. static struct insn opcode_b2[] = {
  572. #ifdef CONFIG_64BIT
  573. { "sske", 0x2b, INSTR_RRF_M0RR },
  574. { "stckf", 0x7c, INSTR_S_RD },
  575. { "cu21", 0xa6, INSTR_RRF_M0RR },
  576. { "cuutf", 0xa6, INSTR_RRF_M0RR },
  577. { "cu12", 0xa7, INSTR_RRF_M0RR },
  578. { "cutfu", 0xa7, INSTR_RRF_M0RR },
  579. { "stfle", 0xb0, INSTR_S_RD },
  580. { "lpswe", 0xb2, INSTR_S_RD },
  581. { "srnmt", 0xb9, INSTR_S_RD },
  582. { "lfas", 0xbd, INSTR_S_RD },
  583. #endif
  584. { "stidp", 0x02, INSTR_S_RD },
  585. { "sck", 0x04, INSTR_S_RD },
  586. { "stck", 0x05, INSTR_S_RD },
  587. { "sckc", 0x06, INSTR_S_RD },
  588. { "stckc", 0x07, INSTR_S_RD },
  589. { "spt", 0x08, INSTR_S_RD },
  590. { "stpt", 0x09, INSTR_S_RD },
  591. { "spka", 0x0a, INSTR_S_RD },
  592. { "ipk", 0x0b, INSTR_S_00 },
  593. { "ptlb", 0x0d, INSTR_S_00 },
  594. { "spx", 0x10, INSTR_S_RD },
  595. { "stpx", 0x11, INSTR_S_RD },
  596. { "stap", 0x12, INSTR_S_RD },
  597. { "sie", 0x14, INSTR_S_RD },
  598. { "pc", 0x18, INSTR_S_RD },
  599. { "sac", 0x19, INSTR_S_RD },
  600. { "cfc", 0x1a, INSTR_S_RD },
  601. { "ipte", 0x21, INSTR_RRE_RR },
  602. { "ipm", 0x22, INSTR_RRE_R0 },
  603. { "ivsk", 0x23, INSTR_RRE_RR },
  604. { "iac", 0x24, INSTR_RRE_R0 },
  605. { "ssar", 0x25, INSTR_RRE_R0 },
  606. { "epar", 0x26, INSTR_RRE_R0 },
  607. { "esar", 0x27, INSTR_RRE_R0 },
  608. { "pt", 0x28, INSTR_RRE_RR },
  609. { "iske", 0x29, INSTR_RRE_RR },
  610. { "rrbe", 0x2a, INSTR_RRE_RR },
  611. { "sske", 0x2b, INSTR_RRE_RR },
  612. { "tb", 0x2c, INSTR_RRE_0R },
  613. { "dxr", 0x2d, INSTR_RRE_F0 },
  614. { "pgin", 0x2e, INSTR_RRE_RR },
  615. { "pgout", 0x2f, INSTR_RRE_RR },
  616. { "csch", 0x30, INSTR_S_00 },
  617. { "hsch", 0x31, INSTR_S_00 },
  618. { "msch", 0x32, INSTR_S_RD },
  619. { "ssch", 0x33, INSTR_S_RD },
  620. { "stsch", 0x34, INSTR_S_RD },
  621. { "tsch", 0x35, INSTR_S_RD },
  622. { "tpi", 0x36, INSTR_S_RD },
  623. { "sal", 0x37, INSTR_S_00 },
  624. { "rsch", 0x38, INSTR_S_00 },
  625. { "stcrw", 0x39, INSTR_S_RD },
  626. { "stcps", 0x3a, INSTR_S_RD },
  627. { "rchp", 0x3b, INSTR_S_00 },
  628. { "schm", 0x3c, INSTR_S_00 },
  629. { "bakr", 0x40, INSTR_RRE_RR },
  630. { "cksm", 0x41, INSTR_RRE_RR },
  631. { "sqdr", 0x44, INSTR_RRE_F0 },
  632. { "sqer", 0x45, INSTR_RRE_F0 },
  633. { "stura", 0x46, INSTR_RRE_RR },
  634. { "msta", 0x47, INSTR_RRE_R0 },
  635. { "palb", 0x48, INSTR_RRE_00 },
  636. { "ereg", 0x49, INSTR_RRE_RR },
  637. { "esta", 0x4a, INSTR_RRE_RR },
  638. { "lura", 0x4b, INSTR_RRE_RR },
  639. { "tar", 0x4c, INSTR_RRE_AR },
  640. { "cpya", 0x4d, INSTR_RRE_AA },
  641. { "sar", 0x4e, INSTR_RRE_AR },
  642. { "ear", 0x4f, INSTR_RRE_RA },
  643. { "csp", 0x50, INSTR_RRE_RR },
  644. { "msr", 0x52, INSTR_RRE_RR },
  645. { "mvpg", 0x54, INSTR_RRE_RR },
  646. { "mvst", 0x55, INSTR_RRE_RR },
  647. { "cuse", 0x57, INSTR_RRE_RR },
  648. { "bsg", 0x58, INSTR_RRE_RR },
  649. { "bsa", 0x5a, INSTR_RRE_RR },
  650. { "clst", 0x5d, INSTR_RRE_RR },
  651. { "srst", 0x5e, INSTR_RRE_RR },
  652. { "cmpsc", 0x63, INSTR_RRE_RR },
  653. { "siga", 0x74, INSTR_S_RD },
  654. { "xsch", 0x76, INSTR_S_00 },
  655. { "rp", 0x77, INSTR_S_RD },
  656. { "stcke", 0x78, INSTR_S_RD },
  657. { "sacf", 0x79, INSTR_S_RD },
  658. { "spp", 0x80, INSTR_S_RD },
  659. { "stsi", 0x7d, INSTR_S_RD },
  660. { "srnm", 0x99, INSTR_S_RD },
  661. { "stfpc", 0x9c, INSTR_S_RD },
  662. { "lfpc", 0x9d, INSTR_S_RD },
  663. { "tre", 0xa5, INSTR_RRE_RR },
  664. { "cuutf", 0xa6, INSTR_RRE_RR },
  665. { "cutfu", 0xa7, INSTR_RRE_RR },
  666. { "stfl", 0xb1, INSTR_S_RD },
  667. { "trap4", 0xff, INSTR_S_RD },
  668. { "", 0, INSTR_INVALID }
  669. };
  670. static struct insn opcode_b3[] = {
  671. #ifdef CONFIG_64BIT
  672. { "maylr", 0x38, INSTR_RRF_F0FF },
  673. { "mylr", 0x39, INSTR_RRF_F0FF },
  674. { "mayr", 0x3a, INSTR_RRF_F0FF },
  675. { "myr", 0x3b, INSTR_RRF_F0FF },
  676. { "mayhr", 0x3c, INSTR_RRF_F0FF },
  677. { "myhr", 0x3d, INSTR_RRF_F0FF },
  678. { "cegbr", 0xa4, INSTR_RRE_RR },
  679. { "cdgbr", 0xa5, INSTR_RRE_RR },
  680. { "cxgbr", 0xa6, INSTR_RRE_RR },
  681. { "cgebr", 0xa8, INSTR_RRF_U0RF },
  682. { "cgdbr", 0xa9, INSTR_RRF_U0RF },
  683. { "cgxbr", 0xaa, INSTR_RRF_U0RF },
  684. { "cfer", 0xb8, INSTR_RRF_U0RF },
  685. { "cfdr", 0xb9, INSTR_RRF_U0RF },
  686. { "cfxr", 0xba, INSTR_RRF_U0RF },
  687. { "cegr", 0xc4, INSTR_RRE_RR },
  688. { "cdgr", 0xc5, INSTR_RRE_RR },
  689. { "cxgr", 0xc6, INSTR_RRE_RR },
  690. { "cger", 0xc8, INSTR_RRF_U0RF },
  691. { "cgdr", 0xc9, INSTR_RRF_U0RF },
  692. { "cgxr", 0xca, INSTR_RRF_U0RF },
  693. { "lpdfr", 0x70, INSTR_RRE_FF },
  694. { "lndfr", 0x71, INSTR_RRE_FF },
  695. { "cpsdr", 0x72, INSTR_RRF_F0FF2 },
  696. { "lcdfr", 0x73, INSTR_RRE_FF },
  697. { "ldgr", 0xc1, INSTR_RRE_FR },
  698. { "lgdr", 0xcd, INSTR_RRE_RF },
  699. { "adtr", 0xd2, INSTR_RRR_F0FF },
  700. { "axtr", 0xda, INSTR_RRR_F0FF },
  701. { "cdtr", 0xe4, INSTR_RRE_FF },
  702. { "cxtr", 0xec, INSTR_RRE_FF },
  703. { "kdtr", 0xe0, INSTR_RRE_FF },
  704. { "kxtr", 0xe8, INSTR_RRE_FF },
  705. { "cedtr", 0xf4, INSTR_RRE_FF },
  706. { "cextr", 0xfc, INSTR_RRE_FF },
  707. { "cdgtr", 0xf1, INSTR_RRE_FR },
  708. { "cxgtr", 0xf9, INSTR_RRE_FR },
  709. { "cdstr", 0xf3, INSTR_RRE_FR },
  710. { "cxstr", 0xfb, INSTR_RRE_FR },
  711. { "cdutr", 0xf2, INSTR_RRE_FR },
  712. { "cxutr", 0xfa, INSTR_RRE_FR },
  713. { "cgdtr", 0xe1, INSTR_RRF_U0RF },
  714. { "cgxtr", 0xe9, INSTR_RRF_U0RF },
  715. { "csdtr", 0xe3, INSTR_RRE_RF },
  716. { "csxtr", 0xeb, INSTR_RRE_RF },
  717. { "cudtr", 0xe2, INSTR_RRE_RF },
  718. { "cuxtr", 0xea, INSTR_RRE_RF },
  719. { "ddtr", 0xd1, INSTR_RRR_F0FF },
  720. { "dxtr", 0xd9, INSTR_RRR_F0FF },
  721. { "eedtr", 0xe5, INSTR_RRE_RF },
  722. { "eextr", 0xed, INSTR_RRE_RF },
  723. { "esdtr", 0xe7, INSTR_RRE_RF },
  724. { "esxtr", 0xef, INSTR_RRE_RF },
  725. { "iedtr", 0xf6, INSTR_RRF_F0FR },
  726. { "iextr", 0xfe, INSTR_RRF_F0FR },
  727. { "ltdtr", 0xd6, INSTR_RRE_FF },
  728. { "ltxtr", 0xde, INSTR_RRE_FF },
  729. { "fidtr", 0xd7, INSTR_RRF_UUFF },
  730. { "fixtr", 0xdf, INSTR_RRF_UUFF },
  731. { "ldetr", 0xd4, INSTR_RRF_0UFF },
  732. { "lxdtr", 0xdc, INSTR_RRF_0UFF },
  733. { "ledtr", 0xd5, INSTR_RRF_UUFF },
  734. { "ldxtr", 0xdd, INSTR_RRF_UUFF },
  735. { "mdtr", 0xd0, INSTR_RRR_F0FF },
  736. { "mxtr", 0xd8, INSTR_RRR_F0FF },
  737. { "qadtr", 0xf5, INSTR_RRF_FUFF },
  738. { "qaxtr", 0xfd, INSTR_RRF_FUFF },
  739. { "rrdtr", 0xf7, INSTR_RRF_FFRU },
  740. { "rrxtr", 0xff, INSTR_RRF_FFRU },
  741. { "sfasr", 0x85, INSTR_RRE_R0 },
  742. { "sdtr", 0xd3, INSTR_RRR_F0FF },
  743. { "sxtr", 0xdb, INSTR_RRR_F0FF },
  744. #endif
  745. { "lpebr", 0x00, INSTR_RRE_FF },
  746. { "lnebr", 0x01, INSTR_RRE_FF },
  747. { "ltebr", 0x02, INSTR_RRE_FF },
  748. { "lcebr", 0x03, INSTR_RRE_FF },
  749. { "ldebr", 0x04, INSTR_RRE_FF },
  750. { "lxdbr", 0x05, INSTR_RRE_FF },
  751. { "lxebr", 0x06, INSTR_RRE_FF },
  752. { "mxdbr", 0x07, INSTR_RRE_FF },
  753. { "kebr", 0x08, INSTR_RRE_FF },
  754. { "cebr", 0x09, INSTR_RRE_FF },
  755. { "aebr", 0x0a, INSTR_RRE_FF },
  756. { "sebr", 0x0b, INSTR_RRE_FF },
  757. { "mdebr", 0x0c, INSTR_RRE_FF },
  758. { "debr", 0x0d, INSTR_RRE_FF },
  759. { "maebr", 0x0e, INSTR_RRF_F0FF },
  760. { "msebr", 0x0f, INSTR_RRF_F0FF },
  761. { "lpdbr", 0x10, INSTR_RRE_FF },
  762. { "lndbr", 0x11, INSTR_RRE_FF },
  763. { "ltdbr", 0x12, INSTR_RRE_FF },
  764. { "lcdbr", 0x13, INSTR_RRE_FF },
  765. { "sqebr", 0x14, INSTR_RRE_FF },
  766. { "sqdbr", 0x15, INSTR_RRE_FF },
  767. { "sqxbr", 0x16, INSTR_RRE_FF },
  768. { "meebr", 0x17, INSTR_RRE_FF },
  769. { "kdbr", 0x18, INSTR_RRE_FF },
  770. { "cdbr", 0x19, INSTR_RRE_FF },
  771. { "adbr", 0x1a, INSTR_RRE_FF },
  772. { "sdbr", 0x1b, INSTR_RRE_FF },
  773. { "mdbr", 0x1c, INSTR_RRE_FF },
  774. { "ddbr", 0x1d, INSTR_RRE_FF },
  775. { "madbr", 0x1e, INSTR_RRF_F0FF },
  776. { "msdbr", 0x1f, INSTR_RRF_F0FF },
  777. { "lder", 0x24, INSTR_RRE_FF },
  778. { "lxdr", 0x25, INSTR_RRE_FF },
  779. { "lxer", 0x26, INSTR_RRE_FF },
  780. { "maer", 0x2e, INSTR_RRF_F0FF },
  781. { "mser", 0x2f, INSTR_RRF_F0FF },
  782. { "sqxr", 0x36, INSTR_RRE_FF },
  783. { "meer", 0x37, INSTR_RRE_FF },
  784. { "madr", 0x3e, INSTR_RRF_F0FF },
  785. { "msdr", 0x3f, INSTR_RRF_F0FF },
  786. { "lpxbr", 0x40, INSTR_RRE_FF },
  787. { "lnxbr", 0x41, INSTR_RRE_FF },
  788. { "ltxbr", 0x42, INSTR_RRE_FF },
  789. { "lcxbr", 0x43, INSTR_RRE_FF },
  790. { "ledbr", 0x44, INSTR_RRE_FF },
  791. { "ldxbr", 0x45, INSTR_RRE_FF },
  792. { "lexbr", 0x46, INSTR_RRE_FF },
  793. { "fixbr", 0x47, INSTR_RRF_U0FF },
  794. { "kxbr", 0x48, INSTR_RRE_FF },
  795. { "cxbr", 0x49, INSTR_RRE_FF },
  796. { "axbr", 0x4a, INSTR_RRE_FF },
  797. { "sxbr", 0x4b, INSTR_RRE_FF },
  798. { "mxbr", 0x4c, INSTR_RRE_FF },
  799. { "dxbr", 0x4d, INSTR_RRE_FF },
  800. { "tbedr", 0x50, INSTR_RRF_U0FF },
  801. { "tbdr", 0x51, INSTR_RRF_U0FF },
  802. { "diebr", 0x53, INSTR_RRF_FUFF },
  803. { "fiebr", 0x57, INSTR_RRF_U0FF },
  804. { "thder", 0x58, INSTR_RRE_RR },
  805. { "thdr", 0x59, INSTR_RRE_RR },
  806. { "didbr", 0x5b, INSTR_RRF_FUFF },
  807. { "fidbr", 0x5f, INSTR_RRF_U0FF },
  808. { "lpxr", 0x60, INSTR_RRE_FF },
  809. { "lnxr", 0x61, INSTR_RRE_FF },
  810. { "ltxr", 0x62, INSTR_RRE_FF },
  811. { "lcxr", 0x63, INSTR_RRE_FF },
  812. { "lxr", 0x65, INSTR_RRE_RR },
  813. { "lexr", 0x66, INSTR_RRE_FF },
  814. { "fixr", 0x67, INSTR_RRF_U0FF },
  815. { "cxr", 0x69, INSTR_RRE_FF },
  816. { "lzer", 0x74, INSTR_RRE_R0 },
  817. { "lzdr", 0x75, INSTR_RRE_R0 },
  818. { "lzxr", 0x76, INSTR_RRE_R0 },
  819. { "fier", 0x77, INSTR_RRF_U0FF },
  820. { "fidr", 0x7f, INSTR_RRF_U0FF },
  821. { "sfpc", 0x84, INSTR_RRE_RR_OPT },
  822. { "efpc", 0x8c, INSTR_RRE_RR_OPT },
  823. { "cefbr", 0x94, INSTR_RRE_RF },
  824. { "cdfbr", 0x95, INSTR_RRE_RF },
  825. { "cxfbr", 0x96, INSTR_RRE_RF },
  826. { "cfebr", 0x98, INSTR_RRF_U0RF },
  827. { "cfdbr", 0x99, INSTR_RRF_U0RF },
  828. { "cfxbr", 0x9a, INSTR_RRF_U0RF },
  829. { "cefr", 0xb4, INSTR_RRE_RF },
  830. { "cdfr", 0xb5, INSTR_RRE_RF },
  831. { "cxfr", 0xb6, INSTR_RRE_RF },
  832. { "", 0, INSTR_INVALID }
  833. };
  834. static struct insn opcode_b9[] = {
  835. #ifdef CONFIG_64BIT
  836. { "lpgr", 0x00, INSTR_RRE_RR },
  837. { "lngr", 0x01, INSTR_RRE_RR },
  838. { "ltgr", 0x02, INSTR_RRE_RR },
  839. { "lcgr", 0x03, INSTR_RRE_RR },
  840. { "lgr", 0x04, INSTR_RRE_RR },
  841. { "lurag", 0x05, INSTR_RRE_RR },
  842. { "lgbr", 0x06, INSTR_RRE_RR },
  843. { "lghr", 0x07, INSTR_RRE_RR },
  844. { "agr", 0x08, INSTR_RRE_RR },
  845. { "sgr", 0x09, INSTR_RRE_RR },
  846. { "algr", 0x0a, INSTR_RRE_RR },
  847. { "slgr", 0x0b, INSTR_RRE_RR },
  848. { "msgr", 0x0c, INSTR_RRE_RR },
  849. { "dsgr", 0x0d, INSTR_RRE_RR },
  850. { "eregg", 0x0e, INSTR_RRE_RR },
  851. { "lrvgr", 0x0f, INSTR_RRE_RR },
  852. { "lpgfr", 0x10, INSTR_RRE_RR },
  853. { "lngfr", 0x11, INSTR_RRE_RR },
  854. { "ltgfr", 0x12, INSTR_RRE_RR },
  855. { "lcgfr", 0x13, INSTR_RRE_RR },
  856. { "lgfr", 0x14, INSTR_RRE_RR },
  857. { "llgfr", 0x16, INSTR_RRE_RR },
  858. { "llgtr", 0x17, INSTR_RRE_RR },
  859. { "agfr", 0x18, INSTR_RRE_RR },
  860. { "sgfr", 0x19, INSTR_RRE_RR },
  861. { "algfr", 0x1a, INSTR_RRE_RR },
  862. { "slgfr", 0x1b, INSTR_RRE_RR },
  863. { "msgfr", 0x1c, INSTR_RRE_RR },
  864. { "dsgfr", 0x1d, INSTR_RRE_RR },
  865. { "cgr", 0x20, INSTR_RRE_RR },
  866. { "clgr", 0x21, INSTR_RRE_RR },
  867. { "sturg", 0x25, INSTR_RRE_RR },
  868. { "lbr", 0x26, INSTR_RRE_RR },
  869. { "lhr", 0x27, INSTR_RRE_RR },
  870. { "cgfr", 0x30, INSTR_RRE_RR },
  871. { "clgfr", 0x31, INSTR_RRE_RR },
  872. { "bctgr", 0x46, INSTR_RRE_RR },
  873. { "ngr", 0x80, INSTR_RRE_RR },
  874. { "ogr", 0x81, INSTR_RRE_RR },
  875. { "xgr", 0x82, INSTR_RRE_RR },
  876. { "flogr", 0x83, INSTR_RRE_RR },
  877. { "llgcr", 0x84, INSTR_RRE_RR },
  878. { "llghr", 0x85, INSTR_RRE_RR },
  879. { "mlgr", 0x86, INSTR_RRE_RR },
  880. { "dlgr", 0x87, INSTR_RRE_RR },
  881. { "alcgr", 0x88, INSTR_RRE_RR },
  882. { "slbgr", 0x89, INSTR_RRE_RR },
  883. { "cspg", 0x8a, INSTR_RRE_RR },
  884. { "idte", 0x8e, INSTR_RRF_R0RR },
  885. { "llcr", 0x94, INSTR_RRE_RR },
  886. { "llhr", 0x95, INSTR_RRE_RR },
  887. { "esea", 0x9d, INSTR_RRE_R0 },
  888. { "lptea", 0xaa, INSTR_RRF_RURR },
  889. { "cu14", 0xb0, INSTR_RRF_M0RR },
  890. { "cu24", 0xb1, INSTR_RRF_M0RR },
  891. { "cu41", 0xb2, INSTR_RRF_M0RR },
  892. { "cu42", 0xb3, INSTR_RRF_M0RR },
  893. { "crt", 0x72, INSTR_RRF_U0RR },
  894. { "cgrt", 0x60, INSTR_RRF_U0RR },
  895. { "clrt", 0x73, INSTR_RRF_U0RR },
  896. { "clgrt", 0x61, INSTR_RRF_U0RR },
  897. { "ptf", 0xa2, INSTR_RRE_R0 },
  898. { "pfmf", 0xaf, INSTR_RRE_RR },
  899. { "trte", 0xbf, INSTR_RRF_M0RR },
  900. { "trtre", 0xbd, INSTR_RRF_M0RR },
  901. { "ahhhr", 0xc8, INSTR_RRF_R0RR2 },
  902. { "shhhr", 0xc9, INSTR_RRF_R0RR2 },
  903. { "alhhh", 0xca, INSTR_RRF_R0RR2 },
  904. { "alhhl", 0xca, INSTR_RRF_R0RR2 },
  905. { "slhhh", 0xcb, INSTR_RRF_R0RR2 },
  906. { "chhr ", 0xcd, INSTR_RRE_RR },
  907. { "clhhr", 0xcf, INSTR_RRE_RR },
  908. { "ahhlr", 0xd8, INSTR_RRF_R0RR2 },
  909. { "shhlr", 0xd9, INSTR_RRF_R0RR2 },
  910. { "slhhl", 0xdb, INSTR_RRF_R0RR2 },
  911. { "chlr", 0xdd, INSTR_RRE_RR },
  912. { "clhlr", 0xdf, INSTR_RRE_RR },
  913. { { 0, LONG_INSN_POPCNT }, 0xe1, INSTR_RRE_RR },
  914. { "locgr", 0xe2, INSTR_RRF_M0RR },
  915. { "ngrk", 0xe4, INSTR_RRF_R0RR2 },
  916. { "ogrk", 0xe6, INSTR_RRF_R0RR2 },
  917. { "xgrk", 0xe7, INSTR_RRF_R0RR2 },
  918. { "agrk", 0xe8, INSTR_RRF_R0RR2 },
  919. { "sgrk", 0xe9, INSTR_RRF_R0RR2 },
  920. { "algrk", 0xea, INSTR_RRF_R0RR2 },
  921. { "slgrk", 0xeb, INSTR_RRF_R0RR2 },
  922. { "locr", 0xf2, INSTR_RRF_M0RR },
  923. { "nrk", 0xf4, INSTR_RRF_R0RR2 },
  924. { "ork", 0xf6, INSTR_RRF_R0RR2 },
  925. { "xrk", 0xf7, INSTR_RRF_R0RR2 },
  926. { "ark", 0xf8, INSTR_RRF_R0RR2 },
  927. { "srk", 0xf9, INSTR_RRF_R0RR2 },
  928. { "alrk", 0xfa, INSTR_RRF_R0RR2 },
  929. { "slrk", 0xfb, INSTR_RRF_R0RR2 },
  930. #endif
  931. { "kmac", 0x1e, INSTR_RRE_RR },
  932. { "lrvr", 0x1f, INSTR_RRE_RR },
  933. { "km", 0x2e, INSTR_RRE_RR },
  934. { "kmc", 0x2f, INSTR_RRE_RR },
  935. { "kimd", 0x3e, INSTR_RRE_RR },
  936. { "klmd", 0x3f, INSTR_RRE_RR },
  937. { "epsw", 0x8d, INSTR_RRE_RR },
  938. { "trtt", 0x90, INSTR_RRE_RR },
  939. { "trtt", 0x90, INSTR_RRF_M0RR },
  940. { "trto", 0x91, INSTR_RRE_RR },
  941. { "trto", 0x91, INSTR_RRF_M0RR },
  942. { "trot", 0x92, INSTR_RRE_RR },
  943. { "trot", 0x92, INSTR_RRF_M0RR },
  944. { "troo", 0x93, INSTR_RRE_RR },
  945. { "troo", 0x93, INSTR_RRF_M0RR },
  946. { "mlr", 0x96, INSTR_RRE_RR },
  947. { "dlr", 0x97, INSTR_RRE_RR },
  948. { "alcr", 0x98, INSTR_RRE_RR },
  949. { "slbr", 0x99, INSTR_RRE_RR },
  950. { "", 0, INSTR_INVALID }
  951. };
  952. static struct insn opcode_c0[] = {
  953. #ifdef CONFIG_64BIT
  954. { "lgfi", 0x01, INSTR_RIL_RI },
  955. { "xihf", 0x06, INSTR_RIL_RU },
  956. { "xilf", 0x07, INSTR_RIL_RU },
  957. { "iihf", 0x08, INSTR_RIL_RU },
  958. { "iilf", 0x09, INSTR_RIL_RU },
  959. { "nihf", 0x0a, INSTR_RIL_RU },
  960. { "nilf", 0x0b, INSTR_RIL_RU },
  961. { "oihf", 0x0c, INSTR_RIL_RU },
  962. { "oilf", 0x0d, INSTR_RIL_RU },
  963. { "llihf", 0x0e, INSTR_RIL_RU },
  964. { "llilf", 0x0f, INSTR_RIL_RU },
  965. #endif
  966. { "larl", 0x00, INSTR_RIL_RP },
  967. { "brcl", 0x04, INSTR_RIL_UP },
  968. { "brasl", 0x05, INSTR_RIL_RP },
  969. { "", 0, INSTR_INVALID }
  970. };
  971. static struct insn opcode_c2[] = {
  972. #ifdef CONFIG_64BIT
  973. { "slgfi", 0x04, INSTR_RIL_RU },
  974. { "slfi", 0x05, INSTR_RIL_RU },
  975. { "agfi", 0x08, INSTR_RIL_RI },
  976. { "afi", 0x09, INSTR_RIL_RI },
  977. { "algfi", 0x0a, INSTR_RIL_RU },
  978. { "alfi", 0x0b, INSTR_RIL_RU },
  979. { "cgfi", 0x0c, INSTR_RIL_RI },
  980. { "cfi", 0x0d, INSTR_RIL_RI },
  981. { "clgfi", 0x0e, INSTR_RIL_RU },
  982. { "clfi", 0x0f, INSTR_RIL_RU },
  983. { "msfi", 0x01, INSTR_RIL_RI },
  984. { "msgfi", 0x00, INSTR_RIL_RI },
  985. #endif
  986. { "", 0, INSTR_INVALID }
  987. };
  988. static struct insn opcode_c4[] = {
  989. #ifdef CONFIG_64BIT
  990. { "lrl", 0x0d, INSTR_RIL_RP },
  991. { "lgrl", 0x08, INSTR_RIL_RP },
  992. { "lgfrl", 0x0c, INSTR_RIL_RP },
  993. { "lhrl", 0x05, INSTR_RIL_RP },
  994. { "lghrl", 0x04, INSTR_RIL_RP },
  995. { { 0, LONG_INSN_LLGFRL }, 0x0e, INSTR_RIL_RP },
  996. { "llhrl", 0x02, INSTR_RIL_RP },
  997. { { 0, LONG_INSN_LLGHRL }, 0x06, INSTR_RIL_RP },
  998. { "strl", 0x0f, INSTR_RIL_RP },
  999. { "stgrl", 0x0b, INSTR_RIL_RP },
  1000. { "sthrl", 0x07, INSTR_RIL_RP },
  1001. #endif
  1002. { "", 0, INSTR_INVALID }
  1003. };
  1004. static struct insn opcode_c6[] = {
  1005. #ifdef CONFIG_64BIT
  1006. { "crl", 0x0d, INSTR_RIL_RP },
  1007. { "cgrl", 0x08, INSTR_RIL_RP },
  1008. { "cgfrl", 0x0c, INSTR_RIL_RP },
  1009. { "chrl", 0x05, INSTR_RIL_RP },
  1010. { "cghrl", 0x04, INSTR_RIL_RP },
  1011. { "clrl", 0x0f, INSTR_RIL_RP },
  1012. { "clgrl", 0x0a, INSTR_RIL_RP },
  1013. { { 0, LONG_INSN_CLGFRL }, 0x0e, INSTR_RIL_RP },
  1014. { "clhrl", 0x07, INSTR_RIL_RP },
  1015. { { 0, LONG_INSN_CLGHRL }, 0x06, INSTR_RIL_RP },
  1016. { "pfdrl", 0x02, INSTR_RIL_UP },
  1017. { "exrl", 0x00, INSTR_RIL_RP },
  1018. #endif
  1019. { "", 0, INSTR_INVALID }
  1020. };
  1021. static struct insn opcode_c8[] = {
  1022. #ifdef CONFIG_64BIT
  1023. { "mvcos", 0x00, INSTR_SSF_RRDRD },
  1024. { "ectg", 0x01, INSTR_SSF_RRDRD },
  1025. { "csst", 0x02, INSTR_SSF_RRDRD },
  1026. { "lpd", 0x04, INSTR_SSF_RRDRD2 },
  1027. { "lpdg ", 0x05, INSTR_SSF_RRDRD2 },
  1028. #endif
  1029. { "", 0, INSTR_INVALID }
  1030. };
  1031. static struct insn opcode_cc[] = {
  1032. #ifdef CONFIG_64BIT
  1033. { "brcth", 0x06, INSTR_RIL_RP },
  1034. { "aih", 0x08, INSTR_RIL_RI },
  1035. { "alsih", 0x0a, INSTR_RIL_RI },
  1036. { "alsih", 0x0b, INSTR_RIL_RI },
  1037. { "cih", 0x0d, INSTR_RIL_RI },
  1038. { "clih ", 0x0f, INSTR_RIL_RI },
  1039. #endif
  1040. { "", 0, INSTR_INVALID }
  1041. };
  1042. static struct insn opcode_e3[] = {
  1043. #ifdef CONFIG_64BIT
  1044. { "ltg", 0x02, INSTR_RXY_RRRD },
  1045. { "lrag", 0x03, INSTR_RXY_RRRD },
  1046. { "lg", 0x04, INSTR_RXY_RRRD },
  1047. { "cvby", 0x06, INSTR_RXY_RRRD },
  1048. { "ag", 0x08, INSTR_RXY_RRRD },
  1049. { "sg", 0x09, INSTR_RXY_RRRD },
  1050. { "alg", 0x0a, INSTR_RXY_RRRD },
  1051. { "slg", 0x0b, INSTR_RXY_RRRD },
  1052. { "msg", 0x0c, INSTR_RXY_RRRD },
  1053. { "dsg", 0x0d, INSTR_RXY_RRRD },
  1054. { "cvbg", 0x0e, INSTR_RXY_RRRD },
  1055. { "lrvg", 0x0f, INSTR_RXY_RRRD },
  1056. { "lt", 0x12, INSTR_RXY_RRRD },
  1057. { "lray", 0x13, INSTR_RXY_RRRD },
  1058. { "lgf", 0x14, INSTR_RXY_RRRD },
  1059. { "lgh", 0x15, INSTR_RXY_RRRD },
  1060. { "llgf", 0x16, INSTR_RXY_RRRD },
  1061. { "llgt", 0x17, INSTR_RXY_RRRD },
  1062. { "agf", 0x18, INSTR_RXY_RRRD },
  1063. { "sgf", 0x19, INSTR_RXY_RRRD },
  1064. { "algf", 0x1a, INSTR_RXY_RRRD },
  1065. { "slgf", 0x1b, INSTR_RXY_RRRD },
  1066. { "msgf", 0x1c, INSTR_RXY_RRRD },
  1067. { "dsgf", 0x1d, INSTR_RXY_RRRD },
  1068. { "cg", 0x20, INSTR_RXY_RRRD },
  1069. { "clg", 0x21, INSTR_RXY_RRRD },
  1070. { "stg", 0x24, INSTR_RXY_RRRD },
  1071. { "cvdy", 0x26, INSTR_RXY_RRRD },
  1072. { "cvdg", 0x2e, INSTR_RXY_RRRD },
  1073. { "strvg", 0x2f, INSTR_RXY_RRRD },
  1074. { "cgf", 0x30, INSTR_RXY_RRRD },
  1075. { "clgf", 0x31, INSTR_RXY_RRRD },
  1076. { "strvh", 0x3f, INSTR_RXY_RRRD },
  1077. { "bctg", 0x46, INSTR_RXY_RRRD },
  1078. { "sty", 0x50, INSTR_RXY_RRRD },
  1079. { "msy", 0x51, INSTR_RXY_RRRD },
  1080. { "ny", 0x54, INSTR_RXY_RRRD },
  1081. { "cly", 0x55, INSTR_RXY_RRRD },
  1082. { "oy", 0x56, INSTR_RXY_RRRD },
  1083. { "xy", 0x57, INSTR_RXY_RRRD },
  1084. { "ly", 0x58, INSTR_RXY_RRRD },
  1085. { "cy", 0x59, INSTR_RXY_RRRD },
  1086. { "ay", 0x5a, INSTR_RXY_RRRD },
  1087. { "sy", 0x5b, INSTR_RXY_RRRD },
  1088. { "aly", 0x5e, INSTR_RXY_RRRD },
  1089. { "sly", 0x5f, INSTR_RXY_RRRD },
  1090. { "sthy", 0x70, INSTR_RXY_RRRD },
  1091. { "lay", 0x71, INSTR_RXY_RRRD },
  1092. { "stcy", 0x72, INSTR_RXY_RRRD },
  1093. { "icy", 0x73, INSTR_RXY_RRRD },
  1094. { "lb", 0x76, INSTR_RXY_RRRD },
  1095. { "lgb", 0x77, INSTR_RXY_RRRD },
  1096. { "lhy", 0x78, INSTR_RXY_RRRD },
  1097. { "chy", 0x79, INSTR_RXY_RRRD },
  1098. { "ahy", 0x7a, INSTR_RXY_RRRD },
  1099. { "shy", 0x7b, INSTR_RXY_RRRD },
  1100. { "ng", 0x80, INSTR_RXY_RRRD },
  1101. { "og", 0x81, INSTR_RXY_RRRD },
  1102. { "xg", 0x82, INSTR_RXY_RRRD },
  1103. { "mlg", 0x86, INSTR_RXY_RRRD },
  1104. { "dlg", 0x87, INSTR_RXY_RRRD },
  1105. { "alcg", 0x88, INSTR_RXY_RRRD },
  1106. { "slbg", 0x89, INSTR_RXY_RRRD },
  1107. { "stpq", 0x8e, INSTR_RXY_RRRD },
  1108. { "lpq", 0x8f, INSTR_RXY_RRRD },
  1109. { "llgc", 0x90, INSTR_RXY_RRRD },
  1110. { "llgh", 0x91, INSTR_RXY_RRRD },
  1111. { "llc", 0x94, INSTR_RXY_RRRD },
  1112. { "llh", 0x95, INSTR_RXY_RRRD },
  1113. { "cgh", 0x34, INSTR_RXY_RRRD },
  1114. { "laey", 0x75, INSTR_RXY_RRRD },
  1115. { "ltgf", 0x32, INSTR_RXY_RRRD },
  1116. { "mfy", 0x5c, INSTR_RXY_RRRD },
  1117. { "mhy", 0x7c, INSTR_RXY_RRRD },
  1118. { "pfd", 0x36, INSTR_RXY_URRD },
  1119. { "lbh", 0xc0, INSTR_RXY_RRRD },
  1120. { "llch", 0xc2, INSTR_RXY_RRRD },
  1121. { "stch", 0xc3, INSTR_RXY_RRRD },
  1122. { "lhh", 0xc4, INSTR_RXY_RRRD },
  1123. { "llhh", 0xc6, INSTR_RXY_RRRD },
  1124. { "sthh", 0xc7, INSTR_RXY_RRRD },
  1125. { "lfh", 0xca, INSTR_RXY_RRRD },
  1126. { "stfh", 0xcb, INSTR_RXY_RRRD },
  1127. { "chf", 0xcd, INSTR_RXY_RRRD },
  1128. { "clhf", 0xcf, INSTR_RXY_RRRD },
  1129. #endif
  1130. { "lrv", 0x1e, INSTR_RXY_RRRD },
  1131. { "lrvh", 0x1f, INSTR_RXY_RRRD },
  1132. { "strv", 0x3e, INSTR_RXY_RRRD },
  1133. { "ml", 0x96, INSTR_RXY_RRRD },
  1134. { "dl", 0x97, INSTR_RXY_RRRD },
  1135. { "alc", 0x98, INSTR_RXY_RRRD },
  1136. { "slb", 0x99, INSTR_RXY_RRRD },
  1137. { "", 0, INSTR_INVALID }
  1138. };
  1139. static struct insn opcode_e5[] = {
  1140. #ifdef CONFIG_64BIT
  1141. { "strag", 0x02, INSTR_SSE_RDRD },
  1142. { "chhsi", 0x54, INSTR_SIL_RDI },
  1143. { "chsi", 0x5c, INSTR_SIL_RDI },
  1144. { "cghsi", 0x58, INSTR_SIL_RDI },
  1145. { { 0, LONG_INSN_CLHHSI }, 0x55, INSTR_SIL_RDU },
  1146. { { 0, LONG_INSN_CLFHSI }, 0x5d, INSTR_SIL_RDU },
  1147. { { 0, LONG_INSN_CLGHSI }, 0x59, INSTR_SIL_RDU },
  1148. { "mvhhi", 0x44, INSTR_SIL_RDI },
  1149. { "mvhi", 0x4c, INSTR_SIL_RDI },
  1150. { "mvghi", 0x48, INSTR_SIL_RDI },
  1151. #endif
  1152. { "lasp", 0x00, INSTR_SSE_RDRD },
  1153. { "tprot", 0x01, INSTR_SSE_RDRD },
  1154. { "mvcsk", 0x0e, INSTR_SSE_RDRD },
  1155. { "mvcdk", 0x0f, INSTR_SSE_RDRD },
  1156. { "", 0, INSTR_INVALID }
  1157. };
  1158. static struct insn opcode_eb[] = {
  1159. #ifdef CONFIG_64BIT
  1160. { "lmg", 0x04, INSTR_RSY_RRRD },
  1161. { "srag", 0x0a, INSTR_RSY_RRRD },
  1162. { "slag", 0x0b, INSTR_RSY_RRRD },
  1163. { "srlg", 0x0c, INSTR_RSY_RRRD },
  1164. { "sllg", 0x0d, INSTR_RSY_RRRD },
  1165. { "tracg", 0x0f, INSTR_RSY_RRRD },
  1166. { "csy", 0x14, INSTR_RSY_RRRD },
  1167. { "rllg", 0x1c, INSTR_RSY_RRRD },
  1168. { "clmh", 0x20, INSTR_RSY_RURD },
  1169. { "clmy", 0x21, INSTR_RSY_RURD },
  1170. { "stmg", 0x24, INSTR_RSY_RRRD },
  1171. { "stctg", 0x25, INSTR_RSY_CCRD },
  1172. { "stmh", 0x26, INSTR_RSY_RRRD },
  1173. { "stcmh", 0x2c, INSTR_RSY_RURD },
  1174. { "stcmy", 0x2d, INSTR_RSY_RURD },
  1175. { "lctlg", 0x2f, INSTR_RSY_CCRD },
  1176. { "csg", 0x30, INSTR_RSY_RRRD },
  1177. { "cdsy", 0x31, INSTR_RSY_RRRD },
  1178. { "cdsg", 0x3e, INSTR_RSY_RRRD },
  1179. { "bxhg", 0x44, INSTR_RSY_RRRD },
  1180. { "bxleg", 0x45, INSTR_RSY_RRRD },
  1181. { "tmy", 0x51, INSTR_SIY_URD },
  1182. { "mviy", 0x52, INSTR_SIY_URD },
  1183. { "niy", 0x54, INSTR_SIY_URD },
  1184. { "cliy", 0x55, INSTR_SIY_URD },
  1185. { "oiy", 0x56, INSTR_SIY_URD },
  1186. { "xiy", 0x57, INSTR_SIY_URD },
  1187. { "icmh", 0x80, INSTR_RSE_RURD },
  1188. { "icmh", 0x80, INSTR_RSY_RURD },
  1189. { "icmy", 0x81, INSTR_RSY_RURD },
  1190. { "clclu", 0x8f, INSTR_RSY_RRRD },
  1191. { "stmy", 0x90, INSTR_RSY_RRRD },
  1192. { "lmh", 0x96, INSTR_RSY_RRRD },
  1193. { "lmy", 0x98, INSTR_RSY_RRRD },
  1194. { "lamy", 0x9a, INSTR_RSY_AARD },
  1195. { "stamy", 0x9b, INSTR_RSY_AARD },
  1196. { "asi", 0x6a, INSTR_SIY_IRD },
  1197. { "agsi", 0x7a, INSTR_SIY_IRD },
  1198. { "alsi", 0x6e, INSTR_SIY_IRD },
  1199. { "algsi", 0x7e, INSTR_SIY_IRD },
  1200. { "ecag", 0x4c, INSTR_RSY_RRRD },
  1201. { "srak", 0xdc, INSTR_RSY_RRRD },
  1202. { "slak", 0xdd, INSTR_RSY_RRRD },
  1203. { "srlk", 0xde, INSTR_RSY_RRRD },
  1204. { "sllk", 0xdf, INSTR_RSY_RRRD },
  1205. { "locg", 0xe2, INSTR_RSY_RDRM },
  1206. { "stocg", 0xe3, INSTR_RSY_RDRM },
  1207. { "lang", 0xe4, INSTR_RSY_RRRD },
  1208. { "laog", 0xe6, INSTR_RSY_RRRD },
  1209. { "laxg", 0xe7, INSTR_RSY_RRRD },
  1210. { "laag", 0xe8, INSTR_RSY_RRRD },
  1211. { "laalg", 0xea, INSTR_RSY_RRRD },
  1212. { "loc", 0xf2, INSTR_RSY_RDRM },
  1213. { "stoc", 0xf3, INSTR_RSY_RDRM },
  1214. { "lan", 0xf4, INSTR_RSY_RRRD },
  1215. { "lao", 0xf6, INSTR_RSY_RRRD },
  1216. { "lax", 0xf7, INSTR_RSY_RRRD },
  1217. { "laa", 0xf8, INSTR_RSY_RRRD },
  1218. { "laal", 0xfa, INSTR_RSY_RRRD },
  1219. #endif
  1220. { "rll", 0x1d, INSTR_RSY_RRRD },
  1221. { "mvclu", 0x8e, INSTR_RSY_RRRD },
  1222. { "tp", 0xc0, INSTR_RSL_R0RD },
  1223. { "", 0, INSTR_INVALID }
  1224. };
  1225. static struct insn opcode_ec[] = {
  1226. #ifdef CONFIG_64BIT
  1227. { "brxhg", 0x44, INSTR_RIE_RRP },
  1228. { "brxlg", 0x45, INSTR_RIE_RRP },
  1229. { "crb", 0xf6, INSTR_RRS_RRRDU },
  1230. { "cgrb", 0xe4, INSTR_RRS_RRRDU },
  1231. { "crj", 0x76, INSTR_RIE_RRPU },
  1232. { "cgrj", 0x64, INSTR_RIE_RRPU },
  1233. { "cib", 0xfe, INSTR_RIS_RURDI },
  1234. { "cgib", 0xfc, INSTR_RIS_RURDI },
  1235. { "cij", 0x7e, INSTR_RIE_RUPI },
  1236. { "cgij", 0x7c, INSTR_RIE_RUPI },
  1237. { "cit", 0x72, INSTR_RIE_R0IU },
  1238. { "cgit", 0x70, INSTR_RIE_R0IU },
  1239. { "clrb", 0xf7, INSTR_RRS_RRRDU },
  1240. { "clgrb", 0xe5, INSTR_RRS_RRRDU },
  1241. { "clrj", 0x77, INSTR_RIE_RRPU },
  1242. { "clgrj", 0x65, INSTR_RIE_RRPU },
  1243. { "clib", 0xff, INSTR_RIS_RURDU },
  1244. { "clgib", 0xfd, INSTR_RIS_RURDU },
  1245. { "clij", 0x7f, INSTR_RIE_RUPU },
  1246. { "clgij", 0x7d, INSTR_RIE_RUPU },
  1247. { "clfit", 0x73, INSTR_RIE_R0UU },
  1248. { "clgit", 0x71, INSTR_RIE_R0UU },
  1249. { "rnsbg", 0x54, INSTR_RIE_RRUUU },
  1250. { "rxsbg", 0x57, INSTR_RIE_RRUUU },
  1251. { "rosbg", 0x56, INSTR_RIE_RRUUU },
  1252. { "risbg", 0x55, INSTR_RIE_RRUUU },
  1253. { { 0, LONG_INSN_RISBLG }, 0x51, INSTR_RIE_RRUUU },
  1254. { { 0, LONG_INSN_RISBHG }, 0x5D, INSTR_RIE_RRUUU },
  1255. { "ahik", 0xd8, INSTR_RIE_RRI0 },
  1256. { "aghik", 0xd9, INSTR_RIE_RRI0 },
  1257. { { 0, LONG_INSN_ALHSIK }, 0xda, INSTR_RIE_RRI0 },
  1258. { { 0, LONG_INSN_ALGHSIK }, 0xdb, INSTR_RIE_RRI0 },
  1259. #endif
  1260. { "", 0, INSTR_INVALID }
  1261. };
  1262. static struct insn opcode_ed[] = {
  1263. #ifdef CONFIG_64BIT
  1264. { "mayl", 0x38, INSTR_RXF_FRRDF },
  1265. { "myl", 0x39, INSTR_RXF_FRRDF },
  1266. { "may", 0x3a, INSTR_RXF_FRRDF },
  1267. { "my", 0x3b, INSTR_RXF_FRRDF },
  1268. { "mayh", 0x3c, INSTR_RXF_FRRDF },
  1269. { "myh", 0x3d, INSTR_RXF_FRRDF },
  1270. { "ley", 0x64, INSTR_RXY_FRRD },
  1271. { "ldy", 0x65, INSTR_RXY_FRRD },
  1272. { "stey", 0x66, INSTR_RXY_FRRD },
  1273. { "stdy", 0x67, INSTR_RXY_FRRD },
  1274. { "sldt", 0x40, INSTR_RXF_FRRDF },
  1275. { "slxt", 0x48, INSTR_RXF_FRRDF },
  1276. { "srdt", 0x41, INSTR_RXF_FRRDF },
  1277. { "srxt", 0x49, INSTR_RXF_FRRDF },
  1278. { "tdcet", 0x50, INSTR_RXE_FRRD },
  1279. { "tdcdt", 0x54, INSTR_RXE_FRRD },
  1280. { "tdcxt", 0x58, INSTR_RXE_FRRD },
  1281. { "tdget", 0x51, INSTR_RXE_FRRD },
  1282. { "tdgdt", 0x55, INSTR_RXE_FRRD },
  1283. { "tdgxt", 0x59, INSTR_RXE_FRRD },
  1284. #endif
  1285. { "ldeb", 0x04, INSTR_RXE_FRRD },
  1286. { "lxdb", 0x05, INSTR_RXE_FRRD },
  1287. { "lxeb", 0x06, INSTR_RXE_FRRD },
  1288. { "mxdb", 0x07, INSTR_RXE_FRRD },
  1289. { "keb", 0x08, INSTR_RXE_FRRD },
  1290. { "ceb", 0x09, INSTR_RXE_FRRD },
  1291. { "aeb", 0x0a, INSTR_RXE_FRRD },
  1292. { "seb", 0x0b, INSTR_RXE_FRRD },
  1293. { "mdeb", 0x0c, INSTR_RXE_FRRD },
  1294. { "deb", 0x0d, INSTR_RXE_FRRD },
  1295. { "maeb", 0x0e, INSTR_RXF_FRRDF },
  1296. { "mseb", 0x0f, INSTR_RXF_FRRDF },
  1297. { "tceb", 0x10, INSTR_RXE_FRRD },
  1298. { "tcdb", 0x11, INSTR_RXE_FRRD },
  1299. { "tcxb", 0x12, INSTR_RXE_FRRD },
  1300. { "sqeb", 0x14, INSTR_RXE_FRRD },
  1301. { "sqdb", 0x15, INSTR_RXE_FRRD },
  1302. { "meeb", 0x17, INSTR_RXE_FRRD },
  1303. { "kdb", 0x18, INSTR_RXE_FRRD },
  1304. { "cdb", 0x19, INSTR_RXE_FRRD },
  1305. { "adb", 0x1a, INSTR_RXE_FRRD },
  1306. { "sdb", 0x1b, INSTR_RXE_FRRD },
  1307. { "mdb", 0x1c, INSTR_RXE_FRRD },
  1308. { "ddb", 0x1d, INSTR_RXE_FRRD },
  1309. { "madb", 0x1e, INSTR_RXF_FRRDF },
  1310. { "msdb", 0x1f, INSTR_RXF_FRRDF },
  1311. { "lde", 0x24, INSTR_RXE_FRRD },
  1312. { "lxd", 0x25, INSTR_RXE_FRRD },
  1313. { "lxe", 0x26, INSTR_RXE_FRRD },
  1314. { "mae", 0x2e, INSTR_RXF_FRRDF },
  1315. { "mse", 0x2f, INSTR_RXF_FRRDF },
  1316. { "sqe", 0x34, INSTR_RXE_FRRD },
  1317. { "sqd", 0x35, INSTR_RXE_FRRD },
  1318. { "mee", 0x37, INSTR_RXE_FRRD },
  1319. { "mad", 0x3e, INSTR_RXF_FRRDF },
  1320. { "msd", 0x3f, INSTR_RXF_FRRDF },
  1321. { "", 0, INSTR_INVALID }
  1322. };
  1323. /* Extracts an operand value from an instruction. */
  1324. static unsigned int extract_operand(unsigned char *code,
  1325. const struct operand *operand)
  1326. {
  1327. unsigned int val;
  1328. int bits;
  1329. /* Extract fragments of the operand byte for byte. */
  1330. code += operand->shift / 8;
  1331. bits = (operand->shift & 7) + operand->bits;
  1332. val = 0;
  1333. do {
  1334. val <<= 8;
  1335. val |= (unsigned int) *code++;
  1336. bits -= 8;
  1337. } while (bits > 0);
  1338. val >>= -bits;
  1339. val &= ((1U << (operand->bits - 1)) << 1) - 1;
  1340. /* Check for special long displacement case. */
  1341. if (operand->bits == 20 && operand->shift == 20)
  1342. val = (val & 0xff) << 12 | (val & 0xfff00) >> 8;
  1343. /* Sign extend value if the operand is signed or pc relative. */
  1344. if ((operand->flags & (OPERAND_SIGNED | OPERAND_PCREL)) &&
  1345. (val & (1U << (operand->bits - 1))))
  1346. val |= (-1U << (operand->bits - 1)) << 1;
  1347. /* Double value if the operand is pc relative. */
  1348. if (operand->flags & OPERAND_PCREL)
  1349. val <<= 1;
  1350. /* Length x in an instructions has real length x + 1. */
  1351. if (operand->flags & OPERAND_LENGTH)
  1352. val++;
  1353. return val;
  1354. }
  1355. static inline int insn_length(unsigned char code)
  1356. {
  1357. return ((((int) code + 64) >> 7) + 1) << 1;
  1358. }
  1359. static struct insn *find_insn(unsigned char *code)
  1360. {
  1361. unsigned char opfrag = code[1];
  1362. unsigned char opmask;
  1363. struct insn *table;
  1364. switch (code[0]) {
  1365. case 0x01:
  1366. table = opcode_01;
  1367. break;
  1368. case 0xa5:
  1369. table = opcode_a5;
  1370. break;
  1371. case 0xa7:
  1372. table = opcode_a7;
  1373. break;
  1374. case 0xb2:
  1375. table = opcode_b2;
  1376. break;
  1377. case 0xb3:
  1378. table = opcode_b3;
  1379. break;
  1380. case 0xb9:
  1381. table = opcode_b9;
  1382. break;
  1383. case 0xc0:
  1384. table = opcode_c0;
  1385. break;
  1386. case 0xc2:
  1387. table = opcode_c2;
  1388. break;
  1389. case 0xc4:
  1390. table = opcode_c4;
  1391. break;
  1392. case 0xc6:
  1393. table = opcode_c6;
  1394. break;
  1395. case 0xc8:
  1396. table = opcode_c8;
  1397. break;
  1398. case 0xcc:
  1399. table = opcode_cc;
  1400. break;
  1401. case 0xe3:
  1402. table = opcode_e3;
  1403. opfrag = code[5];
  1404. break;
  1405. case 0xe5:
  1406. table = opcode_e5;
  1407. break;
  1408. case 0xeb:
  1409. table = opcode_eb;
  1410. opfrag = code[5];
  1411. break;
  1412. case 0xec:
  1413. table = opcode_ec;
  1414. opfrag = code[5];
  1415. break;
  1416. case 0xed:
  1417. table = opcode_ed;
  1418. opfrag = code[5];
  1419. break;
  1420. default:
  1421. table = opcode;
  1422. opfrag = code[0];
  1423. break;
  1424. }
  1425. while (table->format != INSTR_INVALID) {
  1426. opmask = formats[table->format][0];
  1427. if (table->opfrag == (opfrag & opmask))
  1428. return table;
  1429. table++;
  1430. }
  1431. return NULL;
  1432. }
  1433. static int print_insn(char *buffer, unsigned char *code, unsigned long addr)
  1434. {
  1435. struct insn *insn;
  1436. const unsigned char *ops;
  1437. const struct operand *operand;
  1438. unsigned int value;
  1439. char separator;
  1440. char *ptr;
  1441. int i;
  1442. ptr = buffer;
  1443. insn = find_insn(code);
  1444. if (insn) {
  1445. if (insn->name[0] == '\0')
  1446. ptr += sprintf(ptr, "%s\t",
  1447. long_insn_name[(int) insn->name[1]]);
  1448. else
  1449. ptr += sprintf(ptr, "%.5s\t", insn->name);
  1450. /* Extract the operands. */
  1451. separator = 0;
  1452. for (ops = formats[insn->format] + 1, i = 0;
  1453. *ops != 0 && i < 6; ops++, i++) {
  1454. operand = operands + *ops;
  1455. value = extract_operand(code, operand);
  1456. if ((operand->flags & OPERAND_INDEX) && value == 0)
  1457. continue;
  1458. if ((operand->flags & OPERAND_BASE) &&
  1459. value == 0 && separator == '(') {
  1460. separator = ',';
  1461. continue;
  1462. }
  1463. if (separator)
  1464. ptr += sprintf(ptr, "%c", separator);
  1465. if (operand->flags & OPERAND_GPR)
  1466. ptr += sprintf(ptr, "%%r%i", value);
  1467. else if (operand->flags & OPERAND_FPR)
  1468. ptr += sprintf(ptr, "%%f%i", value);
  1469. else if (operand->flags & OPERAND_AR)
  1470. ptr += sprintf(ptr, "%%a%i", value);
  1471. else if (operand->flags & OPERAND_CR)
  1472. ptr += sprintf(ptr, "%%c%i", value);
  1473. else if (operand->flags & OPERAND_PCREL)
  1474. ptr += sprintf(ptr, "%lx", (signed int) value
  1475. + addr);
  1476. else if (operand->flags & OPERAND_SIGNED)
  1477. ptr += sprintf(ptr, "%i", value);
  1478. else
  1479. ptr += sprintf(ptr, "%u", value);
  1480. if (operand->flags & OPERAND_DISP)
  1481. separator = '(';
  1482. else if (operand->flags & OPERAND_BASE) {
  1483. ptr += sprintf(ptr, ")");
  1484. separator = ',';
  1485. } else
  1486. separator = ',';
  1487. }
  1488. } else
  1489. ptr += sprintf(ptr, "unknown");
  1490. return (int) (ptr - buffer);
  1491. }
  1492. void show_code(struct pt_regs *regs)
  1493. {
  1494. char *mode = (regs->psw.mask & PSW_MASK_PSTATE) ? "User" : "Krnl";
  1495. unsigned char code[64];
  1496. char buffer[64], *ptr;
  1497. mm_segment_t old_fs;
  1498. unsigned long addr;
  1499. int start, end, opsize, hops, i;
  1500. /* Get a snapshot of the 64 bytes surrounding the fault address. */
  1501. old_fs = get_fs();
  1502. set_fs((regs->psw.mask & PSW_MASK_PSTATE) ? USER_DS : KERNEL_DS);
  1503. for (start = 32; start && regs->psw.addr >= 34 - start; start -= 2) {
  1504. addr = regs->psw.addr - 34 + start;
  1505. if (__copy_from_user(code + start - 2,
  1506. (char __user *) addr, 2))
  1507. break;
  1508. }
  1509. for (end = 32; end < 64; end += 2) {
  1510. addr = regs->psw.addr + end - 32;
  1511. if (__copy_from_user(code + end,
  1512. (char __user *) addr, 2))
  1513. break;
  1514. }
  1515. set_fs(old_fs);
  1516. /* Code snapshot useable ? */
  1517. if ((regs->psw.addr & 1) || start >= end) {
  1518. printk("%s Code: Bad PSW.\n", mode);
  1519. return;
  1520. }
  1521. /* Find a starting point for the disassembly. */
  1522. while (start < 32) {
  1523. for (i = 0, hops = 0; start + i < 32 && hops < 3; hops++) {
  1524. if (!find_insn(code + start + i))
  1525. break;
  1526. i += insn_length(code[start + i]);
  1527. }
  1528. if (start + i == 32)
  1529. /* Looks good, sequence ends at PSW. */
  1530. break;
  1531. start += 2;
  1532. }
  1533. /* Decode the instructions. */
  1534. ptr = buffer;
  1535. ptr += sprintf(ptr, "%s Code:", mode);
  1536. hops = 0;
  1537. while (start < end && hops < 8) {
  1538. *ptr++ = (start == 32) ? '>' : ' ';
  1539. addr = regs->psw.addr + start - 32;
  1540. ptr += sprintf(ptr, ONELONG, addr);
  1541. opsize = insn_length(code[start]);
  1542. if (start + opsize >= end)
  1543. break;
  1544. for (i = 0; i < opsize; i++)
  1545. ptr += sprintf(ptr, "%02x", code[start + i]);
  1546. *ptr++ = '\t';
  1547. if (i < 6)
  1548. *ptr++ = '\t';
  1549. ptr += print_insn(ptr, code + start, addr);
  1550. start += opsize;
  1551. printk(buffer);
  1552. ptr = buffer;
  1553. ptr += sprintf(ptr, "\n ");
  1554. hops++;
  1555. }
  1556. printk("\n");
  1557. }