OSDN Git Service

*** empty log message ***
[drdeamon64/drdeamon64.git] / libintel64asm / drd64_intel64_disasm.h
1 /*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
2
3                          D r . D e a m o n  6 4
4                         for INTEL64(R), AMD64(R)
5         
6    Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10
11  1. Redistributions of source code must retain the above copyright notice,
12     this list of conditions and the following disclaimer.
13  2. Redistributions in binary form must reproduce the above copyright
14     notice, this list of conditions and the following disclaimer in the
15     documentation and/or other materials provided with the distribution.
16
17 THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
30
31 /* File Info -----------------------------------------------------------
32 File: drd64_intel64_disasm.h
33 Function: Intel64 DisAssembler Main Module Header 
34 Comment:  none
35 ----------------------------------------------------------------------*/
36
37 #ifndef DRD64_HEADER_INTEL64_DISASM
38 #define DRD64_HEADER_INTEL64_DISASM
39
40 #include"drd64_intel64_dbtype.h"
41 #include"drd64_intel64_db.h"
42 #include"drd64_intel64_asm.h"
43
44 typedef struct  {
45         unsigned        rm              : 3;
46         unsigned        reg             : 3;
47         unsigned        mod             : 2;
48 } __attribute((packed)) ModRM;
49
50 typedef struct  {
51         unsigned        base    : 3;
52         unsigned        index   : 3;
53         unsigned        scale   : 2;
54 } __attribute((packed)) SIB;
55
56 typedef struct  {
57         unsigned        b               : 1;
58         unsigned        x               : 1;
59         unsigned        r               : 1;
60         unsigned        w               : 1;
61         unsigned        head    : 4;
62 } __attribute((packed)) REX;
63
64
65 typedef struct  {
66         /* Prefix Data */
67         int             i_prefixes;
68         Byte    b_prefix[4];
69         /* REX Data */
70         union   {
71                 REX             rex;
72                 Byte    b_rex;
73         } rex;
74         /* Opecode Data */
75         int             i_opcodes;
76         Byte    b_opcode[3];
77         Byte    b_codetype;
78         /* ModR/M Data */       
79         Byte    b_modtype;
80         Byte    b_regtype;
81         Byte    b_rmtype;
82         int             i_modrm_bytes;
83         union   {
84                 ModRM   modrm;
85                 Byte    b_modrm;
86         } modrm;
87         /* SIB Data */
88         int             i_sib_bytes;
89         union   {
90                 SIB             sib;
91                 Byte    b_sib;
92         } sib;
93         /* Displacement */
94         Value   v_disp;
95         /* Immediate */
96         Value   v_imm;
97                 
98         int             i_num;
99         Byte    b_bits;
100         int             i_operands;
101         /* Instruction */
102         char    str_instruction[MAX_INSTRUCTION];
103         /* Operand Information */
104         int             i_operandsize;
105         int             i_addresssize;
106
107         /* Destination Operand */
108         Word    w_desttype;
109         Word    w_destsize;     
110         int             i_destsize;
111         char    str_destination[MAX_OPERAND];
112         /* Source Operand */
113         Word    w_srctype;
114         Word    w_srcsize;
115         int             i_srcsize;
116         char    str_source[MAX_OPERAND];
117         /* Option Operand */
118         Word    w_optiontype;
119         Word    w_optionsize;
120         int             i_optionsize;
121         char    str_option[MAX_OPERAND];
122         
123         Byte    b_duplicationflag;
124 } Drd64_Intel64_AnalyzePacket;
125
126
127 #endif  /* DRD64_HEADER_INTEL64_DISASM */
128
129 /* EOF of drd64_intel64_disasm.h --------------------------------- */