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
00056
00058 XED_DLL_EXPORT xed_iclass_enum_t
00059 xed_encoder_request_get_iclass( const xed_encoder_request_t* p);
00060
00062
00063
00065 XED_DLL_EXPORT void
00066 xed_encoder_request_set_iclass( xed_encoder_request_t* p,
00067 xed_iclass_enum_t iclass);
00068
00070
00071
00072
00073 XED_DLL_EXPORT void xed_encoder_request_set_lock(xed_encoder_request_t* p);
00076 XED_DLL_EXPORT void xed_encoder_request_set_repne(xed_encoder_request_t* p);
00079 XED_DLL_EXPORT void xed_encoder_request_set_rep(xed_encoder_request_t* p);
00082 XED_DLL_EXPORT void xed_encoder_request_clear_rep(xed_encoder_request_t* p);
00084
00086
00087
00088 XED_DLL_EXPORT void
00089 xed_encoder_request_set_effective_operand_width( xed_encoder_request_t* p,
00090 xed_uint_t width_bits);
00092 XED_DLL_EXPORT void
00093 xed_encoder_request_set_effective_address_size( xed_encoder_request_t* p,
00094 xed_uint_t width_bits);
00104 XED_DLL_EXPORT void xed_encoder_request_set_reg(xed_encoder_request_t* p,
00105 xed_operand_enum_t operand,
00106 xed_reg_enum_t reg);
00108
00110
00111
00124 XED_DLL_EXPORT void
00125 xed_encoder_request_set_operand_order(xed_encoder_request_t* p,
00126 xed_uint_t operand_index,
00127 xed_operand_enum_t name);
00128
00136 XED_DLL_EXPORT xed_operand_enum_t
00137 xed_encoder_request_get_operand_order(xed_encoder_request_t* p,
00138 xed_uint_t operand_index);
00139
00140
00144 static XED_INLINE xed_uint_t
00145 xed_encoder_request_operand_order_entries(xed_encoder_request_t* p)
00146 {
00147 return p->_n_operand_order;
00148 }
00149
00151
00152
00154
00155
00156 XED_DLL_EXPORT void xed_encoder_request_set_relbr(xed_encoder_request_t* p);
00158 XED_DLL_EXPORT void
00159 xed_encoder_request_set_branch_displacement(xed_encoder_request_t* p,
00160 xed_int32_t brdisp,
00161 xed_uint_t nbytes);
00163 XED_DLL_EXPORT void xed_encoder_request_set_ptr(xed_encoder_request_t* p);
00165
00166
00168
00169
00170
00171 XED_DLL_EXPORT void xed_encoder_request_set_uimm0(xed_encoder_request_t* p,
00172 xed_uint64_t uimm,
00173 xed_uint_t nbytes);
00176 XED_DLL_EXPORT void xed_encoder_request_set_uimm0_bits(xed_encoder_request_t* p,
00177 xed_uint64_t uimm,
00178 xed_uint_t nbits);
00180 XED_DLL_EXPORT void xed_encoder_request_set_uimm1(xed_encoder_request_t* p,
00181 xed_uint8_t uimm);
00184 XED_DLL_EXPORT void xed_encoder_request_set_simm(xed_encoder_request_t* p,
00185 xed_int32_t simm,
00186 xed_uint_t nbytes);
00187
00189
00190
00191 XED_DLL_EXPORT void
00192 xed_encoder_request_set_memory_displacement(xed_encoder_request_t* p,
00193 xed_int64_t memdisp,
00194 xed_uint_t nbytes);
00195
00197 XED_DLL_EXPORT void xed_encoder_request_set_agen(xed_encoder_request_t* p);
00199 XED_DLL_EXPORT void xed_encoder_request_set_mem0(xed_encoder_request_t* p);
00201 XED_DLL_EXPORT void xed_encoder_request_set_mem1(xed_encoder_request_t* p);
00203 XED_DLL_EXPORT void
00204 xed_encoder_request_set_memory_operand_length(xed_encoder_request_t* p,
00205 xed_uint_t nbytes);
00207 XED_DLL_EXPORT void xed_encoder_request_set_seg0(xed_encoder_request_t* p,
00208 xed_reg_enum_t seg_reg);
00210 XED_DLL_EXPORT void xed_encoder_request_set_seg1(xed_encoder_request_t* p,
00211 xed_reg_enum_t seg_reg);
00213 XED_DLL_EXPORT void xed_encoder_request_set_base0(xed_encoder_request_t* p,
00214 xed_reg_enum_t base_reg);
00216 XED_DLL_EXPORT void xed_encoder_request_set_base1(xed_encoder_request_t* p,
00217 xed_reg_enum_t base_reg) ;
00219 XED_DLL_EXPORT void xed_encoder_request_set_index(xed_encoder_request_t* p,
00220 xed_reg_enum_t index_reg);
00222 XED_DLL_EXPORT void
00223 xed_encoder_request_set_scale(xed_encoder_request_t* p,
00224 xed_uint_t scale);
00226
00229 XED_DLL_EXPORT const xed_operand_values_t*
00230 xed_encoder_request_operands_const(const xed_encoder_request_t* p);
00232 XED_DLL_EXPORT xed_operand_values_t*
00233 xed_encoder_request_operands(xed_encoder_request_t* p);
00234
00236
00237
00241 XED_DLL_EXPORT void
00242 xed_encoder_request_zero_operand_order(xed_encoder_request_t* p);
00243
00245 XED_DLL_EXPORT void
00246 xed_encoder_request_zero_set_mode(xed_encoder_request_t* p,
00247 const xed_state_t* dstate);
00249 XED_DLL_EXPORT void xed_encoder_request_zero(xed_encoder_request_t* p) ;
00251
00252 struct xed_decoded_inst_s;
00255 XED_DLL_EXPORT void
00256 xed_encoder_request_init_from_decode(struct xed_decoded_inst_s* d);
00257
00259
00260
00261 XED_DLL_EXPORT void xed_encode_request_print(const xed_encoder_request_t* p,
00262 char* buf, xed_uint_t buflen);
00264
00265
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