Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Release 1.0
[palacios.git] / misc / decoder_test / XED2 / include / xed-inst-printer.h
1 /*BEGIN_LEGAL 
2 Intel Open Source License 
3
4 Copyright (c) 2002-2007 Intel Corporation 
5 All rights reserved. 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are
8 met:
9
10 Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.  Redistributions
12 in binary form must reproduce the above copyright notice, this list of
13 conditions and the following disclaimer in the documentation and/or
14 other materials provided with the distribution.  Neither the name of
15 the Intel Corporation nor the names of its contributors may be used to
16 endorse or promote products derived from this software without
17 specific prior written permission.
18  
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
23 ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 END_LEGAL */
31 /// @file xed-inst-printer.h 
32 /// @author Mark Charney   <mark.charney@intel.com> 
33
34
35 #ifndef _XED_INST_PRINTER_H_
36 # define _XED_INST_PRINTER_H_
37 #include "xed-types.h"
38 #include "xed-decoded-inst.h"
39 #include "xed-syntax-enum.h"
40
41 /// @name Legacy printers without context parameter
42 //@{
43 /// Disassemble the decoded instruction using the ATT SYSV syntax. The
44 /// output buffer must be at least 16 bytes long. Returns true if
45 /// disassembly proceeded without errors.
46 /// @param xedd a #xed_decoded_inst_t for a decoded instruction
47 /// @param out_buffer a buffer to write the disassembly in to.
48 /// @param buffer_len maximum length of the disassembly buffer
49 /// @param runtime_instruction_address the address of the instruction being disassembled
50 /// @return Returns 0 if the disassembly fails, 1 otherwise.
51 ///@ingroup PRINT
52 XED_DLL_EXPORT xed_bool_t
53 xed_format_att(xed_decoded_inst_t* xedd,
54                char* out_buffer,
55                xed_uint32_t buffer_len,
56                xed_uint64_t runtime_instruction_address);
57
58 /// Disassemble the decoded instruction using the Intel syntax. The
59 /// output buffer must be at least 16 bytes long. Returns true if
60 /// disassembly proceeded without errors.
61 /// @param xedd a #xed_decoded_inst_t for a decoded instruction
62 /// @param out_buffer a buffer to write the disassembly in to.
63 /// @param buffer_len maximum length of the disassembly buffer
64 /// @param runtime_instruction_address the address of the instruction being disassembled
65 /// @return Returns 0 if the disassembly fails, 1 otherwise.
66 ///@ingroup PRINT
67 XED_DLL_EXPORT xed_bool_t
68 xed_format_intel(xed_decoded_inst_t* xedd,
69                  char* out_buffer,
70                  xed_uint32_t buffer_len,
71                  xed_uint64_t runtime_instruction_address);
72
73 /// Disassemble the decoded instruction using the XED syntax providing all
74 /// operand resources (implicit, explicit, suppressed). The output buffer
75 /// must be at least 25 bytes long. Returns true if disassembly proceeded
76 /// without errors. 
77 /// @param xedd a #xed_decoded_inst_t for a decoded instruction
78 /// @param out_buffer a buffer to write the disassembly in to.
79 /// @param buffer_len maximum length of the disassembly buffer
80 /// @param runtime_instruction_address the address of the instruction being disassembled
81 /// @return Returns 0 if the disassembly fails, 1 otherwise.
82 ///@ingroup PRINT
83 XED_DLL_EXPORT xed_bool_t
84 xed_format_xed(xed_decoded_inst_t* xedd,
85                char* out_buffer,
86                xed_uint32_t buffer_len,
87                xed_uint64_t runtime_instruction_address);
88
89
90 /// Disassemble the decoded instruction using the specified syntax.
91 /// The output buffer must be at least 25 bytes long. Returns true if
92 /// disassembly proceeded without errors.
93 /// @param syntax a #xed_syntax_enum_t the specifies the disassembly format
94 /// @param xedd a #xed_decoded_inst_t for a decoded instruction
95 /// @param out_buffer a buffer to write the disassembly in to.
96 /// @param buffer_len maximum length of the disassembly buffer
97 /// @param runtime_instruction_address the address of the instruction being disassembled
98 /// @return Returns 0 if the disassembly fails, 1 otherwise.
99 ///@ingroup PRINT
100 XED_DLL_EXPORT xed_bool_t
101 xed_format(xed_syntax_enum_t syntax,
102            xed_decoded_inst_t* xedd,
103            char* out_buffer,
104            int  buffer_len,
105            xed_uint64_t runtime_instruction_address);
106
107
108 //@}
109 //////////////////////////////////////////////////////////////////////////
110
111
112 /// @name Printers with context parameter
113 //@{
114 /// Disassemble the decoded instruction using the ATT SYSV syntax. The
115 /// output buffer must be at least 16 bytes long. Returns true if
116 /// disassembly proceeded without errors.
117 /// @param xedd a #xed_decoded_inst_t for a decoded instruction
118 /// @param out_buffer a buffer to write the disassembly in to.
119 /// @param buffer_len maximum length of the disassembly buffer
120 /// @param runtime_instruction_address the address of the instruction being disassembled
121 /// @param context A void* used only for the call back routine for symbolic disassembly if one is registered.
122 /// @return Returns 0 if the disassembly fails, 1 otherwise.
123 ///@ingroup PRINT
124 XED_DLL_EXPORT xed_bool_t
125 xed_format_att_context(xed_decoded_inst_t* xedd,
126                        char* out_buffer,
127                        xed_uint32_t buffer_len,
128                        xed_uint64_t runtime_instruction_address,
129                        void* context);
130
131 /// Disassemble the decoded instruction using the Intel syntax. The
132 /// output buffer must be at least 16 bytes long. Returns true if
133 /// disassembly proceeded without errors.
134 /// @param xedd a #xed_decoded_inst_t for a decoded instruction
135 /// @param out_buffer a buffer to write the disassembly in to.
136 /// @param buffer_len maximum length of the disassembly buffer
137 /// @param runtime_instruction_address the address of the instruction being disassembled
138 /// @param context A void* used only for the call back routine for symbolic disassembly if one is registered.
139 /// @return Returns 0 if the disassembly fails, 1 otherwise.
140 ///@ingroup PRINT
141 XED_DLL_EXPORT xed_bool_t
142 xed_format_intel_context(xed_decoded_inst_t* xedd,
143                          char* out_buffer,
144                          xed_uint32_t buffer_len,
145                          xed_uint64_t runtime_instruction_address,
146                          void* context);
147
148
149 /// Disassemble the decoded instruction using the specified syntax.
150 /// The output buffer must be at least 25 bytes long. Returns true if
151 /// disassembly proceeded without errors.
152 /// @param syntax a #xed_syntax_enum_t the specifies the disassembly format
153 /// @param xedd a #xed_decoded_inst_t for a decoded instruction
154 /// @param out_buffer a buffer to write the disassembly in to.
155 /// @param buffer_len maximum length of the disassembly buffer
156 /// @param runtime_instruction_address the address of the instruction being disassembled
157 /// @param context A void* used only for the call back routine for symbolic disassembly if one is registered.
158 /// @return Returns 0 if the disassembly fails, 1 otherwise.
159 ///@ingroup PRINT
160 XED_DLL_EXPORT xed_bool_t
161 xed_format_context(xed_syntax_enum_t syntax,
162                    xed_decoded_inst_t* xedd,
163                    char* out_buffer,
164                    int  buffer_len,
165                    xed_uint64_t runtime_instruction_address,
166                    void* context);
167 //@}
168 #endif
169 ////////////////////////////////////////////////////////////////////////////
170 //Local Variables:
171 //pref: "../../xed-inst-printer.c"
172 //End: