Mercurial > projects > ddbg_continued
comparison src/udis86.d @ 1:4a9dcbd9e54f
-files of 0.13 beta
-fixes so that it now compiles with the current dmd version
author | marton@basel.hu |
---|---|
date | Tue, 05 Apr 2011 20:44:01 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:586e4a649642 | 1:4a9dcbd9e54f |
---|---|
1 /* ----------------------------------------------------------------------------- | |
2 * udis86.h | |
3 * | |
4 * converted to D by Jascha Wetzel | |
5 * | |
6 * Copyright (c) 2002, 2003, 2004 Vivek Mohan <vivek@sig9.com> | |
7 * All rights reserved. See (LICENSE) | |
8 * ----------------------------------------------------------------------------- | |
9 */ | |
10 | |
11 extern(C) | |
12 { | |
13 | |
14 struct __nt_context { int esp; int info; int prev; int handler; int stable; int sindex; int ebp; }; | |
15 | |
16 /* ----------------------------------------------------------------------------- | |
17 * types.h | |
18 * | |
19 * Copyright (c) 2006, Vivek Mohan <vivek@sig9.com> | |
20 * All rights reserved. See LICENSE | |
21 * ----------------------------------------------------------------------------- | |
22 */ | |
23 | |
24 import std.c.stdio; | |
25 | |
26 extern const char* ud_mnemonics[]; | |
27 | |
28 enum ud_mnemonic_code | |
29 { | |
30 UD_Iaaa, | |
31 UD_Iaad, | |
32 UD_Iaam, | |
33 UD_Iaas, | |
34 UD_Iadc, | |
35 UD_Iadd, | |
36 UD_Iaddpd, | |
37 UD_Iaddps, | |
38 UD_Iaddsd, | |
39 UD_Iaddss, | |
40 UD_Iand, | |
41 UD_Iandnpd, | |
42 UD_Iandnps, | |
43 UD_Iandpd, | |
44 UD_Iandps, | |
45 UD_Iarpl, | |
46 UD_Ibound, | |
47 UD_Ibsf, | |
48 UD_Ibsr, | |
49 UD_Ibswap, | |
50 UD_Ibt, | |
51 UD_Ibtc, | |
52 UD_Ibtr, | |
53 UD_Ibts, | |
54 UD_Icall, | |
55 UD_Icbw, | |
56 UD_Icdqe, | |
57 UD_Iclc, | |
58 UD_Icld, | |
59 UD_Iclflush, | |
60 UD_Icli, | |
61 UD_Iclts, | |
62 UD_Icmc, | |
63 UD_Icmovo, | |
64 UD_Icmovno, | |
65 UD_Icmovb, | |
66 UD_Icmovnb, | |
67 UD_Icmovz, | |
68 UD_Icmovnz, | |
69 UD_Icmovbe, | |
70 UD_Icmovnbe, | |
71 UD_Icmovs, | |
72 UD_Icmovns, | |
73 UD_Icmovp, | |
74 UD_Icmovnp, | |
75 UD_Icmovl, | |
76 UD_Icmovnl, | |
77 UD_Icmovle, | |
78 UD_Icmovnle, | |
79 UD_Icmp, | |
80 UD_Icmppd, | |
81 UD_Icmpps, | |
82 UD_Icmps, | |
83 UD_Icmpsb, | |
84 UD_Icmpsd, | |
85 UD_Icmpsq, | |
86 UD_Icmpss, | |
87 UD_Icmpsw, | |
88 UD_Icmpxchg, | |
89 UD_Icmpxchg8b, | |
90 UD_Icomisd, | |
91 UD_Icomiss, | |
92 UD_Icpuid, | |
93 UD_Icqd, | |
94 UD_Icqo, | |
95 UD_Icvtdq2pd, | |
96 UD_Icvtdq2ps, | |
97 UD_Icvtpd2dq, | |
98 UD_Icvtpd2pi, | |
99 UD_Icvtpd2ps, | |
100 UD_Icvtpi2pd, | |
101 UD_Icvtpi2ps, | |
102 UD_Icvtps2dq, | |
103 UD_Icvtps2pd, | |
104 UD_Icvtps2pi, | |
105 UD_Icvtsd2si, | |
106 UD_Icvtsd2ss, | |
107 UD_Icvtsi2sd, | |
108 UD_Icvtsi2ss, | |
109 UD_Icvtss2sd, | |
110 UD_Icvtss2si, | |
111 UD_Icvttpd2dq, | |
112 UD_Icvttpd2pi, | |
113 UD_Icvttps2dq, | |
114 UD_Icvttps2pi, | |
115 UD_Icvttsd2si, | |
116 UD_Icvttsi2sd, | |
117 UD_Icvttsi2ss, | |
118 UD_Icvttss2si, | |
119 UD_Icwd, | |
120 UD_Icwde, | |
121 UD_Icdq, | |
122 UD_Idaa, | |
123 UD_Idas, | |
124 UD_Idec, | |
125 UD_Idiv, | |
126 UD_Idivpd, | |
127 UD_Idivps, | |
128 UD_Idivsd, | |
129 UD_Idivss, | |
130 UD_Iemms, | |
131 UD_Ienter, | |
132 UD_Iesc, | |
133 UD_If2xm1, | |
134 UD_Ifsxm1, | |
135 UD_Ifabs, | |
136 UD_Ifadd, | |
137 UD_Ifaddp, | |
138 UD_Ifbld, | |
139 UD_Ifbstp, | |
140 UD_Ifchs, | |
141 UD_Ifclex, | |
142 UD_Ifcmovb, | |
143 UD_Ifcmovbe, | |
144 UD_Ifcmove, | |
145 UD_Ifcmovnb, | |
146 UD_Ifcmovnbe, | |
147 UD_Ifcmovne, | |
148 UD_Ifcmovnu, | |
149 UD_Ifcmovu, | |
150 UD_Ifcom, | |
151 UD_Ifcomi, | |
152 UD_Ifcomp, | |
153 UD_Ifcomip, | |
154 UD_Ifcompp, | |
155 UD_Ifcos, | |
156 UD_Ifdecstp, | |
157 UD_Ifdiv, | |
158 UD_Ifdivp, | |
159 UD_Ifdivr, | |
160 UD_Ifdivrp, | |
161 UD_Ifemms, | |
162 UD_Iffree, | |
163 UD_Ifiadd, | |
164 UD_Ificom, | |
165 UD_Ificomp, | |
166 UD_Ifidiv, | |
167 UD_Ifidivr, | |
168 UD_Ifidw, | |
169 UD_Ifidwr, | |
170 UD_Ifild, | |
171 UD_Ifimul, | |
172 UD_Ifincstp, | |
173 UD_Ifinit, | |
174 UD_Ifist, | |
175 UD_Ifistp, | |
176 UD_Ifisub, | |
177 UD_Ifisubr, | |
178 UD_Ifld, | |
179 UD_Ifld1, | |
180 UD_Ifldcw, | |
181 UD_Ifldenv, | |
182 UD_Ifldl2e, | |
183 UD_Ifldl2t, | |
184 UD_Ifldlg2, | |
185 UD_Ifldln2, | |
186 UD_Ifldlpi, | |
187 UD_Ifldx, | |
188 UD_Ifldz, | |
189 UD_Ifmul, | |
190 UD_Ifmulp, | |
191 UD_Ifnclex, | |
192 UD_Ifncstp, | |
193 UD_Ifninit, | |
194 UD_Ifnop, | |
195 UD_Ifnsave, | |
196 UD_Ifnstcw, | |
197 UD_Ifnstenv, | |
198 UD_Ifnstsw, | |
199 UD_Ifpatan, | |
200 UD_Ifprem, | |
201 UD_Ifprem1, | |
202 UD_Ifptan, | |
203 UD_Ifpxtract, | |
204 UD_Ifrndint, | |
205 UD_Ifrstor, | |
206 UD_Ifsave, | |
207 UD_Ifscale, | |
208 UD_Ifsin, | |
209 UD_Ifsincos, | |
210 UD_Ifsqrt, | |
211 UD_Ifst, | |
212 UD_Ifstcw, | |
213 UD_Ifstenv, | |
214 UD_Ifstp, | |
215 UD_Ifstsw, | |
216 UD_Ifsub, | |
217 UD_Ifsubp, | |
218 UD_Ifsubr, | |
219 UD_Ifsubrp, | |
220 UD_Iftst, | |
221 UD_Ifucom, | |
222 UD_Ifucomi, | |
223 UD_Ifucomip, | |
224 UD_Ifucomp, | |
225 UD_Ifucompp, | |
226 UD_Ifwait, | |
227 UD_Ifxam, | |
228 UD_Ifxch, | |
229 UD_Ifxrstor, | |
230 UD_Ifxsave, | |
231 UD_Ifxtract, | |
232 UD_Ifyl2x, | |
233 UD_Ifyl2xp1, | |
234 UD_Ihlt, | |
235 UD_Iidiv, | |
236 UD_Iimul, | |
237 UD_Iin, | |
238 UD_Iinc, | |
239 UD_Iins, | |
240 UD_Iinsb, | |
241 UD_Iinsd, | |
242 UD_Iinsw, | |
243 UD_Iint, | |
244 UD_Iinto, | |
245 UD_Iinvd, | |
246 UD_Iinvlpg, | |
247 UD_Iiretw, | |
248 UD_Iiretd, | |
249 UD_Iiretq, | |
250 UD_Ijcxz, | |
251 UD_Ijecxz, | |
252 UD_Ijmp, | |
253 UD_Ijrcxz, | |
254 UD_Ijo, | |
255 UD_Ijno, | |
256 UD_Ijb, | |
257 UD_Ijnb, | |
258 UD_Ijz, | |
259 UD_Ijnz, | |
260 UD_Ijbe, | |
261 UD_Ijnbe, | |
262 UD_Ijs, | |
263 UD_Ijns, | |
264 UD_Ijp, | |
265 UD_Ijnp, | |
266 UD_Ijl, | |
267 UD_Ijnl, | |
268 UD_Ijle, | |
269 UD_Ijnle, | |
270 UD_Ilahf, | |
271 UD_Ilar, | |
272 UD_Ildmxcsr, | |
273 UD_Ilds, | |
274 UD_Ilea, | |
275 UD_Ileave, | |
276 UD_Iles, | |
277 UD_Ilfence, | |
278 UD_Ilfs, | |
279 UD_Ilgdt, | |
280 UD_Ilgs, | |
281 UD_Ilidt, | |
282 UD_Illdt, | |
283 UD_Ilmsw, | |
284 UD_Ilock, | |
285 UD_Ilods, | |
286 UD_Ilodsb, | |
287 UD_Ilodsd, | |
288 UD_Ilodsq, | |
289 UD_Ilodsw, | |
290 UD_Iloop, | |
291 UD_Iloope, | |
292 UD_Iloopn, | |
293 UD_Iloopne, | |
294 UD_Iloopnz, | |
295 UD_Iloopz, | |
296 UD_Ilsl, | |
297 UD_Ilss, | |
298 UD_Iltr, | |
299 UD_Imaskmovdqu, | |
300 UD_Imaskmovq, | |
301 UD_Imaxpd, | |
302 UD_Imaxps, | |
303 UD_Imaxsd, | |
304 UD_Imaxss, | |
305 UD_Imfence, | |
306 UD_Iminpd, | |
307 UD_Iminps, | |
308 UD_Iminsd, | |
309 UD_Iminss, | |
310 UD_Imov, | |
311 UD_Imovapd, | |
312 UD_Imovaps, | |
313 UD_Imovd, | |
314 UD_Imovdq2q, | |
315 UD_Imovdqa, | |
316 UD_Imovdqu, | |
317 UD_Imovhlps, | |
318 UD_Imovhpd, | |
319 UD_Imovhps, | |
320 UD_Imovlhps, | |
321 UD_Imovlpd, | |
322 UD_Imovlps, | |
323 UD_Imovmskpd, | |
324 UD_Imovmskps, | |
325 UD_Imovnig, | |
326 UD_Imovntdq, | |
327 UD_Imovnti, | |
328 UD_Imovntpd, | |
329 UD_Imovntps, | |
330 UD_Imovntq, | |
331 UD_Imovq, | |
332 UD_Imovq2dq, | |
333 UD_Imovqa, | |
334 UD_Imovs, | |
335 UD_Imovsb, | |
336 UD_Imovsd, | |
337 UD_Imovsq, | |
338 UD_Imovss, | |
339 UD_Imovsw, | |
340 UD_Imovsx, | |
341 UD_Imovsxd, | |
342 UD_Imovupd, | |
343 UD_Imovups, | |
344 UD_Imovzx, | |
345 UD_Imul, | |
346 UD_Imulpd, | |
347 UD_Imulps, | |
348 UD_Imulsd, | |
349 UD_Imulss, | |
350 UD_Ineg, | |
351 UD_Inop, | |
352 UD_Inot, | |
353 UD_Ior, | |
354 UD_Iorpd, | |
355 UD_Iorps, | |
356 UD_Iout, | |
357 UD_Iouts, | |
358 UD_Ioutsb, | |
359 UD_Ioutsd, | |
360 UD_Ioutsw, | |
361 UD_Ipackssdw, | |
362 UD_Ipacksswb, | |
363 UD_Ipackusdw, | |
364 UD_Ipackuswb, | |
365 UD_Ipaddb, | |
366 UD_Ipaddd, | |
367 UD_Ipaddq, | |
368 UD_Ipaddsb, | |
369 UD_Ipaddsw, | |
370 UD_Ipaddusb, | |
371 UD_Ipaddusw, | |
372 UD_Ipaddw, | |
373 UD_Ipand, | |
374 UD_Ipandn, | |
375 UD_Ipavgb, | |
376 UD_Ipavgusb, | |
377 UD_Ipavgw, | |
378 UD_Ipcmpeqb, | |
379 UD_Ipcmpeqd, | |
380 UD_Ipcmpeqw, | |
381 UD_Ipcmpgtb, | |
382 UD_Ipcmpgtd, | |
383 UD_Ipcmpgtw, | |
384 UD_Ipextrw, | |
385 UD_Ipf2id, | |
386 UD_Ipf2iw, | |
387 UD_Ipfacc, | |
388 UD_Ipfadd, | |
389 UD_Ipfcmpeq, | |
390 UD_Ipfcmpge, | |
391 UD_Ipfcmpgt, | |
392 UD_Ipfmax, | |
393 UD_Ipfmin, | |
394 UD_Ipfmul, | |
395 UD_Ipfnacc, | |
396 UD_Ipfpnacc, | |
397 UD_Ipfrcp, | |
398 UD_Ipfrcpit1, | |
399 UD_Ipfrcpit2, | |
400 UD_Ipfrsqit1, | |
401 UD_Ipfrsqrt, | |
402 UD_Ipfsub, | |
403 UD_Ipfsubr, | |
404 UD_Ipi2fd, | |
405 UD_Ipi2fw, | |
406 UD_Ipinsrw, | |
407 UD_Ipmaddwd, | |
408 UD_Ipmaxsw, | |
409 UD_Ipmaxub, | |
410 UD_Ipminsw, | |
411 UD_Ipminub, | |
412 UD_Ipmovmskb, | |
413 UD_Ipmulhrw, | |
414 UD_Ipmulhuw, | |
415 UD_Ipmulhw, | |
416 UD_Ipmullw, | |
417 UD_Ipmuludq, | |
418 UD_Ipop, | |
419 UD_Ipopa, | |
420 UD_Ipopad, | |
421 UD_Ipopfw, | |
422 UD_Ipopfd, | |
423 UD_Ipopfq, | |
424 UD_Ipor, | |
425 UD_Iprefetch, | |
426 UD_Ipsadbw, | |
427 UD_Ipshufd, | |
428 UD_Ipshufhw, | |
429 UD_Ipshuflw, | |
430 UD_Ipshufw, | |
431 UD_Ipslld, | |
432 UD_Ipslldq, | |
433 UD_Ipsllq, | |
434 UD_Ipsllw, | |
435 UD_Ipsrad, | |
436 UD_Ipsraw, | |
437 UD_Ipsraq, | |
438 UD_Ipsrld, | |
439 UD_Ipsrldq, | |
440 UD_Ipsrlq, | |
441 UD_Ipsrlw, | |
442 UD_Ipsubb, | |
443 UD_Ipsubd, | |
444 UD_Ipsubq, | |
445 UD_Ipsubsb, | |
446 UD_Ipsubsw, | |
447 UD_Ipsubusb, | |
448 UD_Ipsubusw, | |
449 UD_Ipsubw, | |
450 UD_Ipswapd, | |
451 UD_Ipunpckhbw, | |
452 UD_Ipunpckhdq, | |
453 UD_Ipunpckhqdq, | |
454 UD_Ipunpckhwd, | |
455 UD_Ipunpcklbw, | |
456 UD_Ipunpckldq, | |
457 UD_Ipunpcklqdq, | |
458 UD_Ipunpcklwd, | |
459 UD_Ipush, | |
460 UD_Ipusha, | |
461 UD_Ipushad, | |
462 UD_Ipushfw, | |
463 UD_Ipushfd, | |
464 UD_Ipushfq, | |
465 UD_Ipxor, | |
466 UD_Ircl, | |
467 UD_Ircpps, | |
468 UD_Ircpss, | |
469 UD_Ircr, | |
470 UD_Irdivisr, | |
471 UD_Irdmsr, | |
472 UD_Irdpmc, | |
473 UD_Irdtsc, | |
474 UD_Irep, | |
475 UD_Irepne, | |
476 UD_Iret, | |
477 UD_Iretf, | |
478 UD_Irol, | |
479 UD_Iror, | |
480 UD_Irsm, | |
481 UD_Irsqrtps, | |
482 UD_Irsqrtss, | |
483 UD_Isahf, | |
484 UD_Isal, | |
485 UD_Isalc, | |
486 UD_Isar, | |
487 UD_Isbb, | |
488 UD_Iscas, | |
489 UD_Iscasb, | |
490 UD_Iscasd, | |
491 UD_Iscasq, | |
492 UD_Iscasw, | |
493 UD_Iseto, | |
494 UD_Isetno, | |
495 UD_Isetb, | |
496 UD_Isetnb, | |
497 UD_Isetz, | |
498 UD_Isetnz, | |
499 UD_Isetbe, | |
500 UD_Isetnbe, | |
501 UD_Isets, | |
502 UD_Isetns, | |
503 UD_Isetp, | |
504 UD_Isetnp, | |
505 UD_Isetl, | |
506 UD_Isetnl, | |
507 UD_Isetle, | |
508 UD_Isetnle, | |
509 UD_Isfence, | |
510 UD_Isgdt, | |
511 UD_Ishl, | |
512 UD_Ishld, | |
513 UD_Ishr, | |
514 UD_Ishrd, | |
515 UD_Ishufpd, | |
516 UD_Ishufps, | |
517 UD_Isidt, | |
518 UD_Isldt, | |
519 UD_Ismsw, | |
520 UD_Isqrtpd, | |
521 UD_Isqrtps, | |
522 UD_Isqrtsd, | |
523 UD_Isqrtss, | |
524 UD_Istc, | |
525 UD_Istd, | |
526 UD_Isti, | |
527 UD_Istmxcsr, | |
528 UD_Istos, | |
529 UD_Istosb, | |
530 UD_Istosw, | |
531 UD_Istosd, | |
532 UD_Istr, | |
533 UD_Isub, | |
534 UD_Isubpd, | |
535 UD_Isubps, | |
536 UD_Isubsd, | |
537 UD_Isubss, | |
538 UD_Iswapgs, | |
539 UD_Isyscall, | |
540 UD_Isysenter, | |
541 UD_Isysexit, | |
542 UD_Isysret, | |
543 UD_Itest, | |
544 UD_Iucomisd, | |
545 UD_Iucomiss, | |
546 UD_Iud2, | |
547 UD_Iunpckhpd, | |
548 UD_Iunpckhps, | |
549 UD_Iunpcklpd, | |
550 UD_Iunpcklps, | |
551 UD_Iverr, | |
552 UD_Iverw, | |
553 UD_Iwait, | |
554 UD_Iwbinvd, | |
555 UD_Iwrmsr, | |
556 UD_Ixadd, | |
557 UD_Ixchg, | |
558 UD_Ixlat, | |
559 UD_Ixlatb, | |
560 UD_Ixor, | |
561 UD_Ixorpd, | |
562 UD_Ixorps, | |
563 UD_Iinvalid, | |
564 UD_Igrp, | |
565 UD_Ia32, | |
566 UD_Io32, | |
567 UD_Ies, | |
568 UD_Ifs, | |
569 UD_Igs, | |
570 UD_Ics, | |
571 UD_Ids, | |
572 UD_Iss, | |
573 UD_Ix87, | |
574 UD_I3dnow, | |
575 UD_Idb, | |
576 UD_Icmpxchg16b, | |
577 UD_Istosq, | |
578 UD_Iint3, | |
579 UD_Imovsldup, | |
580 UD_Imovshdup, | |
581 UD_Imovddup, | |
582 UD_Irdtscp, | |
583 UD_Ivmrun, | |
584 UD_Ivmmcall, | |
585 UD_Ivmload, | |
586 UD_Ivmsave, | |
587 UD_Istgi, | |
588 UD_Iclgi, | |
589 UD_Iskinit, | |
590 UD_Iinvlpga, | |
591 UD_Ija, | |
592 UD_Ijae, | |
593 UD_Ijg, | |
594 UD_Ijge, | |
595 UD_Ijc, | |
596 UD_Ijnc, | |
597 UD_Ifisttp, | |
598 UD_Iprefetchnta, | |
599 UD_Iprefetcht0, | |
600 UD_Iprefetcht1, | |
601 UD_Iprefetcht2, | |
602 UD_Icmovae, | |
603 UD_Icmova, | |
604 UD_Icmovge, | |
605 UD_Icmovg, | |
606 UD_Iseta, | |
607 UD_Isetge, | |
608 UD_Isetg, | |
609 UD_Ipause, | |
610 UD_Ina, | |
611 UD_Ihaddpd, | |
612 UD_Ihsubpd, | |
613 UD_Iaddsubpd, | |
614 UD_Ihaddps, | |
615 UD_Ihsubps, | |
616 UD_Iaddsubps, | |
617 UD_Ilddqu, | |
618 UD_Iint1, | |
619 UD_Ivmcall, | |
620 UD_Ivmlaunch, | |
621 UD_Ivmresume, | |
622 UD_Ivmxoff, | |
623 UD_Imonitor, | |
624 UD_Imwait, | |
625 UD_Ivmptrld, | |
626 UD_Ivmptrst, | |
627 UD_Ivmclear, | |
628 UD_Ivmxon, | |
629 UD_Inone, | |
630 UD_I3vil | |
631 } | |
632 | |
633 | |
634 /* ----------------------------------------------------------------------------- | |
635 * All possible "types" of objects in udis86. Order is Important! | |
636 * ----------------------------------------------------------------------------- | |
637 */ | |
638 enum ud_type | |
639 { | |
640 UD_NONE, | |
641 | |
642 /* 8 bit GPRs */ | |
643 UD_R_AL, UD_R_CL, UD_R_DL, UD_R_BL, | |
644 UD_R_AH, UD_R_CH, UD_R_DH, UD_R_BH, | |
645 UD_R_SPL, UD_R_BPL, UD_R_SIL, UD_R_DIL, | |
646 UD_R_R8B, UD_R_R9B, UD_R_R10B, UD_R_R11B, | |
647 UD_R_R12B, UD_R_R13B, UD_R_R14B, UD_R_R15B, | |
648 | |
649 /* 16 bit GPRs */ | |
650 UD_R_AX, UD_R_CX, UD_R_DX, UD_R_BX, | |
651 UD_R_SP, UD_R_BP, UD_R_SI, UD_R_DI, | |
652 UD_R_R8W, UD_R_R9W, UD_R_R10W, UD_R_R11W, | |
653 UD_R_R12W, UD_R_R13W, UD_R_R14W, UD_R_R15W, | |
654 | |
655 /* 32 bit GPRs */ | |
656 UD_R_EAX, UD_R_ECX, UD_R_EDX, UD_R_EBX, | |
657 UD_R_ESP, UD_R_EBP, UD_R_ESI, UD_R_EDI, | |
658 UD_R_R8D, UD_R_R9D, UD_R_R10D, UD_R_R11D, | |
659 UD_R_R12D, UD_R_R13D, UD_R_R14D, UD_R_R15D, | |
660 | |
661 /* 64 bit GPRs */ | |
662 UD_R_RAX, UD_R_RCX, UD_R_RDX, UD_R_RBX, | |
663 UD_R_RSP, UD_R_RBP, UD_R_RSI, UD_R_RDI, | |
664 UD_R_R8, UD_R_R9, UD_R_R10, UD_R_R11, | |
665 UD_R_R12, UD_R_R13, UD_R_R14, UD_R_R15, | |
666 | |
667 /* segment registers */ | |
668 UD_R_ES, UD_R_CS, UD_R_SS, UD_R_DS, | |
669 UD_R_FS, UD_R_GS, | |
670 | |
671 /* control registers*/ | |
672 UD_R_CR0, UD_R_CR1, UD_R_CR2, UD_R_CR3, | |
673 UD_R_CR4, UD_R_CR5, UD_R_CR6, UD_R_CR7, | |
674 UD_R_CR8, UD_R_CR9, UD_R_CR10, UD_R_CR11, | |
675 UD_R_CR12, UD_R_CR13, UD_R_CR14, UD_R_CR15, | |
676 | |
677 /* debug registers */ | |
678 UD_R_DR0, UD_R_DR1, UD_R_DR2, UD_R_DR3, | |
679 UD_R_DR4, UD_R_DR5, UD_R_DR6, UD_R_DR7, | |
680 UD_R_DR8, UD_R_DR9, UD_R_DR10, UD_R_DR11, | |
681 UD_R_DR12, UD_R_DR13, UD_R_DR14, UD_R_DR15, | |
682 | |
683 /* mmx registers */ | |
684 UD_R_MM0, UD_R_MM1, UD_R_MM2, UD_R_MM3, | |
685 UD_R_MM4, UD_R_MM5, UD_R_MM6, UD_R_MM7, | |
686 | |
687 /* x87 registers */ | |
688 UD_R_ST0, UD_R_ST1, UD_R_ST2, UD_R_ST3, | |
689 UD_R_ST4, UD_R_ST5, UD_R_ST6, UD_R_ST7, | |
690 | |
691 /* extended multimedia registers */ | |
692 UD_R_XMM0, UD_R_XMM1, UD_R_XMM2, UD_R_XMM3, | |
693 UD_R_XMM4, UD_R_XMM5, UD_R_XMM6, UD_R_XMM7, | |
694 UD_R_XMM8, UD_R_XMM9, UD_R_XMM10, UD_R_XMM11, | |
695 UD_R_XMM12, UD_R_XMM13, UD_R_XMM14, UD_R_XMM15, | |
696 | |
697 UD_R_RIP, | |
698 | |
699 /* Operand Types */ | |
700 UD_OP_REG, UD_OP_MEM, UD_OP_PTR, UD_OP_IMM, | |
701 UD_OP_JIMM, UD_OP_CONST | |
702 } | |
703 | |
704 /* ----------------------------------------------------------------------------- | |
705 * struct ud_operand - Disassembled instruction Operand. | |
706 * ----------------------------------------------------------------------------- | |
707 */ | |
708 struct ptr_t | |
709 { | |
710 ushort seg; | |
711 uint off; | |
712 } | |
713 union lval_t | |
714 { | |
715 byte sbyte; | |
716 ubyte _ubyte; | |
717 short sword; | |
718 ushort uword; | |
719 int sdword; | |
720 uint udword; | |
721 long sqword; | |
722 ulong uqword; | |
723 | |
724 ptr_t ptr; | |
725 } | |
726 struct ud_operand | |
727 { | |
728 ud_type type; | |
729 ubyte size; | |
730 lval_t lval; | |
731 | |
732 ud_type base; | |
733 ud_type index; | |
734 ubyte offset; | |
735 ubyte scale; | |
736 }; | |
737 | |
738 /* ----------------------------------------------------------------------------- | |
739 * struct ud - The udis86 object. | |
740 * ----------------------------------------------------------------------------- | |
741 */ | |
742 struct ud | |
743 { | |
744 int (*inp_hook) (ud*); | |
745 ubyte inp_curr; | |
746 ubyte inp_fill; | |
747 FILE* inp_file; | |
748 ubyte inp_ctr; | |
749 ubyte* inp_buff; | |
750 ubyte* inp_buff_end; | |
751 ubyte inp_end; | |
752 void (*translator)(ud*); | |
753 ulong insn_offset; | |
754 char insn_hexcode[32]; | |
755 char insn_buffer[64]; | |
756 uint insn_fill; | |
757 ubyte dis_mode; | |
758 ulong pc; | |
759 ubyte vendor; | |
760 map_entry* mapen; | |
761 ud_mnemonic_code mnemonic; | |
762 ud_operand operand[3]; | |
763 ubyte error; | |
764 ubyte pfx_rex; | |
765 ubyte pfx_seg; | |
766 ubyte pfx_opr; | |
767 ubyte pfx_adr; | |
768 ubyte pfx_lock; | |
769 ubyte pfx_rep; | |
770 ubyte pfx_repe; | |
771 ubyte pfx_repne; | |
772 ubyte pfx_insn; | |
773 ubyte default64; | |
774 ubyte opr_mode; | |
775 ubyte adr_mode; | |
776 ubyte br_far; | |
777 ubyte br_near; | |
778 ubyte c1; | |
779 ubyte c2; | |
780 ubyte c3; | |
781 ubyte inp_cache[256]; | |
782 ubyte inp_sess[64]; | |
783 | |
784 } | |
785 | |
786 enum map_operand_type | |
787 { | |
788 OP_NONE = 0, | |
789 OP_A, | |
790 OP_E, | |
791 OP_M, | |
792 OP_G, | |
793 OP_I, | |
794 OP_AL, | |
795 OP_CL, | |
796 OP_DL, | |
797 OP_BL, | |
798 OP_AH, | |
799 OP_CH, | |
800 OP_DH, | |
801 OP_BH, | |
802 OP_ALr8b, | |
803 OP_CLr9b, | |
804 OP_DLr10b, | |
805 OP_BLr11b, | |
806 OP_AHr12b, | |
807 OP_CHr13b, | |
808 OP_DHr14b, | |
809 OP_BHr15b, | |
810 OP_AX, | |
811 OP_CX, | |
812 OP_DX, | |
813 OP_BX, | |
814 OP_SI, | |
815 OP_DI, | |
816 OP_SP, | |
817 OP_BP, | |
818 OP_rAX, | |
819 OP_rCX, | |
820 OP_rDX, | |
821 OP_rBX, | |
822 OP_rSP, | |
823 OP_rBP, | |
824 OP_rSI, | |
825 OP_rDI, | |
826 OP_rAXr8, | |
827 OP_rCXr9, | |
828 OP_rDXr10, | |
829 OP_rBXr11, | |
830 OP_rSPr12, | |
831 OP_rBPr13, | |
832 OP_rSIr14, | |
833 OP_rDIr15, | |
834 OP_eAX, | |
835 OP_eCX, | |
836 OP_eDX, | |
837 OP_eBX, | |
838 OP_eSP, | |
839 OP_eBP, | |
840 OP_eSI, | |
841 OP_eDI, | |
842 OP_ES, | |
843 OP_CS, | |
844 OP_SS, | |
845 OP_DS, | |
846 OP_FS, | |
847 OP_GS, | |
848 OP_ST0, | |
849 OP_ST1, | |
850 OP_ST2, | |
851 OP_ST3, | |
852 OP_ST4, | |
853 OP_ST5, | |
854 OP_ST6, | |
855 OP_ST7, | |
856 OP_J, | |
857 OP_S, | |
858 OP_O, | |
859 OP_I1, | |
860 OP_I3, | |
861 OP_V, | |
862 OP_W, | |
863 OP_Q, | |
864 OP_P, | |
865 OP_R, | |
866 OP_C, | |
867 OP_D, | |
868 OP_VR, | |
869 OP_PR | |
870 } | |
871 | |
872 struct map_operand | |
873 { | |
874 map_operand_type type; | |
875 ubyte size; | |
876 } | |
877 | |
878 struct map_entry | |
879 { | |
880 ud_mnemonic_code mnemonic; | |
881 map_operand operand1; | |
882 map_operand operand2; | |
883 map_operand operand3; | |
884 uint prefix; | |
885 } | |
886 | |
887 /* ----------------------------------------------------------------------------- | |
888 * Type-definitions | |
889 * ----------------------------------------------------------------------------- | |
890 */ | |
891 alias ud_type ud_type_t; | |
892 alias ud_mnemonic_code ud_mnemonic_code_t; | |
893 | |
894 alias ud ud_t; | |
895 alias ud_operand ud_operand_t; | |
896 | |
897 /* | |
898 #define UD_SYN_INTEL ud_translate_intel | |
899 #define UD_SYN_ATT ud_translate_att | |
900 #define UD_EOI -1 | |
901 #define UD_INP_CACHE_SZ 32 | |
902 #define UD_VENDOR_AMD 0 | |
903 #define UD_VENDOR_INTEL 1 | |
904 */ | |
905 | |
906 /* ----------------------------------------------------------------------------- | |
907 * extern.h | |
908 * | |
909 * Copyright (c) 2004, 2005, 2006, Vivek Mohan <vivek@sig9.com> | |
910 * All rights reserved. See LICENSE | |
911 * ----------------------------------------------------------------------------- | |
912 */ | |
913 | |
914 /* ============================= PUBLIC API ================================= */ | |
915 | |
916 extern void ud_init(ud*); | |
917 | |
918 extern void ud_set_mode(ud*, ubyte); | |
919 | |
920 extern void ud_set_pc(ud*, ulong); | |
921 | |
922 extern void ud_set_input_hook(ud*, int (*)(ud*)); | |
923 | |
924 extern void ud_set_input_buffer(ud*, ubyte*, size_t); | |
925 | |
926 extern void ud_set_input_file(ud*, FILE*); | |
927 | |
928 extern void ud_set_vendor(ud*, ushort); | |
929 | |
930 extern void ud_set_syntax(ud*, void function(ud*)); | |
931 | |
932 extern void ud_input_skip(ud*, size_t); | |
933 | |
934 extern int ud_input_end(ud*); | |
935 | |
936 extern uint ud_decode(ud*); | |
937 | |
938 extern uint ud_disassemble(ud*); | |
939 | |
940 extern void ud_translate_intel(ud*); | |
941 | |
942 extern void ud_translate_att(ud*); | |
943 | |
944 extern char* ud_insn_asm(ud* u); | |
945 | |
946 extern ubyte* ud_insn_ptr(ud* u); | |
947 | |
948 extern ulong ud_insn_off(ud*); | |
949 | |
950 extern char* ud_insn_hex(ud*); | |
951 | |
952 extern uint ud_insn_len(ud* u); | |
953 | |
954 extern char* ud_lookup_mnemonic(ud_mnemonic_code c); | |
955 | |
956 } // extern(C) |