duran 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +11 -0
  3. data/Rakefile +29 -0
  4. data/VERSION +1 -0
  5. data/client_src/dr_include/dr_api.h +102 -0
  6. data/client_src/dr_include/dr_app.h +92 -0
  7. data/client_src/dr_include/dr_config.h +650 -0
  8. data/client_src/dr_include/dr_defines.h +391 -0
  9. data/client_src/dr_include/dr_events.h +1057 -0
  10. data/client_src/dr_include/dr_ir_instr.h +1214 -0
  11. data/client_src/dr_include/dr_ir_instrlist.h +149 -0
  12. data/client_src/dr_include/dr_ir_macros.h +2426 -0
  13. data/client_src/dr_include/dr_ir_opcodes.h +768 -0
  14. data/client_src/dr_include/dr_ir_opnd.h +1170 -0
  15. data/client_src/dr_include/dr_ir_utils.h +708 -0
  16. data/client_src/dr_include/dr_proc.h +327 -0
  17. data/client_src/dr_include/dr_tools.h +1304 -0
  18. data/client_src/duran.c +57 -0
  19. data/client_src/extconf.rb +28 -0
  20. data/lib/duran.rb +18 -0
  21. data/lib/duran/app.rb +8 -0
  22. data/lib/duran/defines.rb +39 -0
  23. data/lib/duran/events.rb +156 -0
  24. data/lib/duran/ir_opcodes.rb +616 -0
  25. data/lib/duran/ir_opnd.rb +329 -0
  26. data/lib/duran/ir_utils.rb +133 -0
  27. data/lib/duran/proc.rb +49 -0
  28. data/lib/duran/structs.rb +20 -0
  29. data/lib/duran/structs/exception.rb +23 -0
  30. data/lib/duran/structs/fault_fragment_info.rb +34 -0
  31. data/lib/duran/structs/instruction.rb +15 -0
  32. data/lib/duran/structs/machine_context.rb +80 -0
  33. data/lib/duran/structs/memory_info.rb +12 -0
  34. data/lib/duran/structs/module_data.rb +61 -0
  35. data/lib/duran/structs/module_names.rb +24 -0
  36. data/lib/duran/structs/operand.rb +15 -0
  37. data/lib/duran/structs/restore_state_info.rb +30 -0
  38. data/lib/duran/structs/signal_info.rb +41 -0
  39. data/lib/duran/structs/tracedump.rb +50 -0
  40. data/lib/duran/tools.rb +214 -0
  41. metadata +104 -0
@@ -0,0 +1,149 @@
1
+ /* **********************************************************
2
+ * Copyright (c) 2002-2009 VMware, Inc. All rights reserved.
3
+ * **********************************************************/
4
+
5
+ /*
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * * Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ *
12
+ * * Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
+ * and/or other materials provided with the distribution.
15
+ *
16
+ * * Neither the name of VMware, Inc. nor the names of its contributors may be
17
+ * used to endorse or promote products derived from this software without
18
+ * specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+ * ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE
24
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
30
+ * DAMAGE.
31
+ */
32
+
33
+ #ifndef _DR_IR_INSTRLIST_H_
34
+ #define _DR_IR_INSTRLIST_H_ 1
35
+
36
+ /****************************************************************************
37
+ * INSTRLIST ROUTINES
38
+ */
39
+ /**
40
+ * @file dr_ir_instrlist.h
41
+ * @brief Functions to create and manipulate lists of instructions.
42
+ */
43
+
44
+
45
+ /** Returns an initialized instrlist_t allocated on the thread-local heap. */
46
+ instrlist_t*
47
+ instrlist_create(void *drcontext);
48
+
49
+ /** Initializes \p ilist. */
50
+ void
51
+ instrlist_init(instrlist_t *ilist);
52
+
53
+ /** Deallocates the thread-local heap storage for \p ilist. */
54
+ void
55
+ instrlist_destroy(void *drcontext, instrlist_t *ilist);
56
+
57
+ /** Frees the instructions in \p ilist. */
58
+ void
59
+ instrlist_clear(void *drcontext, instrlist_t *ilist);
60
+
61
+ /** Destroys the instructions in \p ilist and destroys the instrlist_t object itself. */
62
+ void
63
+ instrlist_clear_and_destroy(void *drcontext, instrlist_t *ilist);
64
+
65
+ /**
66
+ * All future instructions inserted into \p ilist that do not have raw bits
67
+ * will have instr_set_translation() called with \p pc as the target.
68
+ * This is a convenience routine to make it easy to have the same
69
+ * code generate non-translation and translation instructions, and it does
70
+ * not try to enforce that all instructions have translations (e.g.,
71
+ * some could be inserted via instr_set_next()).
72
+ */
73
+ void
74
+ instrlist_set_translation_target(instrlist_t *ilist, app_pc pc);
75
+
76
+ /** Returns the translation target, or NULL if none is set. */
77
+ app_pc
78
+ instrlist_get_translation_target(instrlist_t *ilist);
79
+
80
+ /** Returns the first instr_t in \p ilist. */
81
+ instr_t*
82
+ instrlist_first(instrlist_t *ilist);
83
+
84
+ /** Returns the last instr_t in \p ilist. */
85
+ instr_t*
86
+ instrlist_last(instrlist_t *ilist);
87
+
88
+ /** Adds \p instr to the end of \p ilist. */
89
+ void
90
+ instrlist_append(instrlist_t *ilist, instr_t *instr);
91
+
92
+ /** Adds \p instr to the front of \p ilist. */
93
+ void
94
+ instrlist_prepend(instrlist_t *ilist, instr_t *instr);
95
+
96
+ /**
97
+ * Allocates a new instrlist_t and for each instr_t in \p old allocates
98
+ * a new instr_t using instr_clone to produce a complete copy of \p old.
99
+ * Each operand that is opnd_is_instr() has its target updated
100
+ * to point to the corresponding instr_t in the new instrlist_t
101
+ * (this routine assumes that all such targets are contained within \p old,
102
+ * and may fault otherwise).
103
+ */
104
+ instrlist_t*
105
+ instrlist_clone(void *drcontext, instrlist_t *old);
106
+
107
+ /** Inserts \p instr into \p ilist prior to \p where. */
108
+ void
109
+ instrlist_preinsert(instrlist_t *ilist, instr_t *where, instr_t *instr);
110
+
111
+ /** Inserts \p instr into \p ilist after \p where. */
112
+ void
113
+ instrlist_postinsert(instrlist_t *ilist, instr_t *where, instr_t *instr);
114
+
115
+ /** Replaces \p oldinst with \p newinst in \p ilist (does not destroy \p oldinst). */
116
+ instr_t*
117
+ instrlist_replace(instrlist_t *ilist, instr_t *oldinst, instr_t *newinst);
118
+
119
+ /** Removes (does not destroy) \p instr from \p ilist. */
120
+ void
121
+ instrlist_remove(instrlist_t *ilist, instr_t *instr);
122
+
123
+
124
+ /**
125
+ * Prints each instruction in \p ilist in sequence to \p outfile.
126
+ * The default is to use AT&T-style syntax, unless the \ref op_syntax_intel
127
+ * "-syntax_intel" runtime option is specified.
128
+ */
129
+ void
130
+ instrlist_disassemble(void *drcontext, app_pc tag,
131
+ instrlist_t *ilist, file_t outfile);
132
+
133
+ /**
134
+ * Encodes each instruction in \p ilist in turn in contiguous memory starting
135
+ * at \p pc. Returns the pc after all of the encodings, or NULL if any one
136
+ * of the encodings failed.
137
+ * Uses the x86/x64 mode stored in each instr, not the mode of the current thread.
138
+ * In order for instr_t operands to be encoded properly,
139
+ * \p has_instr_jmp_targets must be true. If \p has_instr_jmp_targets is true,
140
+ * the note field of each instr_t in ilist will be overwritten, and if any
141
+ * instr_t targets are not in \p ilist, they must have their note fields set with
142
+ * their offsets relative to pc.
143
+ */
144
+ byte *
145
+ instrlist_encode(void *drcontext, instrlist_t *ilist, byte *pc,
146
+ bool has_instr_jmp_targets);
147
+
148
+
149
+ #endif /* _DR_IR_INSTRLIST_H_ */
@@ -0,0 +1,2426 @@
1
+ /* **********************************************************
2
+ * Copyright (c) 2002-2009 VMware, Inc. All rights reserved.
3
+ * **********************************************************/
4
+
5
+ /*
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * * Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ *
12
+ * * Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
+ * and/or other materials provided with the distribution.
15
+ *
16
+ * * Neither the name of VMware, Inc. nor the names of its contributors may be
17
+ * used to endorse or promote products derived from this software without
18
+ * specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+ * ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE
24
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
30
+ * DAMAGE.
31
+ */
32
+
33
+ #ifndef _DR_IR_MACROS_H_
34
+ #define _DR_IR_MACROS_H_ 1
35
+
36
+ /**
37
+ * @file dr_ir_macros.h
38
+ * @brief Instruction creation convenience macros.
39
+ *
40
+ * All macros assume default data and address sizes. For the most part these
41
+ * macros do not support building non-default address or data size
42
+ * versions; for that, simply duplicate the macro's body, replacing the
43
+ * SIZE and/or hardcoded registers with smaller versions (the IR does
44
+ * not support cs segments with non-default sizes where the default
45
+ * size requires instruction prefixes). For shrinking data sizes, see
46
+ * the instr_shrink_to_16_bits() routine.
47
+ */
48
+
49
+ #include <math.h> /* for floating-point math constants */
50
+
51
+ /* instruction modification convenience routines */
52
+ /**
53
+ * Add the lock prefix to an instruction. For example:
54
+ * instr_t *lock_inc_instr = LOCK(INSTR_CREATE_inc(....));
55
+ */
56
+ #define LOCK(instr_ptr) instr_set_prefix_flag((instr_ptr), PREFIX_LOCK)
57
+ /**
58
+ * Set the translation field for an instruction. For example:
59
+ * instr_t *pushf_instr = INSTR_XL8(INSTR_CREATE_pushf(drcontext), addr);
60
+ */
61
+ #define INSTR_XL8(instr_ptr, app_addr) instr_set_translation((instr_ptr), (app_addr))
62
+
63
+ /* operand convenience routines for common cases */
64
+ /** Create a base+disp 8-byte operand. */
65
+ #define OPND_CREATE_MEM64(base_reg, disp) \
66
+ opnd_create_base_disp(base_reg, REG_NULL, 0, disp, OPSZ_8)
67
+ /** Create a base+disp 4-byte operand. */
68
+ #define OPND_CREATE_MEM32(base_reg, disp) \
69
+ opnd_create_base_disp(base_reg, REG_NULL, 0, disp, OPSZ_4)
70
+ /** Create a base+disp 2-byte operand. */
71
+ #define OPND_CREATE_MEM16(base_reg, disp) \
72
+ opnd_create_base_disp(base_reg, REG_NULL, 0, disp, OPSZ_2)
73
+ /** Create a base+disp 1-byte operand. */
74
+ #define OPND_CREATE_MEM8(base_reg, disp) \
75
+ opnd_create_base_disp(base_reg, REG_NULL, 0, disp, OPSZ_1)
76
+ #ifdef X64
77
+ /** Create a base+disp pointer-sized operand. */
78
+ # define OPND_CREATE_MEMPTR OPND_CREATE_MEM64
79
+ /**
80
+ * Create an absolute address operand encoded as pc-relative.
81
+ * Encoding will fail if addr is out of 32-bit-signed-displacement reach.
82
+ */
83
+ # define OPND_CREATE_ABSMEM(addr, size) \
84
+ opnd_create_rel_addr(addr, size)
85
+ #else
86
+ /** Create a base+disp pointer-sized operand. */
87
+ # define OPND_CREATE_MEMPTR OPND_CREATE_MEM32
88
+ /** Create an absolute address operand. */
89
+ # define OPND_CREATE_ABSMEM(addr, size) \
90
+ opnd_create_abs_addr(addr, size)
91
+ #endif
92
+
93
+ #ifdef X64
94
+ /** Create an 8-byte immediate integer operand. */
95
+ #define OPND_CREATE_INT64(val) opnd_create_immed_int((ptr_int_t)(val), OPSZ_8)
96
+ /** Create a pointer-sized immediate integer operand. */
97
+ # define OPND_CREATE_INTPTR OPND_CREATE_INT64
98
+ #else
99
+ /** Create a pointer-sized immediate integer operand. */
100
+ # define OPND_CREATE_INTPTR OPND_CREATE_INT32
101
+ #endif
102
+ /** Create a 4-byte immediate integer operand. */
103
+ #define OPND_CREATE_INT32(val) opnd_create_immed_int((ptr_int_t)(val), OPSZ_4)
104
+ /** Create a 2-byte immediate integer operand. */
105
+ #define OPND_CREATE_INT16(val) opnd_create_immed_int((ptr_int_t)(val), OPSZ_2)
106
+ /** Create a 1-byte immediate integer operand. */
107
+ #define OPND_CREATE_INT8(val) opnd_create_immed_int((ptr_int_t)(val), OPSZ_1)
108
+ /**
109
+ * Create a 1-byte immediate interger operand if val will fit, else create a 4-byte
110
+ * immediate integer operand.
111
+ */
112
+ #define OPND_CREATE_INT_32OR8(val) ((val) <= INT8_MAX && (ptr_int_t)(val) >= INT8_MIN ? \
113
+ OPND_CREATE_INT8(val) : OPND_CREATE_INT32(val))
114
+ /**
115
+ * Create a 1-byte immediate interger operand if val will fit, else create a 2-byte
116
+ * immediate integer operand.
117
+ */
118
+ #define OPND_CREATE_INT_16OR8(val) ((val) <= INT8_MAX && (ptr_int_t)(val) >= INT8_MIN ? \
119
+ OPND_CREATE_INT8(val) : OPND_CREATE_INT16(val))
120
+
121
+
122
+ /* operand convenience routines for specific opcodes with odd sizes */
123
+ /** Create a memory reference operand appropriately sized for OP_lea. */
124
+ #define OPND_CREATE_MEM_lea(base, index, scale, disp) \
125
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_lea)
126
+ /** Create a memory reference operand appropriately sized for OP_invlpg. */
127
+ #define OPND_CREATE_MEM_invlpg(base, index, scale, disp) \
128
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_invlpg)
129
+ /** Create a memory reference operand appropriately sized for OP_clflush. */
130
+ #define OPND_CREATE_MEM_clflush(base, index, scale, disp) \
131
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_clflush)
132
+ /** Create a memory reference operand appropriately sized for OP_prefetch*. */
133
+ #define OPND_CREATE_MEM_prefetch(base, index, scale, disp) \
134
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_prefetch)
135
+ /** Create a memory reference operand appropriately sized for OP_lgdt. */
136
+ #define OPND_CREATE_MEM_lgdt(base, index, scale, disp) \
137
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_lgdt)
138
+ /** Create a memory reference operand appropriately sized for OP_sgdt. */
139
+ #define OPND_CREATE_MEM_sgdt(base, index, scale, disp) \
140
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_sgdt)
141
+ /** Create a memory reference operand appropriately sized for OP_lidt. */
142
+ #define OPND_CREATE_MEM_lidt(base, index, scale, disp) \
143
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_lidt)
144
+ /** Create a memory reference operand appropriately sized for OP_sidt. */
145
+ #define OPND_CREATE_MEM_sidt(base, index, scale, disp) \
146
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_sidt)
147
+ /** Create a memory reference operand appropriately sized for OP_bound. */
148
+ #define OPND_CREATE_MEM_bound(base, index, scale, disp) \
149
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_bound)
150
+ /** Create a memory reference operand appropriately sized for OP_fldenv. */
151
+ #define OPND_CREATE_MEM_fldenv(base, index, scale, disp) \
152
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_fldenv)
153
+ /** Create a memory reference operand appropriately sized for OP_fnstenv. */
154
+ #define OPND_CREATE_MEM_fnstenv(base, index, scale, disp) \
155
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_fnstenv)
156
+ /** Create a memory reference operand appropriately sized for OP_fnsave. */
157
+ #define OPND_CREATE_MEM_fnsave(base, index, scale, disp) \
158
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_fnsave)
159
+ /** Create a memory reference operand appropriately sized for OP_frstor. */
160
+ #define OPND_CREATE_MEM_frstor(base, index, scale, disp) \
161
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_frstor)
162
+ /** Create a memory reference operand appropriately sized for OP_fxsave. */
163
+ #define OPND_CREATE_MEM_fxsave(base, index, scale, disp) \
164
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_fxsave)
165
+ /** Create a memory reference operand appropriately sized for OP_fxrstor. */
166
+ #define OPND_CREATE_MEM_fxrstor(base, index, scale, disp) \
167
+ opnd_create_base_disp(base, index, scale, disp, OPSZ_fxrstor)
168
+
169
+ /* Macros for building instructions, one for each opcode.
170
+ * Each INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
171
+ * the given explicit operands, automatically supplying any implicit operands.
172
+ * The macro parameter types, encoded by name, are:
173
+ * dc = DR Context*
174
+ * op = uint = opcode
175
+ * s = opnd_t = source operand
176
+ * i = opnd_t = source operand that is an immediate
177
+ * ri = opnd_t = source operand that can be a register or an immediate
178
+ * t = opnd_t = source operand that is a jump target
179
+ * m = opnd_t = source operand that can only reference memory
180
+ * f = opnd_t = floating point register operand
181
+ * d = opnd_t = destination operand
182
+ */
183
+
184
+ /* no-operand instructions */
185
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
186
+ /**
187
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
188
+ * supplying any implicit operands.
189
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
190
+ */
191
+ #define INSTR_CREATE_fwait(dc) instr_create_0dst_0src((dc), OP_fwait)
192
+ #define INSTR_CREATE_hlt(dc) instr_create_0dst_0src((dc), OP_hlt)
193
+ #define INSTR_CREATE_cmc(dc) instr_create_0dst_0src((dc), OP_cmc)
194
+ #define INSTR_CREATE_clc(dc) instr_create_0dst_0src((dc), OP_clc)
195
+ #define INSTR_CREATE_stc(dc) instr_create_0dst_0src((dc), OP_stc)
196
+ #define INSTR_CREATE_cli(dc) instr_create_0dst_0src((dc), OP_cli)
197
+ #define INSTR_CREATE_sti(dc) instr_create_0dst_0src((dc), OP_sti)
198
+ #define INSTR_CREATE_cld(dc) instr_create_0dst_0src((dc), OP_cld)
199
+ #define INSTR_CREATE_std(dc) instr_create_0dst_0src((dc), OP_std)
200
+ #define INSTR_CREATE_clts(dc) instr_create_0dst_0src((dc), OP_clts)
201
+ #define INSTR_CREATE_invd(dc) instr_create_0dst_0src((dc), OP_invd)
202
+ #define INSTR_CREATE_wbinvd(dc) instr_create_0dst_0src((dc), OP_wbinvd)
203
+ #define INSTR_CREATE_ud2a(dc) instr_create_0dst_0src((dc), OP_ud2a)
204
+ #define INSTR_CREATE_emms(dc) instr_create_0dst_0src((dc), OP_emms)
205
+ #define INSTR_CREATE_rsm(dc) instr_create_0dst_0src((dc), OP_rsm)
206
+ #define INSTR_CREATE_ud2b(dc) instr_create_0dst_0src((dc), OP_ud2b)
207
+ #define INSTR_CREATE_lfence(dc) instr_create_0dst_0src((dc), OP_lfence)
208
+ #define INSTR_CREATE_mfence(dc) instr_create_0dst_0src((dc), OP_mfence)
209
+ #define INSTR_CREATE_sfence(dc) instr_create_0dst_0src((dc), OP_sfence)
210
+ #define INSTR_CREATE_nop(dc) instr_create_0dst_0src((dc), OP_nop)
211
+ #define INSTR_CREATE_pause(dc) instr_create_0dst_0src((dc), OP_pause)
212
+ #define INSTR_CREATE_fnop(dc) instr_create_0dst_0src((dc), OP_fnop)
213
+ #define INSTR_CREATE_fdecstp(dc) instr_create_0dst_0src((dc), OP_fdecstp)
214
+ #define INSTR_CREATE_fincstp(dc) instr_create_0dst_0src((dc), OP_fincstp)
215
+ #define INSTR_CREATE_fnclex(dc) instr_create_0dst_0src((dc), OP_fnclex)
216
+ #define INSTR_CREATE_fninit(dc) instr_create_0dst_0src((dc), OP_fninit)
217
+ #define INSTR_CREATE_sysret(dc) instr_create_0dst_0src((dc), OP_sysret)
218
+ #define INSTR_CREATE_femms(dc) instr_create_0dst_0src((dc), OP_femms)
219
+ #define INSTR_CREATE_swapgs(dc) instr_create_0dst_0src((dc), OP_swapgs)
220
+ #define INSTR_CREATE_vmcall(dc) instr_create_0dst_0src((dc), OP_vmcall)
221
+ #define INSTR_CREATE_vmlaunch(dc) instr_create_0dst_0src((dc), OP_vmlaunch)
222
+ #define INSTR_CREATE_vmresume(dc) instr_create_0dst_0src((dc), OP_vmresume)
223
+ #define INSTR_CREATE_vmxoff(dc) instr_create_0dst_0src((dc), OP_vmxoff)
224
+ /* @} */ /* end doxygen group */
225
+ /**
226
+ * Creates an instr_t with opcode OP_LABEL. An OP_LABEL instruction can be used as a
227
+ * jump or call instr_t target, and when emitted it will take no space in the
228
+ * resulting machine code.
229
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
230
+ */
231
+ #define INSTR_CREATE_label(dc) instr_create_0dst_0src((dc), OP_LABEL)
232
+
233
+ /* no destination, 1 source */
234
+ /**
235
+ * Creates an instr_t for a short conditional branch instruction with the given
236
+ * opcode and target operand.
237
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
238
+ * \param op The OP_xxx opcode for the conditional branch, which should be
239
+ * in the range [OP_jo_short, OP_jnle_short].
240
+ * \param t The opnd_t target operand for the instruction, which can be either
241
+ * a pc (opnd_create_pc()) or an instr_t (opnd_create_instr()). Be sure to
242
+ * ensure that the limited reach of this short branch will reach the target
243
+ * (a pc operand is not suitable for most uses unless you know precisely where
244
+ * this instruction will be encoded).
245
+ */
246
+ #define INSTR_CREATE_jcc_short(dc, op, t) \
247
+ instr_create_0dst_1src((dc), (op), (t))
248
+ /**
249
+ * Creates an instr_t for a conditional branch instruction with the given opcode
250
+ * and target operand.
251
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
252
+ * \param op The OP_xxx opcode for the conditional branch, which should be
253
+ * in the range [OP_jo, OP_jnle].
254
+ * \param t The opnd_t target operand for the instruction, which can be either
255
+ * a pc (opnd_create_pc()) or an instr_t (opnd_create_instr()).
256
+ */
257
+ #define INSTR_CREATE_jcc(dc, op, t) \
258
+ instr_create_0dst_1src((dc), (op), (t))
259
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
260
+ /**
261
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
262
+ * the given explicit operands, automatically supplying any implicit operands.
263
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
264
+ * \param t The opnd_t target operand for the instruction, which can be either
265
+ * a pc (opnd_create_pc()) or an instr_t (opnd_create_instr()).
266
+ */
267
+ #define INSTR_CREATE_jmp(dc, t) \
268
+ instr_create_0dst_1src((dc), OP_jmp, (t))
269
+ #define INSTR_CREATE_jmp_short(dc, t) \
270
+ instr_create_0dst_1src((dc), OP_jmp_short, (t))
271
+ /* @} */ /* end doxygen group */
272
+ /**
273
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
274
+ * the given explicit operands, automatically supplying any implicit operands.
275
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
276
+ * \param t The opnd_t target operand for the instruction, which should be
277
+ * a memory reference created with opnd_create_base_disp().
278
+ */
279
+ #define INSTR_CREATE_jmp_ind(dc, t) \
280
+ instr_create_0dst_1src((dc), OP_jmp_ind, (t))
281
+ /**
282
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
283
+ * the given explicit operands, automatically supplying any implicit operands.
284
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
285
+ * \param t The opnd_t target operand for the instruction, which should be
286
+ * a far pc operand created with opnd_create_far_pc().
287
+ */
288
+ #define INSTR_CREATE_jmp_far(dc, t) \
289
+ instr_create_0dst_1src((dc), OP_jmp_far, (t))
290
+ /**
291
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
292
+ * the given explicit operands, automatically supplying any implicit operands.
293
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
294
+ * \param t The opnd_t target operand for the instruction, which should be
295
+ * a far memory reference created with opnd_create_far_base_disp().
296
+ */
297
+ #define INSTR_CREATE_jmp_far_ind(dc, t) \
298
+ instr_create_0dst_1src((dc), OP_jmp_far_ind, (t))
299
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
300
+ /**
301
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
302
+ * the given explicit operands, automatically supplying any implicit operands.
303
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
304
+ * \param s The opnd_t explicit source operand for the instruction.
305
+ */
306
+ #define INSTR_CREATE_lldt(dc, s) \
307
+ instr_create_0dst_1src((dc), OP_lldt, (s))
308
+ #define INSTR_CREATE_ltr(dc, s) \
309
+ instr_create_0dst_1src((dc), OP_ltr, (s))
310
+ #define INSTR_CREATE_verr(dc, s) \
311
+ instr_create_0dst_1src((dc), OP_verr, (s))
312
+ #define INSTR_CREATE_verw(dc, s) \
313
+ instr_create_0dst_1src((dc), OP_verw, (s))
314
+ #define INSTR_CREATE_vmptrld(dc, s) \
315
+ instr_create_0dst_1src((dc), OP_vmptrld, (s))
316
+ #define INSTR_CREATE_vmxon(dc, s) \
317
+ instr_create_0dst_1src((dc), OP_vmxon, (s))
318
+ /**
319
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
320
+ * the given explicit operands, automatically supplying any implicit operands.
321
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
322
+ * \param s The opnd_t explicit source operand for the instruction, which can be
323
+ * created with OPND_CREATE_MEM_lgdt() to get the appropriate operand size.
324
+ */
325
+ #define INSTR_CREATE_lgdt(dc, s) \
326
+ instr_create_0dst_1src((dc), OP_lgdt, (s))
327
+ /**
328
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
329
+ * the given explicit operands, automatically supplying any implicit operands.
330
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
331
+ * \param s The opnd_t explicit source operand for the instruction, which can be
332
+ * created with OPND_CREATE_MEM_lidt() to get the appropriate operand size.
333
+ */
334
+ #define INSTR_CREATE_lidt(dc, s) \
335
+ instr_create_0dst_1src((dc), OP_lidt, (s))
336
+ #define INSTR_CREATE_lmsw(dc, s) \
337
+ instr_create_0dst_1src((dc), OP_lmsw, (s))
338
+ /**
339
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
340
+ * the given explicit operands, automatically supplying any implicit operands.
341
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
342
+ * \param s The opnd_t explicit source operand for the instruction, which can be
343
+ * created with OPND_CREATE_MEM_invlpg() to get the appropriate operand size.
344
+ */
345
+ #define INSTR_CREATE_invlpg(dc, s) \
346
+ instr_create_0dst_1src((dc), OP_invlpg, (s))
347
+ /**
348
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
349
+ * the given explicit operands, automatically supplying any implicit operands.
350
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
351
+ * \param s The opnd_t explicit source operand for the instruction, which can be
352
+ * created with OPND_CREATE_MEM_fxrstor() to get the appropriate operand size.
353
+ */
354
+ #define INSTR_CREATE_fxrstor(dc, s) \
355
+ instr_create_0dst_1src((dc), OP_fxrstor, (s))
356
+ #define INSTR_CREATE_ldmxcsr(dc, s) \
357
+ instr_create_0dst_1src((dc), OP_ldmxcsr, (s))
358
+ #define INSTR_CREATE_nop_modrm(dc, s) \
359
+ instr_create_0dst_1src((dc), OP_nop_modrm, (s))
360
+ /* @} */ /* end doxygen group */
361
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
362
+ /**
363
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
364
+ * the given explicit operands, automatically supplying any implicit operands.
365
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
366
+ * \param s The opnd_t explicit source operand for the instruction, which can be
367
+ * created with OPND_CREATE_MEM_prefetch() to get the appropriate operand size.
368
+ */
369
+ #define INSTR_CREATE_prefetchnta(dc, s) \
370
+ instr_create_0dst_1src((dc), OP_prefetchnta, (s))
371
+ #define INSTR_CREATE_prefetcht0(dc, s) \
372
+ instr_create_0dst_1src((dc), OP_prefetcht0, (s))
373
+ #define INSTR_CREATE_prefetcht1(dc, s) \
374
+ instr_create_0dst_1src((dc), OP_prefetcht1, (s))
375
+ #define INSTR_CREATE_prefetcht2(dc, s) \
376
+ instr_create_0dst_1src((dc), OP_prefetcht2, (s))
377
+ #define INSTR_CREATE_prefetch(dc, s) \
378
+ instr_create_0dst_1src((dc), OP_prefetch, (s))
379
+ #define INSTR_CREATE_prefetchw(dc, s) \
380
+ instr_create_0dst_1src((dc), OP_prefetchw, (s))
381
+ /* @} */ /* end doxygen group */
382
+ /**
383
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
384
+ * the given explicit operands, automatically supplying any implicit operands.
385
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
386
+ * \param s The opnd_t explicit source operand for the instruction, which can be
387
+ * created with OPND_CREATE_MEM_clflush() to get the appropriate operand size.
388
+ */
389
+ #define INSTR_CREATE_clflush(dc, s) \
390
+ instr_create_0dst_1src((dc), OP_clflush, (s))
391
+
392
+
393
+ /* floating-point */
394
+ /**
395
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
396
+ * the given explicit operands, automatically supplying any implicit operands.
397
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
398
+ * \param m The opnd_t explicit destination operand for the instruction, which can be
399
+ * created with OPND_CREATE_MEM_fldenv() to get the appropriate operand size.
400
+ */
401
+ #define INSTR_CREATE_fldenv(dc, m) \
402
+ instr_create_0dst_1src((dc), OP_fldenv, (m))
403
+ /**
404
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
405
+ * the given explicit operands, automatically supplying any implicit operands.
406
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
407
+ * \param m The opnd_t explicit destination operand for the instruction, which must
408
+ * be a memory reference (opnd_create_base_disp() or opnd_create_far_base_disp()).
409
+ */
410
+ #define INSTR_CREATE_fldcw(dc, m) \
411
+ instr_create_0dst_1src((dc), OP_fldcw, (m))
412
+ /**
413
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
414
+ * the given explicit operands, automatically supplying any implicit operands.
415
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
416
+ * \param m The opnd_t explicit destination operand for the instruction, which can be
417
+ * created with OPND_CREATE_MEM_frstor() to get the appropriate operand size.
418
+ */
419
+ #define INSTR_CREATE_frstor(dc, m) \
420
+ instr_create_0dst_1src((dc), OP_frstor, (m))
421
+
422
+ /* no destination, 1 implicit source */
423
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
424
+ /**
425
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
426
+ * supplying any implicit operands.
427
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
428
+ */
429
+ #define INSTR_CREATE_fxam(dc) \
430
+ instr_create_0dst_1src((dc), OP_fxam, opnd_create_reg(REG_ST0))
431
+ #define INSTR_CREATE_sahf(dc) \
432
+ instr_create_0dst_1src((dc), OP_sahf, opnd_create_reg(REG_AH))
433
+ /* @} */ /* end doxygen group */
434
+
435
+ /* no destination, 2 sources */
436
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
437
+ /**
438
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
439
+ * the given explicit operands, automatically supplying any implicit operands.
440
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
441
+ * \param s1 The opnd_t first source operand for the instruction.
442
+ * \param s2 The opnd_t second source operand for the instruction.
443
+ */
444
+ #define INSTR_CREATE_cmp(dc, s1, s2) \
445
+ instr_create_0dst_2src((dc), OP_cmp, (s1), (s2))
446
+ #define INSTR_CREATE_test(dc, s1, s2) \
447
+ instr_create_0dst_2src((dc), OP_test, (s1), (s2))
448
+ #define INSTR_CREATE_ptest(dc, s1, s2) \
449
+ instr_create_0dst_2src((dc), OP_ptest, (s1), (s2))
450
+ /**
451
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
452
+ * the given explicit operands, automatically supplying any implicit operands.
453
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
454
+ * \param s1 The opnd_t first source operand for the instruction.
455
+ * \param s2 The opnd_t second source operand for the instruction, which can
456
+ * be created with OPND_CREATE_MEM_bound() to get the appropriate operand size.
457
+ */
458
+ #define INSTR_CREATE_bound(dc, s1, s2) \
459
+ instr_create_0dst_2src((dc), OP_bound, (s1), (s2))
460
+ /**
461
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
462
+ * the given explicit operands, automatically supplying any implicit operands.
463
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
464
+ * \param s The opnd_t first source operand for the instruction.
465
+ * \param ri The opnd_t second source operand for the instruction, which can
466
+ * be either a register or an immediate integer.
467
+ */
468
+ #define INSTR_CREATE_bt(dc, s, ri) \
469
+ instr_create_0dst_2src((dc), OP_bt, (s), (ri))
470
+ #define INSTR_CREATE_ucomiss(dc, s1, s2) \
471
+ instr_create_0dst_2src((dc), OP_ucomiss, (s1), (s2))
472
+ #define INSTR_CREATE_ucomisd(dc, s1, s2) \
473
+ instr_create_0dst_2src((dc), OP_ucomisd, (s1), (s2))
474
+ #define INSTR_CREATE_comiss(dc, s1, s2) \
475
+ instr_create_0dst_2src((dc), OP_comiss, (s1), (s2))
476
+ #define INSTR_CREATE_comisd(dc, s1, s2) \
477
+ instr_create_0dst_2src((dc), OP_comisd, (s1), (s2))
478
+ /* @} */ /* end doxygen group */
479
+
480
+ /* no destination, 2 sources: 1 implicit */
481
+ /**
482
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
483
+ * the given explicit operands, automatically supplying any implicit operands.
484
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
485
+ * \param t The opnd_t target operand for the instruction, which can be either
486
+ * a pc (opnd_create_pc()) or an instr_t (opnd_create_instr()).
487
+ */
488
+ #define INSTR_CREATE_jecxz(dc, t) \
489
+ instr_create_0dst_2src((dc), OP_jecxz, (t), opnd_create_reg(REG_XCX))
490
+ /**
491
+ * Creates an instr_t for an OP_jecxz instruction that uses cx instead of ecx
492
+ * (there is no separate OP_jcxz).
493
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
494
+ * \param t The opnd_t target operand for the instruction, which can be either
495
+ * a pc (opnd_create_pc()) or an instr_t (opnd_create_instr()).
496
+ */
497
+ #define INSTR_CREATE_jcxz(dc, t) \
498
+ instr_create_0dst_2src((dc), OP_jecxz, (t), opnd_create_reg(REG_CX))
499
+
500
+ /* no destination, 2 sources */
501
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
502
+ /**
503
+ * Creates an instr_t for an OP_out instruction with a source of al
504
+ * (INSTR_CREATE_out_1()) or eax (INSTR_CREATE_out_4()) and dx.
505
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
506
+ */
507
+ #define INSTR_CREATE_out_1(dc) \
508
+ instr_create_0dst_2src((dc), OP_out, opnd_create_reg(REG_AL), opnd_create_reg(REG_DX))
509
+ #define INSTR_CREATE_out_4(dc) \
510
+ instr_create_0dst_2src((dc), OP_out, opnd_create_reg(REG_EAX), opnd_create_reg(REG_DX))
511
+ /* @} */ /* end doxygen group */
512
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
513
+ /**
514
+ * Creates an instr_t for an OP_out instruction with a source of al
515
+ * (INSTR_CREATE_out_1_imm()) or eax (INSTR_CREATE_out_4_imm()) and an immediate.
516
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
517
+ * \param i The opnd_t explicit source operand for the instruction, which must be an
518
+ * immediate integer (opnd_create_immed_int()).
519
+ */
520
+ #define INSTR_CREATE_out_1_imm(dc, i) \
521
+ instr_create_0dst_2src((dc), OP_out, (i), opnd_create_reg(REG_AL))
522
+ #define INSTR_CREATE_out_4_imm(dc, i) \
523
+ instr_create_0dst_2src((dc), OP_out, (i), opnd_create_reg(REG_EAX))
524
+ /* @} */ /* end doxygen group */
525
+
526
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
527
+ /**
528
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
529
+ * supplying any implicit operands.
530
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
531
+ */
532
+ /* no destination, 2 implicit sources */
533
+ #define INSTR_CREATE_mwait(dc) \
534
+ instr_create_0dst_2src((dc), OP_mwait, opnd_create_reg(REG_EAX), \
535
+ opnd_create_reg(REG_ECX))
536
+ /* no destination, 3 implicit sources */
537
+ #define INSTR_CREATE_wrmsr(dc) \
538
+ instr_create_0dst_3src((dc), OP_wrmsr, opnd_create_reg(REG_EDX), \
539
+ opnd_create_reg(REG_EAX), opnd_create_reg(REG_ECX))
540
+ #define INSTR_CREATE_monitor(dc) \
541
+ instr_create_0dst_3src((dc), OP_monitor, opnd_create_reg(REG_EAX), \
542
+ opnd_create_reg(REG_ECX), opnd_create_reg(REG_EDX))
543
+ /* @} */ /* end doxygen group */
544
+
545
+ /* floating-point */
546
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
547
+ /**
548
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
549
+ * given explicit operands, automatically supplying any implicit operands.
550
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
551
+ * \param s The opnd_t explicit source operand for the instruction, which must
552
+ * be one of the following:
553
+ * -# A floating point register (opnd_create_reg()).
554
+ * -# A memory reference (opnd_create_base_disp() or opnd_create_far_base_disp()).
555
+ * The other (implicit) source operand is #REG_ST0.
556
+ */
557
+ #define INSTR_CREATE_fcom(dc, s) \
558
+ instr_create_0dst_2src((dc), OP_fcom, (s), opnd_create_reg(REG_ST0))
559
+ #define INSTR_CREATE_fcomp(dc, s) \
560
+ instr_create_0dst_2src((dc), OP_fcomp, (s), opnd_create_reg(REG_ST0))
561
+ /* @} */ /* end doxygen group */
562
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
563
+ /**
564
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
565
+ * given explicit operands, automatically supplying any implicit operands.
566
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
567
+ * \param f The opnd_t explicit source operand for the instruction, which must
568
+ * be a floating point register (opnd_create_reg()).
569
+ * The other (implicit) source operand is #REG_ST0.
570
+ */
571
+ #define INSTR_CREATE_fcomi(dc, f) \
572
+ instr_create_0dst_2src((dc), OP_fcomi, opnd_create_reg(REG_ST0), (f))
573
+ #define INSTR_CREATE_fcomip(dc, f) \
574
+ instr_create_0dst_2src((dc), OP_fcomip, opnd_create_reg(REG_ST0), (f))
575
+ #define INSTR_CREATE_fucomi(dc, f) \
576
+ instr_create_0dst_2src((dc), OP_fucomi, opnd_create_reg(REG_ST0), (f))
577
+ #define INSTR_CREATE_fucomip(dc, f) \
578
+ instr_create_0dst_2src((dc), OP_fucomip, opnd_create_reg(REG_ST0), (f))
579
+ #define INSTR_CREATE_fucom(dc, f) \
580
+ instr_create_0dst_2src((dc), OP_fucom, opnd_create_reg(REG_ST0), (f))
581
+ #define INSTR_CREATE_fucomp(dc, f) \
582
+ instr_create_0dst_2src((dc), OP_fucomp, opnd_create_reg(REG_ST0), (f))
583
+ /* @} */ /* end doxygen group */
584
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
585
+ /**
586
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx,
587
+ * automatically supplying any implicit operands.
588
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
589
+ */
590
+ #define INSTR_CREATE_fucompp(dc) \
591
+ instr_create_0dst_2src((dc), OP_fucompp, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1))
592
+ #define INSTR_CREATE_fcompp(dc) \
593
+ instr_create_0dst_2src((dc), OP_fcompp, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1))
594
+ /* @} */ /* end doxygen group */
595
+
596
+ /* 1 destination, no sources */
597
+ /**
598
+ * Creats an instr_t for a conditional set instruction with the given opcode
599
+ * and destination operand.
600
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
601
+ * \param op The OP_xxx opcode for the instruction, which should be in the range
602
+ * [OP_seto, OP_setnle].
603
+ * \param d The opnd_t destination operand for the instruction.
604
+ */
605
+ #define INSTR_CREATE_setcc(dc, op, d) \
606
+ instr_create_1dst_0src((dc), (op), (d))
607
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
608
+ /**
609
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
610
+ * explicit operands, automatically supplying any implicit operands.
611
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
612
+ * \param d The opnd_t explicit destination operand for the instruction.
613
+ */
614
+ #define INSTR_CREATE_sldt(dc, d) \
615
+ instr_create_1dst_0src((dc), OP_sldt, (d))
616
+ #define INSTR_CREATE_str(dc, d) \
617
+ instr_create_1dst_0src((dc), OP_str, (d))
618
+ #define INSTR_CREATE_vmptrst(dc, d) \
619
+ instr_create_1dst_0src((dc), OP_vmptrst, (d))
620
+ #define INSTR_CREATE_vmclear(dc, d) \
621
+ instr_create_1dst_0src((dc), OP_vmclear, (d))
622
+ /**
623
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
624
+ * explicit operands, automatically supplying any implicit operands.
625
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
626
+ * \param d The opnd_t explicit destination operand for the instruction, which can
627
+ * be created with OPND_CREATE_MEM_sgdt() to get the appropriate operand size.
628
+ */
629
+ #define INSTR_CREATE_sgdt(dc, d) \
630
+ instr_create_1dst_0src((dc), OP_sgdt, (d))
631
+ /**
632
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
633
+ * explicit operands, automatically supplying any implicit operands.
634
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
635
+ * \param d The opnd_t explicit destination operand for the instruction, which can
636
+ * be created with OPND_CREATE_MEM_sidt() to get the appropriate operand size.
637
+ */
638
+ #define INSTR_CREATE_sidt(dc, d) \
639
+ instr_create_1dst_0src((dc), OP_sidt, (d))
640
+ #define INSTR_CREATE_smsw(dc, d) \
641
+ instr_create_1dst_0src((dc), OP_smsw, (d))
642
+ /**
643
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
644
+ * explicit operands, automatically supplying any implicit operands.
645
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
646
+ * \param d The opnd_t explicit destination operand for the instruction, which can
647
+ * be created with OPND_CREATE_MEM_fxsave() to get the appropriate operand size.
648
+ */
649
+ #define INSTR_CREATE_fxsave(dc, d) \
650
+ instr_create_1dst_0src((dc), OP_fxsave, (d))
651
+ #define INSTR_CREATE_stmxcsr(dc, d) \
652
+ instr_create_1dst_0src((dc), OP_stmxcsr, (d))
653
+ /* @} */ /* end doxygen group */
654
+
655
+ /* floating-point */
656
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
657
+ /**
658
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
659
+ * explicit operands, automatically supplying any implicit operands.
660
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
661
+ * \param m The opnd_t explicit destination operand for the instruction, which must
662
+ * be a memory reference (opnd_create_base_disp() or opnd_create_far_base_disp()).
663
+ */
664
+ /**
665
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
666
+ * explicit operands, automatically supplying any implicit operands.
667
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
668
+ * \param m The opnd_t explicit destination operand for the instruction, which can
669
+ * be created with OPND_CREATE_MEM_fnstenv() to get the appropriate operand size.
670
+ */
671
+ #define INSTR_CREATE_fnstenv(dc, m) \
672
+ instr_create_1dst_0src((dc), OP_fnstenv, (m))
673
+ #define INSTR_CREATE_fnstcw(dc, m) \
674
+ instr_create_1dst_0src((dc), OP_fnstcw, (m))
675
+ /**
676
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
677
+ * explicit operands, automatically supplying any implicit operands.
678
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
679
+ * \param m The opnd_t explicit destination operand for the instruction, which can
680
+ * be created with OPND_CREATE_MEM_fnsave() to get the appropriate operand size.
681
+ */
682
+ #define INSTR_CREATE_fnsave(dc, m) \
683
+ instr_create_1dst_0src((dc), OP_fnsave, (m))
684
+ #define INSTR_CREATE_fnstsw(dc, m) \
685
+ instr_create_1dst_0src((dc), OP_fnstsw, (m))
686
+ /* @} */ /* end doxygen group */
687
+
688
+ /**
689
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
690
+ * explicit operands, automatically supplying any implicit operands.
691
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
692
+ * \param f The opnd_t explicit destination operand for the instruction, which must
693
+ * be a floating point register (opnd_create_reg()).
694
+ */
695
+ #define INSTR_CREATE_ffree(dc, f) \
696
+ instr_create_1dst_0src((dc), OP_ffree, (f))
697
+ #define INSTR_CREATE_ffreep(dc, f) \
698
+ instr_create_1dst_0src((dc), OP_ffreep, (f))
699
+
700
+ /* 1 implicit destination, no sources */
701
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
702
+ /**
703
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
704
+ * supplying any implicit operands.
705
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
706
+ */
707
+ #define INSTR_CREATE_lahf(dc) \
708
+ instr_create_1dst_0src((dc), OP_lahf, opnd_create_reg(REG_AH))
709
+ #define INSTR_CREATE_sysenter(dc) \
710
+ instr_create_1dst_0src((dc), OP_sysenter, opnd_create_reg(REG_XSP))
711
+ #define INSTR_CREATE_sysexit(dc) \
712
+ instr_create_1dst_0src((dc), OP_sysexit, opnd_create_reg(REG_XSP))
713
+ #define INSTR_CREATE_syscall(dc) \
714
+ instr_create_1dst_0src((dc), OP_syscall, opnd_create_reg(REG_XCX))
715
+ #define INSTR_CREATE_salc(dc) \
716
+ instr_create_1dst_0src((dc), OP_salc, opnd_create_reg(REG_AL))
717
+ /* @} */ /* end doxygen group */
718
+
719
+ /* 1 destination, 1 source */
720
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
721
+ /**
722
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
723
+ * explicit operands, automatically supplying any implicit operands.
724
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
725
+ * \param d The opnd_t explicit destination operand for the instruction.
726
+ * \param s The opnd_t explicit source operand for the instruction.
727
+ */
728
+ #define INSTR_CREATE_arpl(dc, d, s) \
729
+ instr_create_1dst_1src((dc), OP_arpl, (d), (s))
730
+ /**
731
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
732
+ * explicit operands, automatically supplying any implicit operands.
733
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
734
+ * \param d The opnd_t explicit destination operand for the instruction.
735
+ * \param s The opnd_t explicit source operand for the instruction, which can be
736
+ * created with OPND_CREATE_MEM_lea() to get the appropriate operand size.
737
+ */
738
+ #define INSTR_CREATE_lea(dc, d, s) \
739
+ instr_create_1dst_1src((dc), OP_lea, (d), (s))
740
+ #define INSTR_CREATE_mov_ld(dc, d, s) \
741
+ instr_create_1dst_1src((dc), OP_mov_ld, (d), (s))
742
+ #define INSTR_CREATE_mov_st(dc, d, s) \
743
+ instr_create_1dst_1src((dc), OP_mov_st, (d), (s))
744
+ #define INSTR_CREATE_mov_imm(dc, d, s) \
745
+ instr_create_1dst_1src((dc), OP_mov_imm, (d), (s))
746
+ #define INSTR_CREATE_mov_seg(dc, d, s) \
747
+ instr_create_1dst_1src((dc), OP_mov_seg, (d), (s))
748
+ #define INSTR_CREATE_mov_priv(dc, d, s) \
749
+ instr_create_1dst_1src((dc), OP_mov_priv, (d), (s))
750
+ #define INSTR_CREATE_lar(dc, d, s) \
751
+ instr_create_1dst_1src((dc), OP_lar, (d), (s))
752
+ #define INSTR_CREATE_lsl(dc, d, s) \
753
+ instr_create_1dst_1src((dc), OP_lsl, (d), (s))
754
+ #define INSTR_CREATE_movntps(dc, d, s) \
755
+ instr_create_1dst_1src((dc), OP_movntps, (d), (s))
756
+ #define INSTR_CREATE_movntpd(dc, d, s) \
757
+ instr_create_1dst_1src((dc), OP_movntpd, (d), (s))
758
+ #define INSTR_CREATE_movd(dc, d, s) \
759
+ instr_create_1dst_1src((dc), OP_movd, (d), (s))
760
+ #define INSTR_CREATE_movq(dc, d, s) \
761
+ instr_create_1dst_1src((dc), OP_movq, (d), (s))
762
+ #define INSTR_CREATE_movdqu(dc, d, s) \
763
+ instr_create_1dst_1src((dc), OP_movdqu, (d), (s))
764
+ #define INSTR_CREATE_movdqa(dc, d, s) \
765
+ instr_create_1dst_1src((dc), OP_movdqa, (d), (s))
766
+ #define INSTR_CREATE_movzx(dc, d, s) \
767
+ instr_create_1dst_1src((dc), OP_movzx, (d), (s))
768
+ #define INSTR_CREATE_movsx(dc, d, s) \
769
+ instr_create_1dst_1src((dc), OP_movsx, (d), (s))
770
+ #define INSTR_CREATE_bsf(dc, d, s) \
771
+ instr_create_1dst_1src((dc), OP_bsf, (d), (s))
772
+ #define INSTR_CREATE_bsr(dc, d, s) \
773
+ instr_create_1dst_1src((dc), OP_bsr, (d), (s))
774
+ #define INSTR_CREATE_pmovmskb(dc, d, s) \
775
+ instr_create_1dst_1src((dc), OP_pmovmskb, (d), (s))
776
+ #define INSTR_CREATE_movups(dc, d, s) \
777
+ instr_create_1dst_1src((dc), OP_movups, (d), (s))
778
+ #define INSTR_CREATE_movss(dc, d, s) \
779
+ instr_create_1dst_1src((dc), OP_movss, (d), (s))
780
+ #define INSTR_CREATE_movupd(dc, d, s) \
781
+ instr_create_1dst_1src((dc), OP_movupd, (d), (s))
782
+ #define INSTR_CREATE_movsd(dc, d, s) \
783
+ instr_create_1dst_1src((dc), OP_movsd, (d), (s))
784
+ #define INSTR_CREATE_movlps(dc, d, s) \
785
+ instr_create_1dst_1src((dc), OP_movlps, (d), (s))
786
+ #define INSTR_CREATE_movlpd(dc, d, s) \
787
+ instr_create_1dst_1src((dc), OP_movlpd, (d), (s))
788
+ #define INSTR_CREATE_movhps(dc, d, s) \
789
+ instr_create_1dst_1src((dc), OP_movhps, (d), (s))
790
+ #define INSTR_CREATE_movhpd(dc, d, s) \
791
+ instr_create_1dst_1src((dc), OP_movhpd, (d), (s))
792
+ #define INSTR_CREATE_movaps(dc, d, s) \
793
+ instr_create_1dst_1src((dc), OP_movaps, (d), (s))
794
+ #define INSTR_CREATE_movapd(dc, d, s) \
795
+ instr_create_1dst_1src((dc), OP_movapd, (d), (s))
796
+ #define INSTR_CREATE_cvtpi2ps(dc, d, s) \
797
+ instr_create_1dst_1src((dc), OP_cvtpi2ps, (d), (s))
798
+ #define INSTR_CREATE_cvtsi2ss(dc, d, s) \
799
+ instr_create_1dst_1src((dc), OP_cvtsi2ss, (d), (s))
800
+ #define INSTR_CREATE_cvtpi2pd(dc, d, s) \
801
+ instr_create_1dst_1src((dc), OP_cvtpi2pd, (d), (s))
802
+ #define INSTR_CREATE_cvtsi2sd(dc, d, s) \
803
+ instr_create_1dst_1src((dc), OP_cvtsi2sd, (d), (s))
804
+ #define INSTR_CREATE_cvttps2pi(dc, d, s) \
805
+ instr_create_1dst_1src((dc), OP_cvttps2pi, (d), (s))
806
+ #define INSTR_CREATE_cvttss2si(dc, d, s) \
807
+ instr_create_1dst_1src((dc), OP_cvttss2si, (d), (s))
808
+ #define INSTR_CREATE_cvttpd2pi(dc, d, s) \
809
+ instr_create_1dst_1src((dc), OP_cvttpd2pi, (d), (s))
810
+ #define INSTR_CREATE_cvttsd2si(dc, d, s) \
811
+ instr_create_1dst_1src((dc), OP_cvttsd2si, (d), (s))
812
+ #define INSTR_CREATE_cvtps2pi(dc, d, s) \
813
+ instr_create_1dst_1src((dc), OP_cvtps2pi, (d), (s))
814
+ #define INSTR_CREATE_cvtss2si(dc, d, s) \
815
+ instr_create_1dst_1src((dc), OP_cvtss2si, (d), (s))
816
+ #define INSTR_CREATE_cvtpd2pi(dc, d, s) \
817
+ instr_create_1dst_1src((dc), OP_cvtpd2pi, (d), (s))
818
+ #define INSTR_CREATE_cvtsd2si(dc, d, s) \
819
+ instr_create_1dst_1src((dc), OP_cvtsd2si, (d), (s))
820
+ #define INSTR_CREATE_cvtps2pd(dc, d, s) \
821
+ instr_create_1dst_1src((dc), OP_cvtps2pd, (d), (s))
822
+ #define INSTR_CREATE_cvtss2sd(dc, d, s) \
823
+ instr_create_1dst_1src((dc), OP_cvtss2sd, (d), (s))
824
+ #define INSTR_CREATE_cvtpd2ps(dc, d, s) \
825
+ instr_create_1dst_1src((dc), OP_cvtpd2ps, (d), (s))
826
+ #define INSTR_CREATE_cvtsd2ss(dc, d, s) \
827
+ instr_create_1dst_1src((dc), OP_cvtsd2ss, (d), (s))
828
+ #define INSTR_CREATE_cvtdq2ps(dc, d, s) \
829
+ instr_create_1dst_1src((dc), OP_cvtdq2ps, (d), (s))
830
+ #define INSTR_CREATE_cvttps2dq(dc, d, s) \
831
+ instr_create_1dst_1src((dc), OP_cvttps2dq, (d), (s))
832
+ #define INSTR_CREATE_cvtps2dq(dc, d, s) \
833
+ instr_create_1dst_1src((dc), OP_cvtps2dq, (d), (s))
834
+ #define INSTR_CREATE_cvtdq2pd(dc, d, s) \
835
+ instr_create_1dst_1src((dc), OP_cvtdq2pd, (d), (s))
836
+ #define INSTR_CREATE_cvttpd2dq(dc, d, s) \
837
+ instr_create_1dst_1src((dc), OP_cvttpd2dq, (d), (s))
838
+ #define INSTR_CREATE_cvtpd2dq(dc, d, s) \
839
+ instr_create_1dst_1src((dc), OP_cvtpd2dq, (d), (s))
840
+ #define INSTR_CREATE_movmskps(dc, d, s) \
841
+ instr_create_1dst_1src((dc), OP_movmskps, (d), (s))
842
+ #define INSTR_CREATE_movmskpd(dc, d, s) \
843
+ instr_create_1dst_1src((dc), OP_movmskpd, (d), (s))
844
+ #define INSTR_CREATE_sqrtps(dc, d, s) \
845
+ instr_create_1dst_1src((dc), OP_sqrtps, (d), (s))
846
+ #define INSTR_CREATE_sqrtss(dc, d, s) \
847
+ instr_create_1dst_1src((dc), OP_sqrtss, (d), (s))
848
+ #define INSTR_CREATE_sqrtpd(dc, d, s) \
849
+ instr_create_1dst_1src((dc), OP_sqrtpd, (d), (s))
850
+ #define INSTR_CREATE_sqrtsd(dc, d, s) \
851
+ instr_create_1dst_1src((dc), OP_sqrtsd, (d), (s))
852
+ #define INSTR_CREATE_rsqrtps(dc, d, s) \
853
+ instr_create_1dst_1src((dc), OP_rsqrtps, (d), (s))
854
+ #define INSTR_CREATE_rsqrtss(dc, d, s) \
855
+ instr_create_1dst_1src((dc), OP_rsqrtss, (d), (s))
856
+ #define INSTR_CREATE_rcpps(dc, d, s) \
857
+ instr_create_1dst_1src((dc), OP_rcpps, (d), (s))
858
+ #define INSTR_CREATE_rcpss(dc, d, s) \
859
+ instr_create_1dst_1src((dc), OP_rcpss, (d), (s))
860
+ #define INSTR_CREATE_lddqu(dc, d, s) \
861
+ instr_create_1dst_1src((dc), OP_lddqu, (d), (s))
862
+ #define INSTR_CREATE_movsldup(dc, d, s) \
863
+ instr_create_1dst_1src((dc), OP_movsldup, (d), (s))
864
+ #define INSTR_CREATE_movshdup(dc, d, s) \
865
+ instr_create_1dst_1src((dc), OP_movshdup, (d), (s))
866
+ #define INSTR_CREATE_movddup(dc, d, s) \
867
+ instr_create_1dst_1src((dc), OP_movddup, (d), (s))
868
+ #define INSTR_CREATE_pshufb(dc, d, s) \
869
+ instr_create_1dst_1src((dc), OP_pshufb, (d), (s))
870
+ #define INSTR_CREATE_popcnt(dc, d, s) \
871
+ instr_create_1dst_1src((dc), OP_popcnt, (d), (s))
872
+ #define INSTR_CREATE_movntss(dc, d, s) \
873
+ instr_create_1dst_1src((dc), OP_movntss, (d), (s))
874
+ #define INSTR_CREATE_movntsd(dc, d, s) \
875
+ instr_create_1dst_1src((dc), OP_movntsd, (d), (s))
876
+ #define INSTR_CREATE_movntq(dc, d, s) \
877
+ instr_create_1dst_1src((dc), OP_movntq, (d), (s))
878
+ #define INSTR_CREATE_movntdq(dc, d, s) \
879
+ instr_create_1dst_1src((dc), OP_movntdq, (d), (s))
880
+ #define INSTR_CREATE_movnti(dc, d, s) \
881
+ instr_create_1dst_1src((dc), OP_movnti, (d), (s))
882
+ #define INSTR_CREATE_lzcnt(dc, d, s) \
883
+ instr_create_1dst_1src((dc), OP_lzcnt, (d), (s))
884
+ #define INSTR_CREATE_pmovsxbw(dc, d, s) \
885
+ instr_create_1dst_1src((dc), OP_pmovsxbw, (d), (s))
886
+ #define INSTR_CREATE_pmovsxbd(dc, d, s) \
887
+ instr_create_1dst_1src((dc), OP_pmovsxbd, (d), (s))
888
+ #define INSTR_CREATE_pmovsxbq(dc, d, s) \
889
+ instr_create_1dst_1src((dc), OP_pmovsxbq, (d), (s))
890
+ #define INSTR_CREATE_pmovsxdw(dc, d, s) \
891
+ instr_create_1dst_1src((dc), OP_pmovsxdw, (d), (s))
892
+ #define INSTR_CREATE_pmovsxwq(dc, d, s) \
893
+ instr_create_1dst_1src((dc), OP_pmovsxwq, (d), (s))
894
+ #define INSTR_CREATE_pmovsxdq(dc, d, s) \
895
+ instr_create_1dst_1src((dc), OP_pmovsxdq, (d), (s))
896
+ #define INSTR_CREATE_movntdqa(dc, d, s) \
897
+ instr_create_1dst_1src((dc), OP_movntdqa, (d), (s))
898
+ #define INSTR_CREATE_pmovzxbw(dc, d, s) \
899
+ instr_create_1dst_1src((dc), OP_pmovzxbw, (d), (s))
900
+ #define INSTR_CREATE_pmovzxbd(dc, d, s) \
901
+ instr_create_1dst_1src((dc), OP_pmovzxbd, (d), (s))
902
+ #define INSTR_CREATE_pmovzxbq(dc, d, s) \
903
+ instr_create_1dst_1src((dc), OP_pmovzxbq, (d), (s))
904
+ #define INSTR_CREATE_pmovzxdw(dc, d, s) \
905
+ instr_create_1dst_1src((dc), OP_pmovzxdw, (d), (s))
906
+ #define INSTR_CREATE_pmovzxwq(dc, d, s) \
907
+ instr_create_1dst_1src((dc), OP_pmovzxwq, (d), (s))
908
+ #define INSTR_CREATE_pmovzxdq(dc, d, s) \
909
+ instr_create_1dst_1src((dc), OP_pmovzxdq, (d), (s))
910
+ #define INSTR_CREATE_phminposuw(dc, d, s) \
911
+ instr_create_1dst_1src((dc), OP_phminposuw, (d), (s))
912
+ #define INSTR_CREATE_vmread(dc, d, s) \
913
+ instr_create_1dst_1src((dc), OP_vmread, (d), (s))
914
+ #define INSTR_CREATE_vmwrite(dc, d, s) \
915
+ instr_create_1dst_1src((dc), OP_vmwrite, (d), (s))
916
+ #define INSTR_CREATE_movsxd(dc, d, s) \
917
+ instr_create_1dst_1src((dc), OP_movsxd, (d), (s))
918
+ /* @} */ /* end doxygen group */
919
+
920
+ /* 1 destination, 1 implicit source */
921
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
922
+ /**
923
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
924
+ * explicit operands, automatically supplying any implicit operands.
925
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
926
+ * \param d The opnd_t explicit destination operand for the instruction.
927
+ */
928
+ #define INSTR_CREATE_inc(dc, d) \
929
+ instr_create_1dst_1src((dc), OP_inc, (d), (d))
930
+ #define INSTR_CREATE_dec(dc, d) \
931
+ instr_create_1dst_1src((dc), OP_dec, (d), (d))
932
+ #define INSTR_CREATE_bswap(dc, d) \
933
+ instr_create_1dst_1src((dc), OP_bswap, (d), (d))
934
+ #define INSTR_CREATE_not(dc, d) \
935
+ instr_create_1dst_1src((dc), OP_not, (d), (d))
936
+ #define INSTR_CREATE_neg(dc, d) \
937
+ instr_create_1dst_1src((dc), OP_neg, (d), (d))
938
+ /* @} */ /* end doxygen group */
939
+
940
+ /* 1 implicit destination, 1 implicit source */
941
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
942
+ /**
943
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
944
+ * supplying any implicit operands.
945
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
946
+ */
947
+ #define INSTR_CREATE_cdq(dc) \
948
+ instr_create_1dst_1src((dc), OP_cdq, opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX))
949
+ #define INSTR_CREATE_daa(dc) \
950
+ instr_create_1dst_1src((dc), OP_daa, opnd_create_reg(REG_AL), opnd_create_reg(REG_AL))
951
+ #define INSTR_CREATE_das(dc) \
952
+ instr_create_1dst_1src((dc), OP_das, opnd_create_reg(REG_AL), opnd_create_reg(REG_AL))
953
+ #define INSTR_CREATE_aaa(dc) \
954
+ instr_create_1dst_1src((dc), OP_aaa, opnd_create_reg(REG_AX), opnd_create_reg(REG_AX))
955
+ #define INSTR_CREATE_aas(dc) \
956
+ instr_create_1dst_1src((dc), OP_aas, opnd_create_reg(REG_AX), opnd_create_reg(REG_AX))
957
+ #define INSTR_CREATE_cwde(dc) \
958
+ instr_create_1dst_1src((dc), OP_cwde, opnd_create_reg(REG_EAX), opnd_create_reg(REG_AX))
959
+ #define INSTR_CREATE_xlat(dc) \
960
+ instr_create_1dst_1src((dc), OP_xlat, opnd_create_reg(REG_AL), \
961
+ opnd_create_far_base_disp(SEG_DS, REG_XBX, REG_AL, 1, 0, OPSZ_xlat))
962
+ /* @} */ /* end doxygen group */
963
+
964
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
965
+ /**
966
+ * Creates an instr_t for an OP_in instruction with a source of al
967
+ * (INSTR_CREATE_in_1()) or eax (INSTR_CREATE_in_4()) and dx.
968
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
969
+ */
970
+ #define INSTR_CREATE_in_1(dc) \
971
+ instr_create_1dst_1src((dc), OP_in, opnd_create_reg(REG_AL), opnd_create_reg(REG_DX))
972
+ #define INSTR_CREATE_in_4(dc) \
973
+ instr_create_1dst_1src((dc), OP_in, opnd_create_reg(REG_EAX), opnd_create_reg(REG_DX))
974
+ /* @} */ /* end doxygen group */
975
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
976
+ /**
977
+ * Creates an instr_t for an OP_in instruction with a source of al
978
+ * (INSTR_CREATE_in_1_imm()) or eax (INSTR_CREATE_in_4_imm()) and an immediate.
979
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
980
+ * \param i The opnd_t explicit source operand for the instruction, which must be an
981
+ * immediate integer (opnd_create_immed_int()).
982
+ */
983
+ #define INSTR_CREATE_in_1_imm(dc, i) \
984
+ instr_create_1dst_1src((dc), OP_in, opnd_create_reg(REG_AL), (i))
985
+ #define INSTR_CREATE_in_4_imm(dc, i) \
986
+ instr_create_1dst_1src((dc), OP_in, opnd_create_reg(REG_EAX), (i))
987
+ /* @} */ /* end doxygen group */
988
+
989
+ /* floating-point */
990
+ /**
991
+ * Creats an instr_t for a conditional move instruction with the given opcode
992
+ * and destination operand.
993
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
994
+ * \param op The OP_xxx opcode for the instruction, which should be in the range
995
+ * [OP_fcmovb, OP_fcmovnu], excluding OP_fucompp.
996
+ * \param f The opnd_t explicit source operand for the instruction, which must
997
+ * be a floating point register (opnd_create_reg()).
998
+ */
999
+ #define INSTR_CREATE_fcmovcc(dc, op, f) \
1000
+ instr_create_1dst_1src((dc), (op), opnd_create_reg(REG_ST0), (f))
1001
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1002
+ /**
1003
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
1004
+ * given explicit operands, automatically supplying any implicit operands.
1005
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1006
+ * \param d The opnd_t explicit destination operand for the instruction, which must
1007
+ * be one of the following:
1008
+ * -# A floating point register (opnd_create_reg()).
1009
+ * -# A memory reference (opnd_create_base_disp() or opnd_create_far_base_disp()).
1010
+ */
1011
+ #define INSTR_CREATE_fst(dc, d) \
1012
+ instr_create_1dst_1src((dc), OP_fst, (d), opnd_create_reg(REG_ST0))
1013
+ #define INSTR_CREATE_fstp(dc, d) \
1014
+ instr_create_1dst_1src((dc), OP_fstp, (d), opnd_create_reg(REG_ST0))
1015
+ /* @} */ /* end doxygen group */
1016
+ /**
1017
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
1018
+ * given explicit operands, automatically supplying any implicit operands.
1019
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1020
+ * \param s The opnd_t explicit source operand for the instruction, which must
1021
+ * be one of the following:
1022
+ * -# A floating point register (opnd_create_reg()).
1023
+ * -# A memory reference (opnd_create_base_disp() or opnd_create_far_base_disp()).
1024
+ */
1025
+ #define INSTR_CREATE_fld(dc, s) \
1026
+ instr_create_1dst_1src((dc), OP_fld, opnd_create_reg(REG_ST0), (s))
1027
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1028
+ /**
1029
+ * This INSTR_CREATE_xxx_mem macro creates an instr_t with opcode OP_xxx and
1030
+ * the given explicit memory operand, automatically supplying any implicit operands.
1031
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1032
+ * \param m The opnd_t explicit destination operand for the instruction, which must be
1033
+ * a memory reference (opnd_create_base_disp() or opnd_create_far_base_disp()).
1034
+ */
1035
+ #define INSTR_CREATE_fist(dc, m) \
1036
+ instr_create_1dst_1src((dc), OP_fist, (m), opnd_create_reg(REG_ST0))
1037
+ #define INSTR_CREATE_fistp(dc, m) \
1038
+ instr_create_1dst_1src((dc), OP_fistp, (m), opnd_create_reg(REG_ST0))
1039
+ #define INSTR_CREATE_fisttp(dc, m) \
1040
+ instr_create_1dst_1src((dc), OP_fisttp, (m), opnd_create_reg(REG_ST0))
1041
+ #define INSTR_CREATE_fbstp(dc, m) \
1042
+ instr_create_1dst_1src((dc), OP_fbstp, (m), opnd_create_reg(REG_ST0))
1043
+ /* @} */ /* end doxygen group */
1044
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1045
+ /**
1046
+ * This INSTR_CREATE_xxx_mem macro creates an instr_t with opcode OP_xxx and
1047
+ * the given explicit memory operand, automatically supplying any implicit operands.
1048
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1049
+ * \param m The opnd_t explicit source operand for the instruction, which must be
1050
+ * a memory reference (opnd_create_base_disp() or opnd_create_far_base_disp()).
1051
+ */
1052
+ #define INSTR_CREATE_fild(dc, m) \
1053
+ instr_create_1dst_1src((dc), OP_fild, opnd_create_reg(REG_ST0), (m))
1054
+ #define INSTR_CREATE_fbld(dc, m) \
1055
+ instr_create_1dst_1src((dc), OP_fbld, opnd_create_reg(REG_ST0), (m))
1056
+ /* @} */ /* end doxygen group */
1057
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1058
+ /**
1059
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
1060
+ * supplying any implicit operands.
1061
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1062
+ */
1063
+ #define INSTR_CREATE_fchs(dc) \
1064
+ instr_create_1dst_1src((dc), OP_fchs, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST0))
1065
+ #define INSTR_CREATE_fabs(dc) \
1066
+ instr_create_1dst_1src((dc), OP_fabs, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST0))
1067
+ #define INSTR_CREATE_ftst(dc) \
1068
+ instr_create_1dst_1src((dc), OP_ftst, opnd_create_reg(REG_ST0), opnd_create_immed_float(0.0f))
1069
+ #define INSTR_CREATE_fld1(dc) \
1070
+ instr_create_1dst_1src((dc), OP_fld1, opnd_create_reg(REG_ST0), opnd_create_immed_float(1.0f))
1071
+ #define INSTR_CREATE_fldl2t(dc) \
1072
+ instr_create_1dst_1src((dc), OP_fldl2t, opnd_create_reg(REG_ST0), \
1073
+ opnd_create_immed_float((float)M_LN10/(float)M_LN2))
1074
+ #define INSTR_CREATE_fldl2e(dc) \
1075
+ instr_create_1dst_1src((dc), OP_fldl2e, opnd_create_reg(REG_ST0), \
1076
+ opnd_create_immed_float(1.0f/(float)M_LN2))
1077
+ #define INSTR_CREATE_fldpi(dc) \
1078
+ instr_create_1dst_1src((dc), OP_fldpi, opnd_create_reg(REG_ST0), \
1079
+ opnd_create_immed_float((float)M_PI))
1080
+ #define INSTR_CREATE_fldlg2(dc) \
1081
+ instr_create_1dst_1src((dc), OP_fldlg2, opnd_create_reg(REG_ST0), \
1082
+ opnd_create_immed_float((float)M_LN2/(float)M_LN10))
1083
+ #define INSTR_CREATE_fldln2(dc) \
1084
+ instr_create_1dst_1src((dc), OP_fldln2, opnd_create_reg(REG_ST0), \
1085
+ opnd_create_immed_float((float)M_LN2))
1086
+ #define INSTR_CREATE_fldz(dc) \
1087
+ instr_create_1dst_1src((dc), OP_fldz, opnd_create_reg(REG_ST0), opnd_create_immed_float(0.0f))
1088
+ #define INSTR_CREATE_f2xm1(dc) \
1089
+ instr_create_1dst_1src((dc), OP_f2xm1, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST0))
1090
+ #define INSTR_CREATE_fptan(dc) \
1091
+ instr_create_1dst_1src((dc), OP_fptan, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST0))
1092
+ #define INSTR_CREATE_fxtract(dc) \
1093
+ instr_create_1dst_1src((dc), OP_fxtract, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST0))
1094
+ #define INSTR_CREATE_fsqrt(dc) \
1095
+ instr_create_1dst_1src((dc), OP_fsqrt, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST0))
1096
+ #define INSTR_CREATE_fsincos(dc) \
1097
+ instr_create_1dst_1src((dc), OP_fsincos, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST0))
1098
+ #define INSTR_CREATE_frndint(dc) \
1099
+ instr_create_1dst_1src((dc), OP_frndint, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST0))
1100
+ #define INSTR_CREATE_fsin(dc) \
1101
+ instr_create_1dst_1src((dc), OP_fsin, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST0))
1102
+ #define INSTR_CREATE_fcos(dc) \
1103
+ instr_create_1dst_1src((dc), OP_fcos, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST0))
1104
+
1105
+ #define INSTR_CREATE_fscale(dc) \
1106
+ instr_create_1dst_2src((dc), OP_fscale, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1), \
1107
+ opnd_create_reg(REG_ST0))
1108
+ #define INSTR_CREATE_fyl2x(dc) \
1109
+ instr_create_2dst_2src((dc), OP_fyl2x, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1), \
1110
+ opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1))
1111
+ #define INSTR_CREATE_fyl2xp1(dc) \
1112
+ instr_create_2dst_2src((dc), OP_fyl2xp1, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1), \
1113
+ opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1))
1114
+ #define INSTR_CREATE_fpatan(dc) \
1115
+ instr_create_2dst_2src((dc), OP_fpatan, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1), \
1116
+ opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1))
1117
+ #define INSTR_CREATE_fprem(dc) \
1118
+ instr_create_2dst_2src((dc), OP_fprem, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1), \
1119
+ opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1))
1120
+ #define INSTR_CREATE_fprem1(dc) \
1121
+ instr_create_2dst_2src((dc), OP_fprem1, opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1), \
1122
+ opnd_create_reg(REG_ST0), opnd_create_reg(REG_ST1))
1123
+ /* @} */ /* end doxygen group */
1124
+
1125
+ /* 1 destination, 2 sources */
1126
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1127
+ /**
1128
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
1129
+ * explicit operands, automatically supplying any implicit operands.
1130
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1131
+ * \param d The opnd_t explicit destination operand for the instruction.
1132
+ * \param s The opnd_t explicit source operand for the instruction.
1133
+ * \param i The opnd_t explicit second source operand for the instruction, which
1134
+ * must be an immediate integer (opnd_create_immed_int()).
1135
+ */
1136
+ #define INSTR_CREATE_pshufw(dc, d, s, i) \
1137
+ instr_create_1dst_2src((dc), OP_pshufw, (d), (s), (i))
1138
+ #define INSTR_CREATE_pshufd(dc, d, s, i) \
1139
+ instr_create_1dst_2src((dc), OP_pshufd, (d), (s), (i))
1140
+ #define INSTR_CREATE_pshufhw(dc, d, s, i) \
1141
+ instr_create_1dst_2src((dc), OP_pshufhw, (d), (s), (i))
1142
+ #define INSTR_CREATE_pshuflw(dc, d, s, i) \
1143
+ instr_create_1dst_2src((dc), OP_pshuflw, (d), (s), (i))
1144
+ #define INSTR_CREATE_pinsrw(dc, d, s, i) \
1145
+ instr_create_1dst_2src((dc), OP_pinsrw, (d), (s), (i))
1146
+ #define INSTR_CREATE_pextrw(dc, d, s, i) \
1147
+ instr_create_1dst_2src((dc), OP_pextrw, (d), (s), (i))
1148
+ /* SSE4 */
1149
+ #define INSTR_CREATE_pextrb(dc, d, s, i) \
1150
+ instr_create_1dst_2src((dc), OP_pextrb, (d), (s), (i))
1151
+ #define INSTR_CREATE_pextrd(dc, d, s, i) \
1152
+ instr_create_1dst_2src((dc), OP_pextrd, (d), (s), (i))
1153
+ #define INSTR_CREATE_extractps(dc, d, s, i) \
1154
+ instr_create_1dst_2src((dc), OP_extractps, (d), (s), (i))
1155
+ #define INSTR_CREATE_roundps(dc, d, s, i) \
1156
+ instr_create_1dst_2src((dc), OP_roundps, (d), (s), (i))
1157
+ #define INSTR_CREATE_roundpd(dc, d, s, i) \
1158
+ instr_create_1dst_2src((dc), OP_roundpd, (d), (s), (i))
1159
+ #define INSTR_CREATE_roundss(dc, d, s, i) \
1160
+ instr_create_1dst_2src((dc), OP_roundss, (d), (s), (i))
1161
+ #define INSTR_CREATE_roundsd(dc, d, s, i) \
1162
+ instr_create_1dst_2src((dc), OP_roundsd, (d), (s), (i))
1163
+ #define INSTR_CREATE_blendps(dc, d, s, i) \
1164
+ instr_create_1dst_2src((dc), OP_blendps, (d), (s), (i))
1165
+ #define INSTR_CREATE_blendpd(dc, d, s, i) \
1166
+ instr_create_1dst_2src((dc), OP_blendpd, (d), (s), (i))
1167
+ #define INSTR_CREATE_pblendw(dc, d, s, i) \
1168
+ instr_create_1dst_2src((dc), OP_pblendw, (d), (s), (i))
1169
+ #define INSTR_CREATE_pinsrb(dc, d, s, i) \
1170
+ instr_create_1dst_2src((dc), OP_pinsrb, (d), (s), (i))
1171
+ #define INSTR_CREATE_insertps(dc, d, s, i) \
1172
+ instr_create_1dst_2src((dc), OP_insertps, (d), (s), (i))
1173
+ #define INSTR_CREATE_pinsrd(dc, d, s, i) \
1174
+ instr_create_1dst_2src((dc), OP_pinsrd, (d), (s), (i))
1175
+ /* @} */ /* end doxygen group */
1176
+
1177
+ /* 1 destination, 2 sources: 1 explicit, 1 implicit */
1178
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1179
+ /**
1180
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
1181
+ * explicit operands, automatically supplying any implicit operands.
1182
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1183
+ * \param d The opnd_t explicit destination operand for the instruction.
1184
+ * \param s The opnd_t explicit source operand for the instruction.
1185
+ */
1186
+ #define INSTR_CREATE_add(dc, d, s) \
1187
+ instr_create_1dst_2src((dc), OP_add, (d), (s), (d))
1188
+ #define INSTR_CREATE_or(dc, d, s) \
1189
+ instr_create_1dst_2src((dc), OP_or, (d), (s), (d))
1190
+ #define INSTR_CREATE_adc(dc, d, s) \
1191
+ instr_create_1dst_2src((dc), OP_adc, (d), (s), (d))
1192
+ #define INSTR_CREATE_sbb(dc, d, s) \
1193
+ instr_create_1dst_2src((dc), OP_sbb, (d), (s), (d))
1194
+ #define INSTR_CREATE_and(dc, d, s) \
1195
+ instr_create_1dst_2src((dc), OP_and, (d), (s), (d))
1196
+ #define INSTR_CREATE_sub(dc, d, s) \
1197
+ instr_create_1dst_2src((dc), OP_sub, (d), (s), (d))
1198
+ #define INSTR_CREATE_xor(dc, d, s) \
1199
+ instr_create_1dst_2src((dc), OP_xor, (d), (s), (d))
1200
+ #define INSTR_CREATE_punpcklbw(dc, d, s) \
1201
+ instr_create_1dst_2src((dc), OP_punpcklbw, (d), (s), (d))
1202
+ #define INSTR_CREATE_punpcklwd(dc, d, s) \
1203
+ instr_create_1dst_2src((dc), OP_punpcklwd, (d), (s), (d))
1204
+ #define INSTR_CREATE_punpckldq(dc, d, s) \
1205
+ instr_create_1dst_2src((dc), OP_punpckldq, (d), (s), (d))
1206
+ #define INSTR_CREATE_packsswb(dc, d, s) \
1207
+ instr_create_1dst_2src((dc), OP_packsswb, (d), (s), (d))
1208
+ #define INSTR_CREATE_pcmpgtb(dc, d, s) \
1209
+ instr_create_1dst_2src((dc), OP_pcmpgtb, (d), (s), (d))
1210
+ #define INSTR_CREATE_pcmpgtw(dc, d, s) \
1211
+ instr_create_1dst_2src((dc), OP_pcmpgtw, (d), (s), (d))
1212
+ #define INSTR_CREATE_pcmpgtd(dc, d, s) \
1213
+ instr_create_1dst_2src((dc), OP_pcmpgtd, (d), (s), (d))
1214
+ #define INSTR_CREATE_packuswb(dc, d, s) \
1215
+ instr_create_1dst_2src((dc), OP_packuswb, (d), (s), (d))
1216
+ #define INSTR_CREATE_punpckhbw(dc, d, s) \
1217
+ instr_create_1dst_2src((dc), OP_punpckhbw, (d), (s), (d))
1218
+ #define INSTR_CREATE_punpckhwd(dc, d, s) \
1219
+ instr_create_1dst_2src((dc), OP_punpckhwd, (d), (s), (d))
1220
+ #define INSTR_CREATE_punpckhdq(dc, d, s) \
1221
+ instr_create_1dst_2src((dc), OP_punpckhdq, (d), (s), (d))
1222
+ #define INSTR_CREATE_packssdw(dc, d, s) \
1223
+ instr_create_1dst_2src((dc), OP_packssdw, (d), (s), (d))
1224
+ #define INSTR_CREATE_punpcklqdq(dc, d, s) \
1225
+ instr_create_1dst_2src((dc), OP_punpcklqdq, (d), (s), (d))
1226
+ #define INSTR_CREATE_punpckhqdq(dc, d, s) \
1227
+ instr_create_1dst_2src((dc), OP_punpckhqdq, (d), (s), (d))
1228
+ #define INSTR_CREATE_pcmpeqb(dc, d, s) \
1229
+ instr_create_1dst_2src((dc), OP_pcmpeqb, (d), (s), (d))
1230
+ #define INSTR_CREATE_pcmpeqw(dc, d, s) \
1231
+ instr_create_1dst_2src((dc), OP_pcmpeqw, (d), (s), (d))
1232
+ #define INSTR_CREATE_pcmpeqd(dc, d, s) \
1233
+ instr_create_1dst_2src((dc), OP_pcmpeqd, (d), (s), (d))
1234
+ #define INSTR_CREATE_psrlw(dc, d, s) \
1235
+ instr_create_1dst_2src((dc), OP_psrlw, (d), (s), (d))
1236
+ #define INSTR_CREATE_psrld(dc, d, s) \
1237
+ instr_create_1dst_2src((dc), OP_psrld, (d), (s), (d))
1238
+ #define INSTR_CREATE_psrlq(dc, d, s) \
1239
+ instr_create_1dst_2src((dc), OP_psrlq, (d), (s), (d))
1240
+ #define INSTR_CREATE_paddq(dc, d, s) \
1241
+ instr_create_1dst_2src((dc), OP_paddq, (d), (s), (d))
1242
+ #define INSTR_CREATE_pmullw(dc, d, s) \
1243
+ instr_create_1dst_2src((dc), OP_pmullw, (d), (s), (d))
1244
+ #define INSTR_CREATE_psubusb(dc, d, s) \
1245
+ instr_create_1dst_2src((dc), OP_psubusb, (d), (s), (d))
1246
+ #define INSTR_CREATE_psubusw(dc, d, s) \
1247
+ instr_create_1dst_2src((dc), OP_psubusw, (d), (s), (d))
1248
+ #define INSTR_CREATE_pminub(dc, d, s) \
1249
+ instr_create_1dst_2src((dc), OP_pminub, (d), (s), (d))
1250
+ #define INSTR_CREATE_pand(dc, d, s) \
1251
+ instr_create_1dst_2src((dc), OP_pand, (d), (s), (d))
1252
+ #define INSTR_CREATE_paddusb(dc, d, s) \
1253
+ instr_create_1dst_2src((dc), OP_paddusb, (d), (s), (d))
1254
+ #define INSTR_CREATE_paddusw(dc, d, s) \
1255
+ instr_create_1dst_2src((dc), OP_paddusw, (d), (s), (d))
1256
+ #define INSTR_CREATE_pmaxub(dc, d, s) \
1257
+ instr_create_1dst_2src((dc), OP_pmaxub, (d), (s), (d))
1258
+ #define INSTR_CREATE_pandn(dc, d, s) \
1259
+ instr_create_1dst_2src((dc), OP_pandn, (d), (s), (d))
1260
+ #define INSTR_CREATE_pavgb(dc, d, s) \
1261
+ instr_create_1dst_2src((dc), OP_pavgb, (d), (s), (d))
1262
+ #define INSTR_CREATE_psraw(dc, d, s) \
1263
+ instr_create_1dst_2src((dc), OP_psraw, (d), (s), (d))
1264
+ #define INSTR_CREATE_psrad(dc, d, s) \
1265
+ instr_create_1dst_2src((dc), OP_psrad, (d), (s), (d))
1266
+ #define INSTR_CREATE_pavgw(dc, d, s) \
1267
+ instr_create_1dst_2src((dc), OP_pavgw, (d), (s), (d))
1268
+ #define INSTR_CREATE_pmulhuw(dc, d, s) \
1269
+ instr_create_1dst_2src((dc), OP_pmulhuw, (d), (s), (d))
1270
+ #define INSTR_CREATE_pmulhw(dc, d, s) \
1271
+ instr_create_1dst_2src((dc), OP_pmulhw, (d), (s), (d))
1272
+ #define INSTR_CREATE_psubsb(dc, d, s) \
1273
+ instr_create_1dst_2src((dc), OP_psubsb, (d), (s), (d))
1274
+ #define INSTR_CREATE_psubsw(dc, d, s) \
1275
+ instr_create_1dst_2src((dc), OP_psubsw, (d), (s), (d))
1276
+ #define INSTR_CREATE_pminsw(dc, d, s) \
1277
+ instr_create_1dst_2src((dc), OP_pminsw, (d), (s), (d))
1278
+ #define INSTR_CREATE_por(dc, d, s) \
1279
+ instr_create_1dst_2src((dc), OP_por, (d), (s), (d))
1280
+ #define INSTR_CREATE_paddsb(dc, d, s) \
1281
+ instr_create_1dst_2src((dc), OP_paddsb, (d), (s), (d))
1282
+ #define INSTR_CREATE_paddsw(dc, d, s) \
1283
+ instr_create_1dst_2src((dc), OP_paddsw, (d), (s), (d))
1284
+ #define INSTR_CREATE_pmaxsw(dc, d, s) \
1285
+ instr_create_1dst_2src((dc), OP_pmaxsw, (d), (s), (d))
1286
+ #define INSTR_CREATE_pxor(dc, d, s) \
1287
+ instr_create_1dst_2src((dc), OP_pxor, (d), (s), (d))
1288
+ #define INSTR_CREATE_psllw(dc, d, s) \
1289
+ instr_create_1dst_2src((dc), OP_psllw, (d), (s), (d))
1290
+ #define INSTR_CREATE_pslld(dc, d, s) \
1291
+ instr_create_1dst_2src((dc), OP_pslld, (d), (s), (d))
1292
+ #define INSTR_CREATE_psllq(dc, d, s) \
1293
+ instr_create_1dst_2src((dc), OP_psllq, (d), (s), (d))
1294
+ #define INSTR_CREATE_pmuludq(dc, d, s) \
1295
+ instr_create_1dst_2src((dc), OP_pmuludq, (d), (s), (d))
1296
+ #define INSTR_CREATE_pmaddwd(dc, d, s) \
1297
+ instr_create_1dst_2src((dc), OP_pmaddwd, (d), (s), (d))
1298
+ #define INSTR_CREATE_psadbw(dc, d, s) \
1299
+ instr_create_1dst_2src((dc), OP_psadbw, (d), (s), (d))
1300
+ #define INSTR_CREATE_psubb(dc, d, s) \
1301
+ instr_create_1dst_2src((dc), OP_psubb, (d), (s), (d))
1302
+ #define INSTR_CREATE_psubw(dc, d, s) \
1303
+ instr_create_1dst_2src((dc), OP_psubw, (d), (s), (d))
1304
+ #define INSTR_CREATE_psubd(dc, d, s) \
1305
+ instr_create_1dst_2src((dc), OP_psubd, (d), (s), (d))
1306
+ #define INSTR_CREATE_psubq(dc, d, s) \
1307
+ instr_create_1dst_2src((dc), OP_psubq, (d), (s), (d))
1308
+ #define INSTR_CREATE_paddb(dc, d, s) \
1309
+ instr_create_1dst_2src((dc), OP_paddb, (d), (s), (d))
1310
+ #define INSTR_CREATE_paddw(dc, d, s) \
1311
+ instr_create_1dst_2src((dc), OP_paddw, (d), (s), (d))
1312
+ #define INSTR_CREATE_paddd(dc, d, s) \
1313
+ instr_create_1dst_2src((dc), OP_paddd, (d), (s), (d))
1314
+ #define INSTR_CREATE_psrldq(dc, d, s) \
1315
+ instr_create_1dst_2src((dc), OP_psrldq, (d), (s), (d))
1316
+ #define INSTR_CREATE_pslldq(dc, d, s) \
1317
+ instr_create_1dst_2src((dc), OP_pslldq, (d), (s), (d))
1318
+ #define INSTR_CREATE_unpcklps(dc, d, s) \
1319
+ instr_create_1dst_2src((dc), OP_unpcklps, (d), (s), (d))
1320
+ #define INSTR_CREATE_unpcklpd(dc, d, s) \
1321
+ instr_create_1dst_2src((dc), OP_unpcklpd, (d), (s), (d))
1322
+ #define INSTR_CREATE_unpckhps(dc, d, s) \
1323
+ instr_create_1dst_2src((dc), OP_unpckhps, (d), (s), (d))
1324
+ #define INSTR_CREATE_unpckhpd(dc, d, s) \
1325
+ instr_create_1dst_2src((dc), OP_unpckhpd, (d), (s), (d))
1326
+ #define INSTR_CREATE_andps(dc, d, s) \
1327
+ instr_create_1dst_2src((dc), OP_andps, (d), (s), (d))
1328
+ #define INSTR_CREATE_andpd(dc, d, s) \
1329
+ instr_create_1dst_2src((dc), OP_andpd, (d), (s), (d))
1330
+ #define INSTR_CREATE_andnps(dc, d, s) \
1331
+ instr_create_1dst_2src((dc), OP_andnps, (d), (s), (d))
1332
+ #define INSTR_CREATE_andnpd(dc, d, s) \
1333
+ instr_create_1dst_2src((dc), OP_andnpd, (d), (s), (d))
1334
+ #define INSTR_CREATE_orps(dc, d, s) \
1335
+ instr_create_1dst_2src((dc), OP_orps, (d), (s), (d))
1336
+ #define INSTR_CREATE_orpd(dc, d, s) \
1337
+ instr_create_1dst_2src((dc), OP_orpd, (d), (s), (d))
1338
+ #define INSTR_CREATE_xorps(dc, d, s) \
1339
+ instr_create_1dst_2src((dc), OP_xorps, (d), (s), (d))
1340
+ #define INSTR_CREATE_xorpd(dc, d, s) \
1341
+ instr_create_1dst_2src((dc), OP_xorpd, (d), (s), (d))
1342
+ #define INSTR_CREATE_addps(dc, d, s) \
1343
+ instr_create_1dst_2src((dc), OP_addps, (d), (s), (d))
1344
+ #define INSTR_CREATE_addss(dc, d, s) \
1345
+ instr_create_1dst_2src((dc), OP_addss, (d), (s), (d))
1346
+ #define INSTR_CREATE_addpd(dc, d, s) \
1347
+ instr_create_1dst_2src((dc), OP_addpd, (d), (s), (d))
1348
+ #define INSTR_CREATE_addsd(dc, d, s) \
1349
+ instr_create_1dst_2src((dc), OP_addsd, (d), (s), (d))
1350
+ #define INSTR_CREATE_mulps(dc, d, s) \
1351
+ instr_create_1dst_2src((dc), OP_mulps, (d), (s), (d))
1352
+ #define INSTR_CREATE_mulss(dc, d, s) \
1353
+ instr_create_1dst_2src((dc), OP_mulss, (d), (s), (d))
1354
+ #define INSTR_CREATE_mulpd(dc, d, s) \
1355
+ instr_create_1dst_2src((dc), OP_mulpd, (d), (s), (d))
1356
+ #define INSTR_CREATE_mulsd(dc, d, s) \
1357
+ instr_create_1dst_2src((dc), OP_mulsd, (d), (s), (d))
1358
+ #define INSTR_CREATE_subps(dc, d, s) \
1359
+ instr_create_1dst_2src((dc), OP_subps, (d), (s), (d))
1360
+ #define INSTR_CREATE_subss(dc, d, s) \
1361
+ instr_create_1dst_2src((dc), OP_subss, (d), (s), (d))
1362
+ #define INSTR_CREATE_subpd(dc, d, s) \
1363
+ instr_create_1dst_2src((dc), OP_subpd, (d), (s), (d))
1364
+ #define INSTR_CREATE_subsd(dc, d, s) \
1365
+ instr_create_1dst_2src((dc), OP_subsd, (d), (s), (d))
1366
+ #define INSTR_CREATE_minps(dc, d, s) \
1367
+ instr_create_1dst_2src((dc), OP_minps, (d), (s), (d))
1368
+ #define INSTR_CREATE_minss(dc, d, s) \
1369
+ instr_create_1dst_2src((dc), OP_minss, (d), (s), (d))
1370
+ #define INSTR_CREATE_minpd(dc, d, s) \
1371
+ instr_create_1dst_2src((dc), OP_minpd, (d), (s), (d))
1372
+ #define INSTR_CREATE_minsd(dc, d, s) \
1373
+ instr_create_1dst_2src((dc), OP_minsd, (d), (s), (d))
1374
+ #define INSTR_CREATE_divps(dc, d, s) \
1375
+ instr_create_1dst_2src((dc), OP_divps, (d), (s), (d))
1376
+ #define INSTR_CREATE_divss(dc, d, s) \
1377
+ instr_create_1dst_2src((dc), OP_divss, (d), (s), (d))
1378
+ #define INSTR_CREATE_divpd(dc, d, s) \
1379
+ instr_create_1dst_2src((dc), OP_divpd, (d), (s), (d))
1380
+ #define INSTR_CREATE_divsd(dc, d, s) \
1381
+ instr_create_1dst_2src((dc), OP_divsd, (d), (s), (d))
1382
+ #define INSTR_CREATE_maxps(dc, d, s) \
1383
+ instr_create_1dst_2src((dc), OP_maxps, (d), (s), (d))
1384
+ #define INSTR_CREATE_maxss(dc, d, s) \
1385
+ instr_create_1dst_2src((dc), OP_maxss, (d), (s), (d))
1386
+ #define INSTR_CREATE_maxpd(dc, d, s) \
1387
+ instr_create_1dst_2src((dc), OP_maxpd, (d), (s), (d))
1388
+ #define INSTR_CREATE_maxsd(dc, d, s) \
1389
+ instr_create_1dst_2src((dc), OP_maxsd, (d), (s), (d))
1390
+ /* SSE3 */
1391
+ #define INSTR_CREATE_haddpd(dc, d, s) \
1392
+ instr_create_1dst_2src((dc), OP_haddpd, (d), (s), (d))
1393
+ #define INSTR_CREATE_haddps(dc, d, s) \
1394
+ instr_create_1dst_2src((dc), OP_haddps, (d), (s), (d))
1395
+ #define INSTR_CREATE_hsubpd(dc, d, s) \
1396
+ instr_create_1dst_2src((dc), OP_hsubpd, (d), (s), (d))
1397
+ #define INSTR_CREATE_hsubps(dc, d, s) \
1398
+ instr_create_1dst_2src((dc), OP_hsubps, (d), (s), (d))
1399
+ #define INSTR_CREATE_addsubpd(dc, d, s) \
1400
+ instr_create_1dst_2src((dc), OP_addsubpd, (d), (s), (d))
1401
+ #define INSTR_CREATE_addsubps(dc, d, s) \
1402
+ instr_create_1dst_2src((dc), OP_addsubps, (d), (s), (d))
1403
+ /* 3D-Now */
1404
+ #define INSTR_CREATE_pavgusb(dc, d, s) \
1405
+ instr_create_1dst_2src((dc), OP_pavgusb, (d), (s), (d))
1406
+ #define INSTR_CREATE_pfadd(dc, d, s) \
1407
+ instr_create_1dst_2src((dc), OP_pfadd, (d), (s), (d))
1408
+ #define INSTR_CREATE_pfacc(dc, d, s) \
1409
+ instr_create_1dst_2src((dc), OP_pfacc, (d), (s), (d))
1410
+ #define INSTR_CREATE_pfcmpge(dc, d, s) \
1411
+ instr_create_1dst_2src((dc), OP_pfcmpge, (d), (s), (d))
1412
+ #define INSTR_CREATE_pfcmpgt(dc, d, s) \
1413
+ instr_create_1dst_2src((dc), OP_pfcmpgt, (d), (s), (d))
1414
+ #define INSTR_CREATE_pfcmpeq(dc, d, s) \
1415
+ instr_create_1dst_2src((dc), OP_pfcmpeq, (d), (s), (d))
1416
+ #define INSTR_CREATE_pfmin(dc, d, s) \
1417
+ instr_create_1dst_2src((dc), OP_pfmin, (d), (s), (d))
1418
+ #define INSTR_CREATE_pfmax(dc, d, s) \
1419
+ instr_create_1dst_2src((dc), OP_pfmax, (d), (s), (d))
1420
+ #define INSTR_CREATE_pfmul(dc, d, s) \
1421
+ instr_create_1dst_2src((dc), OP_pfmul, (d), (s), (d))
1422
+ #define INSTR_CREATE_pfrcp(dc, d, s) \
1423
+ instr_create_1dst_2src((dc), OP_pfrcp, (d), (s), (d))
1424
+ #define INSTR_CREATE_pfrcpit1(dc, d, s) \
1425
+ instr_create_1dst_2src((dc), OP_pfrcpit1, (d), (s), (d))
1426
+ #define INSTR_CREATE_pfrcpit2(dc, d, s) \
1427
+ instr_create_1dst_2src((dc), OP_pfrcpit2, (d), (s), (d))
1428
+ #define INSTR_CREATE_pfrsqrt(dc, d, s) \
1429
+ instr_create_1dst_2src((dc), OP_pfrsqrt, (d), (s), (d))
1430
+ #define INSTR_CREATE_pfrsqit1(dc, d, s) \
1431
+ instr_create_1dst_2src((dc), OP_pfrsqit1, (d), (s), (d))
1432
+ #define INSTR_CREATE_pmulhrw(dc, d, s) \
1433
+ instr_create_1dst_2src((dc), OP_pmulhrw, (d), (s), (d))
1434
+ #define INSTR_CREATE_pfsub(dc, d, s) \
1435
+ instr_create_1dst_2src((dc), OP_pfsub, (d), (s), (d))
1436
+ #define INSTR_CREATE_pfsubr(dc, d, s) \
1437
+ instr_create_1dst_2src((dc), OP_pfsubr, (d), (s), (d))
1438
+ #define INSTR_CREATE_pi2fd(dc, d, s) \
1439
+ instr_create_1dst_2src((dc), OP_pi2fd, (d), (s), (d))
1440
+ #define INSTR_CREATE_pf2id(dc, d, s) \
1441
+ instr_create_1dst_2src((dc), OP_pf2id, (d), (s), (d))
1442
+ #define INSTR_CREATE_pi2fw(dc, d, s) \
1443
+ instr_create_1dst_2src((dc), OP_pi2fw, (d), (s), (d))
1444
+ #define INSTR_CREATE_pf2iw(dc, d, s) \
1445
+ instr_create_1dst_2src((dc), OP_pf2iw, (d), (s), (d))
1446
+ #define INSTR_CREATE_pfnacc(dc, d, s) \
1447
+ instr_create_1dst_2src((dc), OP_pfnacc, (d), (s), (d))
1448
+ #define INSTR_CREATE_pfpnacc(dc, d, s) \
1449
+ instr_create_1dst_2src((dc), OP_pfpnacc, (d), (s), (d))
1450
+ #define INSTR_CREATE_pswapd(dc, d, s) \
1451
+ instr_create_1dst_2src((dc), OP_pswapd, (d), (s), (d))
1452
+ /* SSSE3 */
1453
+ #define INSTR_CREATE_phaddw(dc, d, s) \
1454
+ instr_create_1dst_2src((dc), OP_phaddw, (d), (s), (d))
1455
+ #define INSTR_CREATE_phaddd(dc, d, s) \
1456
+ instr_create_1dst_2src((dc), OP_phaddd, (d), (s), (d))
1457
+ #define INSTR_CREATE_phaddsw(dc, d, s) \
1458
+ instr_create_1dst_2src((dc), OP_phaddsw, (d), (s), (d))
1459
+ #define INSTR_CREATE_pmaddubsw(dc, d, s) \
1460
+ instr_create_1dst_2src((dc), OP_pmaddubsw, (d), (s), (d))
1461
+ #define INSTR_CREATE_phsubw(dc, d, s) \
1462
+ instr_create_1dst_2src((dc), OP_phsubw, (d), (s), (d))
1463
+ #define INSTR_CREATE_phsubd(dc, d, s) \
1464
+ instr_create_1dst_2src((dc), OP_phsubd, (d), (s), (d))
1465
+ #define INSTR_CREATE_phsubsw(dc, d, s) \
1466
+ instr_create_1dst_2src((dc), OP_phsubsw, (d), (s), (d))
1467
+ #define INSTR_CREATE_psignb(dc, d, s) \
1468
+ instr_create_1dst_2src((dc), OP_psignb, (d), (s), (d))
1469
+ #define INSTR_CREATE_psignw(dc, d, s) \
1470
+ instr_create_1dst_2src((dc), OP_psignw, (d), (s), (d))
1471
+ #define INSTR_CREATE_psignd(dc, d, s) \
1472
+ instr_create_1dst_2src((dc), OP_psignd, (d), (s), (d))
1473
+ #define INSTR_CREATE_pmulhrsw(dc, d, s) \
1474
+ instr_create_1dst_2src((dc), OP_pmulhrsw, (d), (s), (d))
1475
+ #define INSTR_CREATE_pabsb(dc, d, s) \
1476
+ instr_create_1dst_2src((dc), OP_pabsb, (d), (s), (d))
1477
+ #define INSTR_CREATE_pabsw(dc, d, s) \
1478
+ instr_create_1dst_2src((dc), OP_pabsw, (d), (s), (d))
1479
+ #define INSTR_CREATE_pabsd(dc, d, s) \
1480
+ instr_create_1dst_2src((dc), OP_pabsd, (d), (s), (d))
1481
+ /* SSE4 */
1482
+ #define INSTR_CREATE_pblendvb(dc, d, s) \
1483
+ instr_create_1dst_2src((dc), OP_pblendvb, (d), (s), opnd_create_reg(REG_XMM0))
1484
+ #define INSTR_CREATE_blendvps(dc, d, s) \
1485
+ instr_create_1dst_2src((dc), OP_blendvps, (d), (s), opnd_create_reg(REG_XMM0))
1486
+ #define INSTR_CREATE_blendvpd(dc, d, s) \
1487
+ instr_create_1dst_2src((dc), OP_blendvpd, (d), (s), opnd_create_reg(REG_XMM0))
1488
+ #define INSTR_CREATE_crc32(dc, d, s) \
1489
+ instr_create_1dst_2src((dc), OP_crc32, (d), (s), (d))
1490
+ #define INSTR_CREATE_packusdw(dc, d, s) \
1491
+ instr_create_1dst_2src((dc), OP_packusdw, (d), (s), (d))
1492
+ #define INSTR_CREATE_pcmpeqq(dc, d, s) \
1493
+ instr_create_1dst_2src((dc), OP_pcmpeqq, (d), (s), (d))
1494
+ #define INSTR_CREATE_pcmpgtq(dc, d, s) \
1495
+ instr_create_1dst_2src((dc), OP_pcmpgtq, (d), (s), (d))
1496
+ #define INSTR_CREATE_pminsb(dc, d, s) \
1497
+ instr_create_1dst_2src((dc), OP_pminsb, (d), (s), (d))
1498
+ #define INSTR_CREATE_pminsd(dc, d, s) \
1499
+ instr_create_1dst_2src((dc), OP_pminsd, (d), (s), (d))
1500
+ #define INSTR_CREATE_pminuw(dc, d, s) \
1501
+ instr_create_1dst_2src((dc), OP_pminuw, (d), (s), (d))
1502
+ #define INSTR_CREATE_pminud(dc, d, s) \
1503
+ instr_create_1dst_2src((dc), OP_pminud, (d), (s), (d))
1504
+ #define INSTR_CREATE_pmaxsb(dc, d, s) \
1505
+ instr_create_1dst_2src((dc), OP_pmaxsb, (d), (s), (d))
1506
+ #define INSTR_CREATE_pmaxsd(dc, d, s) \
1507
+ instr_create_1dst_2src((dc), OP_pmaxsd, (d), (s), (d))
1508
+ #define INSTR_CREATE_pmaxuw(dc, d, s) \
1509
+ instr_create_1dst_2src((dc), OP_pmaxuw, (d), (s), (d))
1510
+ #define INSTR_CREATE_pmaxud(dc, d, s) \
1511
+ instr_create_1dst_2src((dc), OP_pmaxud, (d), (s), (d))
1512
+ #define INSTR_CREATE_pmuldq(dc, d, s) \
1513
+ instr_create_1dst_2src((dc), OP_pmuldq, (d), (s), (d))
1514
+ #define INSTR_CREATE_pmulld(dc, d, s) \
1515
+ instr_create_1dst_2src((dc), OP_pmulld, (d), (s), (d))
1516
+ /* @} */ /* end doxygen group */
1517
+
1518
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1519
+ /**
1520
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
1521
+ * explicit operands, automatically supplying any implicit operands.
1522
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1523
+ * \param d The opnd_t explicit destination operand for the instruction.
1524
+ * \param ri The opnd_t explicit source operand for the instruction, which can
1525
+ * be a register (opnd_create_reg()) or an immediate integer (opnd_create_immed_int()).
1526
+ */
1527
+ #define INSTR_CREATE_bts(dc, d, ri) \
1528
+ instr_create_1dst_2src((dc), OP_bts, (d), (ri), (d))
1529
+ #define INSTR_CREATE_btr(dc, d, ri) \
1530
+ instr_create_1dst_2src((dc), OP_btr, (d), (ri), (d))
1531
+ #define INSTR_CREATE_btc(dc, d, ri) \
1532
+ instr_create_1dst_2src((dc), OP_btc, (d), (ri), (d))
1533
+ /* @} */ /* end doxygen group */
1534
+
1535
+ /**
1536
+ * Creats an instr_t for a conditional move instruction with the given opcode
1537
+ * and destination operand.
1538
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1539
+ * \param op The OP_xxx opcode for the instruction, which should be in the range
1540
+ * [OP_cmovo, OP_cmovnle].
1541
+ * \param d The opnd_t explicit destination operand for the instruction.
1542
+ * \param s The opnd_t explicit source operand for the instruction.
1543
+ */
1544
+ #define INSTR_CREATE_cmovcc(dc, op, d, s) \
1545
+ instr_create_1dst_2src((dc), (op), (d), (s), (d))
1546
+
1547
+ /**
1548
+ * This INSTR_CREATE_xxx_imm macro creates an instr_t with opcode OP_xxx and the given
1549
+ * explicit operands, automatically supplying any implicit operands. The _imm
1550
+ * suffix distinguishes between alternative forms of the same opcode: this
1551
+ * form takes an explicit immediate.
1552
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1553
+ * \param d The opnd_t explicit destination operand for the instruction.
1554
+ * \param s The opnd_t explicit source operand for the instruction.
1555
+ * \param i The opnd_t explicit second source operand for the instruction, which
1556
+ * must be an immediate integer (opnd_create_immed_int()).
1557
+ */
1558
+ #define INSTR_CREATE_imul_imm(dc, d, s, i) \
1559
+ instr_create_1dst_2src((dc), OP_imul, (d), (s), (i))
1560
+ /**
1561
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
1562
+ * explicit operands, automatically supplying any implicit operands.
1563
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1564
+ * \param d The opnd_t explicit destination operand for the instruction.
1565
+ * \param s The opnd_t explicit source operand for the instruction.
1566
+ */
1567
+ #define INSTR_CREATE_imul(dc, d, s) \
1568
+ instr_create_1dst_2src((dc), OP_imul, (d), (s), (d))
1569
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1570
+ /**
1571
+ * This INSTR_CREATE_xxx, INSTR_CREATE_xxx_1, or INSTR_CREATE_xxx_4 macro creates an
1572
+ * instr_t with opcode OP_xxx and the given explicit operands, automatically
1573
+ * supplying any implicit operands. The _1 or _4 suffixes distinguish between
1574
+ * alternative forms of the same opcode (1 and 4 identify the operand size).
1575
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1576
+ * \param s The opnd_t explicit source operand for the instruction.
1577
+ */
1578
+ #define INSTR_CREATE_imul_1(dc, s) \
1579
+ instr_create_1dst_2src((dc), OP_imul, opnd_create_reg(REG_AX), (s), opnd_create_reg(REG_AL))
1580
+ #define INSTR_CREATE_imul_4(dc, s) \
1581
+ instr_create_2dst_2src((dc), OP_imul, opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX), \
1582
+ (s), opnd_create_reg(REG_EAX))
1583
+ #define INSTR_CREATE_mul_1(dc, s) \
1584
+ instr_create_1dst_2src((dc), OP_mul, opnd_create_reg(REG_AX), (s), opnd_create_reg(REG_AL))
1585
+ #define INSTR_CREATE_mul_4(dc, s) \
1586
+ instr_create_2dst_2src((dc), OP_mul, opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX), \
1587
+ (s), opnd_create_reg(REG_EAX))
1588
+ #define INSTR_CREATE_div_1(dc, s) \
1589
+ instr_create_2dst_2src((dc), OP_div, opnd_create_reg(REG_AH), opnd_create_reg(REG_AL), (s), opnd_create_reg(REG_AX))
1590
+ #define INSTR_CREATE_div_4(dc, s) \
1591
+ instr_create_2dst_3src((dc), OP_div, opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX), \
1592
+ (s), opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX))
1593
+ #define INSTR_CREATE_idiv_1(dc, s) \
1594
+ instr_create_2dst_2src((dc), OP_idiv, opnd_create_reg(REG_AH), opnd_create_reg(REG_AL), (s), opnd_create_reg(REG_AX))
1595
+ #define INSTR_CREATE_idiv_4(dc, s) \
1596
+ instr_create_2dst_3src((dc), OP_idiv, opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX), \
1597
+ (s), opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX))
1598
+ /* @} */ /* end doxygen group */
1599
+
1600
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1601
+ /**
1602
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
1603
+ * given explicit operands, automatically supplying any implicit operands.
1604
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1605
+ * \param d The opnd_t explicit destination operand for the instruction.
1606
+ * \param ri The opnd_t explicit source operand for the instruction, which must
1607
+ * be one of the following:
1608
+ * -# The register cl (#opnd_create_reg(#REG_CL));
1609
+ * -# An immediate integer (opnd_create_immed_int()) of size #OPSZ_1;
1610
+ * -# An immediate integer with value 1 and size #OPSZ_0
1611
+ * (#opnd_create_immed_int(1, #OPSZ_0)), which will become an implicit operand
1612
+ * (whereas #opnd_create_immed_int(1, #OPSZ_1) will be encoded explicitly).
1613
+ */
1614
+ #define INSTR_CREATE_rol(dc, d, ri) \
1615
+ instr_create_1dst_2src((dc), OP_rol, (d), (ri), (d))
1616
+ #define INSTR_CREATE_ror(dc, d, ri) \
1617
+ instr_create_1dst_2src((dc), OP_ror, (d), (ri), (d))
1618
+ #define INSTR_CREATE_rcl(dc, d, ri) \
1619
+ instr_create_1dst_2src((dc), OP_rcl, (d), (ri), (d))
1620
+ #define INSTR_CREATE_rcr(dc, d, ri) \
1621
+ instr_create_1dst_2src((dc), OP_rcr, (d), (ri), (d))
1622
+ #define INSTR_CREATE_shl(dc, d, ri) \
1623
+ instr_create_1dst_2src((dc), OP_shl, (d), (ri), (d))
1624
+ #define INSTR_CREATE_shr(dc, d, ri) \
1625
+ instr_create_1dst_2src((dc), OP_shr, (d), (ri), (d))
1626
+ #define INSTR_CREATE_sar(dc, d, ri) \
1627
+ instr_create_1dst_2src((dc), OP_sar, (d), (ri), (d))
1628
+ /* @} */ /* end doxygen group */
1629
+
1630
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1631
+ /**
1632
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
1633
+ * the given explicit operands, automatically supplying any implicit operands.
1634
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1635
+ * \param s1 The opnd_t first source operand for the instruction.
1636
+ * \param s2 The opnd_t second source operand for the instruction.
1637
+ */
1638
+ #define INSTR_CREATE_maskmovq(dc, s1, s2) \
1639
+ instr_create_1dst_2src((dc), OP_maskmovq, \
1640
+ opnd_create_far_base_disp(SEG_DS, REG_XDI, REG_NULL, 0, 0, OPSZ_maskmovq), \
1641
+ (s1), (s2))
1642
+ #define INSTR_CREATE_maskmovdqu(dc, s1, s2) \
1643
+ instr_create_1dst_2src((dc), OP_maskmovdqu, \
1644
+ opnd_create_far_base_disp(SEG_DS, REG_XDI, REG_NULL, 0, 0, OPSZ_maskmovdqu), \
1645
+ (s1), (s2))
1646
+ /* @} */ /* end doxygen group */
1647
+
1648
+ /* floating-point */
1649
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1650
+ /**
1651
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
1652
+ * the given operands, automatically supplying any further implicit operands.
1653
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1654
+ * \param f The opnd_t destination (and implicit source) operand for the
1655
+ * instruction, which must be a floating point register (opnd_create_reg()).
1656
+ * \param s The opnd_t source (and non-destination) operand for the
1657
+ * instruction, which must be one of the following:
1658
+ * -# A floating point register (opnd_create_reg()).
1659
+ * -# A memory reference (opnd_create_base_disp() or opnd_create_far_base_disp()),
1660
+ * in which case the destination \p f must be #REG_ST0.
1661
+ */
1662
+ #define INSTR_CREATE_fadd(dc, f, s) \
1663
+ instr_create_1dst_2src((dc), OP_fadd, (f), (s), (f))
1664
+ #define INSTR_CREATE_fmul(dc, f, s) \
1665
+ instr_create_1dst_2src((dc), OP_fmul, (f), (s), (f))
1666
+ #define INSTR_CREATE_fdiv(dc, f, s) \
1667
+ instr_create_1dst_2src((dc), OP_fdiv, (f), (s), (f))
1668
+ #define INSTR_CREATE_fdivr(dc, f, s) \
1669
+ instr_create_1dst_2src((dc), OP_fdivr, (f), (s), (f))
1670
+ #define INSTR_CREATE_fsub(dc, f, s) \
1671
+ instr_create_1dst_2src((dc), OP_fsub, (f), (s), (f))
1672
+ #define INSTR_CREATE_fsubr(dc, f, s) \
1673
+ instr_create_1dst_2src((dc), OP_fsubr, (f), (s), (f))
1674
+ /* @} */ /* end doxygen group */
1675
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1676
+ /**
1677
+ * This INSTR_CREATE_xxx macro creates an instr_t with
1678
+ * opcode OP_xxx and the given explicit register operand, automatically
1679
+ * supplying any implicit operands.
1680
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1681
+ * \param f The opnd_t explicit destination + source operand for the instruction, which
1682
+ * must be a floating point register (opnd_create_reg()).
1683
+ */
1684
+ #define INSTR_CREATE_faddp(dc, f) \
1685
+ instr_create_1dst_2src((dc), OP_faddp, (f), opnd_create_reg(REG_ST0), (f))
1686
+ #define INSTR_CREATE_fmulp(dc, f) \
1687
+ instr_create_1dst_2src((dc), OP_fmulp, (f), opnd_create_reg(REG_ST0), (f))
1688
+ #define INSTR_CREATE_fdivp(dc, f) \
1689
+ instr_create_1dst_2src((dc), OP_fdivp, (f), opnd_create_reg(REG_ST0), (f))
1690
+ #define INSTR_CREATE_fdivrp(dc, f) \
1691
+ instr_create_1dst_2src((dc), OP_fdivrp, (f), opnd_create_reg(REG_ST0), (f))
1692
+ #define INSTR_CREATE_fsubp(dc, f) \
1693
+ instr_create_1dst_2src((dc), OP_fsubp, (f), opnd_create_reg(REG_ST0), (f))
1694
+ #define INSTR_CREATE_fsubrp(dc, f) \
1695
+ instr_create_1dst_2src((dc), OP_fsubrp, (f), opnd_create_reg(REG_ST0), (f))
1696
+ /* @} */ /* end doxygen group */
1697
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1698
+ /**
1699
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
1700
+ * the given explicit memory operand, automatically supplying any implicit operands.
1701
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1702
+ * \param m The opnd_t explicit source operand for the instruction, which must be
1703
+ * a memory reference (opnd_create_base_disp() or opnd_create_far_base_disp()).
1704
+ */
1705
+ #define INSTR_CREATE_fiadd(dc, m) \
1706
+ instr_create_1dst_2src((dc), OP_fiadd, opnd_create_reg(REG_ST0), (m), opnd_create_reg(REG_ST0))
1707
+ #define INSTR_CREATE_fimul(dc, m) \
1708
+ instr_create_1dst_2src((dc), OP_fimul, opnd_create_reg(REG_ST0), (m), opnd_create_reg(REG_ST0))
1709
+ #define INSTR_CREATE_fidiv(dc, m) \
1710
+ instr_create_1dst_2src((dc), OP_fidiv, opnd_create_reg(REG_ST0), (m), opnd_create_reg(REG_ST0))
1711
+ #define INSTR_CREATE_fidivr(dc, m) \
1712
+ instr_create_1dst_2src((dc), OP_fidivr, opnd_create_reg(REG_ST0), (m), opnd_create_reg(REG_ST0))
1713
+ #define INSTR_CREATE_fisub(dc, m) \
1714
+ instr_create_1dst_2src((dc), OP_fisub, opnd_create_reg(REG_ST0), (m), opnd_create_reg(REG_ST0))
1715
+ #define INSTR_CREATE_fisubr(dc, m) \
1716
+ instr_create_1dst_2src((dc), OP_fisubr, opnd_create_reg(REG_ST0), (m), opnd_create_reg(REG_ST0))
1717
+ #define INSTR_CREATE_ficom(dc, m) \
1718
+ instr_create_1dst_2src((dc), OP_ficom, opnd_create_reg(REG_ST0), (m), opnd_create_reg(REG_ST0))
1719
+ #define INSTR_CREATE_ficomp(dc, m) \
1720
+ instr_create_1dst_2src((dc), OP_ficomp, opnd_create_reg(REG_ST0), (m), opnd_create_reg(REG_ST0))
1721
+ /* @} */ /* end doxygen group */
1722
+
1723
+ /**
1724
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
1725
+ * given explicit operands, automatically supplying any implicit operands.
1726
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1727
+ * \param d The opnd_t explicit destination operand for the instruction.
1728
+ * \param r The opnd_t explicit source operand for the instruction, which
1729
+ * must be an xmm register (opnd_create_reg()).
1730
+ */
1731
+ #define INSTR_CREATE_extrq(dc, d, r) \
1732
+ instr_create_1dst_1src((dc), OP_extrq, (d), (r))
1733
+ /**
1734
+ * This INSTR_CREATE_xxx_imm macro creates an instr_t with opcode OP_xxx and the
1735
+ * given explicit operands, automatically supplying any implicit operands. The _imm
1736
+ * suffix distinguishes between alternative forms of the same opcode: this
1737
+ * form takes explicit immediates.
1738
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1739
+ * \param d The opnd_t explicit destination operand for the instruction.
1740
+ * \param i1 The opnd_t explicit first source operand for the instruction, which
1741
+ * must be an immediate integer (opnd_create_immed_int()).
1742
+ * \param i2 The opnd_t explicit second source operand for the instruction, which
1743
+ * must be an immediate integer (opnd_create_immed_int()).
1744
+ */
1745
+ #define INSTR_CREATE_extrq_imm(dc, d, i1, i2) \
1746
+ instr_create_1dst_2src((dc), OP_extrq, (d), (i1), (i2))
1747
+ /**
1748
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
1749
+ * given explicit operands, automatically supplying any implicit operands.
1750
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1751
+ * \param d The opnd_t explicit destination operand for the instruction.
1752
+ * \param r The opnd_t explicit source operand for the instruction, which
1753
+ * must be an xmm register (opnd_create_reg()).
1754
+ */
1755
+ #define INSTR_CREATE_insertq(dc, d, r) \
1756
+ instr_create_1dst_1src((dc), OP_insertq, (d), (r))
1757
+ /**
1758
+ * This INSTR_CREATE_xxx_imm macro creates an instr_t with opcode OP_xxx and the
1759
+ * given explicit operands, automatically supplying any implicit operands. The _imm
1760
+ * suffix distinguishes between alternative forms of the same opcode: this
1761
+ * form takes explicit immediates.
1762
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1763
+ * \param d The opnd_t explicit destination operand for the instruction.
1764
+ * \param r The opnd_t explicit first source operand for the instruction, which
1765
+ * must be an xmm register (opnd_create_reg()).
1766
+ * \param i1 The opnd_t explicit second source operand for the instruction, which
1767
+ * must be an immediate integer (opnd_create_immed_int()).
1768
+ * \param i2 The opnd_t explicit third source operand for the instruction, which
1769
+ * must be an immediate integer (opnd_create_immed_int()).
1770
+ */
1771
+ #define INSTR_CREATE_insertq_imm(dc, d, r, i1, i2) \
1772
+ instr_create_1dst_3src((dc), OP_insertq, (d), (r), (i1), (i2))
1773
+
1774
+ /* 1 implicit destination, 2 sources: 1 explicit, 1 implicit */
1775
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1776
+ /**
1777
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
1778
+ * explicit operands, automatically supplying any implicit operands.
1779
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1780
+ * \param i The opnd_t explicit source operand for the instruction, which
1781
+ * must be an immediate integer (opnd_create_immed_int()).
1782
+ */
1783
+ #define INSTR_CREATE_aam(dc, i) \
1784
+ instr_create_1dst_2src((dc), OP_aam, opnd_create_reg(REG_AX), (i), opnd_create_reg(REG_AX))
1785
+ #define INSTR_CREATE_aad(dc, i) \
1786
+ instr_create_1dst_2src((dc), OP_aad, opnd_create_reg(REG_AX), (i), opnd_create_reg(REG_AX))
1787
+ /* @} */ /* end doxygen group */
1788
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1789
+ /**
1790
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
1791
+ * explicit operands, automatically supplying any implicit operands.
1792
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1793
+ * \param t The opnd_t target operand for the instruction, which can be either
1794
+ * a pc (opnd_create_pc()) or an instr_t (opnd_create_instr()).
1795
+ */
1796
+ #define INSTR_CREATE_loopne(dc, t) \
1797
+ instr_create_1dst_2src((dc), OP_loopne, opnd_create_reg(REG_XCX), (t), opnd_create_reg(REG_XCX))
1798
+ #define INSTR_CREATE_loope(dc, t) \
1799
+ instr_create_1dst_2src((dc), OP_loope, opnd_create_reg(REG_XCX), (t), opnd_create_reg(REG_XCX))
1800
+ #define INSTR_CREATE_loop(dc, t) \
1801
+ instr_create_1dst_2src((dc), OP_loop, opnd_create_reg(REG_XCX), (t), opnd_create_reg(REG_XCX))
1802
+ /* @} */ /* end doxygen group */
1803
+
1804
+ /* 1 implicit destination, 2 implicit sources */
1805
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1806
+ /**
1807
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
1808
+ * supplying any implicit operands.
1809
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1810
+ */
1811
+ #define INSTR_CREATE_popf(dc) \
1812
+ instr_create_1dst_2src((dc), OP_popf, opnd_create_reg(REG_XSP), \
1813
+ opnd_create_reg(REG_XSP), \
1814
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK))
1815
+ #define INSTR_CREATE_ret(dc) \
1816
+ instr_create_1dst_2src((dc), OP_ret, opnd_create_reg(REG_XSP), \
1817
+ opnd_create_reg(REG_XSP), \
1818
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_ret))
1819
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
1820
+ #define INSTR_CREATE_ret_far(dc) \
1821
+ instr_create_1dst_2src((dc), OP_ret_far, opnd_create_reg(REG_XSP), \
1822
+ opnd_create_reg(REG_XSP), \
1823
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK))
1824
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
1825
+ #define INSTR_CREATE_iret(dc) \
1826
+ instr_create_1dst_2src((dc), OP_iret, opnd_create_reg(REG_XSP), \
1827
+ opnd_create_reg(REG_XSP), \
1828
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK))
1829
+ /* @} */ /* end doxygen group */
1830
+
1831
+ /* 1 destination, 3 sources: 1 implicit */
1832
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1833
+ /**
1834
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
1835
+ * given explicit operands, automatically supplying any implicit operands.
1836
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1837
+ * \param d The opnd_t explicit destination operand for the instruction.
1838
+ * \param s The opnd_t explicit source operand for the instruction.
1839
+ * \param ri The opnd_t explicit source operand for the instruction, which must
1840
+ * be one of the following:
1841
+ * -# The register cl (#opnd_create_reg(#REG_CL));
1842
+ * -# An immediate integer (opnd_create_immed_int()) of size #OPSZ_1;
1843
+ */
1844
+ #define INSTR_CREATE_shld(dc, d, s, ri) \
1845
+ instr_create_1dst_3src((dc), OP_shld, (d), (s), (ri), (d))
1846
+ #define INSTR_CREATE_shrd(dc, d, s, ri) \
1847
+ instr_create_1dst_3src((dc), OP_shrd, (d), (s), (ri), (d))
1848
+ /* @} */ /* end doxygen group */
1849
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1850
+ /**
1851
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
1852
+ * given explicit operands, automatically supplying any implicit operands.
1853
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1854
+ * \param d The opnd_t explicit destination operand for the instruction.
1855
+ * \param s The opnd_t explicit source operand for the instruction.
1856
+ * \param i The opnd_t explicit second source operand for the instruction, which
1857
+ * must be an immediate integer (opnd_create_immed_int()).
1858
+ */
1859
+ #define INSTR_CREATE_shufps(dc, d, s, i ) \
1860
+ instr_create_1dst_3src((dc), OP_shufps, (d), (s), (i), (d))
1861
+ #define INSTR_CREATE_shufpd(dc, d, s, i) \
1862
+ instr_create_1dst_3src((dc), OP_shufpd, (d), (s), (i), (d))
1863
+ #define INSTR_CREATE_cmpps(dc, d, s, i) \
1864
+ instr_create_1dst_3src((dc), OP_cmpps, (d), (s), (i), (d))
1865
+ #define INSTR_CREATE_cmpss(dc, d, s, i) \
1866
+ instr_create_1dst_3src((dc), OP_cmpss, (d), (s), (i), (d))
1867
+ #define INSTR_CREATE_cmppd(dc, d, s, i) \
1868
+ instr_create_1dst_3src((dc), OP_cmppd, (d), (s), (i), (d))
1869
+ #define INSTR_CREATE_cmpsd(dc, d, s, i) \
1870
+ instr_create_1dst_3src((dc), OP_cmpsd, (d), (s), (i), (d))
1871
+ #define INSTR_CREATE_palignr(dc, d, s, i) \
1872
+ instr_create_1dst_3src((dc), OP_palignr, (d), (s), (i), (d))
1873
+ #define INSTR_CREATE_dpps(dc, d, s, i) \
1874
+ instr_create_1dst_3src((dc), OP_dpps, (d), (s), (i), (d))
1875
+ #define INSTR_CREATE_dppd(dc, d, s, i) \
1876
+ instr_create_1dst_3src((dc), OP_dppd, (d), (s), (i), (d))
1877
+ #define INSTR_CREATE_mpsadbw(dc, d, s, i) \
1878
+ instr_create_1dst_3src((dc), OP_mpsadbw, (d), (s), (i), (d))
1879
+ /* @} */ /* end doxygen group */
1880
+
1881
+ /* 1 implicit destination, 3 sources */
1882
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1883
+ /**
1884
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
1885
+ * given explicit operands, automatically supplying any implicit operands.
1886
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1887
+ * \param s1 The opnd_t explicit first source operand for the instruction.
1888
+ * \param s2 The opnd_t explicit second source operand for the instruction.
1889
+ * \param i The opnd_t explicit third source operand for the instruction, which
1890
+ * must be an immediate integer (opnd_create_immed_int()).
1891
+ */
1892
+ #define INSTR_CREATE_pcmpistrm(dc, s1, s2, i) \
1893
+ instr_create_1dst_3src((dc), OP_pcmpistrm, opnd_create_reg(REG_XMM0), (s1), (s2), (i))
1894
+ #define INSTR_CREATE_pcmpistri(dc, s1, s2, i) \
1895
+ instr_create_1dst_3src((dc), OP_pcmpistri, opnd_create_reg(REG_ECX), (s1), (s2), (i))
1896
+ /* @} */ /* end doxygen group */
1897
+
1898
+ /* 1 implicit destination, 3 sources: 2 implicit */
1899
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1900
+ /**
1901
+ * This INSTR_CREATE_xxx_imm macro creates an instr_t with opcode OP_xxx and the
1902
+ * given explicit operands, automatically supplying any implicit operands. The _imm
1903
+ * suffix distinguishes between alternative forms of the same opcode: these
1904
+ * forms take an explicit immediate.
1905
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1906
+ * \param i The opnd_t explicit second source operand for the instruction, which
1907
+ * must be an immediate integer (opnd_create_immed_int()).
1908
+ */
1909
+ #define INSTR_CREATE_ret_imm(dc, i) \
1910
+ instr_create_1dst_3src((dc), OP_ret, opnd_create_reg(REG_XSP), (i), \
1911
+ opnd_create_reg(REG_XSP), \
1912
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_ret))
1913
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
1914
+ #define INSTR_CREATE_ret_far_imm(dc, i) \
1915
+ instr_create_1dst_3src((dc), OP_ret_far, opnd_create_reg(REG_XSP), (i), \
1916
+ opnd_create_reg(REG_XSP), \
1917
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK))
1918
+ /* @} */ /* end doxygen group */
1919
+
1920
+ /* 1 implicit destination, 5 sources: 2 implicit */
1921
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1922
+ /**
1923
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
1924
+ * given explicit operands, automatically supplying any implicit operands.
1925
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1926
+ * \param s1 The opnd_t explicit first source operand for the instruction.
1927
+ * \param s2 The opnd_t explicit second source operand for the instruction.
1928
+ * \param i The opnd_t explicit third source operand for the instruction, which
1929
+ * must be an immediate integer (opnd_create_immed_int()).
1930
+ */
1931
+ #define INSTR_CREATE_pcmpestrm(dc, s1, s2, i) \
1932
+ instr_create_1dst_5src((dc), OP_pcmpestrm, opnd_create_reg(REG_XMM0), \
1933
+ (s1), (s2), (i), opnd_create_reg(REG_EAX), opnd_create_reg(REG_EDX))
1934
+ #define INSTR_CREATE_pcmpestri(dc, s1, s2, i) \
1935
+ instr_create_1dst_5src((dc), OP_pcmpestri, opnd_create_reg(REG_ECX), \
1936
+ (s1), (s2), (i), opnd_create_reg(REG_EAX), opnd_create_reg(REG_EDX))
1937
+ /* @} */ /* end doxygen group */
1938
+
1939
+ /* 2 implicit destinations, no sources */
1940
+ /**
1941
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
1942
+ * supplying any implicit operands.
1943
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1944
+ */
1945
+ #define INSTR_CREATE_rdtsc(dc) \
1946
+ instr_create_2dst_0src((dc), OP_rdtsc, opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX))
1947
+
1948
+ /* 2 destinations: 1 implicit, 1 source */
1949
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1950
+ /**
1951
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
1952
+ * explicit operands, automatically supplying any implicit operands.
1953
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1954
+ * \param d The opnd_t explicit destination operand for the instruction.
1955
+ * \param s The opnd_t explicit source operand for the instruction.
1956
+ */
1957
+ #define INSTR_CREATE_lds(dc, d, s) \
1958
+ instr_create_2dst_1src((dc), OP_lds, (d), opnd_create_reg(SEG_DS), (s))
1959
+ #define INSTR_CREATE_lss(dc, d, s) \
1960
+ instr_create_2dst_1src((dc), OP_lss, (d), opnd_create_reg(SEG_SS), (s))
1961
+ #define INSTR_CREATE_les(dc, d, s) \
1962
+ instr_create_2dst_1src((dc), OP_les, (d), opnd_create_reg(SEG_ES), (s))
1963
+ #define INSTR_CREATE_lfs(dc, d, s) \
1964
+ instr_create_2dst_1src((dc), OP_lfs, (d), opnd_create_reg(SEG_FS), (s))
1965
+ #define INSTR_CREATE_lgs(dc, d, s) \
1966
+ instr_create_2dst_1src((dc), OP_lgs, (d), opnd_create_reg(SEG_GS), (s))
1967
+ /* @} */ /* end doxygen group */
1968
+
1969
+ /* 2 implicit destinations, 1 implicit source */
1970
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
1971
+ /**
1972
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
1973
+ * supplying any implicit operands.
1974
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
1975
+ */
1976
+ #define INSTR_CREATE_pushf(dc) \
1977
+ instr_create_2dst_1src((dc), OP_pushf, opnd_create_reg(REG_XSP), \
1978
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK), \
1979
+ opnd_create_reg(REG_XSP))
1980
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
1981
+ #define INSTR_CREATE_int3(dc) \
1982
+ instr_create_2dst_1src((dc), OP_int3, opnd_create_reg(REG_XSP), \
1983
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK), \
1984
+ opnd_create_reg(REG_XSP))
1985
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
1986
+ #define INSTR_CREATE_into(dc) \
1987
+ instr_create_2dst_1src((dc), OP_into, opnd_create_reg(REG_XSP), \
1988
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK), \
1989
+ opnd_create_reg(REG_XSP))
1990
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
1991
+ #define INSTR_CREATE_int1(dc) \
1992
+ instr_create_2dst_1src((dc), OP_int1, opnd_create_reg(REG_XSP), \
1993
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK), \
1994
+ opnd_create_reg(REG_XSP))
1995
+ #define INSTR_CREATE_rdmsr(dc) \
1996
+ instr_create_2dst_1src((dc), OP_rdmsr, opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX), \
1997
+ opnd_create_reg(REG_ECX))
1998
+ #define INSTR_CREATE_rdpmc(dc) \
1999
+ instr_create_2dst_1src((dc), OP_rdpmc, opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX), \
2000
+ opnd_create_reg(REG_ECX))
2001
+ /* @} */ /* end doxygen group */
2002
+
2003
+ /* 2 destinations: 1 implicit, 2 sources */
2004
+ /**
2005
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
2006
+ * explicit operands, automatically supplying any implicit operands.
2007
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2008
+ * \param d The opnd_t explicit destination operand for the instruction.
2009
+ */
2010
+ #define INSTR_CREATE_pop(dc, d) \
2011
+ instr_create_2dst_2src((dc), OP_pop, (d), opnd_create_reg(REG_XSP), \
2012
+ opnd_create_reg(REG_XSP), \
2013
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_VARSTACK))
2014
+
2015
+ /* 2 destinations: 1 implicit, 2 sources: 1 implicit */
2016
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
2017
+ /**
2018
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
2019
+ * explicit operands, automatically supplying any implicit operands.
2020
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2021
+ * \param d The opnd_t explicit destination operand for the instruction.
2022
+ * \param s The opnd_t explicit source operand for the instruction.
2023
+ */
2024
+ #define INSTR_CREATE_xchg(dc, d, s) \
2025
+ instr_create_2dst_2src((dc), OP_xchg, (d), (s), (d), (s))
2026
+ #define INSTR_CREATE_xadd(dc, d, s) \
2027
+ instr_create_2dst_2src((dc), OP_xadd, (d), (s), (d), (s))
2028
+ /* @} */ /* end doxygen group */
2029
+
2030
+ /* string instructions */
2031
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
2032
+ /**
2033
+ * This INSTR_CREATE_xxx_1 or INSTR_CREATE_xxx_4 macro creates an instr_t with opcode
2034
+ * OP_xxx, automatically supplying any implicit operands. The _1 or _4 suffixes
2035
+ * distinguish between alternative forms of the same opcode (1 and 4 identify the
2036
+ * operand size).
2037
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2038
+ */
2039
+ #define INSTR_CREATE_ins_1(dc) \
2040
+ instr_create_2dst_2src((dc), OP_ins, \
2041
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2042
+ opnd_create_reg(REG_XDI), opnd_create_reg(REG_DX), opnd_create_reg(REG_XDI))
2043
+ #define INSTR_CREATE_ins_4(dc) \
2044
+ instr_create_2dst_2src((dc), OP_ins, \
2045
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2046
+ opnd_create_reg(REG_XDI), opnd_create_reg(REG_DX), opnd_create_reg(REG_XDI))
2047
+ #define INSTR_CREATE_stos_1(dc) \
2048
+ instr_create_2dst_2src((dc), OP_stos, \
2049
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2050
+ opnd_create_reg(REG_XDI), opnd_create_reg(REG_AL), opnd_create_reg(REG_XDI))
2051
+ #define INSTR_CREATE_stos_4(dc) \
2052
+ instr_create_2dst_2src((dc), OP_stos, \
2053
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2054
+ opnd_create_reg(REG_XDI), opnd_create_reg(REG_XAX), opnd_create_reg(REG_XDI))
2055
+ #define INSTR_CREATE_lods_1(dc) \
2056
+ instr_create_2dst_2src((dc), OP_lods, opnd_create_reg(REG_AL), opnd_create_reg(REG_XSI), \
2057
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_1), \
2058
+ opnd_create_reg(REG_XSI))
2059
+ #define INSTR_CREATE_lods_4(dc) \
2060
+ instr_create_2dst_2src((dc), OP_lods, opnd_create_reg(REG_XAX), opnd_create_reg(REG_XSI), \
2061
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2062
+ opnd_create_reg(REG_XSI))
2063
+ #define INSTR_CREATE_movs_1(dc) \
2064
+ instr_create_3dst_3src((dc), OP_movs, \
2065
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2066
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), \
2067
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_1), \
2068
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI))
2069
+ #define INSTR_CREATE_movs_4(dc) \
2070
+ instr_create_3dst_3src((dc), OP_movs, \
2071
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2072
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), \
2073
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2074
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI))
2075
+ #define INSTR_CREATE_rep_ins_1(dc) \
2076
+ instr_create_3dst_3src((dc), OP_rep_ins, \
2077
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2078
+ opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX), \
2079
+ opnd_create_reg(REG_DX), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2080
+ #define INSTR_CREATE_rep_ins_4(dc) \
2081
+ instr_create_3dst_3src((dc), OP_rep_ins, \
2082
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2083
+ opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX), \
2084
+ opnd_create_reg(REG_DX), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2085
+ #define INSTR_CREATE_rep_stos_1(dc) \
2086
+ instr_create_3dst_3src((dc), OP_rep_stos, \
2087
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2088
+ opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX), \
2089
+ opnd_create_reg(REG_AL), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2090
+ #define INSTR_CREATE_rep_stos_4(dc) \
2091
+ instr_create_3dst_3src((dc), OP_rep_stos, \
2092
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2093
+ opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX), \
2094
+ opnd_create_reg(REG_EAX), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2095
+ #define INSTR_CREATE_rep_lods_1(dc) \
2096
+ instr_create_3dst_3src((dc), OP_rep_lods, opnd_create_reg(REG_AL), opnd_create_reg(REG_XSI), \
2097
+ opnd_create_reg(REG_ECX), \
2098
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_1), \
2099
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_ECX))
2100
+ #define INSTR_CREATE_rep_lods_4(dc) \
2101
+ instr_create_3dst_3src((dc), OP_rep_lods, opnd_create_reg(REG_EAX), opnd_create_reg(REG_XSI), \
2102
+ opnd_create_reg(REG_ECX), \
2103
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2104
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_ECX))
2105
+ #define INSTR_CREATE_rep_movs_1(dc) \
2106
+ instr_create_4dst_4src((dc), OP_rep_movs, \
2107
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2108
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX), \
2109
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_1), \
2110
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2111
+ #define INSTR_CREATE_rep_movs_4(dc) \
2112
+ instr_create_4dst_4src((dc), OP_rep_movs, \
2113
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2114
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX), \
2115
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2116
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2117
+ #define INSTR_CREATE_outs_1(dc) \
2118
+ instr_create_1dst_3src((dc), OP_outs, opnd_create_reg(REG_XSI), \
2119
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_1), \
2120
+ opnd_create_reg(REG_DX), opnd_create_reg(REG_XSI))
2121
+ #define INSTR_CREATE_outs_4(dc) \
2122
+ instr_create_1dst_3src((dc), OP_outs, opnd_create_reg(REG_XSI), \
2123
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2124
+ opnd_create_reg(REG_DX), opnd_create_reg(REG_XSI))
2125
+ #define INSTR_CREATE_cmps_1(dc) \
2126
+ instr_create_2dst_4src((dc), OP_cmps, opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), \
2127
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_1), \
2128
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2129
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI))
2130
+ #define INSTR_CREATE_cmps_4(dc) \
2131
+ instr_create_2dst_4src((dc), OP_cmps, opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), \
2132
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2133
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2134
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI))
2135
+ #define INSTR_CREATE_scas_1(dc) \
2136
+ instr_create_1dst_3src((dc), OP_scas, opnd_create_reg(REG_XDI), \
2137
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2138
+ opnd_create_reg(REG_AL), opnd_create_reg(REG_XDI))
2139
+ #define INSTR_CREATE_scas_4(dc) \
2140
+ instr_create_1dst_3src((dc), OP_scas, opnd_create_reg(REG_XDI), \
2141
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2142
+ opnd_create_reg(REG_EAX), opnd_create_reg(REG_XDI))
2143
+ #define INSTR_CREATE_rep_outs_1(dc) \
2144
+ instr_create_2dst_4src((dc), OP_rep_outs, opnd_create_reg(REG_XSI), opnd_create_reg(REG_ECX), \
2145
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_1), \
2146
+ opnd_create_reg(REG_DX), opnd_create_reg(REG_XSI), opnd_create_reg(REG_ECX))
2147
+ #define INSTR_CREATE_rep_outs_4(dc) \
2148
+ instr_create_2dst_4src((dc), OP_rep_outs, opnd_create_reg(REG_XSI), opnd_create_reg(REG_ECX), \
2149
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2150
+ opnd_create_reg(REG_DX), opnd_create_reg(REG_XSI), opnd_create_reg(REG_ECX))
2151
+ #define INSTR_CREATE_rep_cmps_1(dc) \
2152
+ instr_create_3dst_5src((dc), OP_rep_cmps, opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), \
2153
+ opnd_create_reg(REG_ECX), \
2154
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_1), \
2155
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2156
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2157
+ #define INSTR_CREATE_rep_cmps_4(dc) \
2158
+ instr_create_3dst_5src((dc), OP_rep_cmps, opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), \
2159
+ opnd_create_reg(REG_ECX), \
2160
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2161
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2162
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2163
+ #define INSTR_CREATE_repne_cmps_1(dc) \
2164
+ instr_create_3dst_5src((dc), OP_repne_cmps, opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), \
2165
+ opnd_create_reg(REG_ECX), \
2166
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_1), \
2167
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2168
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2169
+ #define INSTR_CREATE_repne_cmps_4(dc) \
2170
+ instr_create_3dst_5src((dc), OP_repne_cmps, opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), \
2171
+ opnd_create_reg(REG_ECX), \
2172
+ opnd_create_far_base_disp(SEG_DS, REG_XSI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2173
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2174
+ opnd_create_reg(REG_XSI), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2175
+ #define INSTR_CREATE_rep_scas_1(dc) \
2176
+ instr_create_2dst_4src((dc), OP_rep_scas, opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX), \
2177
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2178
+ opnd_create_reg(REG_AL), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2179
+ #define INSTR_CREATE_rep_scas_4(dc) \
2180
+ instr_create_2dst_4src((dc), OP_rep_scas, opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX), \
2181
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2182
+ opnd_create_reg(REG_EAX), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2183
+ #define INSTR_CREATE_repne_scas_1(dc) \
2184
+ instr_create_2dst_4src((dc), OP_repne_scas, opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX), \
2185
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_1), \
2186
+ opnd_create_reg(REG_AL), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2187
+ #define INSTR_CREATE_repne_scas_4(dc) \
2188
+ instr_create_2dst_4src((dc), OP_repne_scas, opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX), \
2189
+ opnd_create_far_base_disp(SEG_ES, REG_XDI, REG_NULL, 0, 0, OPSZ_4_rex8_short2), \
2190
+ opnd_create_reg(REG_EAX), opnd_create_reg(REG_XDI), opnd_create_reg(REG_ECX))
2191
+ /* @} */ /* end doxygen group */
2192
+
2193
+ /* floating point */
2194
+ /**
2195
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
2196
+ * explicit register operand, automatically supplying any implicit operands.
2197
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2198
+ * \param f The opnd_t explicit source operand for the instruction, which must
2199
+ * be a floating point register (opnd_create_reg()).
2200
+ */
2201
+ #define INSTR_CREATE_fxch(dc, f) \
2202
+ instr_create_2dst_2src((dc), OP_fxch, opnd_create_reg(REG_ST0), (f), \
2203
+ opnd_create_reg(REG_ST0), (f))
2204
+
2205
+ /* 2 destinations, 2 sources: 1 implicit */
2206
+ /**
2207
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
2208
+ * the given explicit operands, automatically supplying any implicit operands.
2209
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2210
+ * \param t The opnd_t target operand for the instruction, which can be either
2211
+ * a pc (opnd_create_pc()) or an instr_t (opnd_create_instr()).
2212
+ */
2213
+ #define INSTR_CREATE_call(dc, t) \
2214
+ instr_create_2dst_2src((dc), OP_call, opnd_create_reg(REG_XSP), \
2215
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK), \
2216
+ (t), opnd_create_reg(REG_XSP))
2217
+ /**
2218
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
2219
+ * the given explicit operands, automatically supplying any implicit operands.
2220
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2221
+ * \param t The opnd_t target operand for the instruction, which should be
2222
+ * a memory reference created with opnd_create_base_disp().
2223
+ */
2224
+ #define INSTR_CREATE_call_ind(dc, t) \
2225
+ instr_create_2dst_2src((dc), OP_call_ind, opnd_create_reg(REG_XSP), \
2226
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK), \
2227
+ (t), opnd_create_reg(REG_XSP))
2228
+ /**
2229
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
2230
+ * the given explicit operands, automatically supplying any implicit operands.
2231
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2232
+ * \param t The opnd_t target operand for the instruction, which should be
2233
+ * a far pc operand created with opnd_create_far_pc().
2234
+ */
2235
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
2236
+ #define INSTR_CREATE_call_far(dc, t) \
2237
+ instr_create_2dst_2src((dc), OP_call_far, opnd_create_reg(REG_XSP), \
2238
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK), \
2239
+ (t), opnd_create_reg(REG_XSP))
2240
+ /**
2241
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
2242
+ * the given explicit operands, automatically supplying any implicit operands.
2243
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2244
+ * \param t The opnd_t target operand for the instruction, which should be
2245
+ * a far memory reference created with opnd_create_far_base_disp().
2246
+ */
2247
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
2248
+ #define INSTR_CREATE_call_far_ind(dc, t) \
2249
+ instr_create_2dst_2src((dc), OP_call_far_ind, opnd_create_reg(REG_XSP), \
2250
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_REXVARSTACK), \
2251
+ (t), opnd_create_reg(REG_XSP))
2252
+ /**
2253
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and
2254
+ * the given explicit operands, automatically supplying any implicit operands.
2255
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2256
+ * \param s The opnd_t explicit source operand for the instruction.
2257
+ */
2258
+ #define INSTR_CREATE_push(dc, s) \
2259
+ instr_create_2dst_2src((dc), OP_push, opnd_create_reg(REG_XSP), \
2260
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_VARSTACK), \
2261
+ (s), opnd_create_reg(REG_XSP))
2262
+ /**
2263
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
2264
+ * given explicit operands, automatically supplying any implicit operands.
2265
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2266
+ * \param i The opnd_t explicit second source operand for the instruction, which
2267
+ * must be an immediate integer (opnd_create_immed_int()).
2268
+ */
2269
+ #define INSTR_CREATE_push_imm(dc, i) \
2270
+ instr_create_2dst_2src((dc), OP_push_imm, opnd_create_reg(REG_XSP), \
2271
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_VARSTACK), \
2272
+ (i), opnd_create_reg(REG_XSP))
2273
+
2274
+ /* 2 implicit destinations, 2 sources: 1 implicit */
2275
+ /**
2276
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the
2277
+ * given explicit operands, automatically supplying any implicit operands.
2278
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2279
+ * \param i The opnd_t explicit second source operand for the instruction, which
2280
+ * must be an immediate integer (opnd_create_immed_int()).
2281
+ */
2282
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
2283
+ #define INSTR_CREATE_int(dc, i) \
2284
+ instr_create_2dst_2src((dc), OP_int, opnd_create_reg(REG_XSP), \
2285
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK), \
2286
+ (i), opnd_create_reg(REG_XSP))
2287
+
2288
+ /* 2 destinations: 1 implicit, 3 sources: 1 implicit */
2289
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
2290
+ /**
2291
+ * This INSTR_CREATE_xxx_1 or INSTR_CREATE_xxx_4 macro creates an
2292
+ * instr_t with opcode OP_xxx and the given explicit operands, automatically
2293
+ * supplying any implicit operands. The _1 or _4 suffixes distinguish between
2294
+ * alternative forms of the same opcode (1 and 4 identify the operand size).
2295
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2296
+ * \param d The opnd_t explicit destination operand for the instruction.
2297
+ * \param s The opnd_t explicit source operand for the instruction.
2298
+ */
2299
+ #define INSTR_CREATE_cmpxchg_1(dc, d, s) \
2300
+ instr_create_2dst_3src((dc), OP_cmpxchg, (d), opnd_create_reg(REG_AL), (s), (d), \
2301
+ opnd_create_reg(REG_AL))
2302
+ #define INSTR_CREATE_cmpxchg_4(dc, d, s) \
2303
+ instr_create_2dst_3src((dc), OP_cmpxchg, (d), opnd_create_reg(REG_EAX), (s), (d), \
2304
+ opnd_create_reg(REG_EAX))
2305
+ /* @} */ /* end doxygen group */
2306
+
2307
+ /* 2 implicit destinations, 3 implicit sources */
2308
+ #define INSTR_CREATE_leave(dc) \
2309
+ instr_create_2dst_3src((dc), OP_leave, opnd_create_reg(REG_XSP), \
2310
+ opnd_create_reg(REG_XBP), opnd_create_reg(REG_XBP), opnd_create_reg(REG_XSP), \
2311
+ opnd_create_base_disp(REG_XBP, REG_NULL, 0, 0, OPSZ_STACK))
2312
+
2313
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
2314
+ /**
2315
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
2316
+ * supplying any implicit operands.
2317
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2318
+ */
2319
+ /* 2 implicit destinations, 8 implicit sources */
2320
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
2321
+ #define INSTR_CREATE_pusha(dc) instr_create_pusha((dc))
2322
+
2323
+ /* 3 implicit destinations, 1 source */
2324
+ #define INSTR_CREATE_cpuid(dc) \
2325
+ instr_create_4dst_1src((dc), OP_cpuid, opnd_create_reg(REG_EAX), \
2326
+ opnd_create_reg(REG_EBX), opnd_create_reg(REG_ECX), opnd_create_reg(REG_EDX), opnd_create_reg(REG_EAX))
2327
+ /* @} */ /* end doxygen group */
2328
+
2329
+ /* 3 destinations: 2 implicit, 5 implicit sources */
2330
+ /**
2331
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
2332
+ * explicit operands, automatically supplying any implicit operands.
2333
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2334
+ * \param d The opnd_t explicit destination operand for the instruction.
2335
+ */
2336
+ #define INSTR_CREATE_cmpxchg8b(dc, d) \
2337
+ instr_create_3dst_5src((dc), OP_cmpxchg8b, (d), opnd_create_reg(REG_EAX), \
2338
+ opnd_create_reg(REG_EDX), (d), opnd_create_reg(REG_EAX), opnd_create_reg(REG_EDX), \
2339
+ opnd_create_reg(REG_ECX), opnd_create_reg(REG_EBX))
2340
+
2341
+ /* 3 implicit destinations, 4 sources: 2 implicit */
2342
+ /**
2343
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx and the given
2344
+ * explicit operands, automatically supplying any implicit operands.
2345
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2346
+ * \param i16 The opnd_t explicit second source operand for the instruction, which
2347
+ * must be an immediate integer (opnd_create_immed_int()) of OPSZ_2.
2348
+ * \param i8 The opnd_t explicit second source operand for the instruction, which
2349
+ * must be an immediate integer (opnd_create_immed_int()) of OPSZ_1.
2350
+ */
2351
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
2352
+ #define INSTR_CREATE_enter(dc, i16, i8) \
2353
+ instr_create_3dst_4src((dc), OP_enter, opnd_create_reg(REG_XSP), \
2354
+ opnd_create_base_disp(REG_XSP, REG_NULL, 0, 0, OPSZ_STACK), \
2355
+ opnd_create_reg(REG_XBP), \
2356
+ (i16), (i8), opnd_create_reg(REG_XSP), opnd_create_reg(REG_XBP))
2357
+
2358
+ /* 8 implicit destinations, 2 implicit sources */
2359
+ /**
2360
+ * This INSTR_CREATE_xxx macro creates an instr_t with opcode OP_xxx, automatically
2361
+ * supplying any implicit operands.
2362
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2363
+ */
2364
+ /* WARNING: actually performs multiple stack operations (not reflected in size) */
2365
+ #define INSTR_CREATE_popa(dc) instr_create_popa((dc))
2366
+
2367
+ /****************************************************************************/
2368
+
2369
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
2370
+ /**
2371
+ * Convenience routine for nop of certain size. We choose edi as working register
2372
+ * for multibyte nops (seems least likely to impact performance: Microsoft uses it
2373
+ * and DR used to steal it).
2374
+ * Note that Intel now recommends a different set of multi-byte nops,
2375
+ * but we stick with these as our tools (mainly windbg) don't understand
2376
+ * the OP_nop_modrm encoding (though should work on PPro+).
2377
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2378
+ */
2379
+ #define INSTR_CREATE_nop1byte(dc) INSTR_CREATE_nop(dc)
2380
+ #define INSTR_CREATE_nop2byte(dc) INSTR_CREATE_nop2byte_reg(dc, REG_XDI)
2381
+ #define INSTR_CREATE_nop3byte(dc) INSTR_CREATE_nop3byte_reg(dc, REG_XDI)
2382
+ /* @} */ /* end doxygen group */
2383
+ /* @{ */ /* doxygen start group; w/ DISTRIBUTE_GROUP_DOC=YES, one comment suffices. */
2384
+ /**
2385
+ * Convenience routine for nop of certain size.
2386
+ * Note that Intel now recommends a different set of multi-byte nops,
2387
+ * but we stick with these as our tools (mainly windbg) don't understand
2388
+ * the OP_nop_modrm encoding (though should work on PPro+).
2389
+ * AMD recommends 0x66 0x66 ... 0x90 for older processors.
2390
+ * \param dc The void * dcontext used to allocate memory for the instr_t.
2391
+ * \param reg A reg_id_t (NOT opnd_t) to use as source and destination.
2392
+ * For 64-bit mode, use a 64-bit register, but NOT rbp or rsp for the 3-byte form.
2393
+ */
2394
+ #ifdef X64
2395
+ static inline instr_t *
2396
+ INSTR_CREATE_nop2byte_reg(void *dcontext, reg_id_t reg)
2397
+ {
2398
+ /* 32-bit register target zeroes out the top bits, so we use the Intel
2399
+ * and AMD recommended 0x66 0x90 */
2400
+ instr_t *in = instr_build_bits(dcontext, OP_nop, 2);
2401
+ instr_set_raw_byte(in, 0, 0x66);
2402
+ instr_set_raw_byte(in, 1, 0x90);
2403
+ instr_set_operands_valid(in, true);
2404
+ return in;
2405
+ }
2406
+ #else
2407
+ # define INSTR_CREATE_nop2byte_reg(dc, reg) \
2408
+ INSTR_CREATE_mov_st(dc, opnd_create_reg(reg), opnd_create_reg(reg))
2409
+ #endif
2410
+ #ifdef X64
2411
+ /* lea's target is 32-bit but address register is 64: so we eliminate the
2412
+ * displacement and put in rex.w
2413
+ */
2414
+ # define INSTR_CREATE_nop3byte_reg(dc, reg) \
2415
+ INSTR_CREATE_lea(dc, opnd_create_reg(reg), OPND_CREATE_MEM_lea(reg, REG_NULL, 0, 0))
2416
+ #else
2417
+ # define INSTR_CREATE_nop3byte_reg(dc, reg) \
2418
+ INSTR_CREATE_lea(dc, opnd_create_reg(reg), \
2419
+ opnd_create_base_disp_ex(reg, REG_NULL, 0, 0, OPSZ_lea, \
2420
+ true/*encode 0*/, false, false))
2421
+ #endif
2422
+ /* @} */ /* end doxygen group */
2423
+
2424
+
2425
+
2426
+ #endif /* _DR_IR_MACROS_H_ */