xed-encode.h

Go to the documentation of this file.
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 
00037 #ifndef _XED_ENCODE_H_
00038 # define _XED_ENCODE_H_
00039 #include "xed-common-hdrs.h"
00040 #include "xed-types.h"
00041 #include "xed-error-enum.h"
00042 #include "xed-operand-values-interface.h"
00043 #include "xed-operand-width-enum.h"
00044 #include "xed-encoder-iforms.h" //generated
00045 #include "xed-encoder-gen-defs.h" //generated
00046 
00047 // we now (mostly) share the decode data structure
00048 #include "xed-decoded-inst.h" 
00049 
00050 
00051 // establish a type equivalence for the xed_encoder_request_t and the corresponding xed_decoded_inst_t.
00052 
00054 typedef struct  xed_decoded_inst_s xed_encoder_request_s; 
00056 typedef xed_decoded_inst_t xed_encoder_request_t; 
00057 
00058 
00060 XED_DLL_EXPORT xed_iclass_enum_t 
00061 xed_encoder_request_get_iclass( const xed_encoder_request_t* p);
00062 
00064 // set functions
00065 
00067 XED_DLL_EXPORT void  
00068 xed_encoder_request_set_iclass( xed_encoder_request_t* p, 
00069                                 xed_iclass_enum_t iclass);
00070 
00072 
00073 
00074 
00075 XED_DLL_EXPORT void xed_encoder_request_set_lock(xed_encoder_request_t* p);
00078 XED_DLL_EXPORT void xed_encoder_request_set_repne(xed_encoder_request_t* p);
00081 XED_DLL_EXPORT void xed_encoder_request_set_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);
00179 
00181 
00182 
00183 XED_DLL_EXPORT void xed_encoder_request_set_memory_displacement(xed_encoder_request_t* p,
00184                                                                 xed_int64_t memdisp,
00185                                                                 xed_uint_t nbytes);
00186 
00188 XED_DLL_EXPORT void xed_encoder_request_set_agen(xed_encoder_request_t* p);
00190 XED_DLL_EXPORT void xed_encoder_request_set_mem0(xed_encoder_request_t* p);
00192 XED_DLL_EXPORT void xed_encoder_request_set_mem1(xed_encoder_request_t* p);
00194 XED_DLL_EXPORT void xed_encoder_request_set_memory_operand_length(xed_encoder_request_t* p,
00195                                                                   xed_uint_t nbytes);
00197 XED_DLL_EXPORT void xed_encoder_request_set_seg0(xed_encoder_request_t* p,
00198                                   xed_reg_enum_t seg_reg);
00200 XED_DLL_EXPORT void xed_encoder_request_set_seg1(xed_encoder_request_t* p,
00201                                   xed_reg_enum_t seg_reg);
00203 XED_DLL_EXPORT void xed_encoder_request_set_base0(xed_encoder_request_t* p,
00204                                    xed_reg_enum_t base_reg);
00206 XED_DLL_EXPORT void xed_encoder_request_set_base1(xed_encoder_request_t* p,
00207                                    xed_reg_enum_t base_reg) ;
00209 XED_DLL_EXPORT void xed_encoder_request_set_index(xed_encoder_request_t* p,
00210                                    xed_reg_enum_t index_reg);
00212 XED_DLL_EXPORT void xed_encoder_request_set_scale(xed_encoder_request_t* p,
00213                                    xed_uint_t scale);
00215 
00218 XED_DLL_EXPORT const xed_operand_values_t* xed_encoder_request_operands_const(const xed_encoder_request_t* p);
00220 XED_DLL_EXPORT xed_operand_values_t* xed_encoder_request_operands(xed_encoder_request_t* p);
00221 
00223 
00224 
00228 XED_DLL_EXPORT void xed_encoder_request_zero_operand_order(xed_encoder_request_t* p);
00229 
00231 XED_DLL_EXPORT void  xed_encoder_request_zero_set_mode(xed_encoder_request_t* p,
00232                                                        const xed_state_t* dstate);
00234 XED_DLL_EXPORT void  xed_encoder_request_zero(xed_encoder_request_t* p) ;
00236 
00237 struct xed_decoded_inst_s; //fwd decl
00240 XED_DLL_EXPORT void  xed_encoder_request_init_from_decode(struct xed_decoded_inst_s* d);
00241 
00242 void
00243 xed_encoder_request_encode_emit(xed_encoder_request_t* q,
00244                                 const unsigned int bits,
00245                                 const xed_uint64_t value);
00246     
00247 xed_bool_t
00248 xed_encoder_request__memop_compatible(const xed_encoder_request_t* p,
00249                                       xed_operand_width_enum_t operand_width);
00250 
00252 
00253 
00254 XED_DLL_EXPORT void xed_encode_request_print(const xed_encoder_request_t* p, 
00255                                              char* buf, xed_uint_t buflen);
00257 
00258 // Type signature for an encode function
00259 typedef xed_uint_t (*xed_encode_function_pointer_t)(xed_encoder_request_t* enc_req);
00260 
00261 
00263 
00264 
00265 
00266 
00267 
00268 
00269 
00270 
00271 
00272 
00273 
00274 
00275 
00276 
00277 
00278 XED_DLL_EXPORT xed_error_enum_t
00279 xed_encode(xed_encoder_request_t* r,
00280            xed_uint8_t* array, 
00281            const unsigned int ilen,
00282            unsigned int* olen);
00283 
00291 XED_DLL_EXPORT xed_error_enum_t
00292 xed_encode_nop(xed_uint8_t* array, 
00293                const unsigned int ilen);
00295 
00296 #endif
00297 
00298 //Local Variables:
00299 //pref: "../../xed-encode.c"
00300 //End:

Generated on Thu May 15 03:15:09 2008 for XED2 by  doxygen 1.4.6