X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=misc%2Fdecoder_test%2FXED2%2Fdoc%2Fhtml%2Fxed-decoded-inst_8h-source.html;fp=misc%2Fdecoder_test%2FXED2%2Fdoc%2Fhtml%2Fxed-decoded-inst_8h-source.html;h=8a3bd5f701a71686a70304a081ca3b858084cb97;hp=0000000000000000000000000000000000000000;hb=ddc16b0737cf58f7aa90a69c6652cdf4090aec51;hpb=626595465a2c6987606a6bc697df65130ad8c2d3 diff --git a/misc/decoder_test/XED2/doc/html/xed-decoded-inst_8h-source.html b/misc/decoder_test/XED2/doc/html/xed-decoded-inst_8h-source.html new file mode 100644 index 0000000..8a3bd5f --- /dev/null +++ b/misc/decoder_test/XED2/doc/html/xed-decoded-inst_8h-source.html @@ -0,0 +1,329 @@ + +
+00001 /*BEGIN_LEGAL +00002 Copyright (c) 2007, Intel Corp. +00003 All rights reserved. +00004 +00005 Redistribution and use in source and binary forms, with or without +00006 modification, are permitted provided that the following conditions are +00007 met: +00008 +00009 * Redistributions of source code must retain the above copyright +00010 notice, this list of conditions and the following disclaimer. +00011 +00012 * Redistributions in binary form must reproduce the above +00013 copyright notice, this list of conditions and the following +00014 disclaimer in the documentation and/or other materials provided +00015 with the distribution. +00016 +00017 * Neither the name of Intel Corporation nor the names of its +00018 contributors may be used to endorse or promote products derived +00019 from this software without specific prior written permission. +00020 +00021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +00022 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +00023 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +00024 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +00025 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +00026 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +00027 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +00028 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +00029 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +00030 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +00031 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +00032 END_LEGAL */ +00035 +00036 #if !defined(_XED_DECODER_STATE_H_) +00037 # define _XED_DECODER_STATE_H_ +00038 #include "xed-common-hdrs.h" +00039 #include "xed-common-defs.h" +00040 #include "xed-portability.h" +00041 #include "xed-util.h" +00042 #include "xed-types.h" +00043 #include "xed-operand-values-interface.h" +00044 #include "xed-inst.h" +00045 #include "xed-flags.h" +00046 #include "xed-encoder-gen-defs.h" //generated +00047 +00048 +00049 // fwd-decl xed_simple_flag_t; +00050 // fwd-decl xed_inst_t; +00051 +00052 +00053 struct xed_encoder_vars_s; +00054 struct xed_decoder_vars_s; +00055 +00061 typedef struct XED_DLL_EXPORT xed_decoded_inst_s { +00063 xed_operand_values_t _operands[XED_OPERAND_LAST]; // FIXME: can further squeeze down 16b units +00064 +00066 xed_uint8_t _operand_order[XED_ENCODE_ORDER_MAX_OPERANDS]; +00067 +00068 xed_uint8_t _decoded_length; +00069 // Length of the _operand_order[] array. +00070 xed_uint8_t _n_operand_order; +00071 +00075 const xed_inst_t* _inst; +00076 +00077 // decoder does not change it, encoder does +00078 union { +00079 xed_uint8_t* _enc; +00080 const xed_uint8_t* _dec; +00081 } _byte_array; +00082 +00083 // These are stack allocated by xed_encode() or xed_decode(). These are +00084 // per-encode or per-decode transitory data. +00085 union { +00086 +00087 /* user_data is available as a user data storage field after +00088 * decoding. It does not live across re-encodes or re-decodes. */ +00089 xed_uint64_t user_data; +00090 struct xed_decoder_vars_s* dv; +00091 struct xed_encoder_vars_s* ev; +00092 } u; +00093 +00094 +00095 +00096 } xed_decoded_inst_t; +00097 +00098 +00099 +00101 +00102 +00103 +00104 static XED_INLINE const xed_operand_values_t* +00105 xed_decoded_inst_operands_const(const xed_decoded_inst_t* p) { +00106 return STATIC_CAST(xed_operand_values_t*,p->_operands); +00107 } +00110 static XED_INLINE xed_operand_values_t* +00111 xed_decoded_inst_operands(xed_decoded_inst_t* p) { +00112 return STATIC_CAST(xed_operand_values_t*,p->_operands); +00113 } +00115 +00117 +00118 +00119 +00120 XED_DLL_EXPORT void xed_decoded_inst_zero_set_mode(xed_decoded_inst_t* p, const xed_state_t* dstate); +00123 XED_DLL_EXPORT void xed_decoded_inst_zero_keep_mode(xed_decoded_inst_t* p); +00126 XED_DLL_EXPORT void xed_decoded_inst_zero(xed_decoded_inst_t* p); +00129 XED_DLL_EXPORT void xed_decoded_inst_zero_keep_mode_from_operands(xed_decoded_inst_t* p, +00130 const xed_operand_values_t* operands); +00132 +00134 +00135 +00136 +00137 static XED_INLINE xed_uint_t +00138 xed_decoded_inst_get_length(const xed_decoded_inst_t* p) { +00139 return p->_decoded_length; +00140 } +00141 +00142 +00144 +00146 +00147 +00148 static XED_INLINE xed_uint_t xed_decoded_inst_get_mode(const xed_decoded_inst_t* p) { +00149 return p->_operands[XED_OPERAND_MODE]; +00150 } +00152 static XED_INLINE xed_uint_t xed_decoded_inst_get_address_mode(const xed_decoded_inst_t* p) { +00153 return p->_operands[XED_OPERAND_AMODE]; +00154 } +00156 static XED_INLINE xed_uint_t xed_decoded_inst_get_stack_address_mode(const xed_decoded_inst_t* p) { +00157 return p->_operands[XED_OPERAND_SMODE]; +00158 } +00160 +00161 +00165 +00167 +00168 +00169 +00170 static XED_INLINE xed_bool_t xed_decoded_inst_valid(const xed_decoded_inst_t* p ) { +00171 return STATIC_CAST(xed_bool_t,(p->_inst != 0)); +00172 } +00175 static XED_INLINE const xed_inst_t* xed_decoded_inst_inst( const xed_decoded_inst_t* p) { +00176 return p->_inst; +00177 } +00178 +00179 +00182 static XED_INLINE xed_category_enum_t xed_decoded_inst_get_category(const xed_decoded_inst_t* p) { +00183 xed_assert(p->_inst != 0); +00184 return xed_inst_category(p->_inst); +00185 } +00188 static XED_INLINE xed_extension_enum_t xed_decoded_inst_get_extension( const xed_decoded_inst_t* p) { +00189 xed_assert(p->_inst != 0); +00190 return xed_inst_extension(p->_inst); +00191 } +00194 static XED_INLINE xed_iclass_enum_t xed_decoded_inst_get_iclass( const xed_decoded_inst_t* p){ +00195 xed_assert(p->_inst != 0); +00196 return xed_inst_iclass(p->_inst); +00197 } +00198 +00201 XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_get_attribute(const xed_decoded_inst_t* p, xed_attribute_enum_t attr); +00202 +00205 XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_get_attributes(const xed_decoded_inst_t* p); +00207 +00209 +00210 +00213 static XED_INLINE xed_iform_enum_t xed_decoded_inst_get_iform_enum(const xed_decoded_inst_t* p) { +00214 xed_assert(p->_inst != 0); +00215 return xed_inst_iform_enum(p->_inst); +00216 } +00217 +00218 +00224 static XED_INLINE unsigned int xed_decoded_inst_get_iform_enum_dispatch(const xed_decoded_inst_t* p) { +00225 xed_assert(p->_inst != 0); +00226 return xed_inst_iform_enum(p->_inst) & 0xFF; +00227 } +00228 +00233 XED_DLL_EXPORT xed_uint32_t xed_iform_max_per_iclass(xed_iclass_enum_t iclass); +00234 +00235 #define XED_MASK_IFORM(x) ((x) & 0xFF) +00236 +00240 static XED_INLINE xed_uint_t xed_decoded_inst_get_old_iform( const xed_decoded_inst_t* p){ +00241 xed_assert(p->_inst != 0); +00242 return xed_inst_iform(p->_inst); +00243 } +00244 +00246 +00247 +00248 +00250 +00251 +00252 +00253 XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_length(const xed_decoded_inst_t* p, +00254 unsigned int operand_index); +00257 static XED_INLINE unsigned int xed_decoded_inst_noperands(const xed_decoded_inst_t* p) { +00258 unsigned int noperands = xed_inst_noperands(xed_decoded_inst_inst(p)); +00259 return noperands; +00260 } +00262 +00264 +00265 +00266 +00267 XED_DLL_EXPORT void xed_decoded_inst_dump(const xed_decoded_inst_t* p, char* buf, int buflen); +00268 +00277 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_intel_format(const xed_decoded_inst_t* p, +00278 char* buf, +00279 int buflen, +00280 xed_uint64_t runtime_address); +00290 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_intel_format_context(const xed_decoded_inst_t* p, +00291 char* buf, +00292 int buflen, +00293 xed_uint64_t runtime_address, +00294 void* context); +00295 +00308 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_att_format(const xed_decoded_inst_t* p, +00309 char* buf, +00310 int buflen, +00311 xed_uint64_t runtime_address); +00312 +00325 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_att_format_context(const xed_decoded_inst_t* p, +00326 char* buf, +00327 int buflen, +00328 xed_uint64_t runtime_address, +00329 void* context); +00330 +00337 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_xed_format(const xed_decoded_inst_t* p, +00338 char* buf, +00339 int buflen, xed_uint64_t runtime_address) ; +00341 +00343 +00344 +00345 XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_seg_reg(const xed_decoded_inst_t* p, unsigned int mem_idx); +00347 XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_base_reg(const xed_decoded_inst_t* p, unsigned int mem_idx); +00348 XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_index_reg(const xed_decoded_inst_t* p, unsigned int mem_idx); +00350 XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_scale(const xed_decoded_inst_t* p, unsigned int mem_idx); +00352 XED_DLL_EXPORT xed_int64_t xed_decoded_inst_get_memory_displacement(const xed_decoded_inst_t* p, unsigned int mem_idx); +00355 XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_memory_displacement_width(const xed_decoded_inst_t* p, unsigned int mem_idx); +00358 XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_memory_displacement_width_bits(const xed_decoded_inst_t* p, unsigned int mem_idx); +00360 XED_DLL_EXPORT xed_int32_t xed_decoded_inst_get_branch_displacement(const xed_decoded_inst_t* p); +00363 XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_branch_displacement_width(const xed_decoded_inst_t* p); +00366 XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_branch_displacement_width_bits(const xed_decoded_inst_t* p); +00368 XED_DLL_EXPORT xed_uint64_t xed_decoded_inst_get_unsigned_immediate(const xed_decoded_inst_t* p); +00371 XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_is_signed(const xed_decoded_inst_t* p); +00374 XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_width(const xed_decoded_inst_t* p); +00377 XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_width_bits(const xed_decoded_inst_t* p); +00379 XED_DLL_EXPORT xed_int32_t xed_decoded_inst_get_signed_immediate(const xed_decoded_inst_t* p); +00382 static XED_INLINE xed_uint8_t xed_decoded_inst_get_second_immediate(const xed_decoded_inst_t* p) { +00383 return STATIC_CAST(xed_uint8_t,p->_operands[XED_OPERAND_UIMM1]); +00384 } +00385 +00388 static XED_INLINE xed_reg_enum_t xed_decoded_inst_get_reg(const xed_decoded_inst_t* p, +00389 xed_operand_enum_t reg_operand) { +00390 return STATIC_CAST(xed_reg_enum_t,p->_operands[reg_operand]); +00391 } +00392 +00393 +00394 +00396 XED_DLL_EXPORT const xed_simple_flag_t* xed_decoded_inst_get_rflags_info( const xed_decoded_inst_t* p ); +00398 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_uses_rflags(const xed_decoded_inst_t* p); +00400 XED_DLL_EXPORT xed_uint_t xed_decoded_inst_number_of_memory_operands(const xed_decoded_inst_t* p); +00402 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_read(const xed_decoded_inst_t* p, unsigned int mem_idx); +00404 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_written(const xed_decoded_inst_t* p, unsigned int mem_idx); +00406 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_written_only(const xed_decoded_inst_t* p, unsigned int mem_idx); +00408 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_conditionally_writes_registers(const xed_decoded_inst_t* p); +00410 XED_DLL_EXPORT unsigned int xed_decoded_inst_get_memory_operand_length(const xed_decoded_inst_t* p, +00411 unsigned int memop_idx); +00412 +00413 +00416 XED_DLL_EXPORT xed_bool_t xed_decoded_inst_is_prefetch(const xed_decoded_inst_t* p); +00418 +00419 +00421 +00422 // Modifying decoded instructions before re-encoding +00424 XED_DLL_EXPORT void xed_decoded_inst_set_scale(xed_decoded_inst_t* p, xed_uint_t scale); +00427 XED_DLL_EXPORT void xed_decoded_inst_set_memory_displacement(xed_decoded_inst_t* p, xed_int64_t disp, xed_uint_t length_bytes); +00430 XED_DLL_EXPORT void xed_decoded_inst_set_branch_displacement(xed_decoded_inst_t* p, xed_int32_t disp, xed_uint_t length_bytes); +00433 XED_DLL_EXPORT void xed_decoded_inst_set_immediate_signed(xed_decoded_inst_t* p, xed_int32_t x, xed_uint_t length_bytes); +00436 XED_DLL_EXPORT void xed_decoded_inst_set_immediate_unsigned(xed_decoded_inst_t* p, xed_uint64_t x, xed_uint_t length_bytes); +00437 +00438 +00441 XED_DLL_EXPORT void xed_decoded_inst_set_memory_displacement_bits(xed_decoded_inst_t* p, xed_int64_t disp, xed_uint_t length_bits); +00444 XED_DLL_EXPORT void xed_decoded_inst_set_branch_displacement_bits(xed_decoded_inst_t* p, xed_int32_t disp, xed_uint_t length_bits); +00447 XED_DLL_EXPORT void xed_decoded_inst_set_immediate_signed_bits(xed_decoded_inst_t* p, xed_int32_t x, xed_uint_t length_bits); +00450 XED_DLL_EXPORT void xed_decoded_inst_set_immediate_unsigned_bits(xed_decoded_inst_t* p, xed_uint64_t x, xed_uint_t length_bits); +00451 +00453 +00455 +00456 +00457 +00458 static XED_INLINE xed_uint64_t xed_decoded_inst_get_user_data(xed_decoded_inst_t* p) { +00459 return p->u.user_data; +00460 } +00463 static XED_INLINE void xed_decoded_inst_set_user_data(xed_decoded_inst_t* p, xed_uint64_t new_value) { +00464 p->u.user_data = new_value; +00465 } +00467 #endif +00468 //Local Variables: +00469 //pref: "../../xed-decoded-inst.c" +00470 //End: +