xed-operand-values-interface.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 #if !defined(_XED_OPERAND_VALUES_INTERFACE_H_)
00035 # define _XED_OPERAND_VALUES_INTERFACE_H_
00036 
00037 #include "xed-common-hdrs.h"
00038 #include "xed-common-defs.h"
00039 #include "xed-portability.h"
00040 #include "xed-util.h"
00041 #include "xed-types.h"
00042 #include "xed-state.h" // a generated file
00043 #include "xed-operand-enum.h" // a generated file
00044 #include "xed-operand-storage.h" 
00045 #include "xed-reg-enum.h"  // generated
00046 #include "xed-iclass-enum.h"  // generated
00048 
00049 
00050 
00051 XED_DLL_EXPORT void xed_operand_values_init(xed_operand_values_t* p);
00052 
00055 XED_DLL_EXPORT void xed_operand_values_init_set_mode(xed_operand_values_t* p,
00056                                                      const xed_state_t* dstate);
00057 
00060 XED_DLL_EXPORT void
00061 xed_operand_values_set_mode(xed_operand_values_t* p,
00062                             const xed_state_t* dstate);
00063 
00067 XED_DLL_EXPORT void
00068 xed_operand_values_init_keep_mode( xed_operand_values_t* dst,
00069                                    const xed_operand_values_t* src );
00071 
00072 // Returns the raw operand fields. Do not use this. 
00073 XED_DLL_EXPORT xed_uint32_t 
00074 xed_operand_values_get_operand_decider(const xed_operand_values_t* p,
00075                                        xed_operand_enum_t operand_decider_index) ;
00076 
00077     
00080 
00081 
00082 
00083 XED_DLL_EXPORT void
00084 xed_operand_values_dump(const xed_operand_values_t* ov,
00085                         char* buf,
00086                         int buflen);
00089 XED_DLL_EXPORT void
00090 xed_operand_values_print_short(const xed_operand_values_t* ov,
00091                                char* buf,
00092                                int buflen);
00094     
00096 
00097 
00098 
00099 
00100 
00101 XED_DLL_EXPORT xed_bool_t
00102 xed_operand_values_has_real_rep(const xed_operand_values_t* p);
00106 XED_DLL_EXPORT xed_bool_t
00107 xed_operand_values_has_rep_prefix(const xed_operand_values_t* p);
00111 XED_DLL_EXPORT xed_bool_t
00112 xed_operand_values_has_repne_prefix(const xed_operand_values_t* p);
00113 
00116 XED_DLL_EXPORT void xed_operand_values_set_repne(xed_operand_values_t* p);
00119 XED_DLL_EXPORT void xed_operand_values_set_rep(xed_operand_values_t* p);
00122 XED_DLL_EXPORT void xed_operand_values_clear_rep(xed_operand_values_t* p);
00123 
00125 
00130 XED_DLL_EXPORT xed_bool_t
00131 xed_operand_values_get_atomic(const xed_operand_values_t* p);
00132 
00135 XED_DLL_EXPORT xed_bool_t
00136 xed_operand_values_has_lock_prefix(const xed_operand_values_t* p);
00137 
00144 XED_DLL_EXPORT xed_bool_t
00145 xed_operand_values_using_default_segment(const xed_operand_values_t* p,
00146                                          unsigned int i);
00147 
00148 
00149 
00156 XED_DLL_EXPORT xed_uint32_t
00157 xed_operand_values_get_effective_operand_width(const xed_operand_values_t* p);
00160 XED_DLL_EXPORT xed_uint32_t
00161 xed_operand_values_get_effective_address_width(const xed_operand_values_t* p);
00164 XED_DLL_EXPORT xed_uint32_t
00165 xed_operand_values_get_stack_address_width(const xed_operand_values_t* p);
00166 
00167 
00170 XED_DLL_EXPORT xed_bool_t
00171 xed_operand_values_has_memory_displacement(const xed_operand_values_t* p);
00174 XED_DLL_EXPORT xed_bool_t
00175 xed_operand_values_has_branch_displacement(const xed_operand_values_t* p);
00178 XED_DLL_EXPORT xed_bool_t
00179 xed_operand_values_has_displacement(const xed_operand_values_t* p);
00180 
00181 
00184 XED_DLL_EXPORT xed_bool_t
00185 xed_operand_values_get_displacement_for_memop(const xed_operand_values_t* p);
00186 
00189 XED_DLL_EXPORT xed_bool_t
00190 xed_operand_values_has_immediate(const xed_operand_values_t* p);  
00191 
00192 
00197 XED_DLL_EXPORT xed_bool_t
00198 xed_operand_values_has_disp(const xed_operand_values_t* p);  
00199 
00202 XED_DLL_EXPORT xed_bool_t 
00203 xed_operand_values_has_address_size_prefix(const xed_operand_values_t* p);
00204 
00208 XED_DLL_EXPORT xed_bool_t 
00209 xed_operand_values_has_operand_size_prefix(const xed_operand_values_t* p);
00210 
00213 XED_DLL_EXPORT xed_bool_t 
00214 xed_operand_values_has_66_prefix(const xed_operand_values_t* p);
00215 
00218 xed_bool_t 
00219 xed_operand_values_has_rexw_prefix(const xed_operand_values_t* p);
00220 
00221 #if 0
00222 XED_DLL_EXPORT xed_bool_t 
00223 xed_operand_values_has_refining_66_prefix(const xed_operand_values_t* p);
00224 XED_DLL_EXPORT xed_bool_t 
00225 xed_operand_values_has_refining_f2_prefix(const xed_operand_values_t* p);
00226 XED_DLL_EXPORT xed_bool_t 
00227 xed_operand_values_has_refining_f3_prefix(const xed_operand_values_t* p);
00228 #endif
00229 
00231 XED_DLL_EXPORT xed_bool_t 
00232 xed_operand_values_has_segment_prefix(const xed_operand_values_t* p);
00233 
00236 XED_DLL_EXPORT xed_reg_enum_t
00237 xed_operand_values_segment_prefix(const xed_operand_values_t* p);
00238 
00240 XED_DLL_EXPORT xed_bool_t
00241 xed_operand_values_is_prefetch(const xed_operand_values_t* p);
00242 
00244 XED_DLL_EXPORT xed_bool_t
00245 xed_operand_values_get_long_mode(const xed_operand_values_t* p);
00247 XED_DLL_EXPORT xed_bool_t
00248 xed_operand_values_get_real_mode(const xed_operand_values_t* p);
00249 
00251 
00252 
00253 XED_DLL_EXPORT xed_bool_t
00254 xed_operand_values_accesses_memory(const xed_operand_values_t* p);
00255 
00257 XED_DLL_EXPORT unsigned int 
00258 xed_operand_values_number_of_memory_operands(const xed_operand_values_t* p);
00259 
00261 XED_DLL_EXPORT unsigned int
00262 xed_operand_values_get_memory_operand_length(const xed_operand_values_t* p,
00263                                              unsigned int memop_idx);
00264 
00266 XED_DLL_EXPORT xed_reg_enum_t
00267 xed_operand_values_get_base_reg(const xed_operand_values_t* p,
00268                                 unsigned int memop_idx);
00269 
00271 XED_DLL_EXPORT xed_reg_enum_t
00272 xed_operand_values_get_index_reg(const xed_operand_values_t* p,
00273                                  unsigned int memop_idx);
00274 
00276 XED_DLL_EXPORT xed_reg_enum_t
00277 xed_operand_values_get_seg_reg(const xed_operand_values_t* p,
00278                                unsigned int memop_idx);
00279 
00281 XED_DLL_EXPORT unsigned int
00282 xed_operand_values_get_scale(const xed_operand_values_t* p);
00283 
00287 XED_DLL_EXPORT xed_bool_t 
00288 xed_operand_values_memop_without_modrm(const xed_operand_values_t* p);
00291 XED_DLL_EXPORT xed_bool_t
00292 xed_operand_values_has_modrm_byte(const xed_operand_values_t* p);
00293 
00296 XED_DLL_EXPORT xed_bool_t
00297 xed_operand_values_has_sib_byte(const xed_operand_values_t* p);
00299 
00301 XED_DLL_EXPORT xed_bool_t
00302 xed_operand_values_branch_not_taken_hint(const xed_operand_values_t* p);
00304 XED_DLL_EXPORT xed_bool_t
00305 xed_operand_values_branch_taken_hint(const xed_operand_values_t* p);
00306 
00308 XED_DLL_EXPORT xed_bool_t
00309 xed_operand_values_is_nop(const xed_operand_values_t* p);
00310 
00311 
00313 
00314 
00315 XED_DLL_EXPORT xed_int64_t
00316 xed_operand_values_get_immediate_int64(const xed_operand_values_t* p);
00317 
00319 XED_DLL_EXPORT xed_uint64_t
00320 xed_operand_values_get_immediate_uint64(const xed_operand_values_t* p);
00321 
00324 XED_DLL_EXPORT xed_uint_t
00325 xed_operand_values_get_immediate_is_signed(const xed_operand_values_t* p);
00326 
00327     
00330 XED_DLL_EXPORT xed_uint8_t 
00331 xed_operand_values_get_immediate_byte(const xed_operand_values_t* p,
00332                                       unsigned int i);
00333 
00335 XED_DLL_EXPORT xed_uint8_t 
00336 xed_operand_values_get_second_immediate(const xed_operand_values_t* p);
00338 
00340 
00341 
00342 
00343 XED_DLL_EXPORT xed_uint32_t
00344 xed_operand_values_get_memory_displacement_length(const xed_operand_values_t* p);
00347 XED_DLL_EXPORT xed_uint32_t
00348 xed_operand_values_get_memory_displacement_length_bits(const xed_operand_values_t* p);
00349 
00351 XED_DLL_EXPORT xed_int64_t
00352 xed_operand_values_get_memory_displacement_int64(const xed_operand_values_t* p);
00353 
00355 XED_DLL_EXPORT xed_uint8_t 
00356 xed_operand_values_get_memory_displacement_byte(const xed_operand_values_t* p,
00357                                                 unsigned int i);
00359 
00361 
00362 
00363 
00364 XED_DLL_EXPORT xed_uint32_t
00365 xed_operand_values_get_branch_displacement_length(const xed_operand_values_t* p);
00368 XED_DLL_EXPORT xed_uint32_t
00369 xed_operand_values_get_branch_displacement_length_bits(const xed_operand_values_t* p);
00370 
00372 XED_DLL_EXPORT xed_int32_t
00373 xed_operand_values_get_branch_displacement_int32(const xed_operand_values_t* p);
00374 
00376 XED_DLL_EXPORT xed_uint8_t 
00377 xed_operand_values_get_branch_displacement_byte(const xed_operand_values_t* p,
00378                                                 unsigned int i);
00380 
00381 
00383 XED_DLL_EXPORT xed_iclass_enum_t
00384 xed_operand_values_get_iclass(const xed_operand_values_t* p);
00385     
00387 // ENCODE API
00390 
00391 
00392 XED_DLL_EXPORT void
00393 xed_operand_values_zero_immediate(xed_operand_values_t* p);
00395 XED_DLL_EXPORT void
00396 xed_operand_values_zero_branch_displacement(xed_operand_values_t* p);
00398 XED_DLL_EXPORT void
00399 xed_operand_values_zero_memory_displacement(xed_operand_values_t* p);
00400 
00402 XED_DLL_EXPORT void xed_operand_values_set_lock(xed_operand_values_t* p);
00404 XED_DLL_EXPORT void
00405 xed_operand_values_zero_segment_override(xed_operand_values_t* p);
00406 
00407 
00409 XED_DLL_EXPORT void
00410 xed_operand_values_set_iclass(xed_operand_values_t* p,
00411                               xed_iclass_enum_t iclass);
00412 
00415 XED_DLL_EXPORT void
00416 xed_operand_values_set_effective_operand_width(xed_operand_values_t* p,
00417                                                unsigned int width);
00418 
00421 XED_DLL_EXPORT void
00422 xed_operand_values_set_effective_address_width(xed_operand_values_t* p,
00423                                                unsigned int width);
00424 
00426 XED_DLL_EXPORT void
00427 xed_operand_values_set_memory_operand_length(xed_operand_values_t* p,
00428                                              unsigned int memop_length);
00429 
00430    
00433 XED_DLL_EXPORT void
00434 xed_operand_values_set_memory_displacement(xed_operand_values_t* p,
00435                                            xed_int64_t x, unsigned int len);
00438 XED_DLL_EXPORT void
00439 xed_operand_values_set_memory_displacement_bits(xed_operand_values_t* p,
00440                                                 xed_int64_t x,
00441                                                 unsigned int len_bits);
00442 
00445 XED_DLL_EXPORT void xed_operand_values_set_relbr(xed_operand_values_t* p);
00446 
00449 XED_DLL_EXPORT void
00450 xed_operand_values_set_branch_displacement(xed_operand_values_t* p,
00451                                            xed_int32_t x,
00452                                            unsigned int len);
00455 XED_DLL_EXPORT void
00456 xed_operand_values_set_branch_displacement_bits(xed_operand_values_t* p,
00457                                                 xed_int32_t x,
00458                                                 unsigned int len_bits);
00459 
00462 XED_DLL_EXPORT void
00463 xed_operand_values_set_immediate_signed(xed_operand_values_t* p,
00464                                         xed_int32_t x,
00465                                         unsigned int bytes); 
00468 XED_DLL_EXPORT void
00469 xed_operand_values_set_immediate_signed_bits(xed_operand_values_t* p,
00470                                              xed_int32_t x,
00471                                              unsigned int bits); 
00472 
00473 
00476 XED_DLL_EXPORT void
00477 xed_operand_values_set_immediate_unsigned(xed_operand_values_t* p,
00478                                           xed_uint64_t x,
00479                                           unsigned int bytes);
00482 XED_DLL_EXPORT void
00483 xed_operand_values_set_immediate_unsigned_bits(xed_operand_values_t* p,
00484                                                xed_uint64_t x,
00485                                                unsigned int bits);
00486 
00487 
00488 
00490 XED_DLL_EXPORT void xed_operand_values_set_base_reg(xed_operand_values_t* p,
00491                                                     unsigned int memop_idx,
00492                                                     xed_reg_enum_t new_base);
00493 
00495 XED_DLL_EXPORT void xed_operand_values_set_seg_reg(xed_operand_values_t* p,
00496                                                    unsigned int memop_idx,
00497                                                    xed_reg_enum_t new_seg);
00498 
00500 XED_DLL_EXPORT void xed_operand_values_set_index_reg(xed_operand_values_t* p,
00501                                                      unsigned int memop_idx,
00502                                                      xed_reg_enum_t new_index);
00503 
00505 XED_DLL_EXPORT void xed_operand_values_set_scale(xed_operand_values_t* p, 
00506                                                  xed_uint_t memop_idx,
00507                                                  xed_uint_t new_scale);
00508 
00509 
00513 XED_DLL_EXPORT void
00514 xed_operand_values_set_operand_reg(xed_operand_values_t* p,
00515                                    xed_operand_enum_t operand_name,
00516                                    xed_reg_enum_t reg_name);
00517 
00519 #endif
00520 
00521 //Local Variables:
00522 //pref: "../../xed-operand-values-interface.c"
00523 //End:

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