xed-encode.h

Go to the documentation of this file.
00001 /*BEGIN_LEGAL 
00002 Intel Open Source License 
00003 
00004 Copyright (c) 2002-2011 Intel Corporation. All rights reserved.
00005  
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are
00008 met:
00009 
00010 Redistributions of source code must retain the above copyright notice,
00011 this list of conditions and the following disclaimer.  Redistributions
00012 in binary form must reproduce the above copyright notice, this list of
00013 conditions and the following disclaimer in the documentation and/or
00014 other materials provided with the distribution.  Neither the name of
00015 the Intel Corporation nor the names of its contributors may be used to
00016 endorse or promote products derived from this software without
00017 specific prior written permission.
00018  
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00022 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
00023 ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00024 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00025 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00026 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00027 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00028 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00029 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030 END_LEGAL */
00033 
00034 
00035 #ifndef _XED_ENCODE_H_
00036 # define _XED_ENCODE_H_
00037 #include "xed-common-hdrs.h"
00038 #include "xed-types.h"
00039 #include "xed-error-enum.h"
00040 #include "xed-operand-values-interface.h"
00041 #include "xed-operand-width-enum.h"
00042 #include "xed-encoder-iforms.h" //generated
00043 #include "xed-encoder-gen-defs.h" //generated
00044 
00045 // we now (mostly) share the decode data structure
00046 #include "xed-decoded-inst.h" 
00047 
00048 
00049 // establish a type equivalence for the xed_encoder_request_t and the corresponding xed_decoded_inst_t.
00050 
00052 typedef struct  xed_decoded_inst_s xed_encoder_request_s; 
00054 typedef xed_decoded_inst_t xed_encoder_request_t; 
00055 
00056 
00058 XED_DLL_EXPORT xed_iclass_enum_t 
00059 xed_encoder_request_get_iclass( const xed_encoder_request_t* p);
00060 
00062 // set functions
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  xed_encoder_request_set_effective_operand_width( xed_encoder_request_t* p, 
00089                                                                       xed_uint_t width_bits);
00091 XED_DLL_EXPORT void  xed_encoder_request_set_effective_address_size( xed_encoder_request_t* p, 
00092                                                                      xed_uint_t width_bits);
00100 XED_DLL_EXPORT void xed_encoder_request_set_reg(xed_encoder_request_t* p,
00101                                                 xed_operand_enum_t operand, 
00102                                                 xed_reg_enum_t reg);
00104 
00106 
00107 
00120 XED_DLL_EXPORT void xed_encoder_request_set_operand_order(xed_encoder_request_t* p, 
00121                                                           xed_uint_t operand_index, 
00122                                                           xed_operand_enum_t name);
00123 
00131 XED_DLL_EXPORT xed_operand_enum_t xed_encoder_request_get_operand_order(xed_encoder_request_t* p, 
00132                                                                         xed_uint_t operand_index);
00133                                                                         
00134 
00138 static XED_INLINE 
00139 xed_uint_t xed_encoder_request_operand_order_entries(xed_encoder_request_t* p) {
00140     return  p->_n_operand_order;
00141 }
00142 
00144 
00145 
00147 
00148 
00149 XED_DLL_EXPORT void xed_encoder_request_set_relbr(xed_encoder_request_t* p);
00151 XED_DLL_EXPORT void xed_encoder_request_set_branch_displacement(xed_encoder_request_t* p,
00152                                                                 xed_int32_t brdisp,
00153                                                                 xed_uint_t nbytes);
00155 XED_DLL_EXPORT void xed_encoder_request_set_ptr(xed_encoder_request_t* p);
00157 
00158 
00160 
00161 
00162 
00163 XED_DLL_EXPORT void xed_encoder_request_set_uimm0(xed_encoder_request_t* p,
00164                                                   xed_uint64_t uimm,
00165                                                   xed_uint_t nbytes);
00168 XED_DLL_EXPORT void xed_encoder_request_set_uimm0_bits(xed_encoder_request_t* p,
00169                                                        xed_uint64_t uimm,
00170                                                        xed_uint_t nbits);
00172 XED_DLL_EXPORT void xed_encoder_request_set_uimm1(xed_encoder_request_t* p,
00173                                                   xed_uint8_t uimm);
00176 XED_DLL_EXPORT void xed_encoder_request_set_simm(xed_encoder_request_t* p,
00177                                                  xed_int32_t simm,
00178                                                  xed_uint_t nbytes);
00181 XED_DLL_EXPORT void xed_encoder_request_set_operand_storage_field(xed_encoder_request_t* p, 
00182                                                                   xed_operand_enum_t operand_name,  
00183                                                                   xed_uint32_t value);
00184 
00186 
00188 
00189 
00190 XED_DLL_EXPORT void xed_encoder_request_set_memory_displacement(xed_encoder_request_t* p,
00191                                                                 xed_int64_t memdisp,
00192                                                                 xed_uint_t nbytes);
00193 
00195 XED_DLL_EXPORT void xed_encoder_request_set_agen(xed_encoder_request_t* p);
00197 XED_DLL_EXPORT void xed_encoder_request_set_mem0(xed_encoder_request_t* p);
00199 XED_DLL_EXPORT void xed_encoder_request_set_mem1(xed_encoder_request_t* p);
00201 XED_DLL_EXPORT void xed_encoder_request_set_memory_operand_length(xed_encoder_request_t* p,
00202                                                                   xed_uint_t nbytes);
00204 XED_DLL_EXPORT void xed_encoder_request_set_seg0(xed_encoder_request_t* p,
00205                                   xed_reg_enum_t seg_reg);
00207 XED_DLL_EXPORT void xed_encoder_request_set_seg1(xed_encoder_request_t* p,
00208                                   xed_reg_enum_t seg_reg);
00210 XED_DLL_EXPORT void xed_encoder_request_set_base0(xed_encoder_request_t* p,
00211                                    xed_reg_enum_t base_reg);
00213 XED_DLL_EXPORT void xed_encoder_request_set_base1(xed_encoder_request_t* p,
00214                                    xed_reg_enum_t base_reg) ;
00216 XED_DLL_EXPORT void xed_encoder_request_set_index(xed_encoder_request_t* p,
00217                                    xed_reg_enum_t index_reg);
00219 XED_DLL_EXPORT void xed_encoder_request_set_scale(xed_encoder_request_t* p,
00220                                    xed_uint_t scale);
00222 
00225 XED_DLL_EXPORT const xed_operand_values_t* xed_encoder_request_operands_const(const xed_encoder_request_t* p);
00227 XED_DLL_EXPORT xed_operand_values_t* xed_encoder_request_operands(xed_encoder_request_t* p);
00228 
00230 
00231 
00235 XED_DLL_EXPORT void xed_encoder_request_zero_operand_order(xed_encoder_request_t* p);
00236 
00238 XED_DLL_EXPORT void  xed_encoder_request_zero_set_mode(xed_encoder_request_t* p,
00239                                                        const xed_state_t* dstate);
00241 XED_DLL_EXPORT void  xed_encoder_request_zero(xed_encoder_request_t* p) ;
00243 
00244 struct xed_decoded_inst_s; //fwd decl
00247 XED_DLL_EXPORT void  xed_encoder_request_init_from_decode(struct xed_decoded_inst_s* d);
00248 
00249 void
00250 xed_encoder_request_encode_emit(xed_encoder_request_t* q,
00251                                 const unsigned int bits,
00252                                 const xed_uint64_t value);
00253     
00254 xed_bool_t
00255 xed_encoder_request__memop_compatible(const xed_encoder_request_t* p,
00256                                       xed_operand_width_enum_t operand_width);
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 // Type signature for an encode function
00266 typedef xed_uint_t (*xed_encode_function_pointer_t)(xed_encoder_request_t* enc_req);
00267 
00268 
00270 
00271 
00272 
00273 
00274 
00275 
00276 
00277 
00278 
00279 
00280 
00281 
00282 
00283 
00284 
00285 XED_DLL_EXPORT xed_error_enum_t
00286 xed_encode(xed_encoder_request_t* r,
00287            xed_uint8_t* array, 
00288            const unsigned int ilen,
00289            unsigned int* olen);
00290 
00298 XED_DLL_EXPORT xed_error_enum_t
00299 xed_encode_nop(xed_uint8_t* array, 
00300                const unsigned int ilen);
00302 
00303 #endif
00304 
00305 //Local Variables:
00306 //pref: "../../xed-encode.c"
00307 //End:

Generated on Tue Nov 22 12:27:07 2011 for XED2 by  doxygen 1.4.6