VirtualBox

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

Last change on this file since 62010 was 62010, checked in by vboxsync, 8 years ago

IEM: Optimized iemSRegGetHid; started a little on TLB code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 72.8 KB
Line 
1/* $Id: IEMInternal.h 62010 2016-07-04 15:32:28Z vboxsync $ */
2/** @file
3 * IEM - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2011-2015 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/cpum.h>
22#include <VBox/vmm/iem.h>
23#include <VBox/vmm/stam.h>
24#include <VBox/param.h>
25
26#include <setjmp.h>
27
28
29RT_C_DECLS_BEGIN
30
31
32/** @defgroup grp_iem_int Internals
33 * @ingroup grp_iem
34 * @internal
35 * @{
36 */
37
38/** For expanding symbol in slickedit and other products tagging and
39 * crossreferencing IEM symbols. */
40#ifndef IEM_STATIC
41# define IEM_STATIC static
42#endif
43
44/** @def IEM_VERIFICATION_MODE_FULL
45 * Shorthand for:
46 * defined(IEM_VERIFICATION_MODE) && !defined(IEM_VERIFICATION_MODE_MINIMAL)
47 */
48#if (defined(IEM_VERIFICATION_MODE) && !defined(IEM_VERIFICATION_MODE_MINIMAL) && !defined(IEM_VERIFICATION_MODE_FULL)) \
49 || defined(DOXYGEN_RUNNING)
50# define IEM_VERIFICATION_MODE_FULL
51#endif
52
53
54/** @def IEM_CFG_TARGET_CPU
55 * The minimum target CPU for the IEM emulation (IEMTARGETCPU_XXX value).
56 *
57 * By default we allow this to be configured by the user via the
58 * CPUM/GuestCpuName config string, but this comes at a slight cost during
59 * decoding. So, for applications of this code where there is no need to
60 * be dynamic wrt target CPU, just modify this define.
61 */
62#if !defined(IEM_CFG_TARGET_CPU) || defined(DOXYGEN_RUNNING)
63# define IEM_CFG_TARGET_CPU IEMTARGETCPU_DYNAMIC
64#endif
65
66
67
68/** Finish and move to types.h */
69typedef union
70{
71 uint32_t u32;
72} RTFLOAT32U;
73typedef RTFLOAT32U *PRTFLOAT32U;
74typedef RTFLOAT32U const *PCRTFLOAT32U;
75
76
77/**
78 * Extended operand mode that includes a representation of 8-bit.
79 *
80 * This is used for packing down modes when invoking some C instruction
81 * implementations.
82 */
83typedef enum IEMMODEX
84{
85 IEMMODEX_16BIT = IEMMODE_16BIT,
86 IEMMODEX_32BIT = IEMMODE_32BIT,
87 IEMMODEX_64BIT = IEMMODE_64BIT,
88 IEMMODEX_8BIT
89} IEMMODEX;
90AssertCompileSize(IEMMODEX, 4);
91
92
93/**
94 * Branch types.
95 */
96typedef enum IEMBRANCH
97{
98 IEMBRANCH_JUMP = 1,
99 IEMBRANCH_CALL,
100 IEMBRANCH_TRAP,
101 IEMBRANCH_SOFTWARE_INT,
102 IEMBRANCH_HARDWARE_INT
103} IEMBRANCH;
104AssertCompileSize(IEMBRANCH, 4);
105
106
107/**
108 * A FPU result.
109 */
110typedef struct IEMFPURESULT
111{
112 /** The output value. */
113 RTFLOAT80U r80Result;
114 /** The output status. */
115 uint16_t FSW;
116} IEMFPURESULT;
117AssertCompileMemberOffset(IEMFPURESULT, FSW, 10);
118/** Pointer to a FPU result. */
119typedef IEMFPURESULT *PIEMFPURESULT;
120/** Pointer to a const FPU result. */
121typedef IEMFPURESULT const *PCIEMFPURESULT;
122
123
124/**
125 * A FPU result consisting of two output values and FSW.
126 */
127typedef struct IEMFPURESULTTWO
128{
129 /** The first output value. */
130 RTFLOAT80U r80Result1;
131 /** The output status. */
132 uint16_t FSW;
133 /** The second output value. */
134 RTFLOAT80U r80Result2;
135} IEMFPURESULTTWO;
136AssertCompileMemberOffset(IEMFPURESULTTWO, FSW, 10);
137AssertCompileMemberOffset(IEMFPURESULTTWO, r80Result2, 12);
138/** Pointer to a FPU result consisting of two output values and FSW. */
139typedef IEMFPURESULTTWO *PIEMFPURESULTTWO;
140/** Pointer to a const FPU result consisting of two output values and FSW. */
141typedef IEMFPURESULTTWO const *PCIEMFPURESULTTWO;
142
143
144
145#ifdef IEM_VERIFICATION_MODE_FULL
146
147/**
148 * Verification event type.
149 */
150typedef enum IEMVERIFYEVENT
151{
152 IEMVERIFYEVENT_INVALID = 0,
153 IEMVERIFYEVENT_IOPORT_READ,
154 IEMVERIFYEVENT_IOPORT_WRITE,
155 IEMVERIFYEVENT_IOPORT_STR_READ,
156 IEMVERIFYEVENT_IOPORT_STR_WRITE,
157 IEMVERIFYEVENT_RAM_WRITE,
158 IEMVERIFYEVENT_RAM_READ
159} IEMVERIFYEVENT;
160
161/** Checks if the event type is a RAM read or write. */
162# define IEMVERIFYEVENT_IS_RAM(a_enmType) ((a_enmType) == IEMVERIFYEVENT_RAM_WRITE || (a_enmType) == IEMVERIFYEVENT_RAM_READ)
163
164/**
165 * Verification event record.
166 */
167typedef struct IEMVERIFYEVTREC
168{
169 /** Pointer to the next record in the list. */
170 struct IEMVERIFYEVTREC *pNext;
171 /** The event type. */
172 IEMVERIFYEVENT enmEvent;
173 /** The event data. */
174 union
175 {
176 /** IEMVERIFYEVENT_IOPORT_READ */
177 struct
178 {
179 RTIOPORT Port;
180 uint8_t cbValue;
181 } IOPortRead;
182
183 /** IEMVERIFYEVENT_IOPORT_WRITE */
184 struct
185 {
186 RTIOPORT Port;
187 uint8_t cbValue;
188 uint32_t u32Value;
189 } IOPortWrite;
190
191 /** IEMVERIFYEVENT_IOPORT_STR_READ */
192 struct
193 {
194 RTIOPORT Port;
195 uint8_t cbValue;
196 RTGCUINTREG cTransfers;
197 } IOPortStrRead;
198
199 /** IEMVERIFYEVENT_IOPORT_STR_WRITE */
200 struct
201 {
202 RTIOPORT Port;
203 uint8_t cbValue;
204 RTGCUINTREG cTransfers;
205 } IOPortStrWrite;
206
207 /** IEMVERIFYEVENT_RAM_READ */
208 struct
209 {
210 RTGCPHYS GCPhys;
211 uint32_t cb;
212 } RamRead;
213
214 /** IEMVERIFYEVENT_RAM_WRITE */
215 struct
216 {
217 RTGCPHYS GCPhys;
218 uint32_t cb;
219 uint8_t ab[512];
220 } RamWrite;
221 } u;
222} IEMVERIFYEVTREC;
223/** Pointer to an IEM event verification records. */
224typedef IEMVERIFYEVTREC *PIEMVERIFYEVTREC;
225
226#endif /* IEM_VERIFICATION_MODE_FULL */
227
228
229/**
230 * IEM TLB entry.
231 *
232 * Lookup assembly:
233 * @code{.asm}
234 ; Calculate tag.
235 mov rax, [VA]
236 shl rax, 16
237 shr rax, 16 + X86_PAGE_SHIFT
238 or rax, [uTlbRevision]
239
240 ; Do indexing.
241 movzx ecx, al
242 lea rcx, [pTlbEntries + rcx]
243
244 ; Check tag.
245 cmp [rcx + IEMTLBENTRY.uTag], rax
246 jne .TlbMiss
247
248 ; Check access.
249 movsx rax, ACCESS_FLAGS | MAPPING_R3_NOT_VALID | 0xffffff00
250 and rax, [rcx + IEMTLBENTRY.fFlagsAndPhysRev]
251 cmp rax, [uTlbPhysRev]
252 jne .TlbMiss
253
254 ; Calc address and we're done.
255 mov eax, X86_PAGE_OFFSET_MASK
256 and eax, [VA]
257 or rax, [rcx + IEMTLBENTRY.pMappingR3]
258 %ifdef VBOX_WITH_STATISTICS
259 inc qword [cTlbHits]
260 %endif
261 jmp .Done
262
263 .TlbMiss:
264 mov r8d, ACCESS_FLAGS
265 mov rdx, [VA]
266 mov rcx, [pIemCpu]
267 call iemTlbTypeMiss
268 .Done:
269
270 @endcode
271 *
272 */
273typedef struct IEMTLBENTRY
274{
275 /** The TLB entry tag.
276 * Bits 35 thru 0 are made up of the virtual address shifted right 12 bits.
277 * Bits 63 thru 36 are made up of the TLB revision (zero means invalid).
278 *
279 * The TLB lookup code uses the current TLB revision, which won't ever be zero,
280 * enabling an extremely cheap TLB invalidation most of the time. When the TLB
281 * revision wraps around though, the tags needs to be zeroed.
282 *
283 * @note Try use SHRD instruction? After seeing
284 * https://gmplib.org/~tege/x86-timing.pdf, maybe not.
285 */
286 uint64_t uTag;
287 /** Access flags and physical TLB revision.
288 *
289 * - Bit 0 - page tables - not executable (X86_PTE_PAE_NX).
290 * - Bit 1 - page tables - not writable (complemented X86_PTE_RW).
291 * - Bit 2 - page tables - not user (complemented X86_PTE_US).
292 * - Bit 3 - pgm phys/virt - not directly writable.
293 * - Bit 4 - pgm phys page - not directly readable.
294 * - Bit 5 - currently unused.
295 * - Bit 6 - page tables - not dirty (complemented X86_PTE_D).
296 * - Bit 7 - tlb entry - pMappingR3 member not valid.
297 * - Bits 63 thru 8 are used for the physical TLB revision number.
298 *
299 * We're using complemented bit meanings here because it makes it easy to check
300 * whether special action is required. For instance a user mode write access
301 * would do a "TEST fFlags, (X86_PTE_RW | X86_PTE_US | X86_PTE_D)" and a
302 * non-zero result would mean special handling needed because either it wasn't
303 * writable, or it wasn't user, or the page wasn't dirty. A user mode read
304 * access would do "TEST fFlags, X86_PTE_US"; and a kernel mode read wouldn't
305 * need to check any PTE flag.
306 */
307 uint64_t fFlagsAndPhysRev;
308 /** The guest physical page address. */
309 uint64_t GCPhys;
310 /** Pointer to the ring-3 mapping (possibly also valid in ring-0). */
311#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
312 R3PTRTYPE(uint8_t *) pMappingR3;
313#else
314 R3R0PTRTYPE(uint8_t *) pMappingR3;
315#endif
316#if HC_ARCH_BITS == 32
317 uint32_t u32Padding1;
318#endif
319} IEMTLBENTRY;
320AssertCompileSize(IEMTLBENTRY, 32);
321
322/** @name IEMTLBE_F_XXX - TLB entry flags (IEMTLBENTRY::fFlagsAndPhysRev)
323 * @{ */
324#define IEMTLBE_F_PT_NO_EXEC RT_BIT_64(0) /**< Page tables: Not executable. */
325#define IEMTLBE_F_PT_NO_WRITE RT_BIT_64(1) /**< Page tables: Not writable. */
326#define IEMTLBE_F_PT_NO_USER RT_BIT_64(2) /**< Page tables: Not user accessible (supervisor only). */
327#define IEMTLBE_F_PG_NO_WRITE RT_BIT_64(3) /**< Phys page: Not writable (access handler, ROM, whatever). */
328#define IEMTLBE_F_PG_NO_READ RT_BIT_64(4) /**< Phys page: Not readable (MMIO / access handler, ROM) */
329#define IEMTLBE_F_UNUSED RT_BIT_64(5) /**< Currently unused. */
330#define IEMTLBE_F_PT_NO_DIRTY RT_BIT_64(6) /**< Page tables: Not dirty (needs to be made dirty on write). */
331#define IEMTLBE_F_NO_MAPPINGR3 RT_BIT_64(7) /**< TLB entry: The IEMTLBENTRY::pMappingR3 member is invalid. */
332/** @} */
333
334
335/**
336 * An IEM TLB.
337 *
338 * We've got two of these, one for data and one for instructions.
339 */
340typedef struct IEMTLB
341{
342 /** The TLB entries.
343 * We've choosen 256 because that way we can obtain the result directly from a
344 * 8-bit register without an additional AND instruction. */
345 IEMTLBENTRY aEntries[256];
346 /** The TLB revision.
347 * This is actually only 28 bits wide (see IEMTLBENTRY::uTag) and is incremented
348 * by adding RT_BIT_64(36) to it. When it wraps around and becomes zero, all
349 * the tags in the TLB must be zeroed and the revision set to RT_BIT_64(36).
350 * (The revision zero indicates an invalid TLB entry.)
351 *
352 * The initial value is choosen to cause an early wraparound. */
353 uint64_t uTlbRevision;
354 /** The TLB physical address revision - shadow of PGM variable.
355 *
356 * This is actually only 56 bits wide (see IEMTLBENTRY::fFlagsAndPhysRev) and is
357 * incremented by adding RT_BIT_64(8). When it wraps around and becomes zero,
358 * a rendezvous is called and each CPU wipe the IEMTLBENTRY::pMappingR3 as well
359 * as IEMTLBENTRY::fFlagsAndPhysRev bits 63 thru 8, 4, and 3.
360 *
361 * The initial value is choosen to cause an early wraparound. */
362 uint64_t volatile uTlbPhysRev;
363
364 /* Statistics: */
365
366 /** TLB hits (VBOX_WITH_STATISTICS only). */
367 uint64_t cTlbHits;
368 /** TLB misses. */
369 uint32_t cTlbMisses;
370 /** TLB misses because of tag mismatch. */
371 uint32_t cTlbMissesTag;
372 /** TLB misses because of virtual access violation. */
373 uint32_t cTlbMissesVirtAccess;
374 /** TLB misses because of dirty bit. */
375 uint32_t cTlbMissesDirty;
376 /** TLB misses because of MMIO */
377 uint32_t cTlbMissesMmio;
378 /** TLB misses because of write access handlers. */
379 uint32_t cTlbMissesWriteHandler;
380 /** TLB misses because no r3(/r0) mapping. */
381 uint32_t cTlbMissesMapping;
382 /** Alignment padding. */
383 uint32_t au32Padding[3];
384} IEMTLB;
385AssertCompileSizeAlignment(IEMTLB, 64);
386
387
388/**
389 * The per-CPU IEM state.
390 *
391 * @todo Re-org so most frequently accessed members are in the first 64 bytes.
392 */
393typedef struct IEMCPU
394{
395 /** Pointer to the CPU context - ring-3 context. */
396 R3PTRTYPE(PCPUMCTX) pCtxR3;
397 /** Pointer set jump buffer - ring-3 context. */
398 R3PTRTYPE(jmp_buf *) pJmpBufR3;
399 /** Pointer to the CPU context - ring-0 context. */
400 R0PTRTYPE(PCPUMCTX) pCtxR0;
401 /** Pointer set jump buffer - ring-0 context. */
402 R0PTRTYPE(jmp_buf *) pJmpBufR0;
403 /** Pointer to the CPU context - raw-mode context. */
404 RCPTRTYPE(PCPUMCTX) pCtxRC;
405 /** Pointer set jump buffer - raw-mode context. */
406 RCPTRTYPE(jmp_buf *) pJmpBufRC;
407
408 /** Offset of the VMCPU structure relative to this structure (negative). */
409 int32_t offVMCpu;
410 /** Offset of the VM structure relative to this structure (negative). */
411 int32_t offVM;
412
413 /** Whether to bypass access handlers or not. */
414 bool fBypassHandlers;
415 /** Indicates that we're interpreting patch code - RC only! */
416 bool fInPatchCode;
417 /** Explicit alignment padding. */
418 bool afAlignment0[2+4];
419
420 /** The flags of the current exception / interrupt. */
421 uint32_t fCurXcpt;
422 /** The current exception / interrupt. */
423 uint8_t uCurXcpt;
424 /** Exception / interrupt recursion depth. */
425 int8_t cXcptRecursions;
426 /** Explicit alignment padding. */
427 bool afAlignment1[1];
428 /** The CPL. */
429 uint8_t uCpl;
430 /** The current CPU execution mode (CS). */
431 IEMMODE enmCpuMode;
432 /** Info status code that needs to be propagated to the IEM caller.
433 * This cannot be passed internally, as it would complicate all success
434 * checks within the interpreter making the code larger and almost impossible
435 * to get right. Instead, we'll store status codes to pass on here. Each
436 * source of these codes will perform appropriate sanity checks. */
437 int32_t rcPassUp;
438
439 /** @name Statistics
440 * @{ */
441 /** The number of instructions we've executed. */
442 uint32_t cInstructions;
443 /** The number of potential exits. */
444 uint32_t cPotentialExits;
445 /** The number of bytes data or stack written (mostly for IEMExecOneEx).
446 * This may contain uncommitted writes. */
447 uint32_t cbWritten;
448 /** Counts the VERR_IEM_INSTR_NOT_IMPLEMENTED returns. */
449 uint32_t cRetInstrNotImplemented;
450 /** Counts the VERR_IEM_ASPECT_NOT_IMPLEMENTED returns. */
451 uint32_t cRetAspectNotImplemented;
452 /** Counts informational statuses returned (other than VINF_SUCCESS). */
453 uint32_t cRetInfStatuses;
454 /** Counts other error statuses returned. */
455 uint32_t cRetErrStatuses;
456 /** Number of times rcPassUp has been used. */
457 uint32_t cRetPassUpStatus;
458 /** Number of times RZ left with instruction commit pending for ring-3. */
459 uint32_t cPendingCommit;
460 /** Number of long jumps. */
461 uint32_t cLongJumps;
462 uint32_t uPadding; /**< Alignment padding. */
463#ifdef IEM_VERIFICATION_MODE_FULL
464 /** The Number of I/O port reads that has been performed. */
465 uint32_t cIOReads;
466 /** The Number of I/O port writes that has been performed. */
467 uint32_t cIOWrites;
468 /** Set if no comparison to REM is currently performed.
469 * This is used to skip past really slow bits. */
470 bool fNoRem;
471 /** Saved fNoRem flag used by #iemInitExec and #iemUninitExec. */
472 bool fNoRemSavedByExec;
473 /** Indicates that RAX and RDX differences should be ignored since RDTSC
474 * and RDTSCP are timing sensitive. */
475 bool fIgnoreRaxRdx;
476 /** Indicates that a MOVS instruction with overlapping source and destination
477 * was executed, causing the memory write records to be incorrrect. */
478 bool fOverlappingMovs;
479 /** Set if there are problematic memory accesses (MMIO, write monitored, ++). */
480 bool fProblematicMemory;
481 /** This is used to communicate a CPL changed caused by IEMInjectTrap that
482 * CPUM doesn't yet reflect. */
483 uint8_t uInjectCpl;
484 /** To prevent EMR3HmSingleInstruction from triggering endless recursion via
485 * emR3ExecuteInstruction and iemExecVerificationModeCheck. */
486 uint8_t cVerifyDepth;
487 bool afAlignment2[2];
488 /** Mask of undefined eflags.
489 * The verifier will any difference in these flags. */
490 uint32_t fUndefinedEFlags;
491 /** The CS of the instruction being interpreted. */
492 RTSEL uOldCs;
493 /** The RIP of the instruction being interpreted. */
494 uint64_t uOldRip;
495 /** The physical address corresponding to abOpcodes[0]. */
496 RTGCPHYS GCPhysOpcodes;
497#endif
498 /** @} */
499
500 /** @name Decoder state.
501 * @{ */
502
503 /** The default addressing mode . */
504 IEMMODE enmDefAddrMode;
505 /** The effective addressing mode . */
506 IEMMODE enmEffAddrMode;
507 /** The default operand mode . */
508 IEMMODE enmDefOpSize;
509 /** The effective operand mode . */
510 IEMMODE enmEffOpSize;
511
512 /** The prefix mask (IEM_OP_PRF_XXX). */
513 uint32_t fPrefixes;
514 /** The extra REX ModR/M register field bit (REX.R << 3). */
515 uint8_t uRexReg;
516 /** The extra REX ModR/M r/m field, SIB base and opcode reg bit
517 * (REX.B << 3). */
518 uint8_t uRexB;
519 /** The extra REX SIB index field bit (REX.X << 3). */
520 uint8_t uRexIndex;
521 /** The effective segment register (X86_SREG_XXX). */
522 uint8_t iEffSeg;
523
524 /** The current offset into abOpcodes. */
525 uint8_t offOpcode;
526 /** The size of what has currently been fetched into abOpcodes. */
527 uint8_t cbOpcode;
528 /** The opcode bytes. */
529 uint8_t abOpcode[15];
530 /** Offset into abOpcodes where the FPU instruction starts.
531 * Only set by the FPU escape opcodes (0xd8-0xdf) and used later on when the
532 * instruction result is committed. */
533 uint8_t offFpuOpcode;
534
535 /** @} */
536
537 /** The number of active guest memory mappings. */
538 uint8_t cActiveMappings;
539 /** The next unused mapping index. */
540 uint8_t iNextMapping;
541 /** Records for tracking guest memory mappings. */
542 struct
543 {
544 /** The address of the mapped bytes. */
545 void *pv;
546#if defined(IN_RC) && HC_ARCH_BITS == 64
547 uint32_t u32Alignment3; /**< Alignment padding. */
548#endif
549 /** The access flags (IEM_ACCESS_XXX).
550 * IEM_ACCESS_INVALID if the entry is unused. */
551 uint32_t fAccess;
552#if HC_ARCH_BITS == 64
553 uint32_t u32Alignment4; /**< Alignment padding. */
554#endif
555 } aMemMappings[3];
556
557 /** Locking records for the mapped memory. */
558 union
559 {
560 PGMPAGEMAPLOCK Lock;
561 uint64_t au64Padding[2];
562 } aMemMappingLocks[3];
563
564 /** Bounce buffer info.
565 * This runs in parallel to aMemMappings. */
566 struct
567 {
568 /** The physical address of the first byte. */
569 RTGCPHYS GCPhysFirst;
570 /** The physical address of the second page. */
571 RTGCPHYS GCPhysSecond;
572 /** The number of bytes in the first page. */
573 uint16_t cbFirst;
574 /** The number of bytes in the second page. */
575 uint16_t cbSecond;
576 /** Whether it's unassigned memory. */
577 bool fUnassigned;
578 /** Explicit alignment padding. */
579 bool afAlignment5[3];
580 } aMemBbMappings[3];
581
582 /** Bounce buffer storage.
583 * This runs in parallel to aMemMappings and aMemBbMappings. */
584 struct
585 {
586 uint8_t ab[512];
587 } aBounceBuffers[3];
588
589 /** @name Target CPU information.
590 * @{ */
591#if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC
592 /** The target CPU. */
593 uint32_t uTargetCpu;
594#else
595 uint32_t u32TargetCpuPadding;
596#endif
597 /** The CPU vendor. */
598 CPUMCPUVENDOR enmCpuVendor;
599 /** @} */
600
601 /** @name Host CPU information.
602 * @{ */
603 /** The CPU vendor. */
604 CPUMCPUVENDOR enmHostCpuVendor;
605 /** @} */
606
607 uint32_t au32Alignment6[HC_ARCH_BITS == 64 ? 1 + 10 : 1 + 4]; /**< Alignment padding. */
608
609 /** Data TLB.
610 * @remarks Must be 64-byte aligned. */
611 IEMTLB DataTlb;
612 /** Instruction TLB.
613 * @remarks Must be 64-byte aligned. */
614 IEMTLB CodeTlb;
615
616#ifdef IEM_VERIFICATION_MODE_FULL
617 /** The event verification records for what IEM did (LIFO). */
618 R3PTRTYPE(PIEMVERIFYEVTREC) pIemEvtRecHead;
619 /** Insertion point for pIemEvtRecHead. */
620 R3PTRTYPE(PIEMVERIFYEVTREC *) ppIemEvtRecNext;
621 /** The event verification records for what the other party did (FIFO). */
622 R3PTRTYPE(PIEMVERIFYEVTREC) pOtherEvtRecHead;
623 /** Insertion point for pOtherEvtRecHead. */
624 R3PTRTYPE(PIEMVERIFYEVTREC *) ppOtherEvtRecNext;
625 /** List of free event records. */
626 R3PTRTYPE(PIEMVERIFYEVTREC) pFreeEvtRec;
627#endif
628} IEMCPU;
629AssertCompileMemberAlignment(IEMCPU, DataTlb, 64);
630AssertCompileMemberAlignment(IEMCPU, CodeTlb, 64);
631/** Pointer to the per-CPU IEM state. */
632typedef IEMCPU *PIEMCPU;
633/** Pointer to the const per-CPU IEM state. */
634typedef IEMCPU const *PCIEMCPU;
635
636/** Converts a IEMCPU pointer to a VMCPU pointer.
637 * @returns VMCPU pointer.
638 * @param a_pIemCpu The IEM per CPU instance data.
639 */
640#define IEMCPU_TO_VMCPU(a_pIemCpu) ((PVMCPU)( (uintptr_t)(a_pIemCpu) + a_pIemCpu->offVMCpu ))
641
642/** Converts a IEMCPU pointer to a VM pointer.
643 * @returns VM pointer.
644 * @param a_pIemCpu The IEM per CPU instance data.
645 */
646#define IEMCPU_TO_VM(a_pIemCpu) ((PVM)( (uintptr_t)(a_pIemCpu) + a_pIemCpu->offVM ))
647
648/** Gets the current IEMTARGETCPU value.
649 * @returns IEMTARGETCPU value.
650 * @param a_pIemCpu The IEM per CPU instance data.
651 */
652#if IEM_CFG_TARGET_CPU != IEMTARGETCPU_DYNAMIC
653# define IEM_GET_TARGET_CPU(a_pIemCpu) (IEM_CFG_TARGET_CPU)
654#else
655# define IEM_GET_TARGET_CPU(a_pIemCpu) ((a_pIemCpu)->uTargetCpu)
656#endif
657
658/** @name IEM_ACCESS_XXX - Access details.
659 * @{ */
660#define IEM_ACCESS_INVALID UINT32_C(0x000000ff)
661#define IEM_ACCESS_TYPE_READ UINT32_C(0x00000001)
662#define IEM_ACCESS_TYPE_WRITE UINT32_C(0x00000002)
663#define IEM_ACCESS_TYPE_EXEC UINT32_C(0x00000004)
664#define IEM_ACCESS_TYPE_MASK UINT32_C(0x00000007)
665#define IEM_ACCESS_WHAT_CODE UINT32_C(0x00000010)
666#define IEM_ACCESS_WHAT_DATA UINT32_C(0x00000020)
667#define IEM_ACCESS_WHAT_STACK UINT32_C(0x00000030)
668#define IEM_ACCESS_WHAT_SYS UINT32_C(0x00000040)
669#define IEM_ACCESS_WHAT_MASK UINT32_C(0x00000070)
670/** The writes are partial, so if initialize the bounce buffer with the
671 * orignal RAM content. */
672#define IEM_ACCESS_PARTIAL_WRITE UINT32_C(0x00000100)
673/** Used in aMemMappings to indicate that the entry is bounce buffered. */
674#define IEM_ACCESS_BOUNCE_BUFFERED UINT32_C(0x00000200)
675/** Bounce buffer with ring-3 write pending, first page. */
676#define IEM_ACCESS_PENDING_R3_WRITE_1ST UINT32_C(0x00000400)
677/** Bounce buffer with ring-3 write pending, second page. */
678#define IEM_ACCESS_PENDING_R3_WRITE_2ND UINT32_C(0x00000800)
679/** Valid bit mask. */
680#define IEM_ACCESS_VALID_MASK UINT32_C(0x00000fff)
681/** Read+write data alias. */
682#define IEM_ACCESS_DATA_RW (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_DATA)
683/** Write data alias. */
684#define IEM_ACCESS_DATA_W (IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_DATA)
685/** Read data alias. */
686#define IEM_ACCESS_DATA_R (IEM_ACCESS_TYPE_READ | IEM_ACCESS_WHAT_DATA)
687/** Instruction fetch alias. */
688#define IEM_ACCESS_INSTRUCTION (IEM_ACCESS_TYPE_EXEC | IEM_ACCESS_WHAT_CODE)
689/** Stack write alias. */
690#define IEM_ACCESS_STACK_W (IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_STACK)
691/** Stack read alias. */
692#define IEM_ACCESS_STACK_R (IEM_ACCESS_TYPE_READ | IEM_ACCESS_WHAT_STACK)
693/** Stack read+write alias. */
694#define IEM_ACCESS_STACK_RW (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_STACK)
695/** Read system table alias. */
696#define IEM_ACCESS_SYS_R (IEM_ACCESS_TYPE_READ | IEM_ACCESS_WHAT_SYS)
697/** Read+write system table alias. */
698#define IEM_ACCESS_SYS_RW (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_SYS)
699/** @} */
700
701/** @name Prefix constants (IEMCPU::fPrefixes)
702 * @{ */
703#define IEM_OP_PRF_SEG_CS RT_BIT_32(0) /**< CS segment prefix (0x2e). */
704#define IEM_OP_PRF_SEG_SS RT_BIT_32(1) /**< SS segment prefix (0x36). */
705#define IEM_OP_PRF_SEG_DS RT_BIT_32(2) /**< DS segment prefix (0x3e). */
706#define IEM_OP_PRF_SEG_ES RT_BIT_32(3) /**< ES segment prefix (0x26). */
707#define IEM_OP_PRF_SEG_FS RT_BIT_32(4) /**< FS segment prefix (0x64). */
708#define IEM_OP_PRF_SEG_GS RT_BIT_32(5) /**< GS segment prefix (0x65). */
709#define IEM_OP_PRF_SEG_MASK UINT32_C(0x3f)
710
711#define IEM_OP_PRF_SIZE_OP RT_BIT_32(8) /**< Operand size prefix (0x66). */
712#define IEM_OP_PRF_SIZE_REX_W RT_BIT_32(9) /**< REX.W prefix (0x48-0x4f). */
713#define IEM_OP_PRF_SIZE_ADDR RT_BIT_32(10) /**< Address size prefix (0x67). */
714
715#define IEM_OP_PRF_LOCK RT_BIT_32(16) /**< Lock prefix (0xf0). */
716#define IEM_OP_PRF_REPNZ RT_BIT_32(17) /**< Repeat-not-zero prefix (0xf2). */
717#define IEM_OP_PRF_REPZ RT_BIT_32(18) /**< Repeat-if-zero prefix (0xf3). */
718
719#define IEM_OP_PRF_REX RT_BIT_32(24) /**< Any REX prefix (0x40-0x4f). */
720#define IEM_OP_PRF_REX_R RT_BIT_32(25) /**< REX.R prefix (0x44,0x45,0x46,0x47,0x4c,0x4d,0x4e,0x4f). */
721#define IEM_OP_PRF_REX_B RT_BIT_32(26) /**< REX.B prefix (0x41,0x43,0x45,0x47,0x49,0x4b,0x4d,0x4f). */
722#define IEM_OP_PRF_REX_X RT_BIT_32(27) /**< REX.X prefix (0x42,0x43,0x46,0x47,0x4a,0x4b,0x4e,0x4f). */
723/** Mask with all the REX prefix flags.
724 * This is generally for use when needing to undo the REX prefixes when they
725 * are followed legacy prefixes and therefore does not immediately preceed
726 * the first opcode byte.
727 * For testing whether any REX prefix is present, use IEM_OP_PRF_REX instead. */
728#define IEM_OP_PRF_REX_MASK (IEM_OP_PRF_REX | IEM_OP_PRF_REX_R | IEM_OP_PRF_REX_B | IEM_OP_PRF_REX_X | IEM_OP_PRF_SIZE_REX_W )
729/** @} */
730
731/** @name Opcode forms
732 * @{ */
733/** ModR/M: reg, r/m */
734#define IEMOPFORM_RM 0
735/** ModR/M: reg, r/m (register) */
736#define IEMOPFORM_RM_REG (IEMOPFORM_RM | IEMOPFORM_MOD3)
737/** ModR/M: reg, r/m (memory) */
738#define IEMOPFORM_RM_MEM (IEMOPFORM_RM | IEMOPFORM_NOT_MOD3)
739/** ModR/M: r/m, reg */
740#define IEMOPFORM_MR 1
741/** ModR/M: r/m (register), reg */
742#define IEMOPFORM_MR_REG (IEMOPFORM_MR | IEMOPFORM_MOD3)
743/** ModR/M: r/m (memory), reg */
744#define IEMOPFORM_MR_MEM (IEMOPFORM_MR | IEMOPFORM_NOT_MOD3)
745/** ModR/M: r/m only */
746#define IEMOPFORM_M 2
747/** ModR/M: r/m only (register). */
748#define IEMOPFORM_M_REG (IEMOPFORM_M | IEMOPFORM_MOD3)
749/** ModR/M: r/m only (memory). */
750#define IEMOPFORM_M_MEM (IEMOPFORM_M | IEMOPFORM_NOT_MOD3)
751/** ModR/M: reg only */
752#define IEMOPFORM_R 3
753
754/** Fixed register instruction, no R/M. */
755#define IEMOPFORM_FIXED 4
756
757/** The r/m is a register. */
758#define IEMOPFORM_MOD3 RT_BIT_32(8)
759/** The r/m is a memory access. */
760#define IEMOPFORM_NOT_MOD3 RT_BIT_32(9)
761/** @} */
762
763/**
764 * Possible hardware task switch sources.
765 */
766typedef enum IEMTASKSWITCH
767{
768 /** Task switch caused by an interrupt/exception. */
769 IEMTASKSWITCH_INT_XCPT = 1,
770 /** Task switch caused by a far CALL. */
771 IEMTASKSWITCH_CALL,
772 /** Task switch caused by a far JMP. */
773 IEMTASKSWITCH_JUMP,
774 /** Task switch caused by an IRET. */
775 IEMTASKSWITCH_IRET
776} IEMTASKSWITCH;
777AssertCompileSize(IEMTASKSWITCH, 4);
778
779
780/**
781 * Tests if verification mode is enabled.
782 *
783 * This expands to @c false when IEM_VERIFICATION_MODE is not defined and
784 * should therefore cause the compiler to eliminate the verification branch
785 * of an if statement. */
786#ifdef IEM_VERIFICATION_MODE_FULL
787# define IEM_VERIFICATION_ENABLED(a_pIemCpu) (!(a_pIemCpu)->fNoRem)
788#elif defined(IEM_VERIFICATION_MODE_MINIMAL)
789# define IEM_VERIFICATION_ENABLED(a_pIemCpu) (true)
790#else
791# define IEM_VERIFICATION_ENABLED(a_pIemCpu) (false)
792#endif
793
794/**
795 * Tests if full verification mode is enabled.
796 *
797 * This expands to @c false when IEM_VERIFICATION_MODE_FULL is not defined and
798 * should therefore cause the compiler to eliminate the verification branch
799 * of an if statement. */
800#ifdef IEM_VERIFICATION_MODE_FULL
801# define IEM_FULL_VERIFICATION_ENABLED(a_pIemCpu) (!(a_pIemCpu)->fNoRem)
802#else
803# define IEM_FULL_VERIFICATION_ENABLED(a_pIemCpu) (false)
804#endif
805
806/**
807 * Tests if full verification mode is enabled again REM.
808 *
809 * This expands to @c false when IEM_VERIFICATION_MODE_FULL is not defined and
810 * should therefore cause the compiler to eliminate the verification branch
811 * of an if statement. */
812#ifdef IEM_VERIFICATION_MODE_FULL
813# ifdef IEM_VERIFICATION_MODE_FULL_HM
814# define IEM_FULL_VERIFICATION_REM_ENABLED(a_pIemCpu) (!(a_pIemCpu)->fNoRem && !HMIsEnabled(IEMCPU_TO_VM(a_pIemCpu)))
815# else
816# define IEM_FULL_VERIFICATION_REM_ENABLED(a_pIemCpu) (!(a_pIemCpu)->fNoRem)
817# endif
818#else
819# define IEM_FULL_VERIFICATION_REM_ENABLED(a_pIemCpu) (false)
820#endif
821
822/** @def IEM_VERIFICATION_MODE
823 * Indicates that one of the verfication modes are enabled.
824 */
825#if (defined(IEM_VERIFICATION_MODE_FULL) || defined(IEM_VERIFICATION_MODE_MINIMAL)) && !defined(IEM_VERIFICATION_MODE) \
826 || defined(DOXYGEN_RUNNING)
827# define IEM_VERIFICATION_MODE
828#endif
829
830/**
831 * Indicates to the verifier that the given flag set is undefined.
832 *
833 * Can be invoked again to add more flags.
834 *
835 * This is a NOOP if the verifier isn't compiled in.
836 */
837#ifdef IEM_VERIFICATION_MODE_FULL
838# define IEMOP_VERIFICATION_UNDEFINED_EFLAGS(a_fEfl) do { pIemCpu->fUndefinedEFlags |= (a_fEfl); } while (0)
839#else
840# define IEMOP_VERIFICATION_UNDEFINED_EFLAGS(a_fEfl) do { } while (0)
841#endif
842
843
844/** @def IEM_DECL_IMPL_TYPE
845 * For typedef'ing an instruction implementation function.
846 *
847 * @param a_RetType The return type.
848 * @param a_Name The name of the type.
849 * @param a_ArgList The argument list enclosed in parentheses.
850 */
851
852/** @def IEM_DECL_IMPL_DEF
853 * For defining an instruction implementation function.
854 *
855 * @param a_RetType The return type.
856 * @param a_Name The name of the type.
857 * @param a_ArgList The argument list enclosed in parentheses.
858 */
859
860#if defined(__GNUC__) && defined(RT_ARCH_X86)
861# define IEM_DECL_IMPL_TYPE(a_RetType, a_Name, a_ArgList) \
862 __attribute__((__fastcall__)) a_RetType (a_Name) a_ArgList
863# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
864 __attribute__((__fastcall__, __nothrow__)) a_RetType a_Name a_ArgList
865
866#elif defined(_MSC_VER) && defined(RT_ARCH_X86)
867# define IEM_DECL_IMPL_TYPE(a_RetType, a_Name, a_ArgList) \
868 a_RetType (__fastcall a_Name) a_ArgList
869# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
870 a_RetType __fastcall a_Name a_ArgList
871
872#else
873# define IEM_DECL_IMPL_TYPE(a_RetType, a_Name, a_ArgList) \
874 a_RetType (VBOXCALL a_Name) a_ArgList
875# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
876 a_RetType VBOXCALL a_Name a_ArgList
877
878#endif
879
880/** @name Arithmetic assignment operations on bytes (binary).
881 * @{ */
882typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU8, (uint8_t *pu8Dst, uint8_t u8Src, uint32_t *pEFlags));
883typedef FNIEMAIMPLBINU8 *PFNIEMAIMPLBINU8;
884FNIEMAIMPLBINU8 iemAImpl_add_u8, iemAImpl_add_u8_locked;
885FNIEMAIMPLBINU8 iemAImpl_adc_u8, iemAImpl_adc_u8_locked;
886FNIEMAIMPLBINU8 iemAImpl_sub_u8, iemAImpl_sub_u8_locked;
887FNIEMAIMPLBINU8 iemAImpl_sbb_u8, iemAImpl_sbb_u8_locked;
888FNIEMAIMPLBINU8 iemAImpl_or_u8, iemAImpl_or_u8_locked;
889FNIEMAIMPLBINU8 iemAImpl_xor_u8, iemAImpl_xor_u8_locked;
890FNIEMAIMPLBINU8 iemAImpl_and_u8, iemAImpl_and_u8_locked;
891/** @} */
892
893/** @name Arithmetic assignment operations on words (binary).
894 * @{ */
895typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU16, (uint16_t *pu16Dst, uint16_t u16Src, uint32_t *pEFlags));
896typedef FNIEMAIMPLBINU16 *PFNIEMAIMPLBINU16;
897FNIEMAIMPLBINU16 iemAImpl_add_u16, iemAImpl_add_u16_locked;
898FNIEMAIMPLBINU16 iemAImpl_adc_u16, iemAImpl_adc_u16_locked;
899FNIEMAIMPLBINU16 iemAImpl_sub_u16, iemAImpl_sub_u16_locked;
900FNIEMAIMPLBINU16 iemAImpl_sbb_u16, iemAImpl_sbb_u16_locked;
901FNIEMAIMPLBINU16 iemAImpl_or_u16, iemAImpl_or_u16_locked;
902FNIEMAIMPLBINU16 iemAImpl_xor_u16, iemAImpl_xor_u16_locked;
903FNIEMAIMPLBINU16 iemAImpl_and_u16, iemAImpl_and_u16_locked;
904/** @} */
905
906/** @name Arithmetic assignment operations on double words (binary).
907 * @{ */
908typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU32, (uint32_t *pu32Dst, uint32_t u32Src, uint32_t *pEFlags));
909typedef FNIEMAIMPLBINU32 *PFNIEMAIMPLBINU32;
910FNIEMAIMPLBINU32 iemAImpl_add_u32, iemAImpl_add_u32_locked;
911FNIEMAIMPLBINU32 iemAImpl_adc_u32, iemAImpl_adc_u32_locked;
912FNIEMAIMPLBINU32 iemAImpl_sub_u32, iemAImpl_sub_u32_locked;
913FNIEMAIMPLBINU32 iemAImpl_sbb_u32, iemAImpl_sbb_u32_locked;
914FNIEMAIMPLBINU32 iemAImpl_or_u32, iemAImpl_or_u32_locked;
915FNIEMAIMPLBINU32 iemAImpl_xor_u32, iemAImpl_xor_u32_locked;
916FNIEMAIMPLBINU32 iemAImpl_and_u32, iemAImpl_and_u32_locked;
917/** @} */
918
919/** @name Arithmetic assignment operations on quad words (binary).
920 * @{ */
921typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU64, (uint64_t *pu64Dst, uint64_t u64Src, uint32_t *pEFlags));
922typedef FNIEMAIMPLBINU64 *PFNIEMAIMPLBINU64;
923FNIEMAIMPLBINU64 iemAImpl_add_u64, iemAImpl_add_u64_locked;
924FNIEMAIMPLBINU64 iemAImpl_adc_u64, iemAImpl_adc_u64_locked;
925FNIEMAIMPLBINU64 iemAImpl_sub_u64, iemAImpl_sub_u64_locked;
926FNIEMAIMPLBINU64 iemAImpl_sbb_u64, iemAImpl_sbb_u64_locked;
927FNIEMAIMPLBINU64 iemAImpl_or_u64, iemAImpl_or_u64_locked;
928FNIEMAIMPLBINU64 iemAImpl_xor_u64, iemAImpl_xor_u64_locked;
929FNIEMAIMPLBINU64 iemAImpl_and_u64, iemAImpl_and_u64_locked;
930/** @} */
931
932/** @name Compare operations (thrown in with the binary ops).
933 * @{ */
934FNIEMAIMPLBINU8 iemAImpl_cmp_u8;
935FNIEMAIMPLBINU16 iemAImpl_cmp_u16;
936FNIEMAIMPLBINU32 iemAImpl_cmp_u32;
937FNIEMAIMPLBINU64 iemAImpl_cmp_u64;
938/** @} */
939
940/** @name Test operations (thrown in with the binary ops).
941 * @{ */
942FNIEMAIMPLBINU8 iemAImpl_test_u8;
943FNIEMAIMPLBINU16 iemAImpl_test_u16;
944FNIEMAIMPLBINU32 iemAImpl_test_u32;
945FNIEMAIMPLBINU64 iemAImpl_test_u64;
946/** @} */
947
948/** @name Bit operations operations (thrown in with the binary ops).
949 * @{ */
950FNIEMAIMPLBINU16 iemAImpl_bt_u16, iemAImpl_bt_u16_locked;
951FNIEMAIMPLBINU32 iemAImpl_bt_u32, iemAImpl_bt_u32_locked;
952FNIEMAIMPLBINU64 iemAImpl_bt_u64, iemAImpl_bt_u64_locked;
953FNIEMAIMPLBINU16 iemAImpl_btc_u16, iemAImpl_btc_u16_locked;
954FNIEMAIMPLBINU32 iemAImpl_btc_u32, iemAImpl_btc_u32_locked;
955FNIEMAIMPLBINU64 iemAImpl_btc_u64, iemAImpl_btc_u64_locked;
956FNIEMAIMPLBINU16 iemAImpl_btr_u16, iemAImpl_btr_u16_locked;
957FNIEMAIMPLBINU32 iemAImpl_btr_u32, iemAImpl_btr_u32_locked;
958FNIEMAIMPLBINU64 iemAImpl_btr_u64, iemAImpl_btr_u64_locked;
959FNIEMAIMPLBINU16 iemAImpl_bts_u16, iemAImpl_bts_u16_locked;
960FNIEMAIMPLBINU32 iemAImpl_bts_u32, iemAImpl_bts_u32_locked;
961FNIEMAIMPLBINU64 iemAImpl_bts_u64, iemAImpl_bts_u64_locked;
962/** @} */
963
964/** @name Exchange memory with register operations.
965 * @{ */
966IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u8, (uint8_t *pu8Mem, uint8_t *pu8Reg));
967IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u16,(uint16_t *pu16Mem, uint16_t *pu16Reg));
968IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u32,(uint32_t *pu32Mem, uint32_t *pu32Reg));
969IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u64,(uint64_t *pu64Mem, uint64_t *pu64Reg));
970/** @} */
971
972/** @name Exchange and add operations.
973 * @{ */
974IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u8, (uint8_t *pu8Dst, uint8_t *pu8Reg, uint32_t *pEFlags));
975IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u16,(uint16_t *pu16Dst, uint16_t *pu16Reg, uint32_t *pEFlags));
976IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u32,(uint32_t *pu32Dst, uint32_t *pu32Reg, uint32_t *pEFlags));
977IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u64,(uint64_t *pu64Dst, uint64_t *pu64Reg, uint32_t *pEFlags));
978IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u8_locked, (uint8_t *pu8Dst, uint8_t *pu8Reg, uint32_t *pEFlags));
979IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u16_locked,(uint16_t *pu16Dst, uint16_t *pu16Reg, uint32_t *pEFlags));
980IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u32_locked,(uint32_t *pu32Dst, uint32_t *pu32Reg, uint32_t *pEFlags));
981IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u64_locked,(uint64_t *pu64Dst, uint64_t *pu64Reg, uint32_t *pEFlags));
982/** @} */
983
984/** @name Compare and exchange.
985 * @{ */
986IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u8, (uint8_t *pu8Dst, uint8_t *puAl, uint8_t uSrcReg, uint32_t *pEFlags));
987IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u8_locked, (uint8_t *pu8Dst, uint8_t *puAl, uint8_t uSrcReg, uint32_t *pEFlags));
988IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u16, (uint16_t *pu16Dst, uint16_t *puAx, uint16_t uSrcReg, uint32_t *pEFlags));
989IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u16_locked,(uint16_t *pu16Dst, uint16_t *puAx, uint16_t uSrcReg, uint32_t *pEFlags));
990IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u32, (uint32_t *pu32Dst, uint32_t *puEax, uint32_t uSrcReg, uint32_t *pEFlags));
991IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u32_locked,(uint32_t *pu32Dst, uint32_t *puEax, uint32_t uSrcReg, uint32_t *pEFlags));
992#ifdef RT_ARCH_X86
993IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u64, (uint64_t *pu64Dst, uint64_t *puRax, uint64_t *puSrcReg, uint32_t *pEFlags));
994IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u64_locked,(uint64_t *pu64Dst, uint64_t *puRax, uint64_t *puSrcReg, uint32_t *pEFlags));
995#else
996IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u64, (uint64_t *pu64Dst, uint64_t *puRax, uint64_t uSrcReg, uint32_t *pEFlags));
997IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u64_locked,(uint64_t *pu64Dst, uint64_t *puRax, uint64_t uSrcReg, uint32_t *pEFlags));
998#endif
999IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg8b,(uint64_t *pu64Dst, PRTUINT64U pu64EaxEdx, PRTUINT64U pu64EbxEcx,
1000 uint32_t *pEFlags));
1001IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg8b_locked,(uint64_t *pu64Dst, PRTUINT64U pu64EaxEdx, PRTUINT64U pu64EbxEcx,
1002 uint32_t *pEFlags));
1003IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg16b,(PRTUINT128U *pu128Dst, PRTUINT128U pu64RaxRdx, PRTUINT128U pu64RbxRcx,
1004 uint32_t *pEFlags));
1005IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg16b_locked,(PRTUINT128U *pu128Dst, PRTUINT128U pu64RaxRdx, PRTUINT128U pu64RbxRcx,
1006 uint32_t *pEFlags));
1007/** @} */
1008
1009/** @name Memory ordering
1010 * @{ */
1011typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEMFENCE,(void));
1012typedef FNIEMAIMPLMEMFENCE *PFNIEMAIMPLMEMFENCE;
1013IEM_DECL_IMPL_DEF(void, iemAImpl_mfence,(void));
1014IEM_DECL_IMPL_DEF(void, iemAImpl_sfence,(void));
1015IEM_DECL_IMPL_DEF(void, iemAImpl_lfence,(void));
1016IEM_DECL_IMPL_DEF(void, iemAImpl_alt_mem_fence,(void));
1017/** @} */
1018
1019/** @name Double precision shifts
1020 * @{ */
1021typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTDBLU16,(uint16_t *pu16Dst, uint16_t u16Src, uint8_t cShift, uint32_t *pEFlags));
1022typedef FNIEMAIMPLSHIFTDBLU16 *PFNIEMAIMPLSHIFTDBLU16;
1023typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTDBLU32,(uint32_t *pu32Dst, uint32_t u32Src, uint8_t cShift, uint32_t *pEFlags));
1024typedef FNIEMAIMPLSHIFTDBLU32 *PFNIEMAIMPLSHIFTDBLU32;
1025typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTDBLU64,(uint64_t *pu64Dst, uint64_t u64Src, uint8_t cShift, uint32_t *pEFlags));
1026typedef FNIEMAIMPLSHIFTDBLU64 *PFNIEMAIMPLSHIFTDBLU64;
1027FNIEMAIMPLSHIFTDBLU16 iemAImpl_shld_u16;
1028FNIEMAIMPLSHIFTDBLU32 iemAImpl_shld_u32;
1029FNIEMAIMPLSHIFTDBLU64 iemAImpl_shld_u64;
1030FNIEMAIMPLSHIFTDBLU16 iemAImpl_shrd_u16;
1031FNIEMAIMPLSHIFTDBLU32 iemAImpl_shrd_u32;
1032FNIEMAIMPLSHIFTDBLU64 iemAImpl_shrd_u64;
1033/** @} */
1034
1035
1036/** @name Bit search operations (thrown in with the binary ops).
1037 * @{ */
1038FNIEMAIMPLBINU16 iemAImpl_bsf_u16;
1039FNIEMAIMPLBINU32 iemAImpl_bsf_u32;
1040FNIEMAIMPLBINU64 iemAImpl_bsf_u64;
1041FNIEMAIMPLBINU16 iemAImpl_bsr_u16;
1042FNIEMAIMPLBINU32 iemAImpl_bsr_u32;
1043FNIEMAIMPLBINU64 iemAImpl_bsr_u64;
1044/** @} */
1045
1046/** @name Signed multiplication operations (thrown in with the binary ops).
1047 * @{ */
1048FNIEMAIMPLBINU16 iemAImpl_imul_two_u16;
1049FNIEMAIMPLBINU32 iemAImpl_imul_two_u32;
1050FNIEMAIMPLBINU64 iemAImpl_imul_two_u64;
1051/** @} */
1052
1053/** @name Arithmetic assignment operations on bytes (unary).
1054 * @{ */
1055typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU8, (uint8_t *pu8Dst, uint32_t *pEFlags));
1056typedef FNIEMAIMPLUNARYU8 *PFNIEMAIMPLUNARYU8;
1057FNIEMAIMPLUNARYU8 iemAImpl_inc_u8, iemAImpl_inc_u8_locked;
1058FNIEMAIMPLUNARYU8 iemAImpl_dec_u8, iemAImpl_dec_u8_locked;
1059FNIEMAIMPLUNARYU8 iemAImpl_not_u8, iemAImpl_not_u8_locked;
1060FNIEMAIMPLUNARYU8 iemAImpl_neg_u8, iemAImpl_neg_u8_locked;
1061/** @} */
1062
1063/** @name Arithmetic assignment operations on words (unary).
1064 * @{ */
1065typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU16, (uint16_t *pu16Dst, uint32_t *pEFlags));
1066typedef FNIEMAIMPLUNARYU16 *PFNIEMAIMPLUNARYU16;
1067FNIEMAIMPLUNARYU16 iemAImpl_inc_u16, iemAImpl_inc_u16_locked;
1068FNIEMAIMPLUNARYU16 iemAImpl_dec_u16, iemAImpl_dec_u16_locked;
1069FNIEMAIMPLUNARYU16 iemAImpl_not_u16, iemAImpl_not_u16_locked;
1070FNIEMAIMPLUNARYU16 iemAImpl_neg_u16, iemAImpl_neg_u16_locked;
1071/** @} */
1072
1073/** @name Arithmetic assignment operations on double words (unary).
1074 * @{ */
1075typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU32, (uint32_t *pu32Dst, uint32_t *pEFlags));
1076typedef FNIEMAIMPLUNARYU32 *PFNIEMAIMPLUNARYU32;
1077FNIEMAIMPLUNARYU32 iemAImpl_inc_u32, iemAImpl_inc_u32_locked;
1078FNIEMAIMPLUNARYU32 iemAImpl_dec_u32, iemAImpl_dec_u32_locked;
1079FNIEMAIMPLUNARYU32 iemAImpl_not_u32, iemAImpl_not_u32_locked;
1080FNIEMAIMPLUNARYU32 iemAImpl_neg_u32, iemAImpl_neg_u32_locked;
1081/** @} */
1082
1083/** @name Arithmetic assignment operations on quad words (unary).
1084 * @{ */
1085typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU64, (uint64_t *pu64Dst, uint32_t *pEFlags));
1086typedef FNIEMAIMPLUNARYU64 *PFNIEMAIMPLUNARYU64;
1087FNIEMAIMPLUNARYU64 iemAImpl_inc_u64, iemAImpl_inc_u64_locked;
1088FNIEMAIMPLUNARYU64 iemAImpl_dec_u64, iemAImpl_dec_u64_locked;
1089FNIEMAIMPLUNARYU64 iemAImpl_not_u64, iemAImpl_not_u64_locked;
1090FNIEMAIMPLUNARYU64 iemAImpl_neg_u64, iemAImpl_neg_u64_locked;
1091/** @} */
1092
1093
1094/** @name Shift operations on bytes (Group 2).
1095 * @{ */
1096typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU8,(uint8_t *pu8Dst, uint8_t cShift, uint32_t *pEFlags));
1097typedef FNIEMAIMPLSHIFTU8 *PFNIEMAIMPLSHIFTU8;
1098FNIEMAIMPLSHIFTU8 iemAImpl_rol_u8;
1099FNIEMAIMPLSHIFTU8 iemAImpl_ror_u8;
1100FNIEMAIMPLSHIFTU8 iemAImpl_rcl_u8;
1101FNIEMAIMPLSHIFTU8 iemAImpl_rcr_u8;
1102FNIEMAIMPLSHIFTU8 iemAImpl_shl_u8;
1103FNIEMAIMPLSHIFTU8 iemAImpl_shr_u8;
1104FNIEMAIMPLSHIFTU8 iemAImpl_sar_u8;
1105/** @} */
1106
1107/** @name Shift operations on words (Group 2).
1108 * @{ */
1109typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU16,(uint16_t *pu16Dst, uint8_t cShift, uint32_t *pEFlags));
1110typedef FNIEMAIMPLSHIFTU16 *PFNIEMAIMPLSHIFTU16;
1111FNIEMAIMPLSHIFTU16 iemAImpl_rol_u16;
1112FNIEMAIMPLSHIFTU16 iemAImpl_ror_u16;
1113FNIEMAIMPLSHIFTU16 iemAImpl_rcl_u16;
1114FNIEMAIMPLSHIFTU16 iemAImpl_rcr_u16;
1115FNIEMAIMPLSHIFTU16 iemAImpl_shl_u16;
1116FNIEMAIMPLSHIFTU16 iemAImpl_shr_u16;
1117FNIEMAIMPLSHIFTU16 iemAImpl_sar_u16;
1118/** @} */
1119
1120/** @name Shift operations on double words (Group 2).
1121 * @{ */
1122typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU32,(uint32_t *pu32Dst, uint8_t cShift, uint32_t *pEFlags));
1123typedef FNIEMAIMPLSHIFTU32 *PFNIEMAIMPLSHIFTU32;
1124FNIEMAIMPLSHIFTU32 iemAImpl_rol_u32;
1125FNIEMAIMPLSHIFTU32 iemAImpl_ror_u32;
1126FNIEMAIMPLSHIFTU32 iemAImpl_rcl_u32;
1127FNIEMAIMPLSHIFTU32 iemAImpl_rcr_u32;
1128FNIEMAIMPLSHIFTU32 iemAImpl_shl_u32;
1129FNIEMAIMPLSHIFTU32 iemAImpl_shr_u32;
1130FNIEMAIMPLSHIFTU32 iemAImpl_sar_u32;
1131/** @} */
1132
1133/** @name Shift operations on words (Group 2).
1134 * @{ */
1135typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU64,(uint64_t *pu64Dst, uint8_t cShift, uint32_t *pEFlags));
1136typedef FNIEMAIMPLSHIFTU64 *PFNIEMAIMPLSHIFTU64;
1137FNIEMAIMPLSHIFTU64 iemAImpl_rol_u64;
1138FNIEMAIMPLSHIFTU64 iemAImpl_ror_u64;
1139FNIEMAIMPLSHIFTU64 iemAImpl_rcl_u64;
1140FNIEMAIMPLSHIFTU64 iemAImpl_rcr_u64;
1141FNIEMAIMPLSHIFTU64 iemAImpl_shl_u64;
1142FNIEMAIMPLSHIFTU64 iemAImpl_shr_u64;
1143FNIEMAIMPLSHIFTU64 iemAImpl_sar_u64;
1144/** @} */
1145
1146/** @name Multiplication and division operations.
1147 * @{ */
1148typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU8,(uint16_t *pu16AX, uint8_t u8FactorDivisor, uint32_t *pEFlags));
1149typedef FNIEMAIMPLMULDIVU8 *PFNIEMAIMPLMULDIVU8;
1150FNIEMAIMPLMULDIVU8 iemAImpl_mul_u8, iemAImpl_imul_u8;
1151FNIEMAIMPLMULDIVU8 iemAImpl_div_u8, iemAImpl_idiv_u8;
1152
1153typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU16,(uint16_t *pu16AX, uint16_t *pu16DX, uint16_t u16FactorDivisor, uint32_t *pEFlags));
1154typedef FNIEMAIMPLMULDIVU16 *PFNIEMAIMPLMULDIVU16;
1155FNIEMAIMPLMULDIVU16 iemAImpl_mul_u16, iemAImpl_imul_u16;
1156FNIEMAIMPLMULDIVU16 iemAImpl_div_u16, iemAImpl_idiv_u16;
1157
1158typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU32,(uint32_t *pu32EAX, uint32_t *pu32EDX, uint32_t u32FactorDivisor, uint32_t *pEFlags));
1159typedef FNIEMAIMPLMULDIVU32 *PFNIEMAIMPLMULDIVU32;
1160FNIEMAIMPLMULDIVU32 iemAImpl_mul_u32, iemAImpl_imul_u32;
1161FNIEMAIMPLMULDIVU32 iemAImpl_div_u32, iemAImpl_idiv_u32;
1162
1163typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU64,(uint64_t *pu64RAX, uint64_t *pu64RDX, uint64_t u64FactorDivisor, uint32_t *pEFlags));
1164typedef FNIEMAIMPLMULDIVU64 *PFNIEMAIMPLMULDIVU64;
1165FNIEMAIMPLMULDIVU64 iemAImpl_mul_u64, iemAImpl_imul_u64;
1166FNIEMAIMPLMULDIVU64 iemAImpl_div_u64, iemAImpl_idiv_u64;
1167/** @} */
1168
1169/** @name Byte Swap.
1170 * @{ */
1171IEM_DECL_IMPL_TYPE(void, iemAImpl_bswap_u16,(uint32_t *pu32Dst)); /* Yes, 32-bit register access. */
1172IEM_DECL_IMPL_TYPE(void, iemAImpl_bswap_u32,(uint32_t *pu32Dst));
1173IEM_DECL_IMPL_TYPE(void, iemAImpl_bswap_u64,(uint64_t *pu64Dst));
1174/** @} */
1175
1176/** @name Misc.
1177 * @{ */
1178FNIEMAIMPLBINU16 iemAImpl_arpl;
1179/** @} */
1180
1181
1182/** @name FPU operations taking a 32-bit float argument
1183 * @{ */
1184typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR32FSW,(PCX86FXSTATE pFpuState, uint16_t *pFSW,
1185 PCRTFLOAT80U pr80Val1, PCRTFLOAT32U pr32Val2));
1186typedef FNIEMAIMPLFPUR32FSW *PFNIEMAIMPLFPUR32FSW;
1187
1188typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR32,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1189 PCRTFLOAT80U pr80Val1, PCRTFLOAT32U pr32Val2));
1190typedef FNIEMAIMPLFPUR32 *PFNIEMAIMPLFPUR32;
1191
1192FNIEMAIMPLFPUR32FSW iemAImpl_fcom_r80_by_r32;
1193FNIEMAIMPLFPUR32 iemAImpl_fadd_r80_by_r32;
1194FNIEMAIMPLFPUR32 iemAImpl_fmul_r80_by_r32;
1195FNIEMAIMPLFPUR32 iemAImpl_fsub_r80_by_r32;
1196FNIEMAIMPLFPUR32 iemAImpl_fsubr_r80_by_r32;
1197FNIEMAIMPLFPUR32 iemAImpl_fdiv_r80_by_r32;
1198FNIEMAIMPLFPUR32 iemAImpl_fdivr_r80_by_r32;
1199
1200IEM_DECL_IMPL_DEF(void, iemAImpl_fld_r32_to_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTFLOAT32U pr32Val));
1201IEM_DECL_IMPL_DEF(void, iemAImpl_fst_r80_to_r32,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1202 PRTFLOAT32U pr32Val, PCRTFLOAT80U pr80Val));
1203/** @} */
1204
1205/** @name FPU operations taking a 64-bit float argument
1206 * @{ */
1207typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR64,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1208 PCRTFLOAT80U pr80Val1, PCRTFLOAT64U pr64Val2));
1209typedef FNIEMAIMPLFPUR64 *PFNIEMAIMPLFPUR64;
1210
1211FNIEMAIMPLFPUR64 iemAImpl_fadd_r80_by_r64;
1212FNIEMAIMPLFPUR64 iemAImpl_fmul_r80_by_r64;
1213FNIEMAIMPLFPUR64 iemAImpl_fsub_r80_by_r64;
1214FNIEMAIMPLFPUR64 iemAImpl_fsubr_r80_by_r64;
1215FNIEMAIMPLFPUR64 iemAImpl_fdiv_r80_by_r64;
1216FNIEMAIMPLFPUR64 iemAImpl_fdivr_r80_by_r64;
1217
1218IEM_DECL_IMPL_DEF(void, iemAImpl_fcom_r80_by_r64,(PCX86FXSTATE pFpuState, uint16_t *pFSW,
1219 PCRTFLOAT80U pr80Val1, PCRTFLOAT64U pr64Val2));
1220IEM_DECL_IMPL_DEF(void, iemAImpl_fld_r64_to_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTFLOAT64U pr64Val));
1221IEM_DECL_IMPL_DEF(void, iemAImpl_fst_r80_to_r64,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1222 PRTFLOAT64U pr32Val, PCRTFLOAT80U pr80Val));
1223/** @} */
1224
1225/** @name FPU operations taking a 80-bit float argument
1226 * @{ */
1227typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1228 PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2));
1229typedef FNIEMAIMPLFPUR80 *PFNIEMAIMPLFPUR80;
1230FNIEMAIMPLFPUR80 iemAImpl_fadd_r80_by_r80;
1231FNIEMAIMPLFPUR80 iemAImpl_fmul_r80_by_r80;
1232FNIEMAIMPLFPUR80 iemAImpl_fsub_r80_by_r80;
1233FNIEMAIMPLFPUR80 iemAImpl_fsubr_r80_by_r80;
1234FNIEMAIMPLFPUR80 iemAImpl_fdiv_r80_by_r80;
1235FNIEMAIMPLFPUR80 iemAImpl_fdivr_r80_by_r80;
1236FNIEMAIMPLFPUR80 iemAImpl_fprem_r80_by_r80;
1237FNIEMAIMPLFPUR80 iemAImpl_fprem1_r80_by_r80;
1238FNIEMAIMPLFPUR80 iemAImpl_fscale_r80_by_r80;
1239
1240FNIEMAIMPLFPUR80 iemAImpl_fpatan_r80_by_r80;
1241FNIEMAIMPLFPUR80 iemAImpl_fyl2xp1_r80_by_r80;
1242
1243typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80FSW,(PCX86FXSTATE pFpuState, uint16_t *pFSW,
1244 PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2));
1245typedef FNIEMAIMPLFPUR80FSW *PFNIEMAIMPLFPUR80FSW;
1246FNIEMAIMPLFPUR80FSW iemAImpl_fcom_r80_by_r80;
1247FNIEMAIMPLFPUR80FSW iemAImpl_fucom_r80_by_r80;
1248
1249typedef IEM_DECL_IMPL_TYPE(uint32_t, FNIEMAIMPLFPUR80EFL,(PCX86FXSTATE pFpuState, uint16_t *pu16Fsw,
1250 PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2));
1251typedef FNIEMAIMPLFPUR80EFL *PFNIEMAIMPLFPUR80EFL;
1252FNIEMAIMPLFPUR80EFL iemAImpl_fcomi_r80_by_r80;
1253FNIEMAIMPLFPUR80EFL iemAImpl_fucomi_r80_by_r80;
1254
1255typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80UNARY,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTFLOAT80U pr80Val));
1256typedef FNIEMAIMPLFPUR80UNARY *PFNIEMAIMPLFPUR80UNARY;
1257FNIEMAIMPLFPUR80UNARY iemAImpl_fabs_r80;
1258FNIEMAIMPLFPUR80UNARY iemAImpl_fchs_r80;
1259FNIEMAIMPLFPUR80UNARY iemAImpl_f2xm1_r80;
1260FNIEMAIMPLFPUR80UNARY iemAImpl_fyl2x_r80;
1261FNIEMAIMPLFPUR80UNARY iemAImpl_fsqrt_r80;
1262FNIEMAIMPLFPUR80UNARY iemAImpl_frndint_r80;
1263FNIEMAIMPLFPUR80UNARY iemAImpl_fsin_r80;
1264FNIEMAIMPLFPUR80UNARY iemAImpl_fcos_r80;
1265
1266typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80UNARYFSW,(PCX86FXSTATE pFpuState, uint16_t *pu16Fsw, PCRTFLOAT80U pr80Val));
1267typedef FNIEMAIMPLFPUR80UNARYFSW *PFNIEMAIMPLFPUR80UNARYFSW;
1268FNIEMAIMPLFPUR80UNARYFSW iemAImpl_ftst_r80;
1269FNIEMAIMPLFPUR80UNARYFSW iemAImpl_fxam_r80;
1270
1271typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80LDCONST,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes));
1272typedef FNIEMAIMPLFPUR80LDCONST *PFNIEMAIMPLFPUR80LDCONST;
1273FNIEMAIMPLFPUR80LDCONST iemAImpl_fld1;
1274FNIEMAIMPLFPUR80LDCONST iemAImpl_fldl2t;
1275FNIEMAIMPLFPUR80LDCONST iemAImpl_fldl2e;
1276FNIEMAIMPLFPUR80LDCONST iemAImpl_fldpi;
1277FNIEMAIMPLFPUR80LDCONST iemAImpl_fldlg2;
1278FNIEMAIMPLFPUR80LDCONST iemAImpl_fldln2;
1279FNIEMAIMPLFPUR80LDCONST iemAImpl_fldz;
1280
1281typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80UNARYTWO,(PCX86FXSTATE pFpuState, PIEMFPURESULTTWO pFpuResTwo,
1282 PCRTFLOAT80U pr80Val));
1283typedef FNIEMAIMPLFPUR80UNARYTWO *PFNIEMAIMPLFPUR80UNARYTWO;
1284FNIEMAIMPLFPUR80UNARYTWO iemAImpl_fptan_r80_r80;
1285FNIEMAIMPLFPUR80UNARYTWO iemAImpl_fxtract_r80_r80;
1286FNIEMAIMPLFPUR80UNARYTWO iemAImpl_fsincos_r80_r80;
1287
1288IEM_DECL_IMPL_DEF(void, iemAImpl_fld_r80_from_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTFLOAT80U pr80Val));
1289IEM_DECL_IMPL_DEF(void, iemAImpl_fst_r80_to_r80,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1290 PRTFLOAT80U pr80Dst, PCRTFLOAT80U pr80Src));
1291
1292/** @} */
1293
1294/** @name FPU operations taking a 16-bit signed integer argument
1295 * @{ */
1296typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUI16,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1297 PCRTFLOAT80U pr80Val1, int16_t const *pi16Val2));
1298typedef FNIEMAIMPLFPUI16 *PFNIEMAIMPLFPUI16;
1299
1300FNIEMAIMPLFPUI16 iemAImpl_fiadd_r80_by_i16;
1301FNIEMAIMPLFPUI16 iemAImpl_fimul_r80_by_i16;
1302FNIEMAIMPLFPUI16 iemAImpl_fisub_r80_by_i16;
1303FNIEMAIMPLFPUI16 iemAImpl_fisubr_r80_by_i16;
1304FNIEMAIMPLFPUI16 iemAImpl_fidiv_r80_by_i16;
1305FNIEMAIMPLFPUI16 iemAImpl_fidivr_r80_by_i16;
1306
1307IEM_DECL_IMPL_DEF(void, iemAImpl_ficom_r80_by_i16,(PCX86FXSTATE pFpuState, uint16_t *pu16Fsw,
1308 PCRTFLOAT80U pr80Val1, int16_t const *pi16Val2));
1309
1310IEM_DECL_IMPL_DEF(void, iemAImpl_fild_i16_to_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, int16_t const *pi16Val));
1311IEM_DECL_IMPL_DEF(void, iemAImpl_fist_r80_to_i16,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1312 int16_t *pi16Val, PCRTFLOAT80U pr80Val));
1313IEM_DECL_IMPL_DEF(void, iemAImpl_fistt_r80_to_i16,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1314 int16_t *pi16Val, PCRTFLOAT80U pr80Val));
1315/** @} */
1316
1317/** @name FPU operations taking a 32-bit signed integer argument
1318 * @{ */
1319typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUI32,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1320 PCRTFLOAT80U pr80Val1, int32_t const *pi32Val2));
1321typedef FNIEMAIMPLFPUI32 *PFNIEMAIMPLFPUI32;
1322
1323FNIEMAIMPLFPUI32 iemAImpl_fiadd_r80_by_i32;
1324FNIEMAIMPLFPUI32 iemAImpl_fimul_r80_by_i32;
1325FNIEMAIMPLFPUI32 iemAImpl_fisub_r80_by_i32;
1326FNIEMAIMPLFPUI32 iemAImpl_fisubr_r80_by_i32;
1327FNIEMAIMPLFPUI32 iemAImpl_fidiv_r80_by_i32;
1328FNIEMAIMPLFPUI32 iemAImpl_fidivr_r80_by_i32;
1329
1330IEM_DECL_IMPL_DEF(void, iemAImpl_ficom_r80_by_i32,(PCX86FXSTATE pFpuState, uint16_t *pu16Fsw,
1331 PCRTFLOAT80U pr80Val1, int32_t const *pi32Val2));
1332
1333IEM_DECL_IMPL_DEF(void, iemAImpl_fild_i32_to_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, int32_t const *pi32Val));
1334IEM_DECL_IMPL_DEF(void, iemAImpl_fist_r80_to_i32,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1335 int32_t *pi32Val, PCRTFLOAT80U pr80Val));
1336IEM_DECL_IMPL_DEF(void, iemAImpl_fistt_r80_to_i32,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1337 int32_t *pi32Val, PCRTFLOAT80U pr80Val));
1338/** @} */
1339
1340/** @name FPU operations taking a 64-bit signed integer argument
1341 * @{ */
1342typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUI64,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1343 PCRTFLOAT80U pr80Val1, int64_t const *pi64Val2));
1344typedef FNIEMAIMPLFPUI64 *PFNIEMAIMPLFPUI64;
1345
1346FNIEMAIMPLFPUI64 iemAImpl_fiadd_r80_by_i64;
1347FNIEMAIMPLFPUI64 iemAImpl_fimul_r80_by_i64;
1348FNIEMAIMPLFPUI64 iemAImpl_fisub_r80_by_i64;
1349FNIEMAIMPLFPUI64 iemAImpl_fisubr_r80_by_i64;
1350FNIEMAIMPLFPUI64 iemAImpl_fidiv_r80_by_i64;
1351FNIEMAIMPLFPUI64 iemAImpl_fidivr_r80_by_i64;
1352
1353IEM_DECL_IMPL_DEF(void, iemAImpl_ficom_r80_by_i64,(PCX86FXSTATE pFpuState, uint16_t *pu16Fsw,
1354 PCRTFLOAT80U pr80Val1, int64_t const *pi64Val2));
1355
1356IEM_DECL_IMPL_DEF(void, iemAImpl_fild_i64_to_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, int64_t const *pi64Val));
1357IEM_DECL_IMPL_DEF(void, iemAImpl_fist_r80_to_i64,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1358 int64_t *pi64Val, PCRTFLOAT80U pr80Val));
1359IEM_DECL_IMPL_DEF(void, iemAImpl_fistt_r80_to_i64,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1360 int64_t *pi32Val, PCRTFLOAT80U pr80Val));
1361/** @} */
1362
1363
1364/** Temporary type representing a 256-bit vector register. */
1365typedef struct {uint64_t au64[4]; } IEMVMM256;
1366/** Temporary type pointing to a 256-bit vector register. */
1367typedef IEMVMM256 *PIEMVMM256;
1368/** Temporary type pointing to a const 256-bit vector register. */
1369typedef IEMVMM256 *PCIEMVMM256;
1370
1371
1372/** @name Media (SSE/MMX/AVX) operations: full1 + full2 -> full1.
1373 * @{ */
1374typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAF2U64,(PCX86FXSTATE pFpuState, uint64_t *pu64Dst, uint64_t const *pu64Src));
1375typedef FNIEMAIMPLMEDIAF2U64 *PFNIEMAIMPLMEDIAF2U64;
1376typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAF2U128,(PCX86FXSTATE pFpuState, uint128_t *pu128Dst, uint128_t const *pu128Src));
1377typedef FNIEMAIMPLMEDIAF2U128 *PFNIEMAIMPLMEDIAF2U128;
1378FNIEMAIMPLMEDIAF2U64 iemAImpl_pxor_u64, iemAImpl_pcmpeqb_u64, iemAImpl_pcmpeqw_u64, iemAImpl_pcmpeqd_u64;
1379FNIEMAIMPLMEDIAF2U128 iemAImpl_pxor_u128, iemAImpl_pcmpeqb_u128, iemAImpl_pcmpeqw_u128, iemAImpl_pcmpeqd_u128;
1380/** @} */
1381
1382/** @name Media (SSE/MMX/AVX) operations: lowhalf1 + lowhalf1 -> full1.
1383 * @{ */
1384typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAF1L1U64,(PCX86FXSTATE pFpuState, uint64_t *pu64Dst, uint32_t const *pu32Src));
1385typedef FNIEMAIMPLMEDIAF1L1U64 *PFNIEMAIMPLMEDIAF1L1U64;
1386typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAF1L1U128,(PCX86FXSTATE pFpuState, uint128_t *pu128Dst, uint64_t const *pu64Src));
1387typedef FNIEMAIMPLMEDIAF1L1U128 *PFNIEMAIMPLMEDIAF1L1U128;
1388FNIEMAIMPLMEDIAF1L1U64 iemAImpl_punpcklbw_u64, iemAImpl_punpcklwd_u64, iemAImpl_punpckldq_u64;
1389FNIEMAIMPLMEDIAF1L1U128 iemAImpl_punpcklbw_u128, iemAImpl_punpcklwd_u128, iemAImpl_punpckldq_u128, iemAImpl_punpcklqdq_u128;
1390/** @} */
1391
1392/** @name Media (SSE/MMX/AVX) operations: hihalf1 + hihalf2 -> full1.
1393 * @{ */
1394typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAF1H1U64,(PCX86FXSTATE pFpuState, uint64_t *pu64Dst, uint64_t const *pu64Src));
1395typedef FNIEMAIMPLMEDIAF2U64 *PFNIEMAIMPLMEDIAF1H1U64;
1396typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAF1H1U128,(PCX86FXSTATE pFpuState, uint128_t *pu128Dst, uint128_t const *pu128Src));
1397typedef FNIEMAIMPLMEDIAF2U128 *PFNIEMAIMPLMEDIAF1H1U128;
1398FNIEMAIMPLMEDIAF1H1U64 iemAImpl_punpckhbw_u64, iemAImpl_punpckhwd_u64, iemAImpl_punpckhdq_u64;
1399FNIEMAIMPLMEDIAF1H1U128 iemAImpl_punpckhbw_u128, iemAImpl_punpckhwd_u128, iemAImpl_punpckhdq_u128, iemAImpl_punpckhqdq_u128;
1400/** @} */
1401
1402/** @name Media (SSE/MMX/AVX) operation: Packed Shuffle Stuff (evil)
1403 * @{ */
1404typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAPSHUF,(PCX86FXSTATE pFpuState, uint128_t *pu128Dst,
1405 uint128_t const *pu128Src, uint8_t bEvil));
1406typedef FNIEMAIMPLMEDIAPSHUF *PFNIEMAIMPLMEDIAPSHUF;
1407FNIEMAIMPLMEDIAPSHUF iemAImpl_pshufhw, iemAImpl_pshuflw, iemAImpl_pshufd;
1408IEM_DECL_IMPL_DEF(void, iemAImpl_pshufw,(PCX86FXSTATE pFpuState, uint64_t *pu64Dst, uint64_t const *pu64Src, uint8_t bEvil));
1409/** @} */
1410
1411/** @name Media (SSE/MMX/AVX) operation: Move Byte Mask
1412 * @{ */
1413IEM_DECL_IMPL_DEF(void, iemAImpl_pmovmskb_u64,(PCX86FXSTATE pFpuState, uint64_t *pu64Dst, uint64_t const *pu64Src));
1414IEM_DECL_IMPL_DEF(void, iemAImpl_pmovmskb_u128,(PCX86FXSTATE pFpuState, uint64_t *pu64Dst, uint128_t const *pu128Src));
1415/** @} */
1416
1417
1418
1419/** @name Function tables.
1420 * @{
1421 */
1422
1423/**
1424 * Function table for a binary operator providing implementation based on
1425 * operand size.
1426 */
1427typedef struct IEMOPBINSIZES
1428{
1429 PFNIEMAIMPLBINU8 pfnNormalU8, pfnLockedU8;
1430 PFNIEMAIMPLBINU16 pfnNormalU16, pfnLockedU16;
1431 PFNIEMAIMPLBINU32 pfnNormalU32, pfnLockedU32;
1432 PFNIEMAIMPLBINU64 pfnNormalU64, pfnLockedU64;
1433} IEMOPBINSIZES;
1434/** Pointer to a binary operator function table. */
1435typedef IEMOPBINSIZES const *PCIEMOPBINSIZES;
1436
1437
1438/**
1439 * Function table for a unary operator providing implementation based on
1440 * operand size.
1441 */
1442typedef struct IEMOPUNARYSIZES
1443{
1444 PFNIEMAIMPLUNARYU8 pfnNormalU8, pfnLockedU8;
1445 PFNIEMAIMPLUNARYU16 pfnNormalU16, pfnLockedU16;
1446 PFNIEMAIMPLUNARYU32 pfnNormalU32, pfnLockedU32;
1447 PFNIEMAIMPLUNARYU64 pfnNormalU64, pfnLockedU64;
1448} IEMOPUNARYSIZES;
1449/** Pointer to a unary operator function table. */
1450typedef IEMOPUNARYSIZES const *PCIEMOPUNARYSIZES;
1451
1452
1453/**
1454 * Function table for a shift operator providing implementation based on
1455 * operand size.
1456 */
1457typedef struct IEMOPSHIFTSIZES
1458{
1459 PFNIEMAIMPLSHIFTU8 pfnNormalU8;
1460 PFNIEMAIMPLSHIFTU16 pfnNormalU16;
1461 PFNIEMAIMPLSHIFTU32 pfnNormalU32;
1462 PFNIEMAIMPLSHIFTU64 pfnNormalU64;
1463} IEMOPSHIFTSIZES;
1464/** Pointer to a shift operator function table. */
1465typedef IEMOPSHIFTSIZES const *PCIEMOPSHIFTSIZES;
1466
1467
1468/**
1469 * Function table for a multiplication or division operation.
1470 */
1471typedef struct IEMOPMULDIVSIZES
1472{
1473 PFNIEMAIMPLMULDIVU8 pfnU8;
1474 PFNIEMAIMPLMULDIVU16 pfnU16;
1475 PFNIEMAIMPLMULDIVU32 pfnU32;
1476 PFNIEMAIMPLMULDIVU64 pfnU64;
1477} IEMOPMULDIVSIZES;
1478/** Pointer to a multiplication or division operation function table. */
1479typedef IEMOPMULDIVSIZES const *PCIEMOPMULDIVSIZES;
1480
1481
1482/**
1483 * Function table for a double precision shift operator providing implementation
1484 * based on operand size.
1485 */
1486typedef struct IEMOPSHIFTDBLSIZES
1487{
1488 PFNIEMAIMPLSHIFTDBLU16 pfnNormalU16;
1489 PFNIEMAIMPLSHIFTDBLU32 pfnNormalU32;
1490 PFNIEMAIMPLSHIFTDBLU64 pfnNormalU64;
1491} IEMOPSHIFTDBLSIZES;
1492/** Pointer to a double precision shift function table. */
1493typedef IEMOPSHIFTDBLSIZES const *PCIEMOPSHIFTDBLSIZES;
1494
1495
1496/**
1497 * Function table for media instruction taking two full sized media registers,
1498 * optionally the 2nd being a memory reference (only modifying the first op.)
1499 */
1500typedef struct IEMOPMEDIAF2
1501{
1502 PFNIEMAIMPLMEDIAF2U64 pfnU64;
1503 PFNIEMAIMPLMEDIAF2U128 pfnU128;
1504} IEMOPMEDIAF2;
1505/** Pointer to a media operation function table for full sized ops. */
1506typedef IEMOPMEDIAF2 const *PCIEMOPMEDIAF2;
1507
1508/**
1509 * Function table for media instruction taking taking one full and one lower
1510 * half media register.
1511 */
1512typedef struct IEMOPMEDIAF1L1
1513{
1514 PFNIEMAIMPLMEDIAF1L1U64 pfnU64;
1515 PFNIEMAIMPLMEDIAF1L1U128 pfnU128;
1516} IEMOPMEDIAF1L1;
1517/** Pointer to a media operation function table for lowhalf+lowhalf -> full. */
1518typedef IEMOPMEDIAF1L1 const *PCIEMOPMEDIAF1L1;
1519
1520/**
1521 * Function table for media instruction taking taking one full and one high half
1522 * media register.
1523 */
1524typedef struct IEMOPMEDIAF1H1
1525{
1526 PFNIEMAIMPLMEDIAF1H1U64 pfnU64;
1527 PFNIEMAIMPLMEDIAF1H1U128 pfnU128;
1528} IEMOPMEDIAF1H1;
1529/** Pointer to a media operation function table for hihalf+hihalf -> full. */
1530typedef IEMOPMEDIAF1H1 const *PCIEMOPMEDIAF1H1;
1531
1532
1533/** @} */
1534
1535
1536/** @name C instruction implementations for anything slightly complicated.
1537 * @{ */
1538
1539/**
1540 * For typedef'ing or declaring a C instruction implementation function taking
1541 * no extra arguments.
1542 *
1543 * @param a_Name The name of the type.
1544 */
1545# define IEM_CIMPL_DECL_TYPE_0(a_Name) \
1546 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr))
1547/**
1548 * For defining a C instruction implementation function taking no extra
1549 * arguments.
1550 *
1551 * @param a_Name The name of the function
1552 */
1553# define IEM_CIMPL_DEF_0(a_Name) \
1554 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr))
1555/**
1556 * For calling a C instruction implementation function taking no extra
1557 * arguments.
1558 *
1559 * This special call macro adds default arguments to the call and allow us to
1560 * change these later.
1561 *
1562 * @param a_fn The name of the function.
1563 */
1564# define IEM_CIMPL_CALL_0(a_fn) a_fn(pIemCpu, cbInstr)
1565
1566/**
1567 * For typedef'ing or declaring a C instruction implementation function taking
1568 * one extra argument.
1569 *
1570 * @param a_Name The name of the type.
1571 * @param a_Type0 The argument type.
1572 * @param a_Arg0 The argument name.
1573 */
1574# define IEM_CIMPL_DECL_TYPE_1(a_Name, a_Type0, a_Arg0) \
1575 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0))
1576/**
1577 * For defining a C instruction implementation function taking one extra
1578 * argument.
1579 *
1580 * @param a_Name The name of the function
1581 * @param a_Type0 The argument type.
1582 * @param a_Arg0 The argument name.
1583 */
1584# define IEM_CIMPL_DEF_1(a_Name, a_Type0, a_Arg0) \
1585 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0))
1586/**
1587 * For calling a C instruction implementation function taking one extra
1588 * argument.
1589 *
1590 * This special call macro adds default arguments to the call and allow us to
1591 * change these later.
1592 *
1593 * @param a_fn The name of the function.
1594 * @param a0 The name of the 1st argument.
1595 */
1596# define IEM_CIMPL_CALL_1(a_fn, a0) a_fn(pIemCpu, cbInstr, (a0))
1597
1598/**
1599 * For typedef'ing or declaring a C instruction implementation function taking
1600 * two extra arguments.
1601 *
1602 * @param a_Name The name of the type.
1603 * @param a_Type0 The type of the 1st argument
1604 * @param a_Arg0 The name of the 1st argument.
1605 * @param a_Type1 The type of the 2nd argument.
1606 * @param a_Arg1 The name of the 2nd argument.
1607 */
1608# define IEM_CIMPL_DECL_TYPE_2(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1) \
1609 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1))
1610/**
1611 * For defining a C instruction implementation function taking two extra
1612 * arguments.
1613 *
1614 * @param a_Name The name of the function.
1615 * @param a_Type0 The type of the 1st argument
1616 * @param a_Arg0 The name of the 1st argument.
1617 * @param a_Type1 The type of the 2nd argument.
1618 * @param a_Arg1 The name of the 2nd argument.
1619 */
1620# define IEM_CIMPL_DEF_2(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1) \
1621 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1))
1622/**
1623 * For calling a C instruction implementation function taking two extra
1624 * arguments.
1625 *
1626 * This special call macro adds default arguments to the call and allow us to
1627 * change these later.
1628 *
1629 * @param a_fn The name of the function.
1630 * @param a0 The name of the 1st argument.
1631 * @param a1 The name of the 2nd argument.
1632 */
1633# define IEM_CIMPL_CALL_2(a_fn, a0, a1) a_fn(pIemCpu, cbInstr, (a0), (a1))
1634
1635/**
1636 * For typedef'ing or declaring a C instruction implementation function taking
1637 * three extra arguments.
1638 *
1639 * @param a_Name The name of the type.
1640 * @param a_Type0 The type of the 1st argument
1641 * @param a_Arg0 The name of the 1st argument.
1642 * @param a_Type1 The type of the 2nd argument.
1643 * @param a_Arg1 The name of the 2nd argument.
1644 * @param a_Type2 The type of the 3rd argument.
1645 * @param a_Arg2 The name of the 3rd argument.
1646 */
1647# define IEM_CIMPL_DECL_TYPE_3(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2) \
1648 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2))
1649/**
1650 * For defining a C instruction implementation function taking three extra
1651 * arguments.
1652 *
1653 * @param a_Name The name of the function.
1654 * @param a_Type0 The type of the 1st argument
1655 * @param a_Arg0 The name of the 1st argument.
1656 * @param a_Type1 The type of the 2nd argument.
1657 * @param a_Arg1 The name of the 2nd argument.
1658 * @param a_Type2 The type of the 3rd argument.
1659 * @param a_Arg2 The name of the 3rd argument.
1660 */
1661# define IEM_CIMPL_DEF_3(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2) \
1662 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2))
1663/**
1664 * For calling a C instruction implementation function taking three extra
1665 * arguments.
1666 *
1667 * This special call macro adds default arguments to the call and allow us to
1668 * change these later.
1669 *
1670 * @param a_fn The name of the function.
1671 * @param a0 The name of the 1st argument.
1672 * @param a1 The name of the 2nd argument.
1673 * @param a2 The name of the 3rd argument.
1674 */
1675# define IEM_CIMPL_CALL_3(a_fn, a0, a1, a2) a_fn(pIemCpu, cbInstr, (a0), (a1), (a2))
1676
1677
1678/**
1679 * For typedef'ing or declaring a C instruction implementation function taking
1680 * four extra arguments.
1681 *
1682 * @param a_Name The name of the type.
1683 * @param a_Type0 The type of the 1st argument
1684 * @param a_Arg0 The name of the 1st argument.
1685 * @param a_Type1 The type of the 2nd argument.
1686 * @param a_Arg1 The name of the 2nd argument.
1687 * @param a_Type2 The type of the 3rd argument.
1688 * @param a_Arg2 The name of the 3rd argument.
1689 * @param a_Type3 The type of the 4th argument.
1690 * @param a_Arg3 The name of the 4th argument.
1691 */
1692# define IEM_CIMPL_DECL_TYPE_4(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2, a_Type3, a_Arg3) \
1693 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))
1694/**
1695 * For defining a C instruction implementation function taking four extra
1696 * arguments.
1697 *
1698 * @param a_Name The name of the function.
1699 * @param a_Type0 The type of the 1st argument
1700 * @param a_Arg0 The name of the 1st argument.
1701 * @param a_Type1 The type of the 2nd argument.
1702 * @param a_Arg1 The name of the 2nd argument.
1703 * @param a_Type2 The type of the 3rd argument.
1704 * @param a_Arg2 The name of the 3rd argument.
1705 * @param a_Type3 The type of the 4th argument.
1706 * @param a_Arg3 The name of the 4th argument.
1707 */
1708# define IEM_CIMPL_DEF_4(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2, a_Type3, a_Arg3) \
1709 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, \
1710 a_Type2 a_Arg2, a_Type3 a_Arg3))
1711/**
1712 * For calling a C instruction implementation function taking four extra
1713 * arguments.
1714 *
1715 * This special call macro adds default arguments to the call and allow us to
1716 * change these later.
1717 *
1718 * @param a_fn The name of the function.
1719 * @param a0 The name of the 1st argument.
1720 * @param a1 The name of the 2nd argument.
1721 * @param a2 The name of the 3rd argument.
1722 * @param a3 The name of the 4th argument.
1723 */
1724# define IEM_CIMPL_CALL_4(a_fn, a0, a1, a2, a3) a_fn(pIemCpu, cbInstr, (a0), (a1), (a2), (a3))
1725
1726
1727/**
1728 * For typedef'ing or declaring a C instruction implementation function taking
1729 * five extra arguments.
1730 *
1731 * @param a_Name The name of the type.
1732 * @param a_Type0 The type of the 1st argument
1733 * @param a_Arg0 The name of the 1st argument.
1734 * @param a_Type1 The type of the 2nd argument.
1735 * @param a_Arg1 The name of the 2nd argument.
1736 * @param a_Type2 The type of the 3rd argument.
1737 * @param a_Arg2 The name of the 3rd argument.
1738 * @param a_Type3 The type of the 4th argument.
1739 * @param a_Arg3 The name of the 4th argument.
1740 * @param a_Type4 The type of the 5th argument.
1741 * @param a_Arg4 The name of the 5th argument.
1742 */
1743# 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) \
1744 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, \
1745 a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2, \
1746 a_Type3 a_Arg3, a_Type4 a_Arg4))
1747/**
1748 * For defining a C instruction implementation function taking five extra
1749 * arguments.
1750 *
1751 * @param a_Name The name of the function.
1752 * @param a_Type0 The type of the 1st argument
1753 * @param a_Arg0 The name of the 1st argument.
1754 * @param a_Type1 The type of the 2nd argument.
1755 * @param a_Arg1 The name of the 2nd argument.
1756 * @param a_Type2 The type of the 3rd argument.
1757 * @param a_Arg2 The name of the 3rd argument.
1758 * @param a_Type3 The type of the 4th argument.
1759 * @param a_Arg3 The name of the 4th argument.
1760 * @param a_Type4 The type of the 5th argument.
1761 * @param a_Arg4 The name of the 5th argument.
1762 */
1763# 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) \
1764 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PIEMCPU pIemCpu, uint8_t cbInstr, \
1765 a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2, \
1766 a_Type3 a_Arg3, a_Type4 a_Arg4))
1767/**
1768 * For calling a C instruction implementation function taking five extra
1769 * arguments.
1770 *
1771 * This special call macro adds default arguments to the call and allow us to
1772 * change these later.
1773 *
1774 * @param a_fn The name of the function.
1775 * @param a0 The name of the 1st argument.
1776 * @param a1 The name of the 2nd argument.
1777 * @param a2 The name of the 3rd argument.
1778 * @param a3 The name of the 4th argument.
1779 * @param a4 The name of the 5th argument.
1780 */
1781# define IEM_CIMPL_CALL_5(a_fn, a0, a1, a2, a3, a4) a_fn(pIemCpu, cbInstr, (a0), (a1), (a2), (a3), (a4))
1782
1783/** @} */
1784
1785
1786/** @} */
1787
1788RT_C_DECLS_END
1789
1790#endif
1791
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