blob: a220398e10a1564ce4a060f30a635c2aae232728 [file] [log] [blame]
sewardjc9a65702004-07-07 16:32:57 +00001
2/*---------------------------------------------------------------*/
3/*--- ---*/
sewardj2a9ad022004-11-25 02:46:58 +00004/*--- This file (guest-x86/gdefs.h) is ---*/
sewardjc9a65702004-07-07 16:32:57 +00005/*--- Copyright (c) 2004 OpenWorks LLP. All rights reserved. ---*/
6/*--- ---*/
7/*---------------------------------------------------------------*/
8
sewardjf8ed9d82004-11-12 17:40:23 +00009/*
10 This file is part of LibVEX, a library for dynamic binary
11 instrumentation and translation.
12
13 Copyright (C) 2004 OpenWorks, LLP.
14
15 This program is free software; you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation; Version 2 dated June 1991 of the
18 license.
19
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or liability
23 for damages. See the GNU General Public License for more details.
24
25 Neither the names of the U.S. Department of Energy nor the
26 University of California nor the names of its contributors may be
27 used to endorse or promote products derived from this software
28 without prior written permission.
29
30 You should have received a copy of the GNU General Public License
31 along with this program; if not, write to the Free Software
32 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
33 USA.
34*/
35
sewardjc9a65702004-07-07 16:32:57 +000036/* Only to be used within the guest-x86 directory. */
37
38/* Some of this stuff is taken from QEMU, which is Copyright (c) 2003
39 Fabrice Bellard, and licensed under the LGPL. */
40
sewardj2a9ad022004-11-25 02:46:58 +000041#ifndef __LIBVEX_GUEST_X86_DEFS_H
42#define __LIBVEX_GUEST_X86_DEFS_H
sewardjc9a65702004-07-07 16:32:57 +000043
44
45/*---------------------------------------------------------*/
46/*--- x86 to IR conversion ---*/
47/*---------------------------------------------------------*/
48
49extern
sewardj2a9ad022004-11-25 02:46:58 +000050IRBB* bbToIR_X86 ( UChar* x86code,
51 Addr64 eip,
52 Int* guest_bytes_read,
53 Bool (*byte_accessible)(Addr64),
54 Bool (*resteerOkFn)(Addr64),
55 Bool host_bigendian );
sewardjc9a65702004-07-07 16:32:57 +000056
sewardj84ff0652004-08-23 16:16:08 +000057/* Used by the optimiser to specialise calls to helpers. */
58extern
sewardj2a9ad022004-11-25 02:46:58 +000059IRExpr* guest_x86_spechelper ( Char* function_name,
60 IRExpr** args );
sewardj84ff0652004-08-23 16:16:08 +000061
sewardj76bdc802004-10-25 15:33:26 +000062/* Describes to the optimser which part of the guest state require
63 precise memory exceptions. This is logically part of the guest
64 state description. */
65extern
66Bool guest_x86_state_requires_precise_mem_exns ( Int, Int );
67
sewardj49651f42004-10-28 22:11:04 +000068extern
sewardjeeac8412004-11-02 00:26:55 +000069VexGuestLayout x86guest_layout;
sewardj49651f42004-10-28 22:11:04 +000070
sewardjc9a65702004-07-07 16:32:57 +000071
72/*---------------------------------------------------------*/
sewardj8ea867b2004-10-30 19:03:02 +000073/*--- x86 guest helpers ---*/
74/*---------------------------------------------------------*/
75
76/* --- CLEAN HELPERS --- */
sewardj2a2ba8b2004-11-08 13:14:06 +000077
sewardj2a9ad022004-11-25 02:46:58 +000078extern UInt x86g_calculate_eflags_all (
79 UInt cc_op, UInt cc_dep1, UInt cc_dep2, UInt cc_ndep
80 );
sewardj2a2ba8b2004-11-08 13:14:06 +000081
sewardj2a9ad022004-11-25 02:46:58 +000082extern UInt x86g_calculate_eflags_c (
83 UInt cc_op, UInt cc_dep1, UInt cc_dep2, UInt cc_ndep
84 );
sewardj2a2ba8b2004-11-08 13:14:06 +000085
sewardj2a9ad022004-11-25 02:46:58 +000086extern UInt x86g_calculate_condition (
87 UInt/*X86Condcode*/ cond,
88 UInt cc_op,
89 UInt cc_dep1, UInt cc_dep2, UInt cc_ndep
90 );
sewardj2a2ba8b2004-11-08 13:14:06 +000091
sewardj2a9ad022004-11-25 02:46:58 +000092extern UInt x86g_calculate_FXAM ( UInt tag, ULong dbl );
sewardj2a2ba8b2004-11-08 13:14:06 +000093
sewardj2a9ad022004-11-25 02:46:58 +000094extern ULong x86g_calculate_RCR (
95 UInt arg, UInt rot_amt, UInt eflags_in, UInt sz
96 );
sewardj8ea867b2004-10-30 19:03:02 +000097
sewardj3bd6f3e2004-12-13 10:48:19 +000098extern ULong x86g_check_fldcw ( UInt fpucw );
sewardj893aada2004-11-29 19:57:54 +000099
sewardj3bd6f3e2004-12-13 10:48:19 +0000100extern UInt x86g_create_fpucw ( UInt fpround );
sewardj7df596b2004-12-06 14:29:12 +0000101
sewardj3bd6f3e2004-12-13 10:48:19 +0000102extern ULong x86g_check_ldmxcsr ( UInt mxcsr );
sewardj7df596b2004-12-06 14:29:12 +0000103
sewardj3bd6f3e2004-12-13 10:48:19 +0000104extern UInt x86g_create_mxcsr ( UInt sseround );
105
106/* Translate a guest virtual_addr into a guest linear address by
107 consulting the supplied LDT/GDT structures. Their representation
108 must be as specified in pub/libvex_guest_x86.h. To indicate a
109 translation failure, 1<<32 is returned. On success, the lower 32
110 bits of the returned result indicate the linear address.
111*/
112extern
113ULong x86g_use_seg_selector ( HWord ldt, HWord gdt,
114 UInt seg_selector, UInt virtual_addr );
sewardj893aada2004-11-29 19:57:54 +0000115
sewardj464efa42004-11-19 22:17:29 +0000116/* --- Clean helpers for MMX --- */
117
sewardj164f9272004-12-09 00:39:32 +0000118extern ULong x86g_calculate_add64x1 ( ULong, ULong );
sewardj2a9ad022004-11-25 02:46:58 +0000119extern ULong x86g_calculate_add32x2 ( ULong, ULong );
120extern ULong x86g_calculate_add16x4 ( ULong, ULong );
121extern ULong x86g_calculate_add8x8 ( ULong, ULong );
sewardj464efa42004-11-19 22:17:29 +0000122
sewardj2a9ad022004-11-25 02:46:58 +0000123extern ULong x86g_calculate_qadd16Sx4 ( ULong, ULong );
124extern ULong x86g_calculate_qadd8Sx8 ( ULong, ULong );
sewardj464efa42004-11-19 22:17:29 +0000125
sewardj2a9ad022004-11-25 02:46:58 +0000126extern ULong x86g_calculate_qadd16Ux4 ( ULong, ULong );
127extern ULong x86g_calculate_qadd8Ux8 ( ULong, ULong );
sewardj464efa42004-11-19 22:17:29 +0000128
sewardjb9fa69b2004-12-09 23:25:14 +0000129extern ULong x86g_calculate_sub64x1 ( ULong, ULong );
sewardj2a9ad022004-11-25 02:46:58 +0000130extern ULong x86g_calculate_sub32x2 ( ULong, ULong );
131extern ULong x86g_calculate_sub16x4 ( ULong, ULong );
132extern ULong x86g_calculate_sub8x8 ( ULong, ULong );
sewardj464efa42004-11-19 22:17:29 +0000133
sewardj2a9ad022004-11-25 02:46:58 +0000134extern ULong x86g_calculate_qsub16Sx4 ( ULong, ULong );
135extern ULong x86g_calculate_qsub8Sx8 ( ULong, ULong );
sewardj464efa42004-11-19 22:17:29 +0000136
sewardj2a9ad022004-11-25 02:46:58 +0000137extern ULong x86g_calculate_qsub16Ux4 ( ULong, ULong );
138extern ULong x86g_calculate_qsub8Ux8 ( ULong, ULong );
sewardj464efa42004-11-19 22:17:29 +0000139
sewardj2a9ad022004-11-25 02:46:58 +0000140extern ULong x86g_calculate_mulhi16x4 ( ULong, ULong );
141extern ULong x86g_calculate_mullo16x4 ( ULong, ULong );
sewardj464efa42004-11-19 22:17:29 +0000142
sewardj2a9ad022004-11-25 02:46:58 +0000143extern ULong x86g_calculate_pmaddwd ( ULong, ULong );
sewardj4340dac2004-11-20 13:17:04 +0000144
sewardj2a9ad022004-11-25 02:46:58 +0000145extern ULong x86g_calculate_cmpeq32x2 ( ULong, ULong );
146extern ULong x86g_calculate_cmpeq16x4 ( ULong, ULong );
147extern ULong x86g_calculate_cmpeq8x8 ( ULong, ULong );
148extern ULong x86g_calculate_cmpge32Sx2 ( ULong, ULong );
149extern ULong x86g_calculate_cmpge16Sx4 ( ULong, ULong );
150extern ULong x86g_calculate_cmpge8Sx8 ( ULong, ULong );
sewardj63ba4092004-11-21 12:30:18 +0000151
sewardj2a9ad022004-11-25 02:46:58 +0000152extern ULong x86g_calculate_packssdw ( ULong, ULong );
153extern ULong x86g_calculate_packsswb ( ULong, ULong );
154extern ULong x86g_calculate_packuswb ( ULong, ULong );
sewardj63ba4092004-11-21 12:30:18 +0000155
sewardj2a9ad022004-11-25 02:46:58 +0000156extern ULong x86g_calculate_punpckhbw ( ULong, ULong );
157extern ULong x86g_calculate_punpcklbw ( ULong, ULong );
158extern ULong x86g_calculate_punpckhwd ( ULong, ULong );
159extern ULong x86g_calculate_punpcklwd ( ULong, ULong );
160extern ULong x86g_calculate_punpckhdq ( ULong, ULong );
161extern ULong x86g_calculate_punpckldq ( ULong, ULong );
sewardj4340dac2004-11-20 13:17:04 +0000162
sewardj2a9ad022004-11-25 02:46:58 +0000163extern ULong x86g_calculate_shl16x4 ( ULong, ULong );
164extern ULong x86g_calculate_shl32x2 ( ULong, ULong );
165extern ULong x86g_calculate_shl64x1 ( ULong, ULong );
sewardj8d14a592004-11-21 17:04:50 +0000166
sewardj2a9ad022004-11-25 02:46:58 +0000167extern ULong x86g_calculate_shr16Ux4 ( ULong, ULong );
168extern ULong x86g_calculate_shr32Ux2 ( ULong, ULong );
169extern ULong x86g_calculate_shr64Ux1 ( ULong, ULong );
sewardj8d14a592004-11-21 17:04:50 +0000170
sewardj2a9ad022004-11-25 02:46:58 +0000171extern ULong x86g_calculate_shr16Sx4 ( ULong, ULong );
172extern ULong x86g_calculate_shr32Sx2 ( ULong, ULong );
sewardj8d14a592004-11-21 17:04:50 +0000173
sewardjb5452082004-12-04 20:33:02 +0000174extern ULong x86g_calculate_avg8Ux8 ( ULong, ULong );
175extern ULong x86g_calculate_avg16Ux4 ( ULong, ULong );
176
177extern ULong x86g_calculate_max16Sx4 ( ULong, ULong );
178extern ULong x86g_calculate_max8Ux8 ( ULong, ULong );
179extern ULong x86g_calculate_min16Sx4 ( ULong, ULong );
180extern ULong x86g_calculate_min8Ux8 ( ULong, ULong );
181
sewardj0bd7ce62004-12-05 02:47:40 +0000182extern UInt x86g_calculate_pmovmskb ( ULong xx );
183extern ULong x86g_calculate_psadbw ( ULong, ULong );
184
185extern ULong x86g_calculate_mull16uHIx4 ( ULong, ULong );
sewardjb5452082004-12-04 20:33:02 +0000186
sewardje5854d62004-12-09 03:44:34 +0000187extern UInt x86g_calculate_sse_pmovmskb ( ULong w64hi, ULong w64lo );
sewardj4340dac2004-11-20 13:17:04 +0000188
sewardj8ea867b2004-10-30 19:03:02 +0000189/* --- DIRTY HELPERS --- */
sewardj2a2ba8b2004-11-08 13:14:06 +0000190
sewardj2a9ad022004-11-25 02:46:58 +0000191extern ULong x86g_loadF80le ( UInt );
sewardj2a2ba8b2004-11-08 13:14:06 +0000192
sewardj2a9ad022004-11-25 02:46:58 +0000193extern void x86g_storeF80le ( UInt, ULong );
sewardj2a2ba8b2004-11-08 13:14:06 +0000194
sewardj2a9ad022004-11-25 02:46:58 +0000195extern void x86g_dirtyhelper_CPUID ( VexGuestX86State* );
sewardj8ea867b2004-10-30 19:03:02 +0000196
sewardj9fc9e782004-11-26 17:57:40 +0000197extern void x86g_dirtyhelper_FSAVE ( VexGuestX86State*, HWord );
198
sewardj7df596b2004-12-06 14:29:12 +0000199extern VexEmWarn
200 x86g_dirtyhelper_FRSTOR ( VexGuestX86State*, HWord );
201
202extern void x86g_dirtyhelper_FSTENV ( VexGuestX86State*, HWord );
203
204extern VexEmWarn
205 x86g_dirtyhelper_FLDENV ( VexGuestX86State*, HWord );
sewardj9fc9e782004-11-26 17:57:40 +0000206
sewardj8ea867b2004-10-30 19:03:02 +0000207
208/*---------------------------------------------------------*/
sewardjc9a65702004-07-07 16:32:57 +0000209/*--- Condition code stuff ---*/
210/*---------------------------------------------------------*/
211
212/* eflags masks */
sewardj2a9ad022004-11-25 02:46:58 +0000213#define X86G_CC_SHIFT_O 11
214#define X86G_CC_SHIFT_S 7
215#define X86G_CC_SHIFT_Z 6
216#define X86G_CC_SHIFT_A 4
217#define X86G_CC_SHIFT_C 0
218#define X86G_CC_SHIFT_P 2
sewardj9aebb0c2004-10-24 19:20:43 +0000219
sewardj2a9ad022004-11-25 02:46:58 +0000220#define X86G_CC_MASK_O (1 << X86G_CC_SHIFT_O)
221#define X86G_CC_MASK_S (1 << X86G_CC_SHIFT_S)
222#define X86G_CC_MASK_Z (1 << X86G_CC_SHIFT_Z)
223#define X86G_CC_MASK_A (1 << X86G_CC_SHIFT_A)
224#define X86G_CC_MASK_C (1 << X86G_CC_SHIFT_C)
225#define X86G_CC_MASK_P (1 << X86G_CC_SHIFT_P)
sewardjc9a65702004-07-07 16:32:57 +0000226
sewardjc4be80c2004-09-10 16:17:45 +0000227/* FPU flag masks */
sewardj2a9ad022004-11-25 02:46:58 +0000228#define X86G_FC_MASK_C3 (1 << 14)
229#define X86G_FC_MASK_C2 (1 << 10)
230#define X86G_FC_MASK_C1 (1 << 9)
231#define X86G_FC_MASK_C0 (1 << 8)
sewardjc4be80c2004-09-10 16:17:45 +0000232
sewardj2a2ba8b2004-11-08 13:14:06 +0000233/* %EFLAGS thunk descriptors. A four-word thunk is used to record
234 details of the most recent flag-setting operation, so the flags can
235 be computed later if needed. It is possible to do this a little
236 more efficiently using a 3-word thunk, but that makes it impossible
237 to describe the flag data dependencies sufficiently accurately for
238 Memcheck. Hence 4 words are used, with minimal loss of efficiency.
sewardj948d48b2004-11-05 19:49:09 +0000239
sewardj2a2ba8b2004-11-08 13:14:06 +0000240 The four words are:
sewardj948d48b2004-11-05 19:49:09 +0000241
sewardj2a2ba8b2004-11-08 13:14:06 +0000242 CC_OP, which describes the operation.
243
244 CC_DEP1 and CC_DEP2. These are arguments to the operation.
245 We want Memcheck to believe that the resulting flags are
246 data-dependent on both CC_DEP1 and CC_DEP2, hence the
247 name DEP.
248
249 CC_NDEP. This is a 3rd argument to the operation which is
250 sometimes needed. We arrange things so that Memcheck does
251 not believe the resulting flags are data-dependent on CC_NDEP
252 ("not dependent").
253
254 To make Memcheck believe that (the definedness of) the encoded
255 flags depends only on (the definedness of) CC_DEP1 and CC_DEP2
256 requires two things:
257
258 (1) In the guest state layout info (x86guest_layout), CC_OP and
259 CC_NDEP are marked as always defined.
260
261 (2) When passing the thunk components to an evaluation function
262 (calculate_condition, calculate_eflags, calculate_eflags_c) the
263 IRCallee's mcx_mask must be set so as to exclude from
264 consideration all passed args except CC_DEP1 and CC_DEP2.
265
266 Strictly speaking only (2) is necessary for correctness. However,
267 (1) helps efficiency in that since (2) means we never ask about the
268 definedness of CC_OP or CC_NDEP, we may as well not even bother to
269 track their definedness.
270
271 When building the thunk, it is always necessary to write words into
272 CC_DEP1 and CC_DEP2, even if those args are not used given the
273 CC_OP field (eg, CC_DEP2 is not used if CC_OP is CC_LOGIC1/2/4).
274 This is important because otherwise Memcheck could give false
275 positives as it does not understand the relationship between the
276 CC_OP field and CC_DEP1 and CC_DEP2, and so believes that the
277 definedness of the stored flags always depends on both CC_DEP1 and
278 CC_DEP2.
279
280 However, it is only necessary to set CC_NDEP when the CC_OP value
281 requires it, because Memcheck ignores CC_NDEP, and the evaluation
282 functions do understand the CC_OP fields and will only examine
283 CC_NDEP for suitable values of CC_OP.
284
285 A summary of the field usages is:
286
287 Operation DEP1 DEP2 NDEP
288 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
289
290 add/sub/mul first arg second arg unused
291
292 adc/sbb first arg (second arg)
293 XOR old_carry old_carry
294
295 and/or/xor result zero unused
296
297 inc/dec result zero old_carry
298
299 shl/shr/sar result subshifted- unused
300 result
301
302 rol/ror result zero old_flags
303
304 copy old_flags zero unused.
305
306
307 Therefore Memcheck will believe the following:
308
309 * add/sub/mul -- definedness of result flags depends on definedness
310 of both args.
311
312 * adc/sbb -- definedness of result flags depends on definedness of
313 both args and definedness of the old C flag. Because only two
314 DEP fields are available, the old C flag is XOR'd into the second
315 arg so that Memcheck sees the data dependency on it. That means
316 the NDEP field must contain a second copy of the old C flag
317 so that the evaluation functions can correctly recover the second
318 arg.
319
320 * and/or/xor are straightforward -- definedness of result flags
321 depends on definedness of result value.
322
323 * inc/dec -- definedness of result flags depends only on
324 definedness of result. This isn't really true -- it also depends
325 on the old C flag. However, we don't want Memcheck to see that,
326 and so the old C flag must be passed in NDEP and not in DEP2.
327 It's inconceivable that a compiler would generate code that puts
328 the C flag in an undefined state, then does an inc/dec, which
329 leaves C unchanged, and then makes a conditional jump/move based
330 on C. So our fiction seems a good approximation.
331
332 * shl/shr/sar -- straightforward, again, definedness of result
333 flags depends on definedness of result value. The subshifted
334 value (value shifted one less) is also needed, but its
335 definedness is the same as the definedness of the shifted value.
336
337 * rol/ror -- these only set O and C, and leave A Z C P alone.
338 However it seems prudent (as per inc/dec) to say the definedness
339 of all resulting flags depends on the definedness of the result,
340 hence the old flags must go in as NDEP and not DEP2.
341
342 * rcl/rcr are too difficult to do in-line, and so are done by a
343 helper function. They are not part of this scheme. The helper
344 function takes the value to be rotated, the rotate amount and the
345 old flags, and returns the new flags and the rotated value.
346 Since the helper's mcx_mask does not have any set bits, Memcheck
347 will lazily propagate undefinedness from any of the 3 args into
348 both results (flags and actual value).
sewardj948d48b2004-11-05 19:49:09 +0000349*/
sewardjc9a65702004-07-07 16:32:57 +0000350enum {
sewardj2a9ad022004-11-25 02:46:58 +0000351 X86G_CC_OP_COPY, /* DEP1 = current flags, DEP2 = 0, NDEP = unused */
352 /* just copy DEP1 to output */
sewardjc9a65702004-07-07 16:32:57 +0000353
sewardj2a9ad022004-11-25 02:46:58 +0000354 X86G_CC_OP_ADDB, /* 1 */
355 X86G_CC_OP_ADDW, /* 2 DEP1 = argL, DEP2 = argR, NDEP = unused */
356 X86G_CC_OP_ADDL, /* 3 */
sewardjc9a65702004-07-07 16:32:57 +0000357
sewardj2a9ad022004-11-25 02:46:58 +0000358 X86G_CC_OP_SUBB, /* 4 */
359 X86G_CC_OP_SUBW, /* 5 DEP1 = argL, DEP2 = argR, NDEP = unused */
360 X86G_CC_OP_SUBL, /* 6 */
sewardjc9a65702004-07-07 16:32:57 +0000361
sewardj2a9ad022004-11-25 02:46:58 +0000362 X86G_CC_OP_ADCB, /* 7 */
363 X86G_CC_OP_ADCW, /* 8 DEP1 = argL, DEP2 = argR ^ oldCarry, NDEP = oldCarry */
364 X86G_CC_OP_ADCL, /* 9 */
sewardjc9a65702004-07-07 16:32:57 +0000365
sewardj2a9ad022004-11-25 02:46:58 +0000366 X86G_CC_OP_SBBB, /* 10 */
367 X86G_CC_OP_SBBW, /* 11 DEP1 = argL, DEP2 = argR ^ oldCarry, NDEP = oldCarry */
368 X86G_CC_OP_SBBL, /* 12 */
sewardjc9a65702004-07-07 16:32:57 +0000369
sewardj2a9ad022004-11-25 02:46:58 +0000370 X86G_CC_OP_LOGICB, /* 13 */
371 X86G_CC_OP_LOGICW, /* 14 DEP1 = result, DEP2 = 0, NDEP = unused */
372 X86G_CC_OP_LOGICL, /* 15 */
sewardjc9a65702004-07-07 16:32:57 +0000373
sewardj2a9ad022004-11-25 02:46:58 +0000374 X86G_CC_OP_INCB, /* 16 */
375 X86G_CC_OP_INCW, /* 17 DEP1 = result, DEP2 = 0, NDEP = oldCarry (0 or 1) */
376 X86G_CC_OP_INCL, /* 18 */
sewardjc9a65702004-07-07 16:32:57 +0000377
sewardj2a9ad022004-11-25 02:46:58 +0000378 X86G_CC_OP_DECB, /* 19 */
379 X86G_CC_OP_DECW, /* 20 DEP1 = result, DEP2 = 0, NDEP = oldCarry (0 or 1) */
380 X86G_CC_OP_DECL, /* 21 */
sewardjc9a65702004-07-07 16:32:57 +0000381
sewardj2a9ad022004-11-25 02:46:58 +0000382 X86G_CC_OP_SHLB, /* 22 DEP1 = res, DEP2 = res', NDEP = unused */
383 X86G_CC_OP_SHLW, /* 23 where res' is like res but shifted one bit less */
384 X86G_CC_OP_SHLL, /* 24 */
sewardjc9a65702004-07-07 16:32:57 +0000385
sewardj2a9ad022004-11-25 02:46:58 +0000386 X86G_CC_OP_SHRB, /* 25 DEP1 = res, DEP2 = res', NDEP = unused */
387 X86G_CC_OP_SHRW, /* 26 where res' is like res but shifted one bit less */
388 X86G_CC_OP_SHRL, /* 27 */
sewardjc9a65702004-07-07 16:32:57 +0000389
sewardj2a9ad022004-11-25 02:46:58 +0000390 X86G_CC_OP_ROLB, /* 28 */
391 X86G_CC_OP_ROLW, /* 29 DEP1 = res, DEP2 = 0, NDEP = old flags */
392 X86G_CC_OP_ROLL, /* 30 */
sewardj1813dbe2004-07-28 17:09:04 +0000393
sewardj2a9ad022004-11-25 02:46:58 +0000394 X86G_CC_OP_RORB, /* 31 */
395 X86G_CC_OP_RORW, /* 32 DEP1 = res, DEP2 = 0, NDEP = old flags */
396 X86G_CC_OP_RORL, /* 33 */
sewardj1813dbe2004-07-28 17:09:04 +0000397
sewardj2a9ad022004-11-25 02:46:58 +0000398 X86G_CC_OP_UMULB, /* 34 */
399 X86G_CC_OP_UMULW, /* 35 DEP1 = argL, DEP2 = argR, NDEP = unused */
400 X86G_CC_OP_UMULL, /* 36 */
sewardjcf780b42004-07-13 18:42:17 +0000401
sewardj2a9ad022004-11-25 02:46:58 +0000402 X86G_CC_OP_SMULB, /* 37 */
403 X86G_CC_OP_SMULW, /* 38 DEP1 = argL, DEP2 = argR, NDEP = unused */
404 X86G_CC_OP_SMULL, /* 39 */
sewardjcf780b42004-07-13 18:42:17 +0000405
sewardj2a9ad022004-11-25 02:46:58 +0000406 X86G_CC_OP_NUMBER
sewardjc9a65702004-07-07 16:32:57 +0000407};
408
sewardj84ff0652004-08-23 16:16:08 +0000409typedef
410 enum {
sewardj2a9ad022004-11-25 02:46:58 +0000411 X86CondO = 0, /* overflow */
412 X86CondNO = 1, /* no overflow */
sewardj84ff0652004-08-23 16:16:08 +0000413
sewardj2a9ad022004-11-25 02:46:58 +0000414 X86CondB = 2, /* below */
415 X86CondNB = 3, /* not below */
sewardj84ff0652004-08-23 16:16:08 +0000416
sewardj2a9ad022004-11-25 02:46:58 +0000417 X86CondZ = 4, /* zero */
418 X86CondNZ = 5, /* not zero */
sewardj84ff0652004-08-23 16:16:08 +0000419
sewardj2a9ad022004-11-25 02:46:58 +0000420 X86CondBE = 6, /* below or equal */
421 X86CondNBE = 7, /* not below or equal */
sewardj84ff0652004-08-23 16:16:08 +0000422
sewardj2a9ad022004-11-25 02:46:58 +0000423 X86CondS = 8, /* negative */
424 X86CondNS = 9, /* not negative */
sewardj84ff0652004-08-23 16:16:08 +0000425
sewardj2a9ad022004-11-25 02:46:58 +0000426 X86CondP = 10, /* parity even */
427 X86CondNP = 11, /* not parity even */
sewardj84ff0652004-08-23 16:16:08 +0000428
sewardj2a9ad022004-11-25 02:46:58 +0000429 X86CondL = 12, /* jump less */
430 X86CondNL = 13, /* not less */
sewardj84ff0652004-08-23 16:16:08 +0000431
sewardj2a9ad022004-11-25 02:46:58 +0000432 X86CondLE = 14, /* less or equal */
433 X86CondNLE = 15, /* not less or equal */
sewardj84ff0652004-08-23 16:16:08 +0000434
sewardj2a9ad022004-11-25 02:46:58 +0000435 X86CondAlways = 16 /* HACK */
sewardj84ff0652004-08-23 16:16:08 +0000436 }
sewardj2a9ad022004-11-25 02:46:58 +0000437 X86Condcode;
sewardj84ff0652004-08-23 16:16:08 +0000438
sewardj2a9ad022004-11-25 02:46:58 +0000439#endif /* ndef __LIBVEX_GUEST_X86_DEFS_H */
sewardjc9a65702004-07-07 16:32:57 +0000440
441/*---------------------------------------------------------------*/
sewardj2a9ad022004-11-25 02:46:58 +0000442/*--- end guest-x86/gdefs.h ---*/
sewardjc9a65702004-07-07 16:32:57 +0000443/*---------------------------------------------------------------*/