00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00032
00033
00034 #ifndef _XED_ENCODE_H_
00035 # define _XED_ENCODE_H_
00036 #include "xed-common-hdrs.h"
00037 #include "xed-types.h"
00038 #include "xed-error-enum.h"
00039 #include "xed-operand-values-interface.h"
00040 #include "xed-operand-width-enum.h"
00041 #include "xed-encoder-iforms.h"
00042 #include "xed-encoder-gen-defs.h"
00043
00044
00045 #include "xed-decoded-inst.h"
00046
00047
00048
00049
00051 typedef struct xed_decoded_inst_s xed_encoder_request_s;
00053 typedef xed_decoded_inst_t xed_encoder_request_t;
00054
00055
00057 XED_DLL_EXPORT xed_iclass_enum_t
00058 xed_encoder_request_get_iclass( const xed_encoder_request_t* p);
00059
00061
00062
00064 XED_DLL_EXPORT void
00065 xed_encoder_request_set_iclass( xed_encoder_request_t* p,
00066 xed_iclass_enum_t iclass);
00067
00069
00070
00071
00072 XED_DLL_EXPORT void xed_encoder_request_set_lock(xed_encoder_request_t* p);
00075 XED_DLL_EXPORT void xed_encoder_request_set_repne(xed_encoder_request_t* p);
00078 XED_DLL_EXPORT void xed_encoder_request_set_rep(xed_encoder_request_t* p);
00081 XED_DLL_EXPORT void xed_encoder_request_clear_rep(xed_encoder_request_t* p);
00083
00085
00086
00087 XED_DLL_EXPORT void xed_encoder_request_set_effective_operand_width( xed_encoder_request_t* p,
00088 xed_uint_t width_bits);
00090 XED_DLL_EXPORT void xed_encoder_request_set_effective_address_size( xed_encoder_request_t* p,
00091 xed_uint_t width_bits);
00099 XED_DLL_EXPORT void xed_encoder_request_set_reg(xed_encoder_request_t* p,
00100 xed_operand_enum_t operand,
00101 xed_reg_enum_t reg);
00103
00105
00106
00119 XED_DLL_EXPORT void xed_encoder_request_set_operand_order(xed_encoder_request_t* p,
00120 xed_uint_t operand_index,
00121 xed_operand_enum_t name);
00122
00130 XED_DLL_EXPORT xed_operand_enum_t xed_encoder_request_get_operand_order(xed_encoder_request_t* p,
00131 xed_uint_t operand_index);
00132
00133
00137 static XED_INLINE
00138 xed_uint_t xed_encoder_request_operand_order_entries(xed_encoder_request_t* p) {
00139 return p->_n_operand_order;
00140 }
00141
00143
00144
00146
00147
00148 XED_DLL_EXPORT void xed_encoder_request_set_relbr(xed_encoder_request_t* p);
00150 XED_DLL_EXPORT void xed_encoder_request_set_branch_displacement(xed_encoder_request_t* p,
00151 xed_int32_t brdisp,
00152 xed_uint_t nbytes);
00154 XED_DLL_EXPORT void xed_encoder_request_set_ptr(xed_encoder_request_t* p);
00156
00157
00159
00160
00161
00162 XED_DLL_EXPORT void xed_encoder_request_set_uimm0(xed_encoder_request_t* p,
00163 xed_uint64_t uimm,
00164 xed_uint_t nbytes);
00167 XED_DLL_EXPORT void xed_encoder_request_set_uimm0_bits(xed_encoder_request_t* p,
00168 xed_uint64_t uimm,
00169 xed_uint_t nbits);
00171 XED_DLL_EXPORT void xed_encoder_request_set_uimm1(xed_encoder_request_t* p,
00172 xed_uint8_t uimm);
00175 XED_DLL_EXPORT void xed_encoder_request_set_simm(xed_encoder_request_t* p,
00176 xed_int32_t simm,
00177 xed_uint_t nbytes);
00180 XED_DLL_EXPORT void xed_encoder_request_set_operand_storage_field(xed_encoder_request_t* p,
00181 xed_operand_enum_t operand_name,
00182 xed_uint32_t value);
00183
00185
00187
00188
00189 XED_DLL_EXPORT void xed_encoder_request_set_memory_displacement(xed_encoder_request_t* p,
00190 xed_int64_t memdisp,
00191 xed_uint_t nbytes);
00192
00194 XED_DLL_EXPORT void xed_encoder_request_set_agen(xed_encoder_request_t* p);
00196 XED_DLL_EXPORT void xed_encoder_request_set_mem0(xed_encoder_request_t* p);
00198 XED_DLL_EXPORT void xed_encoder_request_set_mem1(xed_encoder_request_t* p);
00200 XED_DLL_EXPORT void xed_encoder_request_set_memory_operand_length(xed_encoder_request_t* p,
00201 xed_uint_t nbytes);
00203 XED_DLL_EXPORT void xed_encoder_request_set_seg0(xed_encoder_request_t* p,
00204 xed_reg_enum_t seg_reg);
00206 XED_DLL_EXPORT void xed_encoder_request_set_seg1(xed_encoder_request_t* p,
00207 xed_reg_enum_t seg_reg);
00209 XED_DLL_EXPORT void xed_encoder_request_set_base0(xed_encoder_request_t* p,
00210 xed_reg_enum_t base_reg);
00212 XED_DLL_EXPORT void xed_encoder_request_set_base1(xed_encoder_request_t* p,
00213 xed_reg_enum_t base_reg) ;
00215 XED_DLL_EXPORT void xed_encoder_request_set_index(xed_encoder_request_t* p,
00216 xed_reg_enum_t index_reg);
00218 XED_DLL_EXPORT void xed_encoder_request_set_scale(xed_encoder_request_t* p,
00219 xed_uint_t scale);
00221
00224 XED_DLL_EXPORT const xed_operand_values_t* xed_encoder_request_operands_const(const xed_encoder_request_t* p);
00226 XED_DLL_EXPORT xed_operand_values_t* xed_encoder_request_operands(xed_encoder_request_t* p);
00227
00229
00230
00234 XED_DLL_EXPORT void xed_encoder_request_zero_operand_order(xed_encoder_request_t* p);
00235
00237 XED_DLL_EXPORT void xed_encoder_request_zero_set_mode(xed_encoder_request_t* p,
00238 const xed_state_t* dstate);
00240 XED_DLL_EXPORT void xed_encoder_request_zero(xed_encoder_request_t* p) ;
00242
00243 struct xed_decoded_inst_s;
00246 XED_DLL_EXPORT void xed_encoder_request_init_from_decode(struct xed_decoded_inst_s* d);
00247
00248 void
00249 xed_encoder_request_encode_emit(xed_encoder_request_t* q,
00250 const unsigned int bits,
00251 const xed_uint64_t value);
00252
00253 xed_bool_t
00254 xed_encoder_request__memop_compatible(const xed_encoder_request_t* p,
00255 xed_operand_width_enum_t operand_width);
00256
00258
00259
00260 XED_DLL_EXPORT void xed_encode_request_print(const xed_encoder_request_t* p,
00261 char* buf, xed_uint_t buflen);
00263
00264
00265 typedef xed_uint_t (*xed_encode_function_pointer_t)(xed_encoder_request_t* enc_req);
00266
00267
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284 XED_DLL_EXPORT xed_error_enum_t
00285 xed_encode(xed_encoder_request_t* r,
00286 xed_uint8_t* array,
00287 const unsigned int ilen,
00288 unsigned int* olen);
00289
00297 XED_DLL_EXPORT xed_error_enum_t
00298 xed_encode_nop(xed_uint8_t* array,
00299 const unsigned int ilen);
00301
00302 #endif
00303
00304
00305
00306