XED
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
xed-operand-values-interface.h
Go to the documentation of this file.
1 /*BEGIN_LEGAL
2 Intel Open Source License
3 
4 Copyright (c) 2002-2014 Intel Corporation. All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are
8 met:
9 
10 Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. Redistributions
12 in binary form must reproduce the above copyright notice, this list of
13 conditions and the following disclaimer in the documentation and/or
14 other materials provided with the distribution. Neither the name of
15 the Intel Corporation nor the names of its contributors may be used to
16 endorse or promote products derived from this software without
17 specific prior written permission.
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
23 ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 END_LEGAL */
33 
34 #if !defined(_XED_OPERAND_VALUES_INTERFACE_H_)
35 # define _XED_OPERAND_VALUES_INTERFACE_H_
36 
37 #include "xed-common-hdrs.h"
38 #include "xed-common-defs.h"
39 #include "xed-portability.h"
40 #include "xed-util.h"
41 #include "xed-types.h"
42 #include "xed-state.h" // a generated file
43 #include "xed-operand-enum.h" // a generated file
44 #include "xed-decoded-inst.h"
45 #include "xed-reg-enum.h" // generated
46 #include "xed-iclass-enum.h" // generated
48 
52 
56  const xed_state_t* dstate);
57 
60 XED_DLL_EXPORT void
62  const xed_state_t* dstate);
63 
67 XED_DLL_EXPORT void
69  const xed_operand_values_t* src );
71 
74 
75 XED_DLL_EXPORT void
79  char* buf,
80  int buflen);
83 XED_DLL_EXPORT void
85  char* buf,
86  int buflen);
88 
90 
107 
117 
119 
126 
131 
140  unsigned int i);
141 
142 
143 
150 XED_DLL_EXPORT xed_uint32_t
154 XED_DLL_EXPORT xed_uint32_t
158 XED_DLL_EXPORT xed_uint32_t
160 
161 
174 
175 
180 
185 
186 
193 
198 
204 
209 
214 
218 
223 
227 
234 
236 
240 
242 XED_DLL_EXPORT unsigned int
244 
246 XED_DLL_EXPORT unsigned int
248  unsigned int memop_idx);
249 
253  unsigned int memop_idx);
254 
258  unsigned int memop_idx);
259 
263  unsigned int memop_idx);
264 
266 XED_DLL_EXPORT unsigned int
268 
278 
284 
291 
295 
296 
298 
299 XED_DLL_EXPORT xed_int64_t
302 
303 
305 XED_DLL_EXPORT xed_uint64_t
307 
312 
313 
316 XED_DLL_EXPORT xed_uint8_t
318  unsigned int i);
319 
321 XED_DLL_EXPORT xed_uint8_t
324 
326 
327 XED_DLL_EXPORT xed_uint32_t
333 XED_DLL_EXPORT xed_uint32_t
335 
338 XED_DLL_EXPORT xed_uint32_t
340 
342 XED_DLL_EXPORT xed_int64_t
344 
346 XED_DLL_EXPORT xed_int64_t
348 
350 XED_DLL_EXPORT xed_int64_t
352 
354 XED_DLL_EXPORT xed_int32_t
356 
357 
359 XED_DLL_EXPORT xed_uint8_t
361  unsigned int i);
363 
365 
366 XED_DLL_EXPORT xed_uint32_t
372 XED_DLL_EXPORT xed_uint32_t
374 
376 XED_DLL_EXPORT xed_int32_t
378 
380 XED_DLL_EXPORT xed_uint8_t
382  unsigned int i);
384 
385 
389 
391 // ENCODE API
394 
395 XED_DLL_EXPORT void
399 XED_DLL_EXPORT void
402 XED_DLL_EXPORT void
404 
408 XED_DLL_EXPORT void
410 
411 
413 XED_DLL_EXPORT void
415  xed_iclass_enum_t iclass);
416 
419 XED_DLL_EXPORT void
421  unsigned int width);
422 
425 XED_DLL_EXPORT void
427  unsigned int width);
428 
430 XED_DLL_EXPORT void
432  unsigned int memop_length);
433 
434 
437 XED_DLL_EXPORT void
439  xed_int64_t x, unsigned int len);
442 XED_DLL_EXPORT void
444  xed_int64_t x,
445  unsigned int len_bits);
446 
450 
453 XED_DLL_EXPORT void
455  xed_int32_t x,
456  unsigned int len);
459 XED_DLL_EXPORT void
461  xed_int32_t x,
462  unsigned int len_bits);
463 
466 XED_DLL_EXPORT void
468  xed_int32_t x,
469  unsigned int bytes);
472 XED_DLL_EXPORT void
474  xed_int32_t x,
475  unsigned int bits);
476 
477 
480 XED_DLL_EXPORT void
482  xed_uint64_t x,
483  unsigned int bytes);
486 XED_DLL_EXPORT void
488  xed_uint64_t x,
489  unsigned int bits);
490 
491 
492 
495  unsigned int memop_idx,
496  xed_reg_enum_t new_base);
497 
500  unsigned int memop_idx,
501  xed_reg_enum_t new_seg);
502 
505  unsigned int memop_idx,
506  xed_reg_enum_t new_index);
507 
510  xed_uint_t memop_idx,
511  xed_uint_t new_scale);
512 
513 
517 XED_DLL_EXPORT void
519  xed_operand_enum_t operand_name,
520  xed_reg_enum_t reg_name);
521 
523 #endif
524 
XED_DLL_EXPORT void xed_operand_values_set_scale(xed_operand_values_t *p, xed_uint_t memop_idx, xed_uint_t new_scale)
XED_DLL_EXPORT xed_bool_t xed_operand_values_get_real_mode(const xed_operand_values_t *p)
The main container for instructions.
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_branch_displacement_length(const xed_operand_values_t *p)
Return the branch displacement width in bytes.
XED_DLL_EXPORT xed_uint8_t xed_operand_values_get_branch_displacement_byte(const xed_operand_values_t *p, unsigned int i)
XED_DLL_EXPORT xed_int64_t xed_operand_values_get_immediate_int64(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_branch_displacement(const xed_operand_values_t *p)
True if there is a branch displacement.
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_real_rep(const xed_operand_values_t *p)
True if the instruction has a real REP prefix.
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_effective_operand_width(const xed_operand_values_t *p)
Returns The effective operand width in bits: 16/32/64.
xed_iclass_enum_t
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_immediate(const xed_operand_values_t *p)
Return true if there is an immediate operand.
XED_DLL_EXPORT xed_bool_t xed_operand_values_using_default_segment(const xed_operand_values_t *p, unsigned int i)
Indicates if the default segment is being used.
XED_DLL_EXPORT void xed_operand_values_set_base_reg(xed_operand_values_t *p, unsigned int memop_idx, xed_reg_enum_t new_base)
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_rep_prefix(const xed_operand_values_t *p)
True if the instruction as a F3 REP prefix (used for opcode refining, for rep for string operations...
XED_DLL_EXPORT xed_reg_enum_t xed_operand_values_get_seg_reg(const xed_operand_values_t *p, unsigned int memop_idx)
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_memory_displacement_length(const xed_operand_values_t *p)
Return the memory displacement width in BYTES.
XED_DLL_EXPORT xed_iclass_enum_t xed_operand_values_get_iclass(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_rexw_prefix(const xed_operand_values_t *p)
This instruction has a REX prefix with the W bit set.
XED_DLL_EXPORT xed_uint8_t xed_operand_values_get_memory_displacement_byte(const xed_operand_values_t *p, unsigned int i)
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_modrm_byte(const xed_operand_values_t *p)
Returns true if the instruction has a MODRM byte.
XED_DLL_EXPORT void xed_operand_values_set_effective_operand_width(xed_operand_values_t *p, unsigned int width)
width is bits 8, 16, 32, 64
XED_DLL_EXPORT void xed_operand_values_set_immediate_signed_bits(xed_operand_values_t *p, xed_int32_t x, unsigned int bits)
Set the signed immediate using a BITS length.
XED_DLL_EXPORT xed_bool_t xed_operand_values_get_long_mode(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_repne_prefix(const xed_operand_values_t *p)
True if the instruction as a F2 REP prefix (used for opcode refining, for rep for string operations...
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_displacement(const xed_operand_values_t *p)
True if there is a memory or branch displacement.
XED_DLL_EXPORT xed_uint8_t xed_operand_values_get_second_immediate(const xed_operand_values_t *p)
XED_DLL_EXPORT void xed_operand_values_set_rep(xed_operand_values_t *p)
for REP(F3) prefix on string ops
XED_DLL_EXPORT xed_uint8_t xed_operand_values_get_immediate_byte(const xed_operand_values_t *p, unsigned int i)
Return the i'th byte of the immediate.
XED_DLL_EXPORT xed_bool_t xed_operand_values_get_atomic(const xed_operand_values_t *p)
Returns true if the memory operation has atomic read-modify-write semantics.
unsigned int xed_bool_t
Definition: xed-types.h:68
XED_DLL_EXPORT void xed_operand_values_set_immediate_signed(xed_operand_values_t *p, xed_int32_t x, unsigned int bytes)
Set the signed immediate using a BYTES length.
XED_DLL_EXPORT xed_bool_t xed_operand_values_memop_without_modrm(const xed_operand_values_t *p)
Returns true if the instruction access memory but without using a MODRM byte limiting its addressing ...
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_effective_address_width(const xed_operand_values_t *p)
Returns The effective address width in bits: 16/32/64.
XED_DLL_EXPORT void xed_operand_values_set_memory_displacement_bits(xed_operand_values_t *p, xed_int64_t x, unsigned int len_bits)
Set the memory displacement using a BITS length.
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_memory_displacement_length_bits(const xed_operand_values_t *p)
Return the memory displacement width in BITS.
xed_operand_enum_t
xed_reg_enum_t
Definition: xed-reg-enum.h:39
some pervasive defines
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_address_size_prefix(const xed_operand_values_t *p)
This indicates the presence of a 67 prefix.
XED_DLL_EXPORT void xed_operand_values_set_iclass(xed_operand_values_t *p, xed_iclass_enum_t iclass)
XED_DLL_EXPORT void xed_operand_values_zero_segment_override(xed_operand_values_t *p)
XED_DLL_EXPORT void xed_operand_values_set_mode(xed_operand_values_t *p, const xed_state_t *dstate)
Set the mode values.
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_lock_prefix(const xed_operand_values_t *p)
Returns true if the memory operation has a valid lock prefix.
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_memory_displacement_length_bits_raw(const xed_operand_values_t *p)
Return the raw memory displacement width in BITS(ignores scaling)
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_branch_displacement_length_bits(const xed_operand_values_t *p)
Return the branch displacement width in bits.
XED_DLL_EXPORT xed_reg_enum_t xed_operand_values_get_index_reg(const xed_operand_values_t *p, unsigned int memop_idx)
XED_DLL_EXPORT void xed_operand_values_zero_memory_displacement(xed_operand_values_t *p)
XED_DLL_EXPORT xed_int64_t xed3_operand_get_memory_displacement_int64(const xed_operand_values_t *p)
XED_DLL_EXPORT void xed_operand_values_init_keep_mode(xed_operand_values_t *dst, const xed_operand_values_t *src)
Initializes dst operand structure but preserves the existing MODE/SMODE values from the src operand s...
XED_DLL_EXPORT xed_reg_enum_t xed_operand_values_get_base_reg(const xed_operand_values_t *p, unsigned int memop_idx)
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_memory_displacement(const xed_operand_values_t *p)
True if there is a memory displacement.
Encapsulates machine modes for decoder/encoder requests.
Definition: xed-state.h:52
XED_DLL_EXPORT void xed_operand_values_set_lock(xed_operand_values_t *p)
XED_DLL_EXPORT void xed_operand_values_print_short(const xed_operand_values_t *ov, char *buf, int buflen)
More tersely dump all the information about the operands to buf.
XED_DLL_EXPORT void xed_operand_values_clear_rep(xed_operand_values_t *p)
clear the REP prefix indicator
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_disp(const xed_operand_values_t *p)
ALIAS for has_displacement().
XED_DLL_EXPORT xed_bool_t xed_operand_values_is_nop(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_operand_size_prefix(const xed_operand_values_t *p)
This does not include the cases when the 66 prefix is used an opcode-refining prefix for multibyte op...
XED_DLL_EXPORT void xed_operand_values_zero_immediate(xed_operand_values_t *p)
XED_DLL_EXPORT xed_int64_t xed_operand_values_get_memory_displacement_int64(const xed_operand_values_t *p)
XED_DLL_EXPORT void xed_operand_values_zero_branch_displacement(xed_operand_values_t *p)
XED_DLL_EXPORT xed_uint64_t xed_operand_values_get_immediate_uint64(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_uint32_t xed_operand_values_get_stack_address_width(const xed_operand_values_t *p)
Returns The stack address width in bits: 16/32/64.
XED_DLL_EXPORT void xed_operand_values_set_immediate_unsigned_bits(xed_operand_values_t *p, xed_uint64_t x, unsigned int bits)
Set the unsigned immediate using a BIT length.
XED_DLL_EXPORT xed_int32_t xed3_operand_get_branch_displacement_int32(const xed_operand_values_t *p)
unsigned int xed_uint_t
Definition: xed-types.h:65
XED_DLL_EXPORT void xed_operand_values_set_relbr(xed_operand_values_t *p)
Indicate that we have a relative branch.
XED_DLL_EXPORT void xed_operand_values_dump(const xed_operand_values_t *ov, char *buf, int buflen)
Dump all the information about the operands to buf.
XED_DLL_EXPORT void xed_operand_values_set_seg_reg(xed_operand_values_t *p, unsigned int memop_idx, xed_reg_enum_t new_seg)
XED_DLL_EXPORT void xed_operand_values_set_index_reg(xed_operand_values_t *p, unsigned int memop_idx, xed_reg_enum_t new_index)
XED_DLL_EXPORT void xed_operand_values_init(xed_operand_values_t *p)
Initializes operand structure.
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_sib_byte(const xed_operand_values_t *p)
Returns true if the instruction has a SIB byte.
XED_DLL_EXPORT unsigned int xed_operand_values_get_scale(const xed_operand_values_t *p)
XED_DLL_EXPORT void xed_operand_values_set_operand_reg(xed_operand_values_t *p, xed_operand_enum_t operand_name, xed_reg_enum_t reg_name)
Set the operand storage field entry named 'operand_name' to the register value specified by 'reg_name...
XED_DLL_EXPORT xed_reg_enum_t xed_operand_values_segment_prefix(const xed_operand_values_t *p)
Return the segment prefix, if any, as a xed_reg_enum_t value.
XED_DLL_EXPORT void xed_operand_values_set_immediate_unsigned(xed_operand_values_t *p, xed_uint64_t x, unsigned int bytes)
Set the unsigned immediate using a BYTE length.
XED_DLL_EXPORT void xed_operand_values_set_memory_operand_length(xed_operand_values_t *p, unsigned int memop_length)
XED_DLL_EXPORT unsigned int xed_operand_values_number_of_memory_operands(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_uint_t xed_operand_values_get_immediate_is_signed(const xed_operand_values_t *p)
Return true if the first immediate (IMM0) is signed.
XED_DLL_EXPORT void xed_operand_values_set_memory_displacement(xed_operand_values_t *p, xed_int64_t x, unsigned int len)
Set the memory displacement using a BYTES length.
XED_DLL_EXPORT void xed_operand_values_init_set_mode(xed_operand_values_t *p, const xed_state_t *dstate)
Initializes the operand storage and sets mode values.
XED_DLL_EXPORT void xed_operand_values_set_effective_address_width(xed_operand_values_t *p, unsigned int width)
width is bits 16, 32, 64
XED_DLL_EXPORT void xed_operand_values_set_branch_displacement(xed_operand_values_t *p, xed_int32_t x, unsigned int len)
Set the branch displacement using a BYTES length.
XED_DLL_EXPORT xed_bool_t xed_operand_values_branch_not_taken_hint(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_bool_t xed_operand_values_accesses_memory(const xed_operand_values_t *p)
XED_DLL_EXPORT void xed_operand_values_set_branch_displacement_bits(xed_operand_values_t *p, xed_int32_t x, unsigned int len_bits)
Set the branch displacement using a BITS length.
XED_DLL_EXPORT xed_bool_t xed_operand_values_is_prefetch(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_bool_t xed_operand_values_get_displacement_for_memop(const xed_operand_values_t *p)
Deprecated.
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_segment_prefix(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_bool_t xed_operand_values_branch_taken_hint(const xed_operand_values_t *p)
XED_DLL_EXPORT void xed_operand_values_set_repne(xed_operand_values_t *p)
for REPNE(F2) prefix on string ops
#define XED_DLL_EXPORT
XED_DLL_EXPORT xed_int32_t xed_operand_values_get_branch_displacement_int32(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_int64_t xed3_operand_get_memory_displacement_int64_raw(const xed_operand_values_t *p)
XED_DLL_EXPORT xed_bool_t xed_operand_values_has_66_prefix(const xed_operand_values_t *p)
This includes any 66 prefix that shows up even if it is ignored.
XED_DLL_EXPORT unsigned int xed_operand_values_get_memory_operand_length(const xed_operand_values_t *p, unsigned int memop_idx)