VirtualBox

source: vbox/trunk/src/VBox/VMM/include/IEMInternal.h@ 40093

Last change on this file since 40093 was 40093, checked in by vboxsync, 13 years ago

IEM: fld m64i

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 40.7 KB
Line 
1/* $Id: IEMInternal.h 40093 2012-02-13 13:05:21Z vboxsync $ */
2/** @file
3 * IEM - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2011 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___IEMInternal_h
19#define ___IEMInternal_h
20
21#include <VBox/vmm/stam.h>
22#include <VBox/vmm/cpum.h>
23#include <VBox/param.h>
24
25
26RT_C_DECLS_BEGIN
27
28
29/** @defgroup grp_iem_int Internals
30 * @ingroup grp_iem
31 * @internal
32 * @{
33 */
34
35
36/** Finish and move to types.h */
37typedef union
38{
39 uint32_t u32;
40} RTFLOAT32U;
41typedef RTFLOAT32U *PRTFLOAT32U;
42typedef RTFLOAT32U const *PCRTFLOAT32U;
43
44
45/**
46 * Operand or addressing mode.
47 */
48typedef enum IEMMODE
49{
50 IEMMODE_16BIT = 0,
51 IEMMODE_32BIT,
52 IEMMODE_64BIT
53} IEMMODE;
54AssertCompileSize(IEMMODE, 4);
55
56/**
57 * Extended operand mode that includes a representation of 8-bit.
58 *
59 * This is used for packing down modes when invoking some C instruction
60 * implementations.
61 */
62typedef enum IEMMODEX
63{
64 IEMMODEX_16BIT = IEMMODE_16BIT,
65 IEMMODEX_32BIT = IEMMODE_32BIT,
66 IEMMODEX_64BIT = IEMMODE_64BIT,
67 IEMMODEX_8BIT
68} IEMMODEX;
69AssertCompileSize(IEMMODEX, 4);
70
71
72/**
73 * A FPU result.
74 */
75typedef struct IEMFPURESULT
76{
77 /** The output value. */
78 RTFLOAT80U r80Result;
79 /** The output status. */
80 uint16_t FSW;
81} IEMFPURESULT;
82AssertCompileMemberOffset(IEMFPURESULT, FSW, 10);
83/** Pointer to a FPU result. */
84typedef IEMFPURESULT *PIEMFPURESULT;
85/** Pointer to a const FPU result. */
86typedef IEMFPURESULT const *PCIEMFPURESULT;
87
88
89#ifdef IEM_VERIFICATION_MODE
90
91/**
92 * Verification event type.
93 */
94typedef enum IEMVERIFYEVENT
95{
96 IEMVERIFYEVENT_INVALID = 0,
97 IEMVERIFYEVENT_IOPORT_READ,
98 IEMVERIFYEVENT_IOPORT_WRITE,
99 IEMVERIFYEVENT_RAM_WRITE,
100 IEMVERIFYEVENT_RAM_READ
101} IEMVERIFYEVENT;
102
103/** Checks if the event type is a RAM read or write. */
104# define IEMVERIFYEVENT_IS_RAM(a_enmType) ((a_enmType) == IEMVERIFYEVENT_RAM_WRITE || (a_enmType) == IEMVERIFYEVENT_RAM_READ)
105
106/**
107 * Verification event record.
108 */
109typedef struct IEMVERIFYEVTREC
110{
111 /** Pointer to the next record in the list. */
112 struct IEMVERIFYEVTREC *pNext;
113 /** The event type. */
114 IEMVERIFYEVENT enmEvent;
115 /** The event data. */
116 union
117 {
118 /** IEMVERIFYEVENT_IOPORT_READ */
119 struct
120 {
121 RTIOPORT Port;
122 uint32_t cbValue;
123 } IOPortRead;
124
125 /** IEMVERIFYEVENT_IOPORT_WRITE */
126 struct
127 {
128 RTIOPORT Port;
129 uint32_t cbValue;
130 uint32_t u32Value;
131 } IOPortWrite;
132
133 /** IEMVERIFYEVENT_RAM_READ */
134 struct
135 {
136 RTGCPHYS GCPhys;
137 uint32_t cb;
138 } RamRead;
139
140 /** IEMVERIFYEVENT_RAM_WRITE */
141 struct
142 {
143 RTGCPHYS GCPhys;
144 uint32_t cb;
145 uint8_t ab[32];
146 } RamWrite;
147 } u;
148} IEMVERIFYEVTREC;
149/** Pointer to an IEM event verification records. */
150typedef IEMVERIFYEVTREC *PIEMVERIFYEVTREC;
151
152#endif /* IEM_VERIFICATION_MODE */
153
154
155/**
156 * The per-CPU IEM state.
157 */
158typedef struct IEMCPU
159{
160 /** Pointer to the CPU context - ring-3 contex. */
161 R3PTRTYPE(PCPUMCTX) pCtxR3;
162 /** Pointer to the CPU context - ring-0 contex. */
163 R0PTRTYPE(PCPUMCTX) pCtxR0;
164 /** Pointer to the CPU context - raw-mode contex. */
165 RCPTRTYPE(PCPUMCTX) pCtxRC;
166
167 /** Offset of the VMCPU structure relative to this structure (negative). */
168 int32_t offVMCpu;
169 /** Offset of the VM structure relative to this structure (negative). */
170 int32_t offVM;
171
172 /** Whether to bypass access handlers or not. */
173 bool fByPassHandlers;
174 /** Explicit alignment padding. */
175 bool afAlignment0[3];
176
177 /** The flags of the current exception / interrupt. */
178 uint32_t fCurXcpt;
179 /** The current exception / interrupt. */
180 uint8_t uCurXcpt;
181 /** Exception / interrupt recursion depth. */
182 int8_t cXcptRecursions;
183 /** Explicit alignment padding. */
184 bool afAlignment1[5];
185 /** The CPL. */
186 uint8_t uCpl;
187 /** The current CPU execution mode (CS). */
188 IEMMODE enmCpuMode;
189
190 /** @name Statistics
191 * @{ */
192 /** The number of instructions we've executed. */
193 uint32_t cInstructions;
194 /** The number of potential exits. */
195 uint32_t cPotentialExits;
196#ifdef IEM_VERIFICATION_MODE
197 /** The Number of I/O port reads that has been performed. */
198 uint32_t cIOReads;
199 /** The Number of I/O port writes that has been performed. */
200 uint32_t cIOWrites;
201 /** Set if no comparison to REM is currently performed.
202 * This is used to skip past really slow bits. */
203 bool fNoRem;
204 /** Indicates that RAX and RDX differences should be ignored since RDTSC
205 * and RDTSCP are timing sensitive. */
206 bool fIgnoreRaxRdx;
207 bool afAlignment2[2];
208 /** Mask of undefined eflags.
209 * The verifier will any difference in these flags. */
210 uint32_t fUndefinedEFlags;
211 /** The physical address corresponding to abOpcodes[0]. */
212 RTGCPHYS GCPhysOpcodes;
213#endif
214 /** @} */
215
216 /** @name Decoder state.
217 * @{ */
218
219 /** The default addressing mode . */
220 IEMMODE enmDefAddrMode;
221 /** The effective addressing mode . */
222 IEMMODE enmEffAddrMode;
223 /** The default operand mode . */
224 IEMMODE enmDefOpSize;
225 /** The effective operand mode . */
226 IEMMODE enmEffOpSize;
227
228 /** The prefix mask (IEM_OP_PRF_XXX). */
229 uint32_t fPrefixes;
230 /** The extra REX ModR/M register field bit (REX.R << 3). */
231 uint8_t uRexReg;
232 /** The extra REX ModR/M r/m field, SIB base and opcode reg bit
233 * (REX.B << 3). */
234 uint8_t uRexB;
235 /** The extra REX SIB index field bit (REX.X << 3). */
236 uint8_t uRexIndex;
237 /** The effective segment register (X86_SREG_XXX). */
238 uint8_t iEffSeg;
239
240 /** The current offset into abOpcodes. */
241 uint8_t offOpcode;
242 /** The size of what has currently been fetched into abOpcodes. */
243 uint8_t cbOpcode;
244 /** The opcode bytes. */
245 uint8_t abOpcode[15];
246 /** Offset into abOpcodes where the FPU instruction starts.
247 * Only set by the FPU escape opcodes (0xd8-0xdf) and used later on when the
248 * instruction result is committed. */
249 uint8_t offFpuOpcode;
250
251 /** @}*/
252
253 /** Alignment padding for aMemMappings. */
254 uint8_t abAlignment2[4];
255
256 /** The number of active guest memory mappings. */
257 uint8_t cActiveMappings;
258 /** The next unused mapping index. */
259 uint8_t iNextMapping;
260 /** Records for tracking guest memory mappings. */
261 struct
262 {
263 /** The address of the mapped bytes. */
264 void *pv;
265#if defined(IN_RC) && HC_ARCH_BITS == 64
266 uint32_t u32Alignment3; /**< Alignment padding. */
267#endif
268 /** The access flags (IEM_ACCESS_XXX).
269 * IEM_ACCESS_INVALID if the entry is unused. */
270 uint32_t fAccess;
271#if HC_ARCH_BITS == 64
272 uint32_t u32Alignment4; /**< Alignment padding. */
273#endif
274 } aMemMappings[3];
275
276 /** Bounce buffer info.
277 * This runs in parallel to aMemMappings. */
278 struct
279 {
280 /** The physical address of the first byte. */
281 RTGCPHYS GCPhysFirst;
282 /** The physical address of the second page. */
283 RTGCPHYS GCPhysSecond;
284 /** The number of bytes in the first page. */
285 uint16_t cbFirst;
286 /** The number of bytes in the second page. */
287 uint16_t cbSecond;
288 /** Whether it's unassigned memory. */
289 bool fUnassigned;
290 /** Explicit alignment padding. */
291 bool afAlignment5[3];
292 } aMemBbMappings[3];
293
294 /** Bounce buffer storage.
295 * This runs in parallel to aMemMappings and aMemBbMappings. */
296 struct
297 {
298 uint8_t ab[512];
299 } aBounceBuffers[3];
300
301#ifdef IEM_VERIFICATION_MODE
302 /** The event verification records for what IEM did (LIFO). */
303 R3PTRTYPE(PIEMVERIFYEVTREC) pIemEvtRecHead;
304 /** Insertion point for pIemEvtRecHead. */
305 R3PTRTYPE(PIEMVERIFYEVTREC *) ppIemEvtRecNext;
306 /** The event verification records for what the other party did (FIFO). */
307 R3PTRTYPE(PIEMVERIFYEVTREC) pOtherEvtRecHead;
308 /** Insertion point for pOtherEvtRecHead. */
309 R3PTRTYPE(PIEMVERIFYEVTREC *) ppOtherEvtRecNext;
310 /** List of free event records. */
311 R3PTRTYPE(PIEMVERIFYEVTREC) pFreeEvtRec;
312#endif
313} IEMCPU;
314/** Pointer to the per-CPU IEM state. */
315typedef IEMCPU *PIEMCPU;
316
317/** Converts a IEMCPU pointer to a VMCPU pointer.
318 * @returns VMCPU pointer.
319 * @param a_pIemCpu The IEM per CPU instance data.
320 */
321#define IEMCPU_TO_VMCPU(a_pIemCpu) ((PVMCPU)( (uintptr_t)(a_pIemCpu) + a_pIemCpu->offVMCpu ))
322
323/** Converts a IEMCPU pointer to a VM pointer.
324 * @returns VM pointer.
325 * @param a_pIemCpu The IEM per CPU instance data.
326 */
327#define IEMCPU_TO_VM(a_pIemCpu) ((PVM)( (uintptr_t)(a_pIemCpu) + a_pIemCpu->offVM ))
328
329/** @name IEM_ACCESS_XXX - Access details.
330 * @{ */
331#define IEM_ACCESS_INVALID UINT32_C(0x000000ff)
332#define IEM_ACCESS_TYPE_READ UINT32_C(0x00000001)
333#define IEM_ACCESS_TYPE_WRITE UINT32_C(0x00000002)
334#define IEM_ACCESS_TYPE_EXEC UINT32_C(0x00000004)
335#define IEM_ACCESS_TYPE_MASK UINT32_C(0x00000007)
336#define IEM_ACCESS_WHAT_CODE UINT32_C(0x00000010)
337#define IEM_ACCESS_WHAT_DATA UINT32_C(0x00000020)
338#define IEM_ACCESS_WHAT_STACK UINT32_C(0x00000030)
339#define IEM_ACCESS_WHAT_SYS UINT32_C(0x00000040)
340#define IEM_ACCESS_WHAT_MASK UINT32_C(0x00000070)
341/** Used in aMemMappings to indicate that the entry is bounce buffered. */
342#define IEM_ACCESS_BOUNCE_BUFFERED UINT32_C(0x00000100)
343/** Read+write data alias. */
344#define IEM_ACCESS_DATA_RW (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_DATA)
345/** Write data alias. */
346#define IEM_ACCESS_DATA_W (IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_DATA)
347/** Read data alias. */
348#define IEM_ACCESS_DATA_R (IEM_ACCESS_TYPE_READ | IEM_ACCESS_WHAT_DATA)
349/** Instruction fetch alias. */
350#define IEM_ACCESS_INSTRUCTION (IEM_ACCESS_TYPE_EXEC | IEM_ACCESS_WHAT_CODE)
351/** Stack write alias. */
352#define IEM_ACCESS_STACK_W (IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_STACK)
353/** Stack read alias. */
354#define IEM_ACCESS_STACK_R (IEM_ACCESS_TYPE_READ | IEM_ACCESS_WHAT_STACK)
355/** Stack read+write alias. */
356#define IEM_ACCESS_STACK_RW (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_STACK)
357/** Read system table alias. */
358#define IEM_ACCESS_SYS_R (IEM_ACCESS_TYPE_READ | IEM_ACCESS_WHAT_SYS)
359/** Read+write system table alias. */
360#define IEM_ACCESS_SYS_RW (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_SYS)
361/** @} */
362
363/** @name Prefix constants (IEMCPU::fPrefixes)
364 * @{ */
365#define IEM_OP_PRF_SEG_CS RT_BIT_32(0) /**< CS segment prefix (0x2e). */
366#define IEM_OP_PRF_SEG_SS RT_BIT_32(1) /**< SS segment prefix (0x36). */
367#define IEM_OP_PRF_SEG_DS RT_BIT_32(2) /**< DS segment prefix (0x3e). */
368#define IEM_OP_PRF_SEG_ES RT_BIT_32(3) /**< ES segment prefix (0x26). */
369#define IEM_OP_PRF_SEG_FS RT_BIT_32(4) /**< FS segment prefix (0x64). */
370#define IEM_OP_PRF_SEG_GS RT_BIT_32(5) /**< GS segment prefix (0x65). */
371#define IEM_OP_PRF_SEG_MASK UINT32_C(0x3f)
372
373#define IEM_OP_PRF_SIZE_OP RT_BIT_32(8) /**< Operand size prefix (0x66). */
374#define IEM_OP_PRF_SIZE_REX_W RT_BIT_32(9) /**< REX.W prefix (0x48-0x4f). */
375#define IEM_OP_PRF_SIZE_ADDR RT_BIT_32(10) /**< Address size prefix (0x67). */
376
377#define IEM_OP_PRF_LOCK RT_BIT_32(16) /**< Lock prefix (0xf0). */
378#define IEM_OP_PRF_REPNZ RT_BIT_32(17) /**< Repeat-not-zero prefix (0xf2). */
379#define IEM_OP_PRF_REPZ RT_BIT_32(18) /**< Repeat-if-zero prefix (0xf3). */
380
381#define IEM_OP_PRF_REX RT_BIT_32(24) /**< Any REX prefix (0x40-0x4f). */
382#define IEM_OP_PRF_REX_R RT_BIT_32(25) /**< REX.R prefix (0x44,0x45,0x46,0x47,0x4c,0x4d,0x4e,0x4f). */
383#define IEM_OP_PRF_REX_B RT_BIT_32(26) /**< REX.B prefix (0x41,0x43,0x45,0x47,0x49,0x4b,0x4d,0x4f). */
384#define IEM_OP_PRF_REX_X RT_BIT_32(27) /**< REX.X prefix (0x42,0x43,0x46,0x47,0x4a,0x4b,0x4e,0x4f). */
385/** @} */
386
387/**
388 * Tests if verification mode is enabled.
389 *
390 * This expands to @c false when IEM_VERIFICATION_MODE is not defined and
391 * should therefore cause the compiler to eliminate the verification branch
392 * of an if statement. */
393#ifdef IEM_VERIFICATION_MODE
394# define IEM_VERIFICATION_ENABLED(a_pIemCpu) (!(a_pIemCpu)->fNoRem)
395#else
396# define IEM_VERIFICATION_ENABLED(a_pIemCpu) (false)
397#endif
398
399/**
400 * Indicates to the verifier that the given flag set is undefined.
401 *
402 * Can be invoked again to add more flags.
403 *
404 * This is a NOOP if the verifier isn't compiled in.
405 */
406#ifdef IEM_VERIFICATION_MODE
407# define IEMOP_VERIFICATION_UNDEFINED_EFLAGS(a_fEfl) do { pIemCpu->fUndefinedEFlags |= (a_fEfl); } while (0)
408#else
409# define IEMOP_VERIFICATION_UNDEFINED_EFLAGS(a_fEfl) do { } while (0)
410#endif
411
412
413/** @def IEM_DECL_IMPL_TYPE
414 * For typedef'ing an instruction implementation function.
415 *
416 * @param a_RetType The return type.
417 * @param a_Name The name of the type.
418 * @param a_ArgList The argument list enclosed in parentheses.
419 */
420
421/** @def IEM_DECL_IMPL_DEF
422 * For defining an instruction implementation function.
423 *
424 * @param a_RetType The return type.
425 * @param a_Name The name of the type.
426 * @param a_ArgList The argument list enclosed in parentheses.
427 */
428
429#if defined(__GNUC__) && defined(RT_ARCH_X86)
430# define IEM_DECL_IMPL_TYPE(a_RetType, a_Name, a_ArgList) \
431 __attribute__((__fastcall__)) a_RetType (a_Name) a_ArgList
432# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
433 __attribute__((__fastcall__, __nothrow__)) a_RetType a_Name a_ArgList
434
435#elif defined(_MSC_VER) && defined(RT_ARCH_X86)
436# define IEM_DECL_IMPL_TYPE(a_RetType, a_Name, a_ArgList) \
437 a_RetType (__fastcall a_Name) a_ArgList
438# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
439 a_RetType __fastcall a_Name a_ArgList
440
441#else
442# define IEM_DECL_IMPL_TYPE(a_RetType, a_Name, a_ArgList) \
443 a_RetType (VBOXCALL a_Name) a_ArgList
444# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
445 a_RetType VBOXCALL a_Name a_ArgList
446
447#endif
448
449/** @name Arithmetic assignment operations on bytes (binary).
450 * @{ */
451typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU8, (uint8_t *pu8Dst, uint8_t u8Src, uint32_t *pEFlags));
452typedef FNIEMAIMPLBINU8 *PFNIEMAIMPLBINU8;
453FNIEMAIMPLBINU8 iemAImpl_add_u8, iemAImpl_add_u8_locked;
454FNIEMAIMPLBINU8 iemAImpl_adc_u8, iemAImpl_adc_u8_locked;
455FNIEMAIMPLBINU8 iemAImpl_sub_u8, iemAImpl_sub_u8_locked;
456FNIEMAIMPLBINU8 iemAImpl_sbb_u8, iemAImpl_sbb_u8_locked;
457FNIEMAIMPLBINU8 iemAImpl_or_u8, iemAImpl_or_u8_locked;
458FNIEMAIMPLBINU8 iemAImpl_xor_u8, iemAImpl_xor_u8_locked;
459FNIEMAIMPLBINU8 iemAImpl_and_u8, iemAImpl_and_u8_locked;
460/** @} */
461
462/** @name Arithmetic assignment operations on words (binary).
463 * @{ */
464typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU16, (uint16_t *pu16Dst, uint16_t u16Src, uint32_t *pEFlags));
465typedef FNIEMAIMPLBINU16 *PFNIEMAIMPLBINU16;
466FNIEMAIMPLBINU16 iemAImpl_add_u16, iemAImpl_add_u16_locked;
467FNIEMAIMPLBINU16 iemAImpl_adc_u16, iemAImpl_adc_u16_locked;
468FNIEMAIMPLBINU16 iemAImpl_sub_u16, iemAImpl_sub_u16_locked;
469FNIEMAIMPLBINU16 iemAImpl_sbb_u16, iemAImpl_sbb_u16_locked;
470FNIEMAIMPLBINU16 iemAImpl_or_u16, iemAImpl_or_u16_locked;
471FNIEMAIMPLBINU16 iemAImpl_xor_u16, iemAImpl_xor_u16_locked;
472FNIEMAIMPLBINU16 iemAImpl_and_u16, iemAImpl_and_u16_locked;
473/** @} */
474
475/** @name Arithmetic assignment operations on double words (binary).
476 * @{ */
477typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU32, (uint32_t *pu32Dst, uint32_t u32Src, uint32_t *pEFlags));
478typedef FNIEMAIMPLBINU32 *PFNIEMAIMPLBINU32;
479FNIEMAIMPLBINU32 iemAImpl_add_u32, iemAImpl_add_u32_locked;
480FNIEMAIMPLBINU32 iemAImpl_adc_u32, iemAImpl_adc_u32_locked;
481FNIEMAIMPLBINU32 iemAImpl_sub_u32, iemAImpl_sub_u32_locked;
482FNIEMAIMPLBINU32 iemAImpl_sbb_u32, iemAImpl_sbb_u32_locked;
483FNIEMAIMPLBINU32 iemAImpl_or_u32, iemAImpl_or_u32_locked;
484FNIEMAIMPLBINU32 iemAImpl_xor_u32, iemAImpl_xor_u32_locked;
485FNIEMAIMPLBINU32 iemAImpl_and_u32, iemAImpl_and_u32_locked;
486/** @} */
487
488/** @name Arithmetic assignment operations on quad words (binary).
489 * @{ */
490typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU64, (uint64_t *pu64Dst, uint64_t u64Src, uint32_t *pEFlags));
491typedef FNIEMAIMPLBINU64 *PFNIEMAIMPLBINU64;
492FNIEMAIMPLBINU64 iemAImpl_add_u64, iemAImpl_add_u64_locked;
493FNIEMAIMPLBINU64 iemAImpl_adc_u64, iemAImpl_adc_u64_locked;
494FNIEMAIMPLBINU64 iemAImpl_sub_u64, iemAImpl_sub_u64_locked;
495FNIEMAIMPLBINU64 iemAImpl_sbb_u64, iemAImpl_sbb_u64_locked;
496FNIEMAIMPLBINU64 iemAImpl_or_u64, iemAImpl_or_u64_locked;
497FNIEMAIMPLBINU64 iemAImpl_xor_u64, iemAImpl_xor_u64_locked;
498FNIEMAIMPLBINU64 iemAImpl_and_u64, iemAImpl_and_u64_locked;
499/** @} */
500
501/** @name Compare operations (thrown in with the binary ops).
502 * @{ */
503FNIEMAIMPLBINU8 iemAImpl_cmp_u8;
504FNIEMAIMPLBINU16 iemAImpl_cmp_u16;
505FNIEMAIMPLBINU32 iemAImpl_cmp_u32;
506FNIEMAIMPLBINU64 iemAImpl_cmp_u64;
507/** @} */
508
509/** @name Test operations (thrown in with the binary ops).
510 * @{ */
511FNIEMAIMPLBINU8 iemAImpl_test_u8;
512FNIEMAIMPLBINU16 iemAImpl_test_u16;
513FNIEMAIMPLBINU32 iemAImpl_test_u32;
514FNIEMAIMPLBINU64 iemAImpl_test_u64;
515/** @} */
516
517/** @name Bit operations operations (thrown in with the binary ops).
518 * @{ */
519FNIEMAIMPLBINU16 iemAImpl_bt_u16, iemAImpl_bt_u16_locked;
520FNIEMAIMPLBINU32 iemAImpl_bt_u32, iemAImpl_bt_u32_locked;
521FNIEMAIMPLBINU64 iemAImpl_bt_u64, iemAImpl_bt_u64_locked;
522FNIEMAIMPLBINU16 iemAImpl_btc_u16, iemAImpl_btc_u16_locked;
523FNIEMAIMPLBINU32 iemAImpl_btc_u32, iemAImpl_btc_u32_locked;
524FNIEMAIMPLBINU64 iemAImpl_btc_u64, iemAImpl_btc_u64_locked;
525FNIEMAIMPLBINU16 iemAImpl_btr_u16, iemAImpl_btr_u16_locked;
526FNIEMAIMPLBINU32 iemAImpl_btr_u32, iemAImpl_btr_u32_locked;
527FNIEMAIMPLBINU64 iemAImpl_btr_u64, iemAImpl_btr_u64_locked;
528FNIEMAIMPLBINU16 iemAImpl_bts_u16, iemAImpl_bts_u16_locked;
529FNIEMAIMPLBINU32 iemAImpl_bts_u32, iemAImpl_bts_u32_locked;
530FNIEMAIMPLBINU64 iemAImpl_bts_u64, iemAImpl_bts_u64_locked;
531/** @} */
532
533/** @name Exchange memory with register operations.
534 * @{ */
535IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u8, (uint8_t *pu8Mem, uint8_t *pu8Reg));
536IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u16,(uint16_t *pu16Mem, uint16_t *pu16Reg));
537IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u32,(uint32_t *pu32Mem, uint32_t *pu32Reg));
538IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u64,(uint64_t *pu64Mem, uint64_t *pu64Reg));
539/** @} */
540
541/** @name Exchange and add operations.
542 * @{ */
543IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u8, (uint8_t *pu8Dst, uint8_t *pu8Reg, uint32_t *pEFlags));
544IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u16,(uint16_t *pu16Dst, uint16_t *pu16Reg, uint32_t *pEFlags));
545IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u32,(uint32_t *pu32Dst, uint32_t *pu32Reg, uint32_t *pEFlags));
546IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u64,(uint64_t *pu64Dst, uint64_t *pu64Reg, uint32_t *pEFlags));
547IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u8_locked, (uint8_t *pu8Dst, uint8_t *pu8Reg, uint32_t *pEFlags));
548IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u16_locked,(uint16_t *pu16Dst, uint16_t *pu16Reg, uint32_t *pEFlags));
549IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u32_locked,(uint32_t *pu32Dst, uint32_t *pu32Reg, uint32_t *pEFlags));
550IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u64_locked,(uint64_t *pu64Dst, uint64_t *pu64Reg, uint32_t *pEFlags));
551/** @} */
552
553/** @name Double precision shifts
554 * @{ */
555typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTDBLU16,(uint16_t *pu16Dst, uint16_t u16Src, uint8_t cShift, uint32_t *pEFlags));
556typedef FNIEMAIMPLSHIFTDBLU16 *PFNIEMAIMPLSHIFTDBLU16;
557typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTDBLU32,(uint32_t *pu32Dst, uint32_t u32Src, uint8_t cShift, uint32_t *pEFlags));
558typedef FNIEMAIMPLSHIFTDBLU32 *PFNIEMAIMPLSHIFTDBLU32;
559typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTDBLU64,(uint64_t *pu64Dst, uint64_t u64Src, uint8_t cShift, uint32_t *pEFlags));
560typedef FNIEMAIMPLSHIFTDBLU64 *PFNIEMAIMPLSHIFTDBLU64;
561FNIEMAIMPLSHIFTDBLU16 iemAImpl_shld_u16;
562FNIEMAIMPLSHIFTDBLU32 iemAImpl_shld_u32;
563FNIEMAIMPLSHIFTDBLU64 iemAImpl_shld_u64;
564FNIEMAIMPLSHIFTDBLU16 iemAImpl_shrd_u16;
565FNIEMAIMPLSHIFTDBLU32 iemAImpl_shrd_u32;
566FNIEMAIMPLSHIFTDBLU64 iemAImpl_shrd_u64;
567/** @} */
568
569
570/** @name Bit search operations (thrown in with the binary ops).
571 * @{ */
572FNIEMAIMPLBINU16 iemAImpl_bsf_u16;
573FNIEMAIMPLBINU32 iemAImpl_bsf_u32;
574FNIEMAIMPLBINU64 iemAImpl_bsf_u64;
575FNIEMAIMPLBINU16 iemAImpl_bsr_u16;
576FNIEMAIMPLBINU32 iemAImpl_bsr_u32;
577FNIEMAIMPLBINU64 iemAImpl_bsr_u64;
578/** @} */
579
580/** @name Signed multiplication operations (thrown in with the binary ops).
581 * @{ */
582FNIEMAIMPLBINU16 iemAImpl_imul_two_u16;
583FNIEMAIMPLBINU32 iemAImpl_imul_two_u32;
584FNIEMAIMPLBINU64 iemAImpl_imul_two_u64;
585/** @} */
586
587/** @name Arithmetic assignment operations on bytes (unary).
588 * @{ */
589typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU8, (uint8_t *pu8Dst, uint32_t *pEFlags));
590typedef FNIEMAIMPLUNARYU8 *PFNIEMAIMPLUNARYU8;
591FNIEMAIMPLUNARYU8 iemAImpl_inc_u8, iemAImpl_inc_u8_locked;
592FNIEMAIMPLUNARYU8 iemAImpl_dec_u8, iemAImpl_dec_u8_locked;
593FNIEMAIMPLUNARYU8 iemAImpl_not_u8, iemAImpl_not_u8_locked;
594FNIEMAIMPLUNARYU8 iemAImpl_neg_u8, iemAImpl_neg_u8_locked;
595/** @} */
596
597/** @name Arithmetic assignment operations on words (unary).
598 * @{ */
599typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU16, (uint16_t *pu16Dst, uint32_t *pEFlags));
600typedef FNIEMAIMPLUNARYU16 *PFNIEMAIMPLUNARYU16;
601FNIEMAIMPLUNARYU16 iemAImpl_inc_u16, iemAImpl_inc_u16_locked;
602FNIEMAIMPLUNARYU16 iemAImpl_dec_u16, iemAImpl_dec_u16_locked;
603FNIEMAIMPLUNARYU16 iemAImpl_not_u16, iemAImpl_not_u16_locked;
604FNIEMAIMPLUNARYU16 iemAImpl_neg_u16, iemAImpl_neg_u16_locked;
605/** @} */
606
607/** @name Arithmetic assignment operations on double words (unary).
608 * @{ */
609typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU32, (uint32_t *pu32Dst, uint32_t *pEFlags));
610typedef FNIEMAIMPLUNARYU32 *PFNIEMAIMPLUNARYU32;
611FNIEMAIMPLUNARYU32 iemAImpl_inc_u32, iemAImpl_inc_u32_locked;
612FNIEMAIMPLUNARYU32 iemAImpl_dec_u32, iemAImpl_dec_u32_locked;
613FNIEMAIMPLUNARYU32 iemAImpl_not_u32, iemAImpl_not_u32_locked;
614FNIEMAIMPLUNARYU32 iemAImpl_neg_u32, iemAImpl_neg_u32_locked;
615/** @} */
616
617/** @name Arithmetic assignment operations on quad words (unary).
618 * @{ */
619typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU64, (uint64_t *pu64Dst, uint32_t *pEFlags));
620typedef FNIEMAIMPLUNARYU64 *PFNIEMAIMPLUNARYU64;
621FNIEMAIMPLUNARYU64 iemAImpl_inc_u64, iemAImpl_inc_u64_locked;
622FNIEMAIMPLUNARYU64 iemAImpl_dec_u64, iemAImpl_dec_u64_locked;
623FNIEMAIMPLUNARYU64 iemAImpl_not_u64, iemAImpl_not_u64_locked;
624FNIEMAIMPLUNARYU64 iemAImpl_neg_u64, iemAImpl_neg_u64_locked;
625/** @} */
626
627
628/** @name Shift operations on bytes (Group 2).
629 * @{ */
630typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU8,(uint8_t *pu8Dst, uint8_t cShift, uint32_t *pEFlags));
631typedef FNIEMAIMPLSHIFTU8 *PFNIEMAIMPLSHIFTU8;
632FNIEMAIMPLSHIFTU8 iemAImpl_rol_u8;
633FNIEMAIMPLSHIFTU8 iemAImpl_ror_u8;
634FNIEMAIMPLSHIFTU8 iemAImpl_rcl_u8;
635FNIEMAIMPLSHIFTU8 iemAImpl_rcr_u8;
636FNIEMAIMPLSHIFTU8 iemAImpl_shl_u8;
637FNIEMAIMPLSHIFTU8 iemAImpl_shr_u8;
638FNIEMAIMPLSHIFTU8 iemAImpl_sar_u8;
639/** @} */
640
641/** @name Shift operations on words (Group 2).
642 * @{ */
643typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU16,(uint16_t *pu16Dst, uint8_t cShift, uint32_t *pEFlags));
644typedef FNIEMAIMPLSHIFTU16 *PFNIEMAIMPLSHIFTU16;
645FNIEMAIMPLSHIFTU16 iemAImpl_rol_u16;
646FNIEMAIMPLSHIFTU16 iemAImpl_ror_u16;
647FNIEMAIMPLSHIFTU16 iemAImpl_rcl_u16;
648FNIEMAIMPLSHIFTU16 iemAImpl_rcr_u16;
649FNIEMAIMPLSHIFTU16 iemAImpl_shl_u16;
650FNIEMAIMPLSHIFTU16 iemAImpl_shr_u16;
651FNIEMAIMPLSHIFTU16 iemAImpl_sar_u16;
652/** @} */
653
654/** @name Shift operations on double words (Group 2).
655 * @{ */
656typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU32,(uint32_t *pu32Dst, uint8_t cShift, uint32_t *pEFlags));
657typedef FNIEMAIMPLSHIFTU32 *PFNIEMAIMPLSHIFTU32;
658FNIEMAIMPLSHIFTU32 iemAImpl_rol_u32;
659FNIEMAIMPLSHIFTU32 iemAImpl_ror_u32;
660FNIEMAIMPLSHIFTU32 iemAImpl_rcl_u32;
661FNIEMAIMPLSHIFTU32 iemAImpl_rcr_u32;
662FNIEMAIMPLSHIFTU32 iemAImpl_shl_u32;
663FNIEMAIMPLSHIFTU32 iemAImpl_shr_u32;
664FNIEMAIMPLSHIFTU32 iemAImpl_sar_u32;
665/** @} */
666
667/** @name Shift operations on words (Group 2).
668 * @{ */
669typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU64,(uint64_t *pu64Dst, uint8_t cShift, uint32_t *pEFlags));
670typedef FNIEMAIMPLSHIFTU64 *PFNIEMAIMPLSHIFTU64;
671FNIEMAIMPLSHIFTU64 iemAImpl_rol_u64;
672FNIEMAIMPLSHIFTU64 iemAImpl_ror_u64;
673FNIEMAIMPLSHIFTU64 iemAImpl_rcl_u64;
674FNIEMAIMPLSHIFTU64 iemAImpl_rcr_u64;
675FNIEMAIMPLSHIFTU64 iemAImpl_shl_u64;
676FNIEMAIMPLSHIFTU64 iemAImpl_shr_u64;
677FNIEMAIMPLSHIFTU64 iemAImpl_sar_u64;
678/** @} */
679
680/** @name Multiplication and division operations.
681 * @{ */
682typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU8,(uint16_t *pu16AX, uint8_t u8FactorDivisor, uint32_t *pEFlags));
683typedef FNIEMAIMPLMULDIVU8 *PFNIEMAIMPLMULDIVU8;
684FNIEMAIMPLMULDIVU8 iemAImpl_mul_u8, iemAImpl_imul_u8;
685FNIEMAIMPLMULDIVU8 iemAImpl_div_u8, iemAImpl_idiv_u8;
686
687typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU16,(uint16_t *pu16AX, uint16_t *pu16DX, uint16_t u16FactorDivisor, uint32_t *pEFlags));
688typedef FNIEMAIMPLMULDIVU16 *PFNIEMAIMPLMULDIVU16;
689FNIEMAIMPLMULDIVU16 iemAImpl_mul_u16, iemAImpl_imul_u16;
690FNIEMAIMPLMULDIVU16 iemAImpl_div_u16, iemAImpl_idiv_u16;
691
692typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU32,(uint32_t *pu32EAX, uint32_t *pu32EDX, uint32_t u32FactorDivisor, uint32_t *pEFlags));
693typedef FNIEMAIMPLMULDIVU32 *PFNIEMAIMPLMULDIVU32;
694FNIEMAIMPLMULDIVU32 iemAImpl_mul_u32, iemAImpl_imul_u32;
695FNIEMAIMPLMULDIVU32 iemAImpl_div_u32, iemAImpl_idiv_u32;
696
697typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU64,(uint64_t *pu64RAX, uint64_t *pu64RDX, uint64_t u64FactorDivisor, uint32_t *pEFlags));
698typedef FNIEMAIMPLMULDIVU64 *PFNIEMAIMPLMULDIVU64;
699FNIEMAIMPLMULDIVU64 iemAImpl_mul_u64, iemAImpl_imul_u64;
700FNIEMAIMPLMULDIVU64 iemAImpl_div_u64, iemAImpl_idiv_u64;
701/** @} */
702
703/** @name Byte Swap.
704 * @{ */
705IEM_DECL_IMPL_TYPE(void, iemAImpl_bswap_u16,(uint32_t *pu32Dst)); /* Yes, 32-bit register access. */
706IEM_DECL_IMPL_TYPE(void, iemAImpl_bswap_u32,(uint32_t *pu32Dst));
707IEM_DECL_IMPL_TYPE(void, iemAImpl_bswap_u64,(uint64_t *pu64Dst));
708/** @} */
709
710
711/** @name FPU operations taking a 32-bit float argument
712 * @{ */
713typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR32,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, RTFLOAT32U r32Val));
714typedef FNIEMAIMPLFPUR32 *PFNIEMAIMPLFPUR32;
715FNIEMAIMPLFPUR32 iemAImpl_fpu_r32_to_r80;
716/** @} */
717
718/** @name FPU operations taking a 64-bit float argument
719 * @{ */
720typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR64,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTFLOAT64U pr64Val));
721typedef FNIEMAIMPLFPUR64 *PFNIEMAIMPLFPUR64;
722FNIEMAIMPLFPUR64 iemAImpl_fpu_r64_to_r80;
723/** @} */
724
725
726/** @name Function tables.
727 * @{
728 */
729
730/**
731 * Function table for a binary operator providing implementation based on
732 * operand size.
733 */
734typedef struct IEMOPBINSIZES
735{
736 PFNIEMAIMPLBINU8 pfnNormalU8, pfnLockedU8;
737 PFNIEMAIMPLBINU16 pfnNormalU16, pfnLockedU16;
738 PFNIEMAIMPLBINU32 pfnNormalU32, pfnLockedU32;
739 PFNIEMAIMPLBINU64 pfnNormalU64, pfnLockedU64;
740} IEMOPBINSIZES;
741/** Pointer to a binary operator function table. */
742typedef IEMOPBINSIZES const *PCIEMOPBINSIZES;
743
744
745/**
746 * Function table for a unary operator providing implementation based on
747 * operand size.
748 */
749typedef struct IEMOPUNARYSIZES
750{
751 PFNIEMAIMPLUNARYU8 pfnNormalU8, pfnLockedU8;
752 PFNIEMAIMPLUNARYU16 pfnNormalU16, pfnLockedU16;
753 PFNIEMAIMPLUNARYU32 pfnNormalU32, pfnLockedU32;
754 PFNIEMAIMPLUNARYU64 pfnNormalU64, pfnLockedU64;
755} IEMOPUNARYSIZES;
756/** Pointer to a unary operator function table. */
757typedef IEMOPUNARYSIZES const *PCIEMOPUNARYSIZES;
758
759
760/**
761 * Function table for a shift operator providing implementation based on
762 * operand size.
763 */
764typedef struct IEMOPSHIFTSIZES
765{
766 PFNIEMAIMPLSHIFTU8 pfnNormalU8;
767 PFNIEMAIMPLSHIFTU16 pfnNormalU16;
768 PFNIEMAIMPLSHIFTU32 pfnNormalU32;
769 PFNIEMAIMPLSHIFTU64 pfnNormalU64;
770} IEMOPSHIFTSIZES;
771/** Pointer to a shift operator function table. */
772typedef IEMOPSHIFTSIZES const *PCIEMOPSHIFTSIZES;
773
774
775/**
776 * Function table for a multiplication or division operation.
777 */
778typedef struct IEMOPMULDIVSIZES
779{
780 PFNIEMAIMPLMULDIVU8 pfnU8;
781 PFNIEMAIMPLMULDIVU16 pfnU16;
782 PFNIEMAIMPLMULDIVU32 pfnU32;
783 PFNIEMAIMPLMULDIVU64 pfnU64;
784} IEMOPMULDIVSIZES;
785/** Pointer to a multiplication or division operation function table. */
786typedef IEMOPMULDIVSIZES const *PCIEMOPMULDIVSIZES;
787
788
789/**
790 * Function table for a double precision shift operator providing implementation
791 * based on operand size.
792 */
793typedef struct IEMOPSHIFTDBLSIZES
794{
795 PFNIEMAIMPLSHIFTDBLU16 pfnNormalU16;
796 PFNIEMAIMPLSHIFTDBLU32 pfnNormalU32;
797 PFNIEMAIMPLSHIFTDBLU64 pfnNormalU64;
798} IEMOPSHIFTDBLSIZES;
799/** Pointer to a double precision shift function table. */
800typedef IEMOPSHIFTDBLSIZES const *PCIEMOPSHIFTDBLSIZES;
801
802
803/** @} */
804
805
806/** @name C instruction implementations for anything slightly complicated.
807 * @{ */
808
809/**
810 * For typedef'ing or declaring a C instruction implementation function taking
811 * no extra arguments.
812 *
813 * @param a_Name The name of the type.
814 */
815# define IEM_CIMPL_DECL_TYPE_0(a_Name) \
816 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr))
817/**
818 * For defining a C instruction implementation function taking no extra
819 * arguments.
820 *
821 * @param a_Name The name of the function
822 */
823# define IEM_CIMPL_DEF_0(a_Name) \
824 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr))
825/**
826 * For calling a C instruction implementation function taking no extra
827 * arguments.
828 *
829 * This special call macro adds default arguments to the call and allow us to
830 * change these later.
831 *
832 * @param a_fn The name of the function.
833 */
834# define IEM_CIMPL_CALL_0(a_fn) a_fn(pIemCpu, cbInstr)
835
836/**
837 * For typedef'ing or declaring a C instruction implementation function taking
838 * one extra argument.
839 *
840 * @param a_Name The name of the type.
841 * @param a_Type0 The argument type.
842 * @param a_Arg0 The argument name.
843 */
844# define IEM_CIMPL_DECL_TYPE_1(a_Name, a_Type0, a_Arg0) \
845 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0))
846/**
847 * For defining a C instruction implementation function taking one extra
848 * argument.
849 *
850 * @param a_Name The name of the function
851 * @param a_Type0 The argument type.
852 * @param a_Arg0 The argument name.
853 */
854# define IEM_CIMPL_DEF_1(a_Name, a_Type0, a_Arg0) \
855 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0))
856/**
857 * For calling a C instruction implementation function taking one extra
858 * argument.
859 *
860 * This special call macro adds default arguments to the call and allow us to
861 * change these later.
862 *
863 * @param a_fn The name of the function.
864 * @param a0 The name of the 1st argument.
865 */
866# define IEM_CIMPL_CALL_1(a_fn, a0) a_fn(pIemCpu, cbInstr, (a0))
867
868/**
869 * For typedef'ing or declaring a C instruction implementation function taking
870 * two extra arguments.
871 *
872 * @param a_Name The name of the type.
873 * @param a_Type0 The type of the 1st argument
874 * @param a_Arg0 The name of the 1st argument.
875 * @param a_Type1 The type of the 2nd argument.
876 * @param a_Arg1 The name of the 2nd argument.
877 */
878# define IEM_CIMPL_DECL_TYPE_2(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1) \
879 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1))
880/**
881 * For defining a C instruction implementation function taking two extra
882 * arguments.
883 *
884 * @param a_Name The name of the function.
885 * @param a_Type0 The type of the 1st argument
886 * @param a_Arg0 The name of the 1st argument.
887 * @param a_Type1 The type of the 2nd argument.
888 * @param a_Arg1 The name of the 2nd argument.
889 */
890# define IEM_CIMPL_DEF_2(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1) \
891 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1))
892/**
893 * For calling a C instruction implementation function taking two extra
894 * arguments.
895 *
896 * This special call macro adds default arguments to the call and allow us to
897 * change these later.
898 *
899 * @param a_fn The name of the function.
900 * @param a0 The name of the 1st argument.
901 * @param a1 The name of the 2nd argument.
902 */
903# define IEM_CIMPL_CALL_2(a_fn, a0, a1) a_fn(pIemCpu, cbInstr, (a0), (a1))
904
905/**
906 * For typedef'ing or declaring a C instruction implementation function taking
907 * three extra arguments.
908 *
909 * @param a_Name The name of the type.
910 * @param a_Type0 The type of the 1st argument
911 * @param a_Arg0 The name of the 1st argument.
912 * @param a_Type1 The type of the 2nd argument.
913 * @param a_Arg1 The name of the 2nd argument.
914 * @param a_Type2 The type of the 3rd argument.
915 * @param a_Arg2 The name of the 3rd argument.
916 */
917# define IEM_CIMPL_DECL_TYPE_3(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2) \
918 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2))
919/**
920 * For defining a C instruction implementation function taking three extra
921 * arguments.
922 *
923 * @param a_Name The name of the function.
924 * @param a_Type0 The type of the 1st argument
925 * @param a_Arg0 The name of the 1st argument.
926 * @param a_Type1 The type of the 2nd argument.
927 * @param a_Arg1 The name of the 2nd argument.
928 * @param a_Type2 The type of the 3rd argument.
929 * @param a_Arg2 The name of the 3rd argument.
930 */
931# define IEM_CIMPL_DEF_3(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2) \
932 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2))
933/**
934 * For calling a C instruction implementation function taking three extra
935 * arguments.
936 *
937 * This special call macro adds default arguments to the call and allow us to
938 * change these later.
939 *
940 * @param a_fn The name of the function.
941 * @param a0 The name of the 1st argument.
942 * @param a1 The name of the 2nd argument.
943 * @param a2 The name of the 3rd argument.
944 */
945# define IEM_CIMPL_CALL_3(a_fn, a0, a1, a2) a_fn(pIemCpu, cbInstr, (a0), (a1), (a2))
946
947
948/**
949 * For typedef'ing or declaring a C instruction implementation function taking
950 * four extra arguments.
951 *
952 * @param a_Name The name of the type.
953 * @param a_Type0 The type of the 1st argument
954 * @param a_Arg0 The name of the 1st argument.
955 * @param a_Type1 The type of the 2nd argument.
956 * @param a_Arg1 The name of the 2nd argument.
957 * @param a_Type2 The type of the 3rd argument.
958 * @param a_Arg2 The name of the 3rd argument.
959 * @param a_Type3 The type of the 4th argument.
960 * @param a_Arg3 The name of the 4th argument.
961 */
962# define IEM_CIMPL_DECL_TYPE_4(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2, a_Type3, a_Arg3) \
963 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2, a_Type3 a_Arg3))
964/**
965 * For defining a C instruction implementation function taking four extra
966 * arguments.
967 *
968 * @param a_Name The name of the function.
969 * @param a_Type0 The type of the 1st argument
970 * @param a_Arg0 The name of the 1st argument.
971 * @param a_Type1 The type of the 2nd argument.
972 * @param a_Arg1 The name of the 2nd argument.
973 * @param a_Type2 The type of the 3rd argument.
974 * @param a_Arg2 The name of the 3rd argument.
975 * @param a_Type3 The type of the 4th argument.
976 * @param a_Arg3 The name of the 4th argument.
977 */
978# define IEM_CIMPL_DEF_4(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2, a_Type3, aArg3) \
979 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2, a_Type3 a_Arg3))
980/**
981 * For calling a C instruction implementation function taking four extra
982 * arguments.
983 *
984 * This special call macro adds default arguments to the call and allow us to
985 * change these later.
986 *
987 * @param a_fn The name of the function.
988 * @param a0 The name of the 1st argument.
989 * @param a1 The name of the 2nd argument.
990 * @param a2 The name of the 3rd argument.
991 * @param a3 The name of the 4th argument.
992 */
993# define IEM_CIMPL_CALL_4(a_fn, a0, a1, a2, a3) a_fn(pIemCpu, cbInstr, (a0), (a1), (a2), (a3))
994
995
996/**
997 * For typedef'ing or declaring a C instruction implementation function taking
998 * five extra arguments.
999 *
1000 * @param a_Name The name of the type.
1001 * @param a_Type0 The type of the 1st argument
1002 * @param a_Arg0 The name of the 1st argument.
1003 * @param a_Type1 The type of the 2nd argument.
1004 * @param a_Arg1 The name of the 2nd argument.
1005 * @param a_Type2 The type of the 3rd argument.
1006 * @param a_Arg2 The name of the 3rd argument.
1007 * @param a_Type3 The type of the 4th argument.
1008 * @param a_Arg3 The name of the 4th argument.
1009 * @param a_Type4 The type of the 5th argument.
1010 * @param a_Arg4 The name of the 5th argument.
1011 */
1012# define IEM_CIMPL_DECL_TYPE_5(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2, a_Type3, a_Arg3, a_Type4, a_Arg4) \
1013 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, \
1014 a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2, \
1015 a_Type3 a_Arg3, a_Type4 a_Arg4))
1016/**
1017 * For defining a C instruction implementation function taking five extra
1018 * arguments.
1019 *
1020 * @param a_Name The name of the function.
1021 * @param a_Type0 The type of the 1st argument
1022 * @param a_Arg0 The name of the 1st argument.
1023 * @param a_Type1 The type of the 2nd argument.
1024 * @param a_Arg1 The name of the 2nd argument.
1025 * @param a_Type2 The type of the 3rd argument.
1026 * @param a_Arg2 The name of the 3rd argument.
1027 * @param a_Type3 The type of the 4th argument.
1028 * @param a_Arg3 The name of the 4th argument.
1029 * @param a_Type4 The type of the 5th argument.
1030 * @param a_Arg4 The name of the 5th argument.
1031 */
1032# define IEM_CIMPL_DEF_5(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2, a_Type3, a_Arg3, a_Type4, a_Arg4) \
1033 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, \
1034 a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2, \
1035 a_Type3 a_Arg3, a_Type4 a_Arg4))
1036/**
1037 * For calling a C instruction implementation function taking five extra
1038 * arguments.
1039 *
1040 * This special call macro adds default arguments to the call and allow us to
1041 * change these later.
1042 *
1043 * @param a_fn The name of the function.
1044 * @param a0 The name of the 1st argument.
1045 * @param a1 The name of the 2nd argument.
1046 * @param a2 The name of the 3rd argument.
1047 * @param a3 The name of the 4th argument.
1048 * @param a4 The name of the 5th argument.
1049 */
1050# define IEM_CIMPL_CALL_5(a_fn, a0, a1, a2, a3, a4) a_fn(pIemCpu, cbInstr, (a0), (a1), (a2), (a3), (a4))
1051
1052/** @} */
1053
1054
1055/** @} */
1056
1057RT_C_DECLS_END
1058
1059#endif
1060
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette