1 /******************************************************************************
3 * Module: disassemblerdefines.h *
9 * Copyright (c) 2000 Goran Devic *
11 * Author: Goran Devic *
13 *******************************************************************************
17 This is a header file containing the disassembler defines that are
18 used in DisassemblerData.h
20 *******************************************************************************
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 *******************************************************************************
31 ******************************************************************************/
35 /******************************************************************************
37 * Groups and special codes in place of name index
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
78 /******************************************************************************
80 * Addressing modes argument definiton for the opcodes in a table
82 ******************************************************************************/
148 /******************************************************************************
150 * Define holding structure for opcode
152 ******************************************************************************/
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
167 // Data access flags are used with memory access instructions
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
173 // Low nibble contains the data length code - do not change these values as
174 // they represent the data width value as well
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
182 // Disassembler flags; bottom 4 bits are used by the scanner flags
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
190 // Scanner enums: 4 bits wide
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
199 // Define values stored in meta pages (bits [7:4])
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
206 /******************************************************************************
208 * Define opcode values for the main table *
210 ******************************************************************************/
297 #define _loopne 0x057
298 #define _loopnz 0x058
325 #define _pushad 0x073
327 #define _pushfd 0x075
373 #define _loadall 0x0a3
383 #define _setnbe 0x0ad
391 #define _setnle 0x0b5
416 #define _fcompp 0x00b
418 #define _fdecstp 0x00d
422 #define _fdivrp 0x011
426 #define _ficomp 0x015
428 #define _fidivr 0x017
431 #define _fincstp 0x01a
436 #define _fisubr 0x01f
440 #define _fldenv 0x023
441 #define _fldl2e 0x024
442 #define _fldl2t 0x025
443 #define _fldlg2 0x026
444 #define _fldln2 0x027
450 #define _fpatan 0x02d
452 #define _fprem1 0x02f
454 #define _frndint 0x031
455 #define _frstor 0x032
457 #define _fscale 0x034
459 #define _fsincos 0x036
463 #define _fstenv 0x03a
469 #define _fsubrp 0x040
472 #define _fucomp 0x043
473 #define _fucompp 0x044
476 #define _fxtract 0x047
478 #define _fyl2xp1 0x049
480 /******************************************************************************
482 * External data and strings
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 ];