ReactOS  0.4.14-dev-323-g6fe6a88
disassemblerdefines.h
Go to the documentation of this file.
1 /******************************************************************************
2 * *
3 * Module: disassemblerdefines.h *
4 * *
5 * Revision: 1.00 *
6 * *
7 * Date: 3/17/2000 *
8 * *
9 * Copyright (c) 2000 Goran Devic *
10 * *
11 * Author: Goran Devic *
12 * *
13 *******************************************************************************
14 
15  Module Description:
16 
17  This is a header file containing the disassembler defines that are
18  used in DisassemblerData.h
19 
20 *******************************************************************************
21 * *
22 * Changes: *
23 * *
24 * DATE DESCRIPTION OF CHANGES AUTHOR *
25 * -------- --------------------------------------------------- ----------- *
26 * 4/28/2000 Original Goran Devic *
27 * 11/4/2000 Modified for LinIce Goran Devic *
28 * -------- --------------------------------------------------- ----------- *
29 *******************************************************************************
30 * Important Defines *
31 ******************************************************************************/
32 #ifndef _DDEF_H_
33 #define _DDEF_H_
34 
35 /******************************************************************************
36 *
37 * Groups and special codes in place of name index
38 *
39 ******************************************************************************/
40 #define _NDEF 0x00 // Udefined/reserved opcode
41 #define _2BESC 0x01 // 2 byte escape code
42 #define _S_ES 0x02 // Segment ES override | these defines
43 #define _S_CS 0x03 // Segment CS override | must have
44 #define _S_SS 0x04 // Segment SS override | consecutive
45 #define _S_DS 0x05 // Segment DS override | enumeration
46 #define _S_FS 0x06 // Segment FS override | numbers.
47 #define _S_GS 0x07 // Segment GS override |
48 #define _OPSIZ 0x08 // Operand size override
49 #define _ADSIZ 0x09 // Address size override
50 #define _REPNE 0x0A // REPNE/REPNZ prefix
51 #define _REP 0x0B // REP/REPE/REPZ prefix
52 #define _EscD8 0x0C // Escape to coprocessor set: prefix D8
53 #define _EscD9 0x0D // Escape to coprocessor set: prefix D9
54 #define _EscDA 0x0E // Escape to coprocessor set: prefix DA
55 #define _EscDB 0x0F // Escape to coprocessor set: prefix DB
56 #define _EscDC 0x10 // Escape to coprocessor set: prefix DC
57 #define _EscDD 0x11 // Escape to coprocessor set: prefix DD
58 #define _EscDE 0x12 // Escape to coprocessor set: prefix DE
59 #define _EscDF 0x13 // Escape to coprocessor set: prefix DF
60 #define _GRP1a 0x14 // Group 1a extended opcode
61 #define _GRP1b 0x15 // Group 1b extended opcode
62 #define _GRP1c 0x16 // Group 1c extended opcode
63 #define _GRP2a 0x17 // Group 2a extended opcode
64 #define _GRP2b 0x18 // Group 2b extended opcode
65 #define _GRP2c 0x19 // Group 2c extended opcode
66 #define _GRP2d 0x1A // Group 2d extended opcode
67 #define _GRP2e 0x1B // Group 2e extended opcode
68 #define _GRP2f 0x1C // Group 2f extended opcode
69 #define _GRP3a 0x1D // Group 3a extended opcode
70 #define _GRP3b 0x1E // Group 3b extended opcode
71 #define _GRP4 0x1F // Group 4 extended opcode
72 #define _GRP5 0x20 // Group 5 extended opcode
73 #define _GRP6 0x21 // Group 6 extended opcode
74 #define _GRP7 0x22 // Group 7 extended opcode
75 #define _GRP8 0x23 // Group 8 extended opcode
76 #define _GRP9 0x24 // Group 9 extended opcode
77 
78 /******************************************************************************
79 *
80 * Addressing modes argument definiton for the opcodes in a table
81 *
82 ******************************************************************************/
83 #define _O 0x01
84 
85 #define _Ib 0x03
86 #define _Iv 0x04
87 #define _Iw 0x05
88 #define _Yb 0x06
89 #define _Yv 0x07
90 #define _Xb 0x08
91 #define _Xv 0x09
92 #define _Jb 0x0A
93 #define _Jv 0x0B
94 #define _Ap 0x0C
95 #define _1 0x10
96 #define _3 0x11
97 #define _DX 0x12
98 #define _AL 0x13
99 #define _AH 0x14
100 #define _BL 0x15
101 #define _BH 0x16
102 #define _CL 0x17
103 #define _CH 0x18
104 #define _DL 0x19
105 #define _DH 0x1A
106 #define _CS 0x1B
107 #define _DS 0x1C
108 #define _ES 0x1D
109 #define _SS 0x1E
110 #define _FS 0x1F
111 #define _GS 0x20
112 #define _eAX 0x21
113 #define _eCX 0x22
114 #define _eDX 0x23
115 #define _eBX 0x24
116 #define _eSP 0x25
117 #define _eBP 0x26
118 #define _eSI 0x27
119 #define _eDI 0x28
120 #define _Eb 0x2F
121 #define _Ev 0x30
122 #define _Ew 0x31
123 #define _Ep 0x32
124 #define _Gb 0x33
125 #define _Gv 0x34
126 #define _M 0x35
127 #define _Ma 0x36
128 #define _Mp 0x37
129 #define _Ms 0x38
130 #define _Mq 0x39
131 #define _Rd 0x3A
132 #define _Rw 0x3B
133 #define _Sw 0x3C
134 #define _Cd 0x3D
135 #define _Dd 0x3E
136 #define _Td 0x3F
137 #define _ST 0x40
138 #define _ST0 0x41
139 #define _ST1 0x42
140 #define _ST2 0x43
141 #define _ST3 0x44
142 #define _ST4 0x45
143 #define _ST5 0x46
144 #define _ST6 0x47
145 #define _ST7 0x48
146 #define _AX 0x49
147 
148 /******************************************************************************
149 *
150 * Define holding structure for opcode
151 *
152 ******************************************************************************/
153 
154 typedef struct
155 {
156  UCHAR name; // Index into the opcode name table
157  UCHAR args; // Number of addressing codes that follow
158  UCHAR dest; // Destination operand addressing code
159  UCHAR src; // Source operand addressing code
160  UCHAR thrid; // Third operand addressing code
161  UCHAR v_instruction; // Virtual instruction index
162  UCHAR access; // Instruction data access type
163  UCHAR flags; // Miscellaneous flags
164 } TOpcodeData;
165 
166 // `access' field:
167 // Data access flags are used with memory access instructions
168 
169 #define INSTR_READ 0x80 // Faulting instruction reads memory
170 #define INSTR_WRITE 0x40 // Faulting instruction writes to memory
171 #define INSTR_READ_WRITE 0x20 // Faulting instruction is read-modify-write
172 
173 // Low nibble contains the data length code - do not change these values as
174 // they represent the data width value as well
175 
176 #define INSTR_BYTE 0x01 // Byte access instruction
177 #define INSTR_WORD 0x02 // Word access instruction
178 #define INSTR_WORD_DWORD 0x03 // Word or dword, depending on operand size
179 #define INSTR_DWORD 0x04 // Dword access instruction
180 
181 // `flags' field:
182 // Disassembler flags; bottom 4 bits are used by the scanner flags
183 
184 #define DIS_SPECIAL 0x80 // Special opcode
185 #define DIS_NAME_FLAG 0x40 // Name changes
186 #define DIS_GETNAMEFLAG(flags) (((flags)>>6)&1)
187 #define DIS_COPROC 0x20 // Coprocessor instruction
188 #define DIS_MODRM 0x10 // Use additional Mod R/M byte
189 
190 // Scanner enums: 4 bits wide
191 
192 #define SCAN_NATIVE 0x0 // Native instruction are default 0
193 #define SCAN_JUMP 0x1 // Evaluate new path
194 #define SCAN_COND_JUMP 0x2 // Evaluate both paths
195 #define SCAN_TERMINATING 0x3 // Terminating instruction needs virtualization
196 #define SCAN_TERM_PMODE 0x4 // Terminating instruction in protected mode only
197 #define SCAN_SINGLE_STEP 0x5 // Single-step instruction
198 
199 // Define values stored in meta pages (bits [7:4])
200 
201 #define META_NATIVE 0x0 // Native instruction are default 0
202 #define META_UNDEF 0x1 // Undefined/illegal instruction
203 #define META_TERMINATING 0x2 // Terminating instruction
204 #define META_SINGLE_STEP 0x3 // Execute natively single step
205 
206 /******************************************************************************
207 * *
208 * Define opcode values for the main table *
209 * *
210 ******************************************************************************/
211 #define _aaa 0x001
212 #define _aad 0x002
213 #define _aam 0x003
214 #define _aas 0x004
215 #define _adc 0x005
216 #define _add 0x006
217 #define _and 0x007
218 #define _arpl 0x008
219 #define _bound 0x009
220 #define _bsf 0x00a
221 #define _bsr 0x00b
222 #define _bt 0x00c
223 #define _btc 0x00d
224 #define _btr 0x00e
225 #define _bts 0x00f
226 #define _call 0x010
227 #define _cbw 0x011
228 #define _cwde 0x012
229 #define _clc 0x013
230 #define _cld 0x014
231 #define _cli 0x015
232 #define _clts 0x016
233 #define _cmc 0x017
234 #define _cmp 0x018
235 #define _cmps 0x019
236 #define _cmpsb 0x01a
237 #define _cmpsw 0x01b
238 #define _cmpsd 0x01c
239 #define _cwd 0x01d
240 #define _cdq 0x01e
241 #define _daa 0x01f
242 #define _das 0x020
243 #define _dec 0x021
244 #define _div 0x022
245 #define _enter 0x023
246 #define _hlt 0x024
247 #define _idiv 0x025
248 #define _imul 0x026
249 #define _in 0x027
250 #define _inc 0x028
251 #define _ins 0x029
252 #define _insb 0x02a
253 #define _insw 0x02b
254 #define _insd 0x02c
255 #define _int 0x02d
256 #define _into 0x02e
257 #define _iret 0x02f
258 #define _iretd 0x030
259 #define _jo 0x031
260 #define _jno 0x032
261 #define _jb 0x033
262 #define _jnb 0x034
263 #define _jz 0x035
264 #define _jnz 0x036
265 #define _jbe 0x037
266 #define _jnbe 0x038
267 #define _js 0x039
268 #define _jns 0x03a
269 #define _jp 0x03b
270 #define _jnp 0x03c
271 #define _jl 0x03d
272 #define _jnl 0x03e
273 #define _jle 0x03f
274 #define _jnle 0x040
275 #define _jmp 0x041
276 #define _lahf 0x042
277 #define _lar 0x043
278 #define _lea 0x044
279 #define _leave 0x045
280 #define _lgdt 0x046
281 #define _lidt 0x047
282 #define _lgs 0x048
283 #define _lss 0x049
284 #define _lds 0x04a
285 #define _les 0x04b
286 #define _lfs 0x04c
287 #define _lldt 0x04d
288 #define _lmsw 0x04e
289 #define _lock 0x04f
290 #define _lods 0x050
291 #define _lodsb 0x051
292 #define _lodsw 0x052
293 #define _lodsd 0x053
294 #define _loop 0x054
295 #define _loope 0x055
296 #define _loopz 0x056
297 #define _loopne 0x057
298 #define _loopnz 0x058
299 #define _lsl 0x059
300 #define _ltr 0x05a
301 #define _mov 0x05b
302 #define _movs 0x05c
303 #define _movsb 0x05d
304 #define _movsw 0x05e
305 #define _movsd 0x05f
306 #define _movsx 0x060
307 #define _movzx 0x061
308 #define _mul 0x062
309 #define _neg 0x063
310 #define _nop 0x064
311 #define _not 0x065
312 #define _or 0x066
313 #define _out 0x067
314 #define _outs 0x068
315 #define _outsb 0x069
316 #define _outsw 0x06a
317 #define _outsd 0x06b
318 #define _pop 0x06c
319 #define _popa 0x06d
320 #define _popad 0x06e
321 #define _popf 0x06f
322 #define _popfd 0x070
323 #define _push 0x071
324 #define _pusha 0x072
325 #define _pushad 0x073
326 #define _pushf 0x074
327 #define _pushfd 0x075
328 #define _rcl 0x076
329 #define _rcr 0x077
330 #define _rol 0x078
331 #define _ror 0x079
332 #define _rep 0x07a
333 #define _repe 0x07b
334 #define _repz 0x07c
335 #define _repne 0x07d
336 #define _repnz 0x07e
337 #define _ret 0x07f
338 #define _sahf 0x080
339 #define _sal 0x081
340 #define _sar 0x082
341 #define _shl 0x083
342 #define _shr 0x084
343 #define _sbb 0x085
344 #define _scas 0x086
345 #define _scasb 0x087
346 #define _scasw 0x088
347 #define _scasd 0x089
348 #define _set 0x08a
349 #define _sgdt 0x08b
350 #define _sidt 0x08c
351 #define _shld 0x08d
352 #define _shrd 0x08e
353 #define _sldt 0x08f
354 #define _smsw 0x090
355 #define _stc 0x091
356 #define _std 0x092
357 #define _sti 0x093
358 #define _stos 0x094
359 #define _stosb 0x095
360 #define _stosw 0x096
361 #define _stosd 0x097
362 #define _str 0x098
363 #define _sub 0x099
364 #define _test 0x09a
365 #define _verr 0x09b
366 #define _verw 0x09c
367 #define _wait 0x09d
368 #define _xchg 0x09e
369 #define _xlat 0x09f
370 #define _xlatb 0x0a0
371 #define _xor 0x0a1
372 #define _jcxz 0x0a2
373 #define _loadall 0x0a3
374 #define _invd 0x0a4
375 #define _wbinv 0x0a5
376 #define _seto 0x0a6
377 #define _setno 0x0a7
378 #define _setb 0x0a8
379 #define _setnb 0x0a9
380 #define _setz 0x0aa
381 #define _setnz 0x0ab
382 #define _setbe 0x0ac
383 #define _setnbe 0x0ad
384 #define _sets 0x0ae
385 #define _setns 0x0af
386 #define _setp 0x0b0
387 #define _setnp 0x0b1
388 #define _setl 0x0b2
389 #define _setnl 0x0b3
390 #define _setle 0x0b4
391 #define _setnle 0x0b5
392 #define _wrmsr 0x0b6
393 #define _rdtsc 0x0b7
394 #define _rdmsr 0x0b8
395 #define _cpuid 0x0b9
396 #define _rsm 0x0ba
397 #define _cmpx 0x0bb
398 #define _xadd 0x0bc
399 #define _bswap 0x0bd
400 #define _invpg 0x0be
401 #define _cmpx8 0x0bf
402 #define _jmpf 0x0c0
403 #define _retf 0x0c1
404 #define _rdpmc 0x0c2
405 
406 #define _f2xm1 0x001
407 #define _fabs 0x002
408 #define _fadd 0x003
409 #define _faddp 0x004
410 #define _fbld 0x005
411 #define _fbstp 0x006
412 #define _fchs 0x007
413 #define _fclex 0x008
414 #define _fcom 0x009
415 #define _fcomp 0x00a
416 #define _fcompp 0x00b
417 #define _fcos 0x00c
418 #define _fdecstp 0x00d
419 #define _fdiv 0x00e
420 #define _fdivp 0x00f
421 #define _fdivr 0x010
422 #define _fdivrp 0x011
423 #define _ffree 0x012
424 #define _fiadd 0x013
425 #define _ficom 0x014
426 #define _ficomp 0x015
427 #define _fidiv 0x016
428 #define _fidivr 0x017
429 #define _fild 0x018
430 #define _fimul 0x019
431 #define _fincstp 0x01a
432 #define _finit 0x01b
433 #define _fist 0x01c
434 #define _fistp 0x01d
435 #define _fisub 0x01e
436 #define _fisubr 0x01f
437 #define _fld 0x020
438 #define _fld1 0x021
439 #define _fldcw 0x022
440 #define _fldenv 0x023
441 #define _fldl2e 0x024
442 #define _fldl2t 0x025
443 #define _fldlg2 0x026
444 #define _fldln2 0x027
445 #define _fldpi 0x028
446 #define _fldz 0x029
447 #define _fmul 0x02a
448 #define _fmulp 0x02b
449 #define _fnop 0x02c
450 #define _fpatan 0x02d
451 #define _fprem 0x02e
452 #define _fprem1 0x02f
453 #define _fptan 0x030
454 #define _frndint 0x031
455 #define _frstor 0x032
456 #define _fsave 0x033
457 #define _fscale 0x034
458 #define _fsin 0x035
459 #define _fsincos 0x036
460 #define _fsqrt 0x037
461 #define _fst 0x038
462 #define _fstcw 0x039
463 #define _fstenv 0x03a
464 #define _fstp 0x03b
465 #define _fstsw 0x03c
466 #define _fsub 0x03d
467 #define _fsubp 0x03e
468 #define _fsubr 0x03f
469 #define _fsubrp 0x040
470 #define _ftst 0x041
471 #define _fucom 0x042
472 #define _fucomp 0x043
473 #define _fucompp 0x044
474 #define _fxam 0x045
475 #define _fxch 0x046
476 #define _fxtract 0x047
477 #define _fyl2x 0x048
478 #define _fyl2xp1 0x049
479 
480 /******************************************************************************
481 *
482 * External data and strings
483 *
484 ******************************************************************************/
485 extern char* sNames[];
486 extern char* sCoprocNames[];
487 extern TOpcodeData Op1[ 256 ];
488 extern TOpcodeData Op2[ 256 ];
489 extern TOpcodeData Groups[ 17 ][ 8 ];
490 extern TOpcodeData Coproc1[ 8 ][ 8 ];
491 extern TOpcodeData Coproc2[ 8 ][ 16 * 4 ];
492 extern char *sBytePtr;
493 extern char *sWordPtr;
494 extern char *sDwordPtr;
495 extern char *sFwordPtr;
496 extern char *sQwordPtr;
497 extern char *sGenReg16_32[ 2 ][ 8 ];
498 extern char *sSeg[ 8 ];
499 extern char *sSegOverride[ 8 ];
500 extern char *sSegOverrideDefaultES[ 8 ];
501 extern char *sSegOverrideDefaultDS[ 8 ];
502 extern char *sScale[ 4 ];
503 extern char *sAdr1[ 2 ][ 8 ];
504 extern char *sRegs1[ 2 ][ 2 ][ 8 ];
505 extern char *sRegs2[];
506 extern char *sControl[ 8 ];
507 extern char *sDebug[ 8 ];
508 extern char *sTest[ 8 ];
509 extern char *sYptr[ 2 ];
510 extern char *sXptr[ 2 ];
511 extern char *sRep[ 4 ];
512 extern char *sST[ 9 ];
513 
514 
515 #endif // _DDEF_H_
char * sWordPtr
char * sRegs1[2][2][8]
char * sBytePtr
char * sCoprocNames[]
TOpcodeData Groups[17][8]
char * sSeg[8]
TOpcodeData Op1[256]
char * sFwordPtr
char * sSegOverride[8]
char * sTest[8]
char * sRegs2[]
char * sGenReg16_32[2][8]
char * sDebug[8]
char * sSegOverrideDefaultDS[8]
TOpcodeData Coproc1[8][8]
char * sSegOverrideDefaultES[8]
char * sQwordPtr
char * sRep[4]
char * sNames[]
char * sDwordPtr
unsigned char UCHAR
Definition: xmlstorage.h:181
char * sControl[8]
char * sST[9]
TOpcodeData Coproc2[8][16 *4]
char * sAdr1[2][8]
char * sYptr[2]
TOpcodeData Op2[256]
char * sScale[4]
char * sXptr[2]