VirtualBox

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

Last change on this file since 96537 was 96537, checked in by vboxsync, 2 years ago

VMM/IEM: Implement [v]pblendw/[v]blendps/[v]blendpd instructions, bugref:9898

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 205.0 KB
Line 
1/* $Id: IEMInternal.h 96537 2022-08-27 14:33:11Z vboxsync $ */
2/** @file
3 * IEM - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2011-2022 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef VMM_INCLUDED_SRC_include_IEMInternal_h
29#define VMM_INCLUDED_SRC_include_IEMInternal_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <VBox/vmm/cpum.h>
35#include <VBox/vmm/iem.h>
36#include <VBox/vmm/pgm.h>
37#include <VBox/vmm/stam.h>
38#include <VBox/param.h>
39
40#include <iprt/setjmp-without-sigmask.h>
41
42
43RT_C_DECLS_BEGIN
44
45
46/** @defgroup grp_iem_int Internals
47 * @ingroup grp_iem
48 * @internal
49 * @{
50 */
51
52/** For expanding symbol in slickedit and other products tagging and
53 * crossreferencing IEM symbols. */
54#ifndef IEM_STATIC
55# define IEM_STATIC static
56#endif
57
58/** @def IEM_WITH_SETJMP
59 * Enables alternative status code handling using setjmps.
60 *
61 * This adds a bit of expense via the setjmp() call since it saves all the
62 * non-volatile registers. However, it eliminates return code checks and allows
63 * for more optimal return value passing (return regs instead of stack buffer).
64 */
65#if defined(DOXYGEN_RUNNING) || defined(RT_OS_WINDOWS) || 1
66# define IEM_WITH_SETJMP
67#endif
68
69#define IEM_IMPLEMENTS_TASKSWITCH
70
71/** @def IEM_WITH_3DNOW
72 * Includes the 3DNow decoding. */
73#define IEM_WITH_3DNOW
74
75/** @def IEM_WITH_THREE_0F_38
76 * Includes the three byte opcode map for instrs starting with 0x0f 0x38. */
77#define IEM_WITH_THREE_0F_38
78
79/** @def IEM_WITH_THREE_0F_3A
80 * Includes the three byte opcode map for instrs starting with 0x0f 0x38. */
81#define IEM_WITH_THREE_0F_3A
82
83/** @def IEM_WITH_VEX
84 * Includes the VEX decoding. */
85#define IEM_WITH_VEX
86
87/** @def IEM_CFG_TARGET_CPU
88 * The minimum target CPU for the IEM emulation (IEMTARGETCPU_XXX value).
89 *
90 * By default we allow this to be configured by the user via the
91 * CPUM/GuestCpuName config string, but this comes at a slight cost during
92 * decoding. So, for applications of this code where there is no need to
93 * be dynamic wrt target CPU, just modify this define.
94 */
95#if !defined(IEM_CFG_TARGET_CPU) || defined(DOXYGEN_RUNNING)
96# define IEM_CFG_TARGET_CPU IEMTARGETCPU_DYNAMIC
97#endif
98
99//#define IEM_WITH_CODE_TLB // - work in progress
100//#define IEM_WITH_DATA_TLB // - work in progress
101
102
103/** @def IEM_USE_UNALIGNED_DATA_ACCESS
104 * Use unaligned accesses instead of elaborate byte assembly. */
105#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) || defined(DOXYGEN_RUNNING)
106# define IEM_USE_UNALIGNED_DATA_ACCESS
107#endif
108
109//#define IEM_LOG_MEMORY_WRITES
110
111#if !defined(IN_TSTVMSTRUCT) && !defined(DOXYGEN_RUNNING)
112/** Instruction statistics. */
113typedef struct IEMINSTRSTATS
114{
115# define IEM_DO_INSTR_STAT(a_Name, a_szDesc) uint32_t a_Name;
116# include "IEMInstructionStatisticsTmpl.h"
117# undef IEM_DO_INSTR_STAT
118} IEMINSTRSTATS;
119#else
120struct IEMINSTRSTATS;
121typedef struct IEMINSTRSTATS IEMINSTRSTATS;
122#endif
123/** Pointer to IEM instruction statistics. */
124typedef IEMINSTRSTATS *PIEMINSTRSTATS;
125
126
127/** @name IEMTARGETCPU_EFL_BEHAVIOR_XXX - IEMCPU::aidxTargetCpuEflFlavour
128 * @{ */
129#define IEMTARGETCPU_EFL_BEHAVIOR_NATIVE 0 /**< Native x86 EFLAGS result; Intel EFLAGS when on non-x86 hosts. */
130#define IEMTARGETCPU_EFL_BEHAVIOR_INTEL 1 /**< Intel EFLAGS result. */
131#define IEMTARGETCPU_EFL_BEHAVIOR_AMD 2 /**< AMD EFLAGS result */
132#define IEMTARGETCPU_EFL_BEHAVIOR_RESERVED 3 /**< Reserved/dummy entry slot that's the same as 0. */
133#define IEMTARGETCPU_EFL_BEHAVIOR_MASK 3 /**< For masking the index before use. */
134/** Selects the right variant from a_aArray.
135 * pVCpu is implicit in the caller context. */
136#define IEMTARGETCPU_EFL_BEHAVIOR_SELECT(a_aArray) \
137 (a_aArray[pVCpu->iem.s.aidxTargetCpuEflFlavour[1] & IEMTARGETCPU_EFL_BEHAVIOR_MASK])
138/** Variation of IEMTARGETCPU_EFL_BEHAVIOR_SELECT for when no native worker can
139 * be used because the host CPU does not support the operation. */
140#define IEMTARGETCPU_EFL_BEHAVIOR_SELECT_NON_NATIVE(a_aArray) \
141 (a_aArray[pVCpu->iem.s.aidxTargetCpuEflFlavour[0] & IEMTARGETCPU_EFL_BEHAVIOR_MASK])
142/** Variation of IEMTARGETCPU_EFL_BEHAVIOR_SELECT for a two dimentional
143 * array paralleling IEMCPU::aidxTargetCpuEflFlavour and a single bit index
144 * into the two.
145 * @sa IEM_SELECT_NATIVE_OR_FALLBACK */
146#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
147# define IEMTARGETCPU_EFL_BEHAVIOR_SELECT_EX(a_aaArray, a_fNative) \
148 (a_aaArray[a_fNative][pVCpu->iem.s.aidxTargetCpuEflFlavour[a_fNative] & IEMTARGETCPU_EFL_BEHAVIOR_MASK])
149#else
150# define IEMTARGETCPU_EFL_BEHAVIOR_SELECT_EX(a_aaArray, a_fNative) \
151 (a_aaArray[0][pVCpu->iem.s.aidxTargetCpuEflFlavour[0] & IEMTARGETCPU_EFL_BEHAVIOR_MASK])
152#endif
153/** @} */
154
155/**
156 * Picks @a a_pfnNative or @a a_pfnFallback according to the host CPU feature
157 * indicator given by @a a_fCpumFeatureMember (CPUMFEATURES member).
158 *
159 * On non-x86 hosts, this will shortcut to the fallback w/o checking the
160 * indicator.
161 *
162 * @sa IEMTARGETCPU_EFL_BEHAVIOR_SELECT_EX
163 */
164#if (defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)) && !defined(IEM_WITHOUT_ASSEMBLY)
165# define IEM_SELECT_HOST_OR_FALLBACK(a_fCpumFeatureMember, a_pfnNative, a_pfnFallback) \
166 (g_CpumHostFeatures.s.a_fCpumFeatureMember ? a_pfnNative : a_pfnFallback)
167#else
168# define IEM_SELECT_HOST_OR_FALLBACK(a_fCpumFeatureMember, a_pfnNative, a_pfnFallback) (a_pfnFallback)
169#endif
170
171
172/**
173 * Extended operand mode that includes a representation of 8-bit.
174 *
175 * This is used for packing down modes when invoking some C instruction
176 * implementations.
177 */
178typedef enum IEMMODEX
179{
180 IEMMODEX_16BIT = IEMMODE_16BIT,
181 IEMMODEX_32BIT = IEMMODE_32BIT,
182 IEMMODEX_64BIT = IEMMODE_64BIT,
183 IEMMODEX_8BIT
184} IEMMODEX;
185AssertCompileSize(IEMMODEX, 4);
186
187
188/**
189 * Branch types.
190 */
191typedef enum IEMBRANCH
192{
193 IEMBRANCH_JUMP = 1,
194 IEMBRANCH_CALL,
195 IEMBRANCH_TRAP,
196 IEMBRANCH_SOFTWARE_INT,
197 IEMBRANCH_HARDWARE_INT
198} IEMBRANCH;
199AssertCompileSize(IEMBRANCH, 4);
200
201
202/**
203 * INT instruction types.
204 */
205typedef enum IEMINT
206{
207 /** INT n instruction (opcode 0xcd imm). */
208 IEMINT_INTN = 0,
209 /** Single byte INT3 instruction (opcode 0xcc). */
210 IEMINT_INT3 = IEM_XCPT_FLAGS_BP_INSTR,
211 /** Single byte INTO instruction (opcode 0xce). */
212 IEMINT_INTO = IEM_XCPT_FLAGS_OF_INSTR,
213 /** Single byte INT1 (ICEBP) instruction (opcode 0xf1). */
214 IEMINT_INT1 = IEM_XCPT_FLAGS_ICEBP_INSTR
215} IEMINT;
216AssertCompileSize(IEMINT, 4);
217
218
219/**
220 * A FPU result.
221 */
222typedef struct IEMFPURESULT
223{
224 /** The output value. */
225 RTFLOAT80U r80Result;
226 /** The output status. */
227 uint16_t FSW;
228} IEMFPURESULT;
229AssertCompileMemberOffset(IEMFPURESULT, FSW, 10);
230/** Pointer to a FPU result. */
231typedef IEMFPURESULT *PIEMFPURESULT;
232/** Pointer to a const FPU result. */
233typedef IEMFPURESULT const *PCIEMFPURESULT;
234
235
236/**
237 * A FPU result consisting of two output values and FSW.
238 */
239typedef struct IEMFPURESULTTWO
240{
241 /** The first output value. */
242 RTFLOAT80U r80Result1;
243 /** The output status. */
244 uint16_t FSW;
245 /** The second output value. */
246 RTFLOAT80U r80Result2;
247} IEMFPURESULTTWO;
248AssertCompileMemberOffset(IEMFPURESULTTWO, FSW, 10);
249AssertCompileMemberOffset(IEMFPURESULTTWO, r80Result2, 12);
250/** Pointer to a FPU result consisting of two output values and FSW. */
251typedef IEMFPURESULTTWO *PIEMFPURESULTTWO;
252/** Pointer to a const FPU result consisting of two output values and FSW. */
253typedef IEMFPURESULTTWO const *PCIEMFPURESULTTWO;
254
255
256/**
257 * IEM TLB entry.
258 *
259 * Lookup assembly:
260 * @code{.asm}
261 ; Calculate tag.
262 mov rax, [VA]
263 shl rax, 16
264 shr rax, 16 + X86_PAGE_SHIFT
265 or rax, [uTlbRevision]
266
267 ; Do indexing.
268 movzx ecx, al
269 lea rcx, [pTlbEntries + rcx]
270
271 ; Check tag.
272 cmp [rcx + IEMTLBENTRY.uTag], rax
273 jne .TlbMiss
274
275 ; Check access.
276 mov rax, ACCESS_FLAGS | MAPPING_R3_NOT_VALID | 0xffffff00
277 and rax, [rcx + IEMTLBENTRY.fFlagsAndPhysRev]
278 cmp rax, [uTlbPhysRev]
279 jne .TlbMiss
280
281 ; Calc address and we're done.
282 mov eax, X86_PAGE_OFFSET_MASK
283 and eax, [VA]
284 or rax, [rcx + IEMTLBENTRY.pMappingR3]
285 %ifdef VBOX_WITH_STATISTICS
286 inc qword [cTlbHits]
287 %endif
288 jmp .Done
289
290 .TlbMiss:
291 mov r8d, ACCESS_FLAGS
292 mov rdx, [VA]
293 mov rcx, [pVCpu]
294 call iemTlbTypeMiss
295 .Done:
296
297 @endcode
298 *
299 */
300typedef struct IEMTLBENTRY
301{
302 /** The TLB entry tag.
303 * Bits 35 thru 0 are made up of the virtual address shifted right 12 bits, this
304 * is ASSUMING a virtual address width of 48 bits.
305 *
306 * Bits 63 thru 36 are made up of the TLB revision (zero means invalid).
307 *
308 * The TLB lookup code uses the current TLB revision, which won't ever be zero,
309 * enabling an extremely cheap TLB invalidation most of the time. When the TLB
310 * revision wraps around though, the tags needs to be zeroed.
311 *
312 * @note Try use SHRD instruction? After seeing
313 * https://gmplib.org/~tege/x86-timing.pdf, maybe not.
314 *
315 * @todo This will need to be reorganized for 57-bit wide virtual address and
316 * PCID (currently 12 bits) and ASID (currently 6 bits) support. We'll
317 * have to move the TLB entry versioning entirely to the
318 * fFlagsAndPhysRev member then, 57 bit wide VAs means we'll only have
319 * 19 bits left (64 - 57 + 12 = 19) and they'll almost entire be
320 * consumed by PCID and ASID (12 + 6 = 18).
321 */
322 uint64_t uTag;
323 /** Access flags and physical TLB revision.
324 *
325 * - Bit 0 - page tables - not executable (X86_PTE_PAE_NX).
326 * - Bit 1 - page tables - not writable (complemented X86_PTE_RW).
327 * - Bit 2 - page tables - not user (complemented X86_PTE_US).
328 * - Bit 3 - pgm phys/virt - not directly writable.
329 * - Bit 4 - pgm phys page - not directly readable.
330 * - Bit 5 - page tables - not accessed (complemented X86_PTE_A).
331 * - Bit 6 - page tables - not dirty (complemented X86_PTE_D).
332 * - Bit 7 - tlb entry - pMappingR3 member not valid.
333 * - Bits 63 thru 8 are used for the physical TLB revision number.
334 *
335 * We're using complemented bit meanings here because it makes it easy to check
336 * whether special action is required. For instance a user mode write access
337 * would do a "TEST fFlags, (X86_PTE_RW | X86_PTE_US | X86_PTE_D)" and a
338 * non-zero result would mean special handling needed because either it wasn't
339 * writable, or it wasn't user, or the page wasn't dirty. A user mode read
340 * access would do "TEST fFlags, X86_PTE_US"; and a kernel mode read wouldn't
341 * need to check any PTE flag.
342 */
343 uint64_t fFlagsAndPhysRev;
344 /** The guest physical page address. */
345 uint64_t GCPhys;
346 /** Pointer to the ring-3 mapping. */
347 R3PTRTYPE(uint8_t *) pbMappingR3;
348#if HC_ARCH_BITS == 32
349 uint32_t u32Padding1;
350#endif
351} IEMTLBENTRY;
352AssertCompileSize(IEMTLBENTRY, 32);
353/** Pointer to an IEM TLB entry. */
354typedef IEMTLBENTRY *PIEMTLBENTRY;
355
356/** @name IEMTLBE_F_XXX - TLB entry flags (IEMTLBENTRY::fFlagsAndPhysRev)
357 * @{ */
358#define IEMTLBE_F_PT_NO_EXEC RT_BIT_64(0) /**< Page tables: Not executable. */
359#define IEMTLBE_F_PT_NO_WRITE RT_BIT_64(1) /**< Page tables: Not writable. */
360#define IEMTLBE_F_PT_NO_USER RT_BIT_64(2) /**< Page tables: Not user accessible (supervisor only). */
361#define IEMTLBE_F_PG_NO_WRITE RT_BIT_64(3) /**< Phys page: Not writable (access handler, ROM, whatever). */
362#define IEMTLBE_F_PG_NO_READ RT_BIT_64(4) /**< Phys page: Not readable (MMIO / access handler, ROM) */
363#define IEMTLBE_F_PT_NO_ACCESSED RT_BIT_64(5) /**< Phys tables: Not accessed (need to be marked accessed). */
364#define IEMTLBE_F_PT_NO_DIRTY RT_BIT_64(6) /**< Page tables: Not dirty (needs to be made dirty on write). */
365#define IEMTLBE_F_NO_MAPPINGR3 RT_BIT_64(7) /**< TLB entry: The IEMTLBENTRY::pMappingR3 member is invalid. */
366#define IEMTLBE_F_PG_UNASSIGNED RT_BIT_64(8) /**< Phys page: Unassigned memory (not RAM, ROM, MMIO2 or MMIO). */
367#define IEMTLBE_F_PHYS_REV UINT64_C(0xfffffffffffffe00) /**< Physical revision mask. @sa IEMTLB_PHYS_REV_INCR */
368/** @} */
369
370
371/**
372 * An IEM TLB.
373 *
374 * We've got two of these, one for data and one for instructions.
375 */
376typedef struct IEMTLB
377{
378 /** The TLB entries.
379 * We've choosen 256 because that way we can obtain the result directly from a
380 * 8-bit register without an additional AND instruction. */
381 IEMTLBENTRY aEntries[256];
382 /** The TLB revision.
383 * This is actually only 28 bits wide (see IEMTLBENTRY::uTag) and is incremented
384 * by adding RT_BIT_64(36) to it. When it wraps around and becomes zero, all
385 * the tags in the TLB must be zeroed and the revision set to RT_BIT_64(36).
386 * (The revision zero indicates an invalid TLB entry.)
387 *
388 * The initial value is choosen to cause an early wraparound. */
389 uint64_t uTlbRevision;
390 /** The TLB physical address revision - shadow of PGM variable.
391 *
392 * This is actually only 56 bits wide (see IEMTLBENTRY::fFlagsAndPhysRev) and is
393 * incremented by adding RT_BIT_64(8). When it wraps around and becomes zero,
394 * a rendezvous is called and each CPU wipe the IEMTLBENTRY::pMappingR3 as well
395 * as IEMTLBENTRY::fFlagsAndPhysRev bits 63 thru 8, 4, and 3.
396 *
397 * The initial value is choosen to cause an early wraparound. */
398 uint64_t volatile uTlbPhysRev;
399
400 /* Statistics: */
401
402 /** TLB hits (VBOX_WITH_STATISTICS only). */
403 uint64_t cTlbHits;
404 /** TLB misses. */
405 uint32_t cTlbMisses;
406 /** Slow read path. */
407 uint32_t cTlbSlowReadPath;
408#if 0
409 /** TLB misses because of tag mismatch. */
410 uint32_t cTlbMissesTag;
411 /** TLB misses because of virtual access violation. */
412 uint32_t cTlbMissesVirtAccess;
413 /** TLB misses because of dirty bit. */
414 uint32_t cTlbMissesDirty;
415 /** TLB misses because of MMIO */
416 uint32_t cTlbMissesMmio;
417 /** TLB misses because of write access handlers. */
418 uint32_t cTlbMissesWriteHandler;
419 /** TLB misses because no r3(/r0) mapping. */
420 uint32_t cTlbMissesMapping;
421#endif
422 /** Alignment padding. */
423 uint32_t au32Padding[3+5];
424} IEMTLB;
425AssertCompileSizeAlignment(IEMTLB, 64);
426/** IEMTLB::uTlbRevision increment. */
427#define IEMTLB_REVISION_INCR RT_BIT_64(36)
428/** IEMTLB::uTlbRevision mask. */
429#define IEMTLB_REVISION_MASK (~(RT_BIT_64(36) - 1))
430/** IEMTLB::uTlbPhysRev increment.
431 * @sa IEMTLBE_F_PHYS_REV */
432#define IEMTLB_PHYS_REV_INCR RT_BIT_64(9)
433/**
434 * Calculates the TLB tag for a virtual address.
435 * @returns Tag value for indexing and comparing with IEMTLB::uTag.
436 * @param a_pTlb The TLB.
437 * @param a_GCPtr The virtual address.
438 */
439#define IEMTLB_CALC_TAG(a_pTlb, a_GCPtr) ( IEMTLB_CALC_TAG_NO_REV(a_GCPtr) | (a_pTlb)->uTlbRevision )
440/**
441 * Calculates the TLB tag for a virtual address but without TLB revision.
442 * @returns Tag value for indexing and comparing with IEMTLB::uTag.
443 * @param a_GCPtr The virtual address.
444 */
445#define IEMTLB_CALC_TAG_NO_REV(a_GCPtr) ( (((a_GCPtr) << 16) >> (GUEST_PAGE_SHIFT + 16)) )
446/**
447 * Converts a TLB tag value into a TLB index.
448 * @returns Index into IEMTLB::aEntries.
449 * @param a_uTag Value returned by IEMTLB_CALC_TAG.
450 */
451#define IEMTLB_TAG_TO_INDEX(a_uTag) ( (uint8_t)(a_uTag) )
452/**
453 * Converts a TLB tag value into a TLB index.
454 * @returns Index into IEMTLB::aEntries.
455 * @param a_pTlb The TLB.
456 * @param a_uTag Value returned by IEMTLB_CALC_TAG.
457 */
458#define IEMTLB_TAG_TO_ENTRY(a_pTlb, a_uTag) ( &(a_pTlb)->aEntries[IEMTLB_TAG_TO_INDEX(a_uTag)] )
459
460
461/**
462 * The per-CPU IEM state.
463 */
464typedef struct IEMCPU
465{
466 /** Info status code that needs to be propagated to the IEM caller.
467 * This cannot be passed internally, as it would complicate all success
468 * checks within the interpreter making the code larger and almost impossible
469 * to get right. Instead, we'll store status codes to pass on here. Each
470 * source of these codes will perform appropriate sanity checks. */
471 int32_t rcPassUp; /* 0x00 */
472
473 /** The current CPU execution mode (CS). */
474 IEMMODE enmCpuMode; /* 0x04 */
475 /** The CPL. */
476 uint8_t uCpl; /* 0x05 */
477
478 /** Whether to bypass access handlers or not. */
479 bool fBypassHandlers; /* 0x06 */
480 /** Whether to disregard the lock prefix (implied or not). */
481 bool fDisregardLock; /* 0x07 */
482
483 /** @name Decoder state.
484 * @{ */
485#ifdef IEM_WITH_CODE_TLB
486 /** The offset of the next instruction byte. */
487 uint32_t offInstrNextByte; /* 0x08 */
488 /** The number of bytes available at pbInstrBuf for the current instruction.
489 * This takes the max opcode length into account so that doesn't need to be
490 * checked separately. */
491 uint32_t cbInstrBuf; /* 0x0c */
492 /** Pointer to the page containing RIP, user specified buffer or abOpcode.
493 * This can be NULL if the page isn't mappable for some reason, in which
494 * case we'll do fallback stuff.
495 *
496 * If we're executing an instruction from a user specified buffer,
497 * IEMExecOneWithPrefetchedByPC and friends, this is not necessarily a page
498 * aligned pointer but pointer to the user data.
499 *
500 * For instructions crossing pages, this will start on the first page and be
501 * advanced to the next page by the time we've decoded the instruction. This
502 * therefore precludes stuff like <tt>pbInstrBuf[offInstrNextByte + cbInstrBuf - cbCurInstr]</tt>
503 */
504 uint8_t const *pbInstrBuf; /* 0x10 */
505# if ARCH_BITS == 32
506 uint32_t uInstrBufHigh; /** The high dword of the host context pbInstrBuf member. */
507# endif
508 /** The program counter corresponding to pbInstrBuf.
509 * This is set to a non-canonical address when we need to invalidate it. */
510 uint64_t uInstrBufPc; /* 0x18 */
511 /** The number of bytes available at pbInstrBuf in total (for IEMExecLots).
512 * This takes the CS segment limit into account. */
513 uint16_t cbInstrBufTotal; /* 0x20 */
514 /** Offset into pbInstrBuf of the first byte of the current instruction.
515 * Can be negative to efficiently handle cross page instructions. */
516 int16_t offCurInstrStart; /* 0x22 */
517
518 /** The prefix mask (IEM_OP_PRF_XXX). */
519 uint32_t fPrefixes; /* 0x24 */
520 /** The extra REX ModR/M register field bit (REX.R << 3). */
521 uint8_t uRexReg; /* 0x28 */
522 /** The extra REX ModR/M r/m field, SIB base and opcode reg bit
523 * (REX.B << 3). */
524 uint8_t uRexB; /* 0x29 */
525 /** The extra REX SIB index field bit (REX.X << 3). */
526 uint8_t uRexIndex; /* 0x2a */
527
528 /** The effective segment register (X86_SREG_XXX). */
529 uint8_t iEffSeg; /* 0x2b */
530
531 /** The offset of the ModR/M byte relative to the start of the instruction. */
532 uint8_t offModRm; /* 0x2c */
533#else
534 /** The size of what has currently been fetched into abOpcode. */
535 uint8_t cbOpcode; /* 0x08 */
536 /** The current offset into abOpcode. */
537 uint8_t offOpcode; /* 0x09 */
538 /** The offset of the ModR/M byte relative to the start of the instruction. */
539 uint8_t offModRm; /* 0x0a */
540
541 /** The effective segment register (X86_SREG_XXX). */
542 uint8_t iEffSeg; /* 0x0b */
543
544 /** The prefix mask (IEM_OP_PRF_XXX). */
545 uint32_t fPrefixes; /* 0x0c */
546 /** The extra REX ModR/M register field bit (REX.R << 3). */
547 uint8_t uRexReg; /* 0x10 */
548 /** The extra REX ModR/M r/m field, SIB base and opcode reg bit
549 * (REX.B << 3). */
550 uint8_t uRexB; /* 0x11 */
551 /** The extra REX SIB index field bit (REX.X << 3). */
552 uint8_t uRexIndex; /* 0x12 */
553
554#endif
555
556 /** The effective operand mode. */
557 IEMMODE enmEffOpSize; /* 0x2d, 0x13 */
558 /** The default addressing mode. */
559 IEMMODE enmDefAddrMode; /* 0x2e, 0x14 */
560 /** The effective addressing mode. */
561 IEMMODE enmEffAddrMode; /* 0x2f, 0x15 */
562 /** The default operand mode. */
563 IEMMODE enmDefOpSize; /* 0x30, 0x16 */
564
565 /** Prefix index (VEX.pp) for two byte and three byte tables. */
566 uint8_t idxPrefix; /* 0x31, 0x17 */
567 /** 3rd VEX/EVEX/XOP register.
568 * Please use IEM_GET_EFFECTIVE_VVVV to access. */
569 uint8_t uVex3rdReg; /* 0x32, 0x18 */
570 /** The VEX/EVEX/XOP length field. */
571 uint8_t uVexLength; /* 0x33, 0x19 */
572 /** Additional EVEX stuff. */
573 uint8_t fEvexStuff; /* 0x34, 0x1a */
574
575 /** Explicit alignment padding. */
576 uint8_t abAlignment2a[1]; /* 0x35, 0x1b */
577 /** The FPU opcode (FOP). */
578 uint16_t uFpuOpcode; /* 0x36, 0x1c */
579#ifndef IEM_WITH_CODE_TLB
580 /** Explicit alignment padding. */
581 uint8_t abAlignment2b[2]; /* 0x1e */
582#endif
583
584 /** The opcode bytes. */
585 uint8_t abOpcode[15]; /* 0x48, 0x20 */
586 /** Explicit alignment padding. */
587#ifdef IEM_WITH_CODE_TLB
588 uint8_t abAlignment2c[0x48 - 0x47]; /* 0x37 */
589#else
590 uint8_t abAlignment2c[0x48 - 0x2f]; /* 0x2f */
591#endif
592 /** @} */
593
594
595 /** The flags of the current exception / interrupt. */
596 uint32_t fCurXcpt; /* 0x48, 0x48 */
597 /** The current exception / interrupt. */
598 uint8_t uCurXcpt;
599 /** Exception / interrupt recursion depth. */
600 int8_t cXcptRecursions;
601
602 /** The number of active guest memory mappings. */
603 uint8_t cActiveMappings;
604 /** The next unused mapping index. */
605 uint8_t iNextMapping;
606 /** Records for tracking guest memory mappings. */
607 struct
608 {
609 /** The address of the mapped bytes. */
610 void *pv;
611 /** The access flags (IEM_ACCESS_XXX).
612 * IEM_ACCESS_INVALID if the entry is unused. */
613 uint32_t fAccess;
614#if HC_ARCH_BITS == 64
615 uint32_t u32Alignment4; /**< Alignment padding. */
616#endif
617 } aMemMappings[3];
618
619 /** Locking records for the mapped memory. */
620 union
621 {
622 PGMPAGEMAPLOCK Lock;
623 uint64_t au64Padding[2];
624 } aMemMappingLocks[3];
625
626 /** Bounce buffer info.
627 * This runs in parallel to aMemMappings. */
628 struct
629 {
630 /** The physical address of the first byte. */
631 RTGCPHYS GCPhysFirst;
632 /** The physical address of the second page. */
633 RTGCPHYS GCPhysSecond;
634 /** The number of bytes in the first page. */
635 uint16_t cbFirst;
636 /** The number of bytes in the second page. */
637 uint16_t cbSecond;
638 /** Whether it's unassigned memory. */
639 bool fUnassigned;
640 /** Explicit alignment padding. */
641 bool afAlignment5[3];
642 } aMemBbMappings[3];
643
644 /** Bounce buffer storage.
645 * This runs in parallel to aMemMappings and aMemBbMappings. */
646 struct
647 {
648 uint8_t ab[512];
649 } aBounceBuffers[3];
650
651
652 /** Pointer set jump buffer - ring-3 context. */
653 R3PTRTYPE(jmp_buf *) pJmpBufR3;
654 /** Pointer set jump buffer - ring-0 context. */
655 R0PTRTYPE(jmp_buf *) pJmpBufR0;
656
657 /** @todo Should move this near @a fCurXcpt later. */
658 /** The CR2 for the current exception / interrupt. */
659 uint64_t uCurXcptCr2;
660 /** The error code for the current exception / interrupt. */
661 uint32_t uCurXcptErr;
662
663 /** @name Statistics
664 * @{ */
665 /** The number of instructions we've executed. */
666 uint32_t cInstructions;
667 /** The number of potential exits. */
668 uint32_t cPotentialExits;
669 /** The number of bytes data or stack written (mostly for IEMExecOneEx).
670 * This may contain uncommitted writes. */
671 uint32_t cbWritten;
672 /** Counts the VERR_IEM_INSTR_NOT_IMPLEMENTED returns. */
673 uint32_t cRetInstrNotImplemented;
674 /** Counts the VERR_IEM_ASPECT_NOT_IMPLEMENTED returns. */
675 uint32_t cRetAspectNotImplemented;
676 /** Counts informational statuses returned (other than VINF_SUCCESS). */
677 uint32_t cRetInfStatuses;
678 /** Counts other error statuses returned. */
679 uint32_t cRetErrStatuses;
680 /** Number of times rcPassUp has been used. */
681 uint32_t cRetPassUpStatus;
682 /** Number of times RZ left with instruction commit pending for ring-3. */
683 uint32_t cPendingCommit;
684 /** Number of long jumps. */
685 uint32_t cLongJumps;
686 /** @} */
687
688 /** @name Target CPU information.
689 * @{ */
690#if IEM_CFG_TARGET_CPU == IEMTARGETCPU_DYNAMIC
691 /** The target CPU. */
692 uint8_t uTargetCpu;
693#else
694 uint8_t bTargetCpuPadding;
695#endif
696 /** For selecting assembly works matching the target CPU EFLAGS behaviour, see
697 * IEMTARGETCPU_EFL_BEHAVIOR_XXX for values, with the 1st entry for when no
698 * native host support and the 2nd for when there is.
699 *
700 * The two values are typically indexed by a g_CpumHostFeatures bit.
701 *
702 * This is for instance used for the BSF & BSR instructions where AMD and
703 * Intel CPUs produce different EFLAGS. */
704 uint8_t aidxTargetCpuEflFlavour[2];
705
706 /** The CPU vendor. */
707 CPUMCPUVENDOR enmCpuVendor;
708 /** @} */
709
710 /** @name Host CPU information.
711 * @{ */
712 /** The CPU vendor. */
713 CPUMCPUVENDOR enmHostCpuVendor;
714 /** @} */
715
716 /** Counts RDMSR \#GP(0) LogRel(). */
717 uint8_t cLogRelRdMsr;
718 /** Counts WRMSR \#GP(0) LogRel(). */
719 uint8_t cLogRelWrMsr;
720 /** Alignment padding. */
721 uint8_t abAlignment8[50];
722
723 /** Data TLB.
724 * @remarks Must be 64-byte aligned. */
725 IEMTLB DataTlb;
726 /** Instruction TLB.
727 * @remarks Must be 64-byte aligned. */
728 IEMTLB CodeTlb;
729
730 /** Exception statistics. */
731 STAMCOUNTER aStatXcpts[32];
732 /** Interrupt statistics. */
733 uint32_t aStatInts[256];
734
735#if defined(VBOX_WITH_STATISTICS) && !defined(IN_TSTVMSTRUCT) && !defined(DOXYGEN_RUNNING)
736 /** Instruction statistics for ring-0/raw-mode. */
737 IEMINSTRSTATS StatsRZ;
738 /** Instruction statistics for ring-3. */
739 IEMINSTRSTATS StatsR3;
740#endif
741} IEMCPU;
742AssertCompileMemberOffset(IEMCPU, fCurXcpt, 0x48);
743AssertCompileMemberAlignment(IEMCPU, DataTlb, 64);
744AssertCompileMemberAlignment(IEMCPU, CodeTlb, 64);
745/** Pointer to the per-CPU IEM state. */
746typedef IEMCPU *PIEMCPU;
747/** Pointer to the const per-CPU IEM state. */
748typedef IEMCPU const *PCIEMCPU;
749
750
751/** @def IEM_GET_CTX
752 * Gets the guest CPU context for the calling EMT.
753 * @returns PCPUMCTX
754 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
755 */
756#define IEM_GET_CTX(a_pVCpu) (&(a_pVCpu)->cpum.GstCtx)
757
758/** @def IEM_CTX_ASSERT
759 * Asserts that the @a a_fExtrnMbz is present in the CPU context.
760 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
761 * @param a_fExtrnMbz The mask of CPUMCTX_EXTRN_XXX flags that must be zero.
762 */
763#define IEM_CTX_ASSERT(a_pVCpu, a_fExtrnMbz) AssertMsg(!((a_pVCpu)->cpum.GstCtx.fExtrn & (a_fExtrnMbz)), \
764 ("fExtrn=%#RX64 fExtrnMbz=%#RX64\n", (a_pVCpu)->cpum.GstCtx.fExtrn, \
765 (a_fExtrnMbz)))
766
767/** @def IEM_CTX_IMPORT_RET
768 * Makes sure the CPU context bits given by @a a_fExtrnImport are imported.
769 *
770 * Will call the keep to import the bits as needed.
771 *
772 * Returns on import failure.
773 *
774 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
775 * @param a_fExtrnImport The mask of CPUMCTX_EXTRN_XXX flags to import.
776 */
777#define IEM_CTX_IMPORT_RET(a_pVCpu, a_fExtrnImport) \
778 do { \
779 if (!((a_pVCpu)->cpum.GstCtx.fExtrn & (a_fExtrnImport))) \
780 { /* likely */ } \
781 else \
782 { \
783 int rcCtxImport = CPUMImportGuestStateOnDemand(a_pVCpu, a_fExtrnImport); \
784 AssertRCReturn(rcCtxImport, rcCtxImport); \
785 } \
786 } while (0)
787
788/** @def IEM_CTX_IMPORT_NORET
789 * Makes sure the CPU context bits given by @a a_fExtrnImport are imported.
790 *
791 * Will call the keep to import the bits as needed.
792 *
793 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
794 * @param a_fExtrnImport The mask of CPUMCTX_EXTRN_XXX flags to import.
795 */
796#define IEM_CTX_IMPORT_NORET(a_pVCpu, a_fExtrnImport) \
797 do { \
798 if (!((a_pVCpu)->cpum.GstCtx.fExtrn & (a_fExtrnImport))) \
799 { /* likely */ } \
800 else \
801 { \
802 int rcCtxImport = CPUMImportGuestStateOnDemand(a_pVCpu, a_fExtrnImport); \
803 AssertLogRelRC(rcCtxImport); \
804 } \
805 } while (0)
806
807/** @def IEM_CTX_IMPORT_JMP
808 * Makes sure the CPU context bits given by @a a_fExtrnImport are imported.
809 *
810 * Will call the keep to import the bits as needed.
811 *
812 * Jumps on import failure.
813 *
814 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
815 * @param a_fExtrnImport The mask of CPUMCTX_EXTRN_XXX flags to import.
816 */
817#define IEM_CTX_IMPORT_JMP(a_pVCpu, a_fExtrnImport) \
818 do { \
819 if (!((a_pVCpu)->cpum.GstCtx.fExtrn & (a_fExtrnImport))) \
820 { /* likely */ } \
821 else \
822 { \
823 int rcCtxImport = CPUMImportGuestStateOnDemand(a_pVCpu, a_fExtrnImport); \
824 AssertRCStmt(rcCtxImport, longjmp(*pVCpu->iem.s.CTX_SUFF(pJmpBuf), rcCtxImport)); \
825 } \
826 } while (0)
827
828
829
830/** @def IEM_GET_TARGET_CPU
831 * Gets the current IEMTARGETCPU value.
832 * @returns IEMTARGETCPU value.
833 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
834 */
835#if IEM_CFG_TARGET_CPU != IEMTARGETCPU_DYNAMIC
836# define IEM_GET_TARGET_CPU(a_pVCpu) (IEM_CFG_TARGET_CPU)
837#else
838# define IEM_GET_TARGET_CPU(a_pVCpu) ((a_pVCpu)->iem.s.uTargetCpu)
839#endif
840
841/** @def IEM_GET_INSTR_LEN
842 * Gets the instruction length. */
843#ifdef IEM_WITH_CODE_TLB
844# define IEM_GET_INSTR_LEN(a_pVCpu) ((a_pVCpu)->iem.s.offInstrNextByte - (uint32_t)(int32_t)(a_pVCpu)->iem.s.offCurInstrStart)
845#else
846# define IEM_GET_INSTR_LEN(a_pVCpu) ((a_pVCpu)->iem.s.offOpcode)
847#endif
848
849
850/**
851 * Shared per-VM IEM data.
852 */
853typedef struct IEM
854{
855 /** The VMX APIC-access page handler type. */
856 PGMPHYSHANDLERTYPE hVmxApicAccessPage;
857} IEM;
858
859
860
861/** @name IEM_ACCESS_XXX - Access details.
862 * @{ */
863#define IEM_ACCESS_INVALID UINT32_C(0x000000ff)
864#define IEM_ACCESS_TYPE_READ UINT32_C(0x00000001)
865#define IEM_ACCESS_TYPE_WRITE UINT32_C(0x00000002)
866#define IEM_ACCESS_TYPE_EXEC UINT32_C(0x00000004)
867#define IEM_ACCESS_TYPE_MASK UINT32_C(0x00000007)
868#define IEM_ACCESS_WHAT_CODE UINT32_C(0x00000010)
869#define IEM_ACCESS_WHAT_DATA UINT32_C(0x00000020)
870#define IEM_ACCESS_WHAT_STACK UINT32_C(0x00000030)
871#define IEM_ACCESS_WHAT_SYS UINT32_C(0x00000040)
872#define IEM_ACCESS_WHAT_MASK UINT32_C(0x00000070)
873/** The writes are partial, so if initialize the bounce buffer with the
874 * orignal RAM content. */
875#define IEM_ACCESS_PARTIAL_WRITE UINT32_C(0x00000100)
876/** Used in aMemMappings to indicate that the entry is bounce buffered. */
877#define IEM_ACCESS_BOUNCE_BUFFERED UINT32_C(0x00000200)
878/** Bounce buffer with ring-3 write pending, first page. */
879#define IEM_ACCESS_PENDING_R3_WRITE_1ST UINT32_C(0x00000400)
880/** Bounce buffer with ring-3 write pending, second page. */
881#define IEM_ACCESS_PENDING_R3_WRITE_2ND UINT32_C(0x00000800)
882/** Not locked, accessed via the TLB. */
883#define IEM_ACCESS_NOT_LOCKED UINT32_C(0x00001000)
884/** Valid bit mask. */
885#define IEM_ACCESS_VALID_MASK UINT32_C(0x00001fff)
886/** Shift count for the TLB flags (upper word). */
887#define IEM_ACCESS_SHIFT_TLB_FLAGS 16
888
889/** Read+write data alias. */
890#define IEM_ACCESS_DATA_RW (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_DATA)
891/** Write data alias. */
892#define IEM_ACCESS_DATA_W (IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_DATA)
893/** Read data alias. */
894#define IEM_ACCESS_DATA_R (IEM_ACCESS_TYPE_READ | IEM_ACCESS_WHAT_DATA)
895/** Instruction fetch alias. */
896#define IEM_ACCESS_INSTRUCTION (IEM_ACCESS_TYPE_EXEC | IEM_ACCESS_WHAT_CODE)
897/** Stack write alias. */
898#define IEM_ACCESS_STACK_W (IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_STACK)
899/** Stack read alias. */
900#define IEM_ACCESS_STACK_R (IEM_ACCESS_TYPE_READ | IEM_ACCESS_WHAT_STACK)
901/** Stack read+write alias. */
902#define IEM_ACCESS_STACK_RW (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_STACK)
903/** Read system table alias. */
904#define IEM_ACCESS_SYS_R (IEM_ACCESS_TYPE_READ | IEM_ACCESS_WHAT_SYS)
905/** Read+write system table alias. */
906#define IEM_ACCESS_SYS_RW (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_SYS)
907/** @} */
908
909/** @name Prefix constants (IEMCPU::fPrefixes)
910 * @{ */
911#define IEM_OP_PRF_SEG_CS RT_BIT_32(0) /**< CS segment prefix (0x2e). */
912#define IEM_OP_PRF_SEG_SS RT_BIT_32(1) /**< SS segment prefix (0x36). */
913#define IEM_OP_PRF_SEG_DS RT_BIT_32(2) /**< DS segment prefix (0x3e). */
914#define IEM_OP_PRF_SEG_ES RT_BIT_32(3) /**< ES segment prefix (0x26). */
915#define IEM_OP_PRF_SEG_FS RT_BIT_32(4) /**< FS segment prefix (0x64). */
916#define IEM_OP_PRF_SEG_GS RT_BIT_32(5) /**< GS segment prefix (0x65). */
917#define IEM_OP_PRF_SEG_MASK UINT32_C(0x3f)
918
919#define IEM_OP_PRF_SIZE_OP RT_BIT_32(8) /**< Operand size prefix (0x66). */
920#define IEM_OP_PRF_SIZE_REX_W RT_BIT_32(9) /**< REX.W prefix (0x48-0x4f). */
921#define IEM_OP_PRF_SIZE_ADDR RT_BIT_32(10) /**< Address size prefix (0x67). */
922
923#define IEM_OP_PRF_LOCK RT_BIT_32(16) /**< Lock prefix (0xf0). */
924#define IEM_OP_PRF_REPNZ RT_BIT_32(17) /**< Repeat-not-zero prefix (0xf2). */
925#define IEM_OP_PRF_REPZ RT_BIT_32(18) /**< Repeat-if-zero prefix (0xf3). */
926
927#define IEM_OP_PRF_REX RT_BIT_32(24) /**< Any REX prefix (0x40-0x4f). */
928#define IEM_OP_PRF_REX_R RT_BIT_32(25) /**< REX.R prefix (0x44,0x45,0x46,0x47,0x4c,0x4d,0x4e,0x4f). */
929#define IEM_OP_PRF_REX_B RT_BIT_32(26) /**< REX.B prefix (0x41,0x43,0x45,0x47,0x49,0x4b,0x4d,0x4f). */
930#define IEM_OP_PRF_REX_X RT_BIT_32(27) /**< REX.X prefix (0x42,0x43,0x46,0x47,0x4a,0x4b,0x4e,0x4f). */
931/** Mask with all the REX prefix flags.
932 * This is generally for use when needing to undo the REX prefixes when they
933 * are followed legacy prefixes and therefore does not immediately preceed
934 * the first opcode byte.
935 * For testing whether any REX prefix is present, use IEM_OP_PRF_REX instead. */
936#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 )
937
938#define IEM_OP_PRF_VEX RT_BIT_32(28) /**< Indiciates VEX prefix. */
939#define IEM_OP_PRF_EVEX RT_BIT_32(29) /**< Indiciates EVEX prefix. */
940#define IEM_OP_PRF_XOP RT_BIT_32(30) /**< Indiciates XOP prefix. */
941/** @} */
942
943/** @name IEMOPFORM_XXX - Opcode forms
944 * @note These are ORed together with IEMOPHINT_XXX.
945 * @{ */
946/** ModR/M: reg, r/m */
947#define IEMOPFORM_RM 0
948/** ModR/M: reg, r/m (register) */
949#define IEMOPFORM_RM_REG (IEMOPFORM_RM | IEMOPFORM_MOD3)
950/** ModR/M: reg, r/m (memory) */
951#define IEMOPFORM_RM_MEM (IEMOPFORM_RM | IEMOPFORM_NOT_MOD3)
952/** ModR/M: reg, r/m */
953#define IEMOPFORM_RMI 1
954/** ModR/M: reg, r/m (register) */
955#define IEMOPFORM_RMI_REG (IEMOPFORM_RM | IEMOPFORM_MOD3)
956/** ModR/M: reg, r/m (memory) */
957#define IEMOPFORM_RMI_MEM (IEMOPFORM_RM | IEMOPFORM_NOT_MOD3)
958/** ModR/M: r/m, reg */
959#define IEMOPFORM_MR 2
960/** ModR/M: r/m (register), reg */
961#define IEMOPFORM_MR_REG (IEMOPFORM_MR | IEMOPFORM_MOD3)
962/** ModR/M: r/m (memory), reg */
963#define IEMOPFORM_MR_MEM (IEMOPFORM_MR | IEMOPFORM_NOT_MOD3)
964/** ModR/M: r/m only */
965#define IEMOPFORM_M 3
966/** ModR/M: r/m only (register). */
967#define IEMOPFORM_M_REG (IEMOPFORM_M | IEMOPFORM_MOD3)
968/** ModR/M: r/m only (memory). */
969#define IEMOPFORM_M_MEM (IEMOPFORM_M | IEMOPFORM_NOT_MOD3)
970/** ModR/M: reg only */
971#define IEMOPFORM_R 4
972
973/** VEX+ModR/M: reg, r/m */
974#define IEMOPFORM_VEX_RM 8
975/** VEX+ModR/M: reg, r/m (register) */
976#define IEMOPFORM_VEX_RM_REG (IEMOPFORM_VEX_RM | IEMOPFORM_MOD3)
977/** VEX+ModR/M: reg, r/m (memory) */
978#define IEMOPFORM_VEX_RM_MEM (IEMOPFORM_VEX_RM | IEMOPFORM_NOT_MOD3)
979/** VEX+ModR/M: r/m, reg */
980#define IEMOPFORM_VEX_MR 9
981/** VEX+ModR/M: r/m (register), reg */
982#define IEMOPFORM_VEX_MR_REG (IEMOPFORM_VEX_MR | IEMOPFORM_MOD3)
983/** VEX+ModR/M: r/m (memory), reg */
984#define IEMOPFORM_VEX_MR_MEM (IEMOPFORM_VEX_MR | IEMOPFORM_NOT_MOD3)
985/** VEX+ModR/M: r/m only */
986#define IEMOPFORM_VEX_M 10
987/** VEX+ModR/M: r/m only (register). */
988#define IEMOPFORM_VEX_M_REG (IEMOPFORM_VEX_M | IEMOPFORM_MOD3)
989/** VEX+ModR/M: r/m only (memory). */
990#define IEMOPFORM_VEX_M_MEM (IEMOPFORM_VEX_M | IEMOPFORM_NOT_MOD3)
991/** VEX+ModR/M: reg only */
992#define IEMOPFORM_VEX_R 11
993/** VEX+ModR/M: reg, vvvv, r/m */
994#define IEMOPFORM_VEX_RVM 12
995/** VEX+ModR/M: reg, vvvv, r/m (register). */
996#define IEMOPFORM_VEX_RVM_REG (IEMOPFORM_VEX_RVM | IEMOPFORM_MOD3)
997/** VEX+ModR/M: reg, vvvv, r/m (memory). */
998#define IEMOPFORM_VEX_RVM_MEM (IEMOPFORM_VEX_RVM | IEMOPFORM_NOT_MOD3)
999/** VEX+ModR/M: reg, r/m, vvvv */
1000#define IEMOPFORM_VEX_RMV 13
1001/** VEX+ModR/M: reg, r/m, vvvv (register). */
1002#define IEMOPFORM_VEX_RMV_REG (IEMOPFORM_VEX_RMV | IEMOPFORM_MOD3)
1003/** VEX+ModR/M: reg, r/m, vvvv (memory). */
1004#define IEMOPFORM_VEX_RMV_MEM (IEMOPFORM_VEX_RMV | IEMOPFORM_NOT_MOD3)
1005/** VEX+ModR/M: reg, r/m, imm8 */
1006#define IEMOPFORM_VEX_RMI 14
1007/** VEX+ModR/M: reg, r/m, imm8 (register). */
1008#define IEMOPFORM_VEX_RMI_REG (IEMOPFORM_VEX_RMI | IEMOPFORM_MOD3)
1009/** VEX+ModR/M: reg, r/m, imm8 (memory). */
1010#define IEMOPFORM_VEX_RMI_MEM (IEMOPFORM_VEX_RMI | IEMOPFORM_NOT_MOD3)
1011/** VEX+ModR/M: r/m, vvvv, reg */
1012#define IEMOPFORM_VEX_MVR 15
1013/** VEX+ModR/M: r/m, vvvv, reg (register) */
1014#define IEMOPFORM_VEX_MVR_REG (IEMOPFORM_VEX_MVR | IEMOPFORM_MOD3)
1015/** VEX+ModR/M: r/m, vvvv, reg (memory) */
1016#define IEMOPFORM_VEX_MVR_MEM (IEMOPFORM_VEX_MVR | IEMOPFORM_NOT_MOD3)
1017/** VEX+ModR/M+/n: vvvv, r/m */
1018#define IEMOPFORM_VEX_VM 16
1019/** VEX+ModR/M+/n: vvvv, r/m (register) */
1020#define IEMOPFORM_VEX_VM_REG (IEMOPFORM_VEX_VM | IEMOPFORM_MOD3)
1021/** VEX+ModR/M+/n: vvvv, r/m (memory) */
1022#define IEMOPFORM_VEX_VM_MEM (IEMOPFORM_VEX_VM | IEMOPFORM_NOT_MOD3)
1023
1024/** Fixed register instruction, no R/M. */
1025#define IEMOPFORM_FIXED 32
1026
1027/** The r/m is a register. */
1028#define IEMOPFORM_MOD3 RT_BIT_32(8)
1029/** The r/m is a memory access. */
1030#define IEMOPFORM_NOT_MOD3 RT_BIT_32(9)
1031/** @} */
1032
1033/** @name IEMOPHINT_XXX - Additional Opcode Hints
1034 * @note These are ORed together with IEMOPFORM_XXX.
1035 * @{ */
1036/** Ignores the operand size prefix (66h). */
1037#define IEMOPHINT_IGNORES_OZ_PFX RT_BIT_32(10)
1038/** Ignores REX.W (aka WIG). */
1039#define IEMOPHINT_IGNORES_REXW RT_BIT_32(11)
1040/** Both the operand size prefixes (66h + REX.W) are ignored. */
1041#define IEMOPHINT_IGNORES_OP_SIZES (IEMOPHINT_IGNORES_OZ_PFX | IEMOPHINT_IGNORES_REXW)
1042/** Allowed with the lock prefix. */
1043#define IEMOPHINT_LOCK_ALLOWED RT_BIT_32(11)
1044/** The VEX.L value is ignored (aka LIG). */
1045#define IEMOPHINT_VEX_L_IGNORED RT_BIT_32(12)
1046/** The VEX.L value must be zero (i.e. 128-bit width only). */
1047#define IEMOPHINT_VEX_L_ZERO RT_BIT_32(13)
1048/** The VEX.V value must be zero. */
1049#define IEMOPHINT_VEX_V_ZERO RT_BIT_32(14)
1050
1051/** Hint to IEMAllInstructionPython.py that this macro should be skipped. */
1052#define IEMOPHINT_SKIP_PYTHON RT_BIT_32(31)
1053/** @} */
1054
1055/**
1056 * Possible hardware task switch sources.
1057 */
1058typedef enum IEMTASKSWITCH
1059{
1060 /** Task switch caused by an interrupt/exception. */
1061 IEMTASKSWITCH_INT_XCPT = 1,
1062 /** Task switch caused by a far CALL. */
1063 IEMTASKSWITCH_CALL,
1064 /** Task switch caused by a far JMP. */
1065 IEMTASKSWITCH_JUMP,
1066 /** Task switch caused by an IRET. */
1067 IEMTASKSWITCH_IRET
1068} IEMTASKSWITCH;
1069AssertCompileSize(IEMTASKSWITCH, 4);
1070
1071/**
1072 * Possible CrX load (write) sources.
1073 */
1074typedef enum IEMACCESSCRX
1075{
1076 /** CrX access caused by 'mov crX' instruction. */
1077 IEMACCESSCRX_MOV_CRX,
1078 /** CrX (CR0) write caused by 'lmsw' instruction. */
1079 IEMACCESSCRX_LMSW,
1080 /** CrX (CR0) write caused by 'clts' instruction. */
1081 IEMACCESSCRX_CLTS,
1082 /** CrX (CR0) read caused by 'smsw' instruction. */
1083 IEMACCESSCRX_SMSW
1084} IEMACCESSCRX;
1085
1086#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
1087/** @name IEM_SLAT_FAIL_XXX - Second-level address translation failure information.
1088 *
1089 * These flags provide further context to SLAT page-walk failures that could not be
1090 * determined by PGM (e.g, PGM is not privy to memory access permissions).
1091 *
1092 * @{
1093 */
1094/** Translating a nested-guest linear address failed accessing a nested-guest
1095 * physical address. */
1096# define IEM_SLAT_FAIL_LINEAR_TO_PHYS_ADDR RT_BIT_32(0)
1097/** Translating a nested-guest linear address failed accessing a
1098 * paging-structure entry or updating accessed/dirty bits. */
1099# define IEM_SLAT_FAIL_LINEAR_TO_PAGE_TABLE RT_BIT_32(1)
1100/** @} */
1101
1102DECLCALLBACK(FNPGMPHYSHANDLER) iemVmxApicAccessPageHandler;
1103# ifndef IN_RING3
1104DECLCALLBACK(FNPGMRZPHYSPFHANDLER) iemVmxApicAccessPagePfHandler;
1105# endif
1106#endif
1107
1108/**
1109 * Indicates to the verifier that the given flag set is undefined.
1110 *
1111 * Can be invoked again to add more flags.
1112 *
1113 * This is a NOOP if the verifier isn't compiled in.
1114 *
1115 * @note We're temporarily keeping this until code is converted to new
1116 * disassembler style opcode handling.
1117 */
1118#define IEMOP_VERIFICATION_UNDEFINED_EFLAGS(a_fEfl) do { } while (0)
1119
1120
1121/** @def IEM_DECL_IMPL_TYPE
1122 * For typedef'ing an instruction implementation function.
1123 *
1124 * @param a_RetType The return type.
1125 * @param a_Name The name of the type.
1126 * @param a_ArgList The argument list enclosed in parentheses.
1127 */
1128
1129/** @def IEM_DECL_IMPL_DEF
1130 * For defining an instruction implementation function.
1131 *
1132 * @param a_RetType The return type.
1133 * @param a_Name The name of the type.
1134 * @param a_ArgList The argument list enclosed in parentheses.
1135 */
1136
1137#if defined(__GNUC__) && defined(RT_ARCH_X86)
1138# define IEM_DECL_IMPL_TYPE(a_RetType, a_Name, a_ArgList) \
1139 __attribute__((__fastcall__)) a_RetType (a_Name) a_ArgList
1140# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
1141 __attribute__((__fastcall__, __nothrow__)) a_RetType a_Name a_ArgList
1142# define IEM_DECL_IMPL_PROTO(a_RetType, a_Name, a_ArgList) \
1143 __attribute__((__fastcall__, __nothrow__)) a_RetType a_Name a_ArgList
1144
1145#elif defined(_MSC_VER) && defined(RT_ARCH_X86)
1146# define IEM_DECL_IMPL_TYPE(a_RetType, a_Name, a_ArgList) \
1147 a_RetType (__fastcall a_Name) a_ArgList
1148# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
1149 a_RetType __fastcall a_Name a_ArgList RT_NOEXCEPT
1150# define IEM_DECL_IMPL_PROTO(a_RetType, a_Name, a_ArgList) \
1151 a_RetType __fastcall a_Name a_ArgList RT_NOEXCEPT
1152
1153#elif __cplusplus >= 201700 /* P0012R1 support */
1154# define IEM_DECL_IMPL_TYPE(a_RetType, a_Name, a_ArgList) \
1155 a_RetType (VBOXCALL a_Name) a_ArgList RT_NOEXCEPT
1156# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
1157 a_RetType VBOXCALL a_Name a_ArgList RT_NOEXCEPT
1158# define IEM_DECL_IMPL_PROTO(a_RetType, a_Name, a_ArgList) \
1159 a_RetType VBOXCALL a_Name a_ArgList RT_NOEXCEPT
1160
1161#else
1162# define IEM_DECL_IMPL_TYPE(a_RetType, a_Name, a_ArgList) \
1163 a_RetType (VBOXCALL a_Name) a_ArgList
1164# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
1165 a_RetType VBOXCALL a_Name a_ArgList
1166# define IEM_DECL_IMPL_PROTO(a_RetType, a_Name, a_ArgList) \
1167 a_RetType VBOXCALL a_Name a_ArgList
1168
1169#endif
1170
1171/** Defined in IEMAllAImplC.cpp but also used by IEMAllAImplA.asm. */
1172RT_C_DECLS_BEGIN
1173extern uint8_t const g_afParity[256];
1174RT_C_DECLS_END
1175
1176
1177/** @name Arithmetic assignment operations on bytes (binary).
1178 * @{ */
1179typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU8, (uint8_t *pu8Dst, uint8_t u8Src, uint32_t *pEFlags));
1180typedef FNIEMAIMPLBINU8 *PFNIEMAIMPLBINU8;
1181FNIEMAIMPLBINU8 iemAImpl_add_u8, iemAImpl_add_u8_locked;
1182FNIEMAIMPLBINU8 iemAImpl_adc_u8, iemAImpl_adc_u8_locked;
1183FNIEMAIMPLBINU8 iemAImpl_sub_u8, iemAImpl_sub_u8_locked;
1184FNIEMAIMPLBINU8 iemAImpl_sbb_u8, iemAImpl_sbb_u8_locked;
1185FNIEMAIMPLBINU8 iemAImpl_or_u8, iemAImpl_or_u8_locked;
1186FNIEMAIMPLBINU8 iemAImpl_xor_u8, iemAImpl_xor_u8_locked;
1187FNIEMAIMPLBINU8 iemAImpl_and_u8, iemAImpl_and_u8_locked;
1188/** @} */
1189
1190/** @name Arithmetic assignment operations on words (binary).
1191 * @{ */
1192typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU16, (uint16_t *pu16Dst, uint16_t u16Src, uint32_t *pEFlags));
1193typedef FNIEMAIMPLBINU16 *PFNIEMAIMPLBINU16;
1194FNIEMAIMPLBINU16 iemAImpl_add_u16, iemAImpl_add_u16_locked;
1195FNIEMAIMPLBINU16 iemAImpl_adc_u16, iemAImpl_adc_u16_locked;
1196FNIEMAIMPLBINU16 iemAImpl_sub_u16, iemAImpl_sub_u16_locked;
1197FNIEMAIMPLBINU16 iemAImpl_sbb_u16, iemAImpl_sbb_u16_locked;
1198FNIEMAIMPLBINU16 iemAImpl_or_u16, iemAImpl_or_u16_locked;
1199FNIEMAIMPLBINU16 iemAImpl_xor_u16, iemAImpl_xor_u16_locked;
1200FNIEMAIMPLBINU16 iemAImpl_and_u16, iemAImpl_and_u16_locked;
1201/** @} */
1202
1203/** @name Arithmetic assignment operations on double words (binary).
1204 * @{ */
1205typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU32, (uint32_t *pu32Dst, uint32_t u32Src, uint32_t *pEFlags));
1206typedef FNIEMAIMPLBINU32 *PFNIEMAIMPLBINU32;
1207FNIEMAIMPLBINU32 iemAImpl_add_u32, iemAImpl_add_u32_locked;
1208FNIEMAIMPLBINU32 iemAImpl_adc_u32, iemAImpl_adc_u32_locked;
1209FNIEMAIMPLBINU32 iemAImpl_sub_u32, iemAImpl_sub_u32_locked;
1210FNIEMAIMPLBINU32 iemAImpl_sbb_u32, iemAImpl_sbb_u32_locked;
1211FNIEMAIMPLBINU32 iemAImpl_or_u32, iemAImpl_or_u32_locked;
1212FNIEMAIMPLBINU32 iemAImpl_xor_u32, iemAImpl_xor_u32_locked;
1213FNIEMAIMPLBINU32 iemAImpl_and_u32, iemAImpl_and_u32_locked;
1214FNIEMAIMPLBINU32 iemAImpl_blsi_u32, iemAImpl_blsi_u32_fallback;
1215FNIEMAIMPLBINU32 iemAImpl_blsr_u32, iemAImpl_blsr_u32_fallback;
1216FNIEMAIMPLBINU32 iemAImpl_blsmsk_u32, iemAImpl_blsmsk_u32_fallback;
1217/** @} */
1218
1219/** @name Arithmetic assignment operations on quad words (binary).
1220 * @{ */
1221typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINU64, (uint64_t *pu64Dst, uint64_t u64Src, uint32_t *pEFlags));
1222typedef FNIEMAIMPLBINU64 *PFNIEMAIMPLBINU64;
1223FNIEMAIMPLBINU64 iemAImpl_add_u64, iemAImpl_add_u64_locked;
1224FNIEMAIMPLBINU64 iemAImpl_adc_u64, iemAImpl_adc_u64_locked;
1225FNIEMAIMPLBINU64 iemAImpl_sub_u64, iemAImpl_sub_u64_locked;
1226FNIEMAIMPLBINU64 iemAImpl_sbb_u64, iemAImpl_sbb_u64_locked;
1227FNIEMAIMPLBINU64 iemAImpl_or_u64, iemAImpl_or_u64_locked;
1228FNIEMAIMPLBINU64 iemAImpl_xor_u64, iemAImpl_xor_u64_locked;
1229FNIEMAIMPLBINU64 iemAImpl_and_u64, iemAImpl_and_u64_locked;
1230FNIEMAIMPLBINU64 iemAImpl_blsi_u64, iemAImpl_blsi_u64_fallback;
1231FNIEMAIMPLBINU64 iemAImpl_blsr_u64, iemAImpl_blsr_u64_fallback;
1232FNIEMAIMPLBINU64 iemAImpl_blsmsk_u64, iemAImpl_blsmsk_u64_fallback;
1233/** @} */
1234
1235/** @name Compare operations (thrown in with the binary ops).
1236 * @{ */
1237FNIEMAIMPLBINU8 iemAImpl_cmp_u8;
1238FNIEMAIMPLBINU16 iemAImpl_cmp_u16;
1239FNIEMAIMPLBINU32 iemAImpl_cmp_u32;
1240FNIEMAIMPLBINU64 iemAImpl_cmp_u64;
1241/** @} */
1242
1243/** @name Test operations (thrown in with the binary ops).
1244 * @{ */
1245FNIEMAIMPLBINU8 iemAImpl_test_u8;
1246FNIEMAIMPLBINU16 iemAImpl_test_u16;
1247FNIEMAIMPLBINU32 iemAImpl_test_u32;
1248FNIEMAIMPLBINU64 iemAImpl_test_u64;
1249/** @} */
1250
1251/** @name Bit operations operations (thrown in with the binary ops).
1252 * @{ */
1253FNIEMAIMPLBINU16 iemAImpl_bt_u16;
1254FNIEMAIMPLBINU32 iemAImpl_bt_u32;
1255FNIEMAIMPLBINU64 iemAImpl_bt_u64;
1256FNIEMAIMPLBINU16 iemAImpl_btc_u16, iemAImpl_btc_u16_locked;
1257FNIEMAIMPLBINU32 iemAImpl_btc_u32, iemAImpl_btc_u32_locked;
1258FNIEMAIMPLBINU64 iemAImpl_btc_u64, iemAImpl_btc_u64_locked;
1259FNIEMAIMPLBINU16 iemAImpl_btr_u16, iemAImpl_btr_u16_locked;
1260FNIEMAIMPLBINU32 iemAImpl_btr_u32, iemAImpl_btr_u32_locked;
1261FNIEMAIMPLBINU64 iemAImpl_btr_u64, iemAImpl_btr_u64_locked;
1262FNIEMAIMPLBINU16 iemAImpl_bts_u16, iemAImpl_bts_u16_locked;
1263FNIEMAIMPLBINU32 iemAImpl_bts_u32, iemAImpl_bts_u32_locked;
1264FNIEMAIMPLBINU64 iemAImpl_bts_u64, iemAImpl_bts_u64_locked;
1265/** @} */
1266
1267/** @name Arithmetic three operand operations on double words (binary).
1268 * @{ */
1269typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINVEXU32, (uint32_t *pu32Dst, uint32_t u32Src1, uint32_t u32Src2, uint32_t *pEFlags));
1270typedef FNIEMAIMPLBINVEXU32 *PFNIEMAIMPLBINVEXU32;
1271FNIEMAIMPLBINVEXU32 iemAImpl_andn_u32, iemAImpl_andn_u32_fallback;
1272FNIEMAIMPLBINVEXU32 iemAImpl_bextr_u32, iemAImpl_bextr_u32_fallback;
1273FNIEMAIMPLBINVEXU32 iemAImpl_bzhi_u32, iemAImpl_bzhi_u32_fallback;
1274/** @} */
1275
1276/** @name Arithmetic three operand operations on quad words (binary).
1277 * @{ */
1278typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINVEXU64, (uint64_t *pu64Dst, uint64_t u64Src1, uint64_t u64Src2, uint32_t *pEFlags));
1279typedef FNIEMAIMPLBINVEXU64 *PFNIEMAIMPLBINVEXU64;
1280FNIEMAIMPLBINVEXU64 iemAImpl_andn_u64, iemAImpl_andn_u64_fallback;
1281FNIEMAIMPLBINVEXU64 iemAImpl_bextr_u64, iemAImpl_bextr_u64_fallback;
1282FNIEMAIMPLBINVEXU64 iemAImpl_bzhi_u64, iemAImpl_bzhi_u64_fallback;
1283/** @} */
1284
1285/** @name Arithmetic three operand operations on double words w/o EFLAGS (binary).
1286 * @{ */
1287typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINVEXU32NOEFL, (uint32_t *pu32Dst, uint32_t u32Src1, uint32_t u32Src2));
1288typedef FNIEMAIMPLBINVEXU32NOEFL *PFNIEMAIMPLBINVEXU32NOEFL;
1289FNIEMAIMPLBINVEXU32NOEFL iemAImpl_pdep_u32, iemAImpl_pdep_u32_fallback;
1290FNIEMAIMPLBINVEXU32NOEFL iemAImpl_pext_u32, iemAImpl_pext_u32_fallback;
1291FNIEMAIMPLBINVEXU32NOEFL iemAImpl_sarx_u32, iemAImpl_sarx_u32_fallback;
1292FNIEMAIMPLBINVEXU32NOEFL iemAImpl_shlx_u32, iemAImpl_shlx_u32_fallback;
1293FNIEMAIMPLBINVEXU32NOEFL iemAImpl_shrx_u32, iemAImpl_shrx_u32_fallback;
1294FNIEMAIMPLBINVEXU32NOEFL iemAImpl_rorx_u32;
1295/** @} */
1296
1297/** @name Arithmetic three operand operations on quad words w/o EFLAGS (binary).
1298 * @{ */
1299typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBINVEXU64NOEFL, (uint64_t *pu64Dst, uint64_t u64Src1, uint64_t u64Src2));
1300typedef FNIEMAIMPLBINVEXU64NOEFL *PFNIEMAIMPLBINVEXU64NOEFL;
1301FNIEMAIMPLBINVEXU64NOEFL iemAImpl_pdep_u64, iemAImpl_pdep_u64_fallback;
1302FNIEMAIMPLBINVEXU64NOEFL iemAImpl_pext_u64, iemAImpl_pext_u64_fallback;
1303FNIEMAIMPLBINVEXU64NOEFL iemAImpl_sarx_u64, iemAImpl_sarx_u64_fallback;
1304FNIEMAIMPLBINVEXU64NOEFL iemAImpl_shlx_u64, iemAImpl_shlx_u64_fallback;
1305FNIEMAIMPLBINVEXU64NOEFL iemAImpl_shrx_u64, iemAImpl_shrx_u64_fallback;
1306FNIEMAIMPLBINVEXU64NOEFL iemAImpl_rorx_u64;
1307/** @} */
1308
1309/** @name MULX 32-bit and 64-bit.
1310 * @{ */
1311typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMULXVEXU32, (uint32_t *puDst1, uint32_t *puDst2, uint32_t uSrc1, uint32_t uSrc2));
1312typedef FNIEMAIMPLMULXVEXU32 *PFNIEMAIMPLMULXVEXU32;
1313FNIEMAIMPLMULXVEXU32 iemAImpl_mulx_u32, iemAImpl_mulx_u32_fallback;
1314
1315typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMULXVEXU64, (uint64_t *puDst1, uint64_t *puDst2, uint64_t uSrc1, uint64_t uSrc2));
1316typedef FNIEMAIMPLMULXVEXU64 *PFNIEMAIMPLMULXVEXU64;
1317FNIEMAIMPLMULXVEXU64 iemAImpl_mulx_u64, iemAImpl_mulx_u64_fallback;
1318/** @} */
1319
1320
1321/** @name Exchange memory with register operations.
1322 * @{ */
1323IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u8_locked, (uint8_t *pu8Mem, uint8_t *pu8Reg));
1324IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u16_locked,(uint16_t *pu16Mem, uint16_t *pu16Reg));
1325IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u32_locked,(uint32_t *pu32Mem, uint32_t *pu32Reg));
1326IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u64_locked,(uint64_t *pu64Mem, uint64_t *pu64Reg));
1327IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u8_unlocked, (uint8_t *pu8Mem, uint8_t *pu8Reg));
1328IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u16_unlocked,(uint16_t *pu16Mem, uint16_t *pu16Reg));
1329IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u32_unlocked,(uint32_t *pu32Mem, uint32_t *pu32Reg));
1330IEM_DECL_IMPL_DEF(void, iemAImpl_xchg_u64_unlocked,(uint64_t *pu64Mem, uint64_t *pu64Reg));
1331/** @} */
1332
1333/** @name Exchange and add operations.
1334 * @{ */
1335IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u8, (uint8_t *pu8Dst, uint8_t *pu8Reg, uint32_t *pEFlags));
1336IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u16,(uint16_t *pu16Dst, uint16_t *pu16Reg, uint32_t *pEFlags));
1337IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u32,(uint32_t *pu32Dst, uint32_t *pu32Reg, uint32_t *pEFlags));
1338IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u64,(uint64_t *pu64Dst, uint64_t *pu64Reg, uint32_t *pEFlags));
1339IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u8_locked, (uint8_t *pu8Dst, uint8_t *pu8Reg, uint32_t *pEFlags));
1340IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u16_locked,(uint16_t *pu16Dst, uint16_t *pu16Reg, uint32_t *pEFlags));
1341IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u32_locked,(uint32_t *pu32Dst, uint32_t *pu32Reg, uint32_t *pEFlags));
1342IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u64_locked,(uint64_t *pu64Dst, uint64_t *pu64Reg, uint32_t *pEFlags));
1343/** @} */
1344
1345/** @name Compare and exchange.
1346 * @{ */
1347IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u8, (uint8_t *pu8Dst, uint8_t *puAl, uint8_t uSrcReg, uint32_t *pEFlags));
1348IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u8_locked, (uint8_t *pu8Dst, uint8_t *puAl, uint8_t uSrcReg, uint32_t *pEFlags));
1349IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u16, (uint16_t *pu16Dst, uint16_t *puAx, uint16_t uSrcReg, uint32_t *pEFlags));
1350IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u16_locked,(uint16_t *pu16Dst, uint16_t *puAx, uint16_t uSrcReg, uint32_t *pEFlags));
1351IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u32, (uint32_t *pu32Dst, uint32_t *puEax, uint32_t uSrcReg, uint32_t *pEFlags));
1352IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u32_locked,(uint32_t *pu32Dst, uint32_t *puEax, uint32_t uSrcReg, uint32_t *pEFlags));
1353#if ARCH_BITS == 32
1354IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u64, (uint64_t *pu64Dst, uint64_t *puRax, uint64_t *puSrcReg, uint32_t *pEFlags));
1355IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u64_locked,(uint64_t *pu64Dst, uint64_t *puRax, uint64_t *puSrcReg, uint32_t *pEFlags));
1356#else
1357IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u64, (uint64_t *pu64Dst, uint64_t *puRax, uint64_t uSrcReg, uint32_t *pEFlags));
1358IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg_u64_locked,(uint64_t *pu64Dst, uint64_t *puRax, uint64_t uSrcReg, uint32_t *pEFlags));
1359#endif
1360IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg8b,(uint64_t *pu64Dst, PRTUINT64U pu64EaxEdx, PRTUINT64U pu64EbxEcx,
1361 uint32_t *pEFlags));
1362IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg8b_locked,(uint64_t *pu64Dst, PRTUINT64U pu64EaxEdx, PRTUINT64U pu64EbxEcx,
1363 uint32_t *pEFlags));
1364IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg16b,(PRTUINT128U pu128Dst, PRTUINT128U pu128RaxRdx, PRTUINT128U pu128RbxRcx,
1365 uint32_t *pEFlags));
1366IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg16b_locked,(PRTUINT128U pu128Dst, PRTUINT128U pu128RaxRdx, PRTUINT128U pu128RbxRcx,
1367 uint32_t *pEFlags));
1368#ifndef RT_ARCH_ARM64
1369IEM_DECL_IMPL_DEF(void, iemAImpl_cmpxchg16b_fallback,(PRTUINT128U pu128Dst, PRTUINT128U pu128RaxRdx,
1370 PRTUINT128U pu128RbxRcx, uint32_t *pEFlags));
1371#endif
1372/** @} */
1373
1374/** @name Memory ordering
1375 * @{ */
1376typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEMFENCE,(void));
1377typedef FNIEMAIMPLMEMFENCE *PFNIEMAIMPLMEMFENCE;
1378IEM_DECL_IMPL_DEF(void, iemAImpl_mfence,(void));
1379IEM_DECL_IMPL_DEF(void, iemAImpl_sfence,(void));
1380IEM_DECL_IMPL_DEF(void, iemAImpl_lfence,(void));
1381#ifndef RT_ARCH_ARM64
1382IEM_DECL_IMPL_DEF(void, iemAImpl_alt_mem_fence,(void));
1383#endif
1384/** @} */
1385
1386/** @name Double precision shifts
1387 * @{ */
1388typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTDBLU16,(uint16_t *pu16Dst, uint16_t u16Src, uint8_t cShift, uint32_t *pEFlags));
1389typedef FNIEMAIMPLSHIFTDBLU16 *PFNIEMAIMPLSHIFTDBLU16;
1390typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTDBLU32,(uint32_t *pu32Dst, uint32_t u32Src, uint8_t cShift, uint32_t *pEFlags));
1391typedef FNIEMAIMPLSHIFTDBLU32 *PFNIEMAIMPLSHIFTDBLU32;
1392typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTDBLU64,(uint64_t *pu64Dst, uint64_t u64Src, uint8_t cShift, uint32_t *pEFlags));
1393typedef FNIEMAIMPLSHIFTDBLU64 *PFNIEMAIMPLSHIFTDBLU64;
1394FNIEMAIMPLSHIFTDBLU16 iemAImpl_shld_u16, iemAImpl_shld_u16_amd, iemAImpl_shld_u16_intel;
1395FNIEMAIMPLSHIFTDBLU32 iemAImpl_shld_u32, iemAImpl_shld_u32_amd, iemAImpl_shld_u32_intel;
1396FNIEMAIMPLSHIFTDBLU64 iemAImpl_shld_u64, iemAImpl_shld_u64_amd, iemAImpl_shld_u64_intel;
1397FNIEMAIMPLSHIFTDBLU16 iemAImpl_shrd_u16, iemAImpl_shrd_u16_amd, iemAImpl_shrd_u16_intel;
1398FNIEMAIMPLSHIFTDBLU32 iemAImpl_shrd_u32, iemAImpl_shrd_u32_amd, iemAImpl_shrd_u32_intel;
1399FNIEMAIMPLSHIFTDBLU64 iemAImpl_shrd_u64, iemAImpl_shrd_u64_amd, iemAImpl_shrd_u64_intel;
1400/** @} */
1401
1402
1403/** @name Bit search operations (thrown in with the binary ops).
1404 * @{ */
1405FNIEMAIMPLBINU16 iemAImpl_bsf_u16, iemAImpl_bsf_u16_amd, iemAImpl_bsf_u16_intel;
1406FNIEMAIMPLBINU32 iemAImpl_bsf_u32, iemAImpl_bsf_u32_amd, iemAImpl_bsf_u32_intel;
1407FNIEMAIMPLBINU64 iemAImpl_bsf_u64, iemAImpl_bsf_u64_amd, iemAImpl_bsf_u64_intel;
1408FNIEMAIMPLBINU16 iemAImpl_bsr_u16, iemAImpl_bsr_u16_amd, iemAImpl_bsr_u16_intel;
1409FNIEMAIMPLBINU32 iemAImpl_bsr_u32, iemAImpl_bsr_u32_amd, iemAImpl_bsr_u32_intel;
1410FNIEMAIMPLBINU64 iemAImpl_bsr_u64, iemAImpl_bsr_u64_amd, iemAImpl_bsr_u64_intel;
1411FNIEMAIMPLBINU16 iemAImpl_lzcnt_u16, iemAImpl_lzcnt_u16_amd, iemAImpl_lzcnt_u16_intel;
1412FNIEMAIMPLBINU32 iemAImpl_lzcnt_u32, iemAImpl_lzcnt_u32_amd, iemAImpl_lzcnt_u32_intel;
1413FNIEMAIMPLBINU64 iemAImpl_lzcnt_u64, iemAImpl_lzcnt_u64_amd, iemAImpl_lzcnt_u64_intel;
1414FNIEMAIMPLBINU16 iemAImpl_tzcnt_u16, iemAImpl_tzcnt_u16_amd, iemAImpl_tzcnt_u16_intel;
1415FNIEMAIMPLBINU32 iemAImpl_tzcnt_u32, iemAImpl_tzcnt_u32_amd, iemAImpl_tzcnt_u32_intel;
1416FNIEMAIMPLBINU64 iemAImpl_tzcnt_u64, iemAImpl_tzcnt_u64_amd, iemAImpl_tzcnt_u64_intel;
1417FNIEMAIMPLBINU16 iemAImpl_popcnt_u16, iemAImpl_popcnt_u16_fallback;
1418FNIEMAIMPLBINU32 iemAImpl_popcnt_u32, iemAImpl_popcnt_u32_fallback;
1419FNIEMAIMPLBINU64 iemAImpl_popcnt_u64, iemAImpl_popcnt_u64_fallback;
1420/** @} */
1421
1422/** @name Signed multiplication operations (thrown in with the binary ops).
1423 * @{ */
1424FNIEMAIMPLBINU16 iemAImpl_imul_two_u16, iemAImpl_imul_two_u16_amd, iemAImpl_imul_two_u16_intel;
1425FNIEMAIMPLBINU32 iemAImpl_imul_two_u32, iemAImpl_imul_two_u32_amd, iemAImpl_imul_two_u32_intel;
1426FNIEMAIMPLBINU64 iemAImpl_imul_two_u64, iemAImpl_imul_two_u64_amd, iemAImpl_imul_two_u64_intel;
1427/** @} */
1428
1429/** @name Arithmetic assignment operations on bytes (unary).
1430 * @{ */
1431typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU8, (uint8_t *pu8Dst, uint32_t *pEFlags));
1432typedef FNIEMAIMPLUNARYU8 *PFNIEMAIMPLUNARYU8;
1433FNIEMAIMPLUNARYU8 iemAImpl_inc_u8, iemAImpl_inc_u8_locked;
1434FNIEMAIMPLUNARYU8 iemAImpl_dec_u8, iemAImpl_dec_u8_locked;
1435FNIEMAIMPLUNARYU8 iemAImpl_not_u8, iemAImpl_not_u8_locked;
1436FNIEMAIMPLUNARYU8 iemAImpl_neg_u8, iemAImpl_neg_u8_locked;
1437/** @} */
1438
1439/** @name Arithmetic assignment operations on words (unary).
1440 * @{ */
1441typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU16, (uint16_t *pu16Dst, uint32_t *pEFlags));
1442typedef FNIEMAIMPLUNARYU16 *PFNIEMAIMPLUNARYU16;
1443FNIEMAIMPLUNARYU16 iemAImpl_inc_u16, iemAImpl_inc_u16_locked;
1444FNIEMAIMPLUNARYU16 iemAImpl_dec_u16, iemAImpl_dec_u16_locked;
1445FNIEMAIMPLUNARYU16 iemAImpl_not_u16, iemAImpl_not_u16_locked;
1446FNIEMAIMPLUNARYU16 iemAImpl_neg_u16, iemAImpl_neg_u16_locked;
1447/** @} */
1448
1449/** @name Arithmetic assignment operations on double words (unary).
1450 * @{ */
1451typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU32, (uint32_t *pu32Dst, uint32_t *pEFlags));
1452typedef FNIEMAIMPLUNARYU32 *PFNIEMAIMPLUNARYU32;
1453FNIEMAIMPLUNARYU32 iemAImpl_inc_u32, iemAImpl_inc_u32_locked;
1454FNIEMAIMPLUNARYU32 iemAImpl_dec_u32, iemAImpl_dec_u32_locked;
1455FNIEMAIMPLUNARYU32 iemAImpl_not_u32, iemAImpl_not_u32_locked;
1456FNIEMAIMPLUNARYU32 iemAImpl_neg_u32, iemAImpl_neg_u32_locked;
1457/** @} */
1458
1459/** @name Arithmetic assignment operations on quad words (unary).
1460 * @{ */
1461typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLUNARYU64, (uint64_t *pu64Dst, uint32_t *pEFlags));
1462typedef FNIEMAIMPLUNARYU64 *PFNIEMAIMPLUNARYU64;
1463FNIEMAIMPLUNARYU64 iemAImpl_inc_u64, iemAImpl_inc_u64_locked;
1464FNIEMAIMPLUNARYU64 iemAImpl_dec_u64, iemAImpl_dec_u64_locked;
1465FNIEMAIMPLUNARYU64 iemAImpl_not_u64, iemAImpl_not_u64_locked;
1466FNIEMAIMPLUNARYU64 iemAImpl_neg_u64, iemAImpl_neg_u64_locked;
1467/** @} */
1468
1469
1470/** @name Shift operations on bytes (Group 2).
1471 * @{ */
1472typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU8,(uint8_t *pu8Dst, uint8_t cShift, uint32_t *pEFlags));
1473typedef FNIEMAIMPLSHIFTU8 *PFNIEMAIMPLSHIFTU8;
1474FNIEMAIMPLSHIFTU8 iemAImpl_rol_u8, iemAImpl_rol_u8_amd, iemAImpl_rol_u8_intel;
1475FNIEMAIMPLSHIFTU8 iemAImpl_ror_u8, iemAImpl_ror_u8_amd, iemAImpl_ror_u8_intel;
1476FNIEMAIMPLSHIFTU8 iemAImpl_rcl_u8, iemAImpl_rcl_u8_amd, iemAImpl_rcl_u8_intel;
1477FNIEMAIMPLSHIFTU8 iemAImpl_rcr_u8, iemAImpl_rcr_u8_amd, iemAImpl_rcr_u8_intel;
1478FNIEMAIMPLSHIFTU8 iemAImpl_shl_u8, iemAImpl_shl_u8_amd, iemAImpl_shl_u8_intel;
1479FNIEMAIMPLSHIFTU8 iemAImpl_shr_u8, iemAImpl_shr_u8_amd, iemAImpl_shr_u8_intel;
1480FNIEMAIMPLSHIFTU8 iemAImpl_sar_u8, iemAImpl_sar_u8_amd, iemAImpl_sar_u8_intel;
1481/** @} */
1482
1483/** @name Shift operations on words (Group 2).
1484 * @{ */
1485typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU16,(uint16_t *pu16Dst, uint8_t cShift, uint32_t *pEFlags));
1486typedef FNIEMAIMPLSHIFTU16 *PFNIEMAIMPLSHIFTU16;
1487FNIEMAIMPLSHIFTU16 iemAImpl_rol_u16, iemAImpl_rol_u16_amd, iemAImpl_rol_u16_intel;
1488FNIEMAIMPLSHIFTU16 iemAImpl_ror_u16, iemAImpl_ror_u16_amd, iemAImpl_ror_u16_intel;
1489FNIEMAIMPLSHIFTU16 iemAImpl_rcl_u16, iemAImpl_rcl_u16_amd, iemAImpl_rcl_u16_intel;
1490FNIEMAIMPLSHIFTU16 iemAImpl_rcr_u16, iemAImpl_rcr_u16_amd, iemAImpl_rcr_u16_intel;
1491FNIEMAIMPLSHIFTU16 iemAImpl_shl_u16, iemAImpl_shl_u16_amd, iemAImpl_shl_u16_intel;
1492FNIEMAIMPLSHIFTU16 iemAImpl_shr_u16, iemAImpl_shr_u16_amd, iemAImpl_shr_u16_intel;
1493FNIEMAIMPLSHIFTU16 iemAImpl_sar_u16, iemAImpl_sar_u16_amd, iemAImpl_sar_u16_intel;
1494/** @} */
1495
1496/** @name Shift operations on double words (Group 2).
1497 * @{ */
1498typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU32,(uint32_t *pu32Dst, uint8_t cShift, uint32_t *pEFlags));
1499typedef FNIEMAIMPLSHIFTU32 *PFNIEMAIMPLSHIFTU32;
1500FNIEMAIMPLSHIFTU32 iemAImpl_rol_u32, iemAImpl_rol_u32_amd, iemAImpl_rol_u32_intel;
1501FNIEMAIMPLSHIFTU32 iemAImpl_ror_u32, iemAImpl_ror_u32_amd, iemAImpl_ror_u32_intel;
1502FNIEMAIMPLSHIFTU32 iemAImpl_rcl_u32, iemAImpl_rcl_u32_amd, iemAImpl_rcl_u32_intel;
1503FNIEMAIMPLSHIFTU32 iemAImpl_rcr_u32, iemAImpl_rcr_u32_amd, iemAImpl_rcr_u32_intel;
1504FNIEMAIMPLSHIFTU32 iemAImpl_shl_u32, iemAImpl_shl_u32_amd, iemAImpl_shl_u32_intel;
1505FNIEMAIMPLSHIFTU32 iemAImpl_shr_u32, iemAImpl_shr_u32_amd, iemAImpl_shr_u32_intel;
1506FNIEMAIMPLSHIFTU32 iemAImpl_sar_u32, iemAImpl_sar_u32_amd, iemAImpl_sar_u32_intel;
1507/** @} */
1508
1509/** @name Shift operations on words (Group 2).
1510 * @{ */
1511typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLSHIFTU64,(uint64_t *pu64Dst, uint8_t cShift, uint32_t *pEFlags));
1512typedef FNIEMAIMPLSHIFTU64 *PFNIEMAIMPLSHIFTU64;
1513FNIEMAIMPLSHIFTU64 iemAImpl_rol_u64, iemAImpl_rol_u64_amd, iemAImpl_rol_u64_intel;
1514FNIEMAIMPLSHIFTU64 iemAImpl_ror_u64, iemAImpl_ror_u64_amd, iemAImpl_ror_u64_intel;
1515FNIEMAIMPLSHIFTU64 iemAImpl_rcl_u64, iemAImpl_rcl_u64_amd, iemAImpl_rcl_u64_intel;
1516FNIEMAIMPLSHIFTU64 iemAImpl_rcr_u64, iemAImpl_rcr_u64_amd, iemAImpl_rcr_u64_intel;
1517FNIEMAIMPLSHIFTU64 iemAImpl_shl_u64, iemAImpl_shl_u64_amd, iemAImpl_shl_u64_intel;
1518FNIEMAIMPLSHIFTU64 iemAImpl_shr_u64, iemAImpl_shr_u64_amd, iemAImpl_shr_u64_intel;
1519FNIEMAIMPLSHIFTU64 iemAImpl_sar_u64, iemAImpl_sar_u64_amd, iemAImpl_sar_u64_intel;
1520/** @} */
1521
1522/** @name Multiplication and division operations.
1523 * @{ */
1524typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU8,(uint16_t *pu16AX, uint8_t u8FactorDivisor, uint32_t *pEFlags));
1525typedef FNIEMAIMPLMULDIVU8 *PFNIEMAIMPLMULDIVU8;
1526FNIEMAIMPLMULDIVU8 iemAImpl_mul_u8, iemAImpl_mul_u8_amd, iemAImpl_mul_u8_intel;
1527FNIEMAIMPLMULDIVU8 iemAImpl_imul_u8, iemAImpl_imul_u8_amd, iemAImpl_imul_u8_intel;
1528FNIEMAIMPLMULDIVU8 iemAImpl_div_u8, iemAImpl_div_u8_amd, iemAImpl_div_u8_intel;
1529FNIEMAIMPLMULDIVU8 iemAImpl_idiv_u8, iemAImpl_idiv_u8_amd, iemAImpl_idiv_u8_intel;
1530
1531typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU16,(uint16_t *pu16AX, uint16_t *pu16DX, uint16_t u16FactorDivisor, uint32_t *pEFlags));
1532typedef FNIEMAIMPLMULDIVU16 *PFNIEMAIMPLMULDIVU16;
1533FNIEMAIMPLMULDIVU16 iemAImpl_mul_u16, iemAImpl_mul_u16_amd, iemAImpl_mul_u16_intel;
1534FNIEMAIMPLMULDIVU16 iemAImpl_imul_u16, iemAImpl_imul_u16_amd, iemAImpl_imul_u16_intel;
1535FNIEMAIMPLMULDIVU16 iemAImpl_div_u16, iemAImpl_div_u16_amd, iemAImpl_div_u16_intel;
1536FNIEMAIMPLMULDIVU16 iemAImpl_idiv_u16, iemAImpl_idiv_u16_amd, iemAImpl_idiv_u16_intel;
1537
1538typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU32,(uint32_t *pu32EAX, uint32_t *pu32EDX, uint32_t u32FactorDivisor, uint32_t *pEFlags));
1539typedef FNIEMAIMPLMULDIVU32 *PFNIEMAIMPLMULDIVU32;
1540FNIEMAIMPLMULDIVU32 iemAImpl_mul_u32, iemAImpl_mul_u32_amd, iemAImpl_mul_u32_intel;
1541FNIEMAIMPLMULDIVU32 iemAImpl_imul_u32, iemAImpl_imul_u32_amd, iemAImpl_imul_u32_intel;
1542FNIEMAIMPLMULDIVU32 iemAImpl_div_u32, iemAImpl_div_u32_amd, iemAImpl_div_u32_intel;
1543FNIEMAIMPLMULDIVU32 iemAImpl_idiv_u32, iemAImpl_idiv_u32_amd, iemAImpl_idiv_u32_intel;
1544
1545typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU64,(uint64_t *pu64RAX, uint64_t *pu64RDX, uint64_t u64FactorDivisor, uint32_t *pEFlags));
1546typedef FNIEMAIMPLMULDIVU64 *PFNIEMAIMPLMULDIVU64;
1547FNIEMAIMPLMULDIVU64 iemAImpl_mul_u64, iemAImpl_mul_u64_amd, iemAImpl_mul_u64_intel;
1548FNIEMAIMPLMULDIVU64 iemAImpl_imul_u64, iemAImpl_imul_u64_amd, iemAImpl_imul_u64_intel;
1549FNIEMAIMPLMULDIVU64 iemAImpl_div_u64, iemAImpl_div_u64_amd, iemAImpl_div_u64_intel;
1550FNIEMAIMPLMULDIVU64 iemAImpl_idiv_u64, iemAImpl_idiv_u64_amd, iemAImpl_idiv_u64_intel;
1551/** @} */
1552
1553/** @name Byte Swap.
1554 * @{ */
1555IEM_DECL_IMPL_TYPE(void, iemAImpl_bswap_u16,(uint32_t *pu32Dst)); /* Yes, 32-bit register access. */
1556IEM_DECL_IMPL_TYPE(void, iemAImpl_bswap_u32,(uint32_t *pu32Dst));
1557IEM_DECL_IMPL_TYPE(void, iemAImpl_bswap_u64,(uint64_t *pu64Dst));
1558/** @} */
1559
1560/** @name Misc.
1561 * @{ */
1562FNIEMAIMPLBINU16 iemAImpl_arpl;
1563/** @} */
1564
1565
1566/** @name FPU operations taking a 32-bit float argument
1567 * @{ */
1568typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR32FSW,(PCX86FXSTATE pFpuState, uint16_t *pFSW,
1569 PCRTFLOAT80U pr80Val1, PCRTFLOAT32U pr32Val2));
1570typedef FNIEMAIMPLFPUR32FSW *PFNIEMAIMPLFPUR32FSW;
1571
1572typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR32,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1573 PCRTFLOAT80U pr80Val1, PCRTFLOAT32U pr32Val2));
1574typedef FNIEMAIMPLFPUR32 *PFNIEMAIMPLFPUR32;
1575
1576FNIEMAIMPLFPUR32FSW iemAImpl_fcom_r80_by_r32;
1577FNIEMAIMPLFPUR32 iemAImpl_fadd_r80_by_r32;
1578FNIEMAIMPLFPUR32 iemAImpl_fmul_r80_by_r32;
1579FNIEMAIMPLFPUR32 iemAImpl_fsub_r80_by_r32;
1580FNIEMAIMPLFPUR32 iemAImpl_fsubr_r80_by_r32;
1581FNIEMAIMPLFPUR32 iemAImpl_fdiv_r80_by_r32;
1582FNIEMAIMPLFPUR32 iemAImpl_fdivr_r80_by_r32;
1583
1584IEM_DECL_IMPL_DEF(void, iemAImpl_fld_r80_from_r32,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTFLOAT32U pr32Val));
1585IEM_DECL_IMPL_DEF(void, iemAImpl_fst_r80_to_r32,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1586 PRTFLOAT32U pr32Val, PCRTFLOAT80U pr80Val));
1587/** @} */
1588
1589/** @name FPU operations taking a 64-bit float argument
1590 * @{ */
1591typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR64FSW,(PCX86FXSTATE pFpuState, uint16_t *pFSW,
1592 PCRTFLOAT80U pr80Val1, PCRTFLOAT64U pr64Val2));
1593typedef FNIEMAIMPLFPUR64FSW *PFNIEMAIMPLFPUR64FSW;
1594
1595typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR64,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1596 PCRTFLOAT80U pr80Val1, PCRTFLOAT64U pr64Val2));
1597typedef FNIEMAIMPLFPUR64 *PFNIEMAIMPLFPUR64;
1598
1599FNIEMAIMPLFPUR64FSW iemAImpl_fcom_r80_by_r64;
1600FNIEMAIMPLFPUR64 iemAImpl_fadd_r80_by_r64;
1601FNIEMAIMPLFPUR64 iemAImpl_fmul_r80_by_r64;
1602FNIEMAIMPLFPUR64 iemAImpl_fsub_r80_by_r64;
1603FNIEMAIMPLFPUR64 iemAImpl_fsubr_r80_by_r64;
1604FNIEMAIMPLFPUR64 iemAImpl_fdiv_r80_by_r64;
1605FNIEMAIMPLFPUR64 iemAImpl_fdivr_r80_by_r64;
1606
1607IEM_DECL_IMPL_DEF(void, iemAImpl_fld_r80_from_r64,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTFLOAT64U pr64Val));
1608IEM_DECL_IMPL_DEF(void, iemAImpl_fst_r80_to_r64,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1609 PRTFLOAT64U pr32Val, PCRTFLOAT80U pr80Val));
1610/** @} */
1611
1612/** @name FPU operations taking a 80-bit float argument
1613 * @{ */
1614typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1615 PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2));
1616typedef FNIEMAIMPLFPUR80 *PFNIEMAIMPLFPUR80;
1617FNIEMAIMPLFPUR80 iemAImpl_fadd_r80_by_r80;
1618FNIEMAIMPLFPUR80 iemAImpl_fmul_r80_by_r80;
1619FNIEMAIMPLFPUR80 iemAImpl_fsub_r80_by_r80;
1620FNIEMAIMPLFPUR80 iemAImpl_fsubr_r80_by_r80;
1621FNIEMAIMPLFPUR80 iemAImpl_fdiv_r80_by_r80;
1622FNIEMAIMPLFPUR80 iemAImpl_fdivr_r80_by_r80;
1623FNIEMAIMPLFPUR80 iemAImpl_fprem_r80_by_r80;
1624FNIEMAIMPLFPUR80 iemAImpl_fprem1_r80_by_r80;
1625FNIEMAIMPLFPUR80 iemAImpl_fscale_r80_by_r80;
1626
1627FNIEMAIMPLFPUR80 iemAImpl_fpatan_r80_by_r80, iemAImpl_fpatan_r80_by_r80_amd, iemAImpl_fpatan_r80_by_r80_intel;
1628FNIEMAIMPLFPUR80 iemAImpl_fyl2x_r80_by_r80, iemAImpl_fyl2x_r80_by_r80_amd, iemAImpl_fyl2x_r80_by_r80_intel;
1629FNIEMAIMPLFPUR80 iemAImpl_fyl2xp1_r80_by_r80, iemAImpl_fyl2xp1_r80_by_r80_amd, iemAImpl_fyl2xp1_r80_by_r80_intel;
1630
1631typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80FSW,(PCX86FXSTATE pFpuState, uint16_t *pFSW,
1632 PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2));
1633typedef FNIEMAIMPLFPUR80FSW *PFNIEMAIMPLFPUR80FSW;
1634FNIEMAIMPLFPUR80FSW iemAImpl_fcom_r80_by_r80;
1635FNIEMAIMPLFPUR80FSW iemAImpl_fucom_r80_by_r80;
1636
1637typedef IEM_DECL_IMPL_TYPE(uint32_t, FNIEMAIMPLFPUR80EFL,(PCX86FXSTATE pFpuState, uint16_t *pu16Fsw,
1638 PCRTFLOAT80U pr80Val1, PCRTFLOAT80U pr80Val2));
1639typedef FNIEMAIMPLFPUR80EFL *PFNIEMAIMPLFPUR80EFL;
1640FNIEMAIMPLFPUR80EFL iemAImpl_fcomi_r80_by_r80;
1641FNIEMAIMPLFPUR80EFL iemAImpl_fucomi_r80_by_r80;
1642
1643typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80UNARY,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTFLOAT80U pr80Val));
1644typedef FNIEMAIMPLFPUR80UNARY *PFNIEMAIMPLFPUR80UNARY;
1645FNIEMAIMPLFPUR80UNARY iemAImpl_fabs_r80;
1646FNIEMAIMPLFPUR80UNARY iemAImpl_fchs_r80;
1647FNIEMAIMPLFPUR80UNARY iemAImpl_f2xm1_r80, iemAImpl_f2xm1_r80_amd, iemAImpl_f2xm1_r80_intel;
1648FNIEMAIMPLFPUR80UNARY iemAImpl_fsqrt_r80;
1649FNIEMAIMPLFPUR80UNARY iemAImpl_frndint_r80;
1650FNIEMAIMPLFPUR80UNARY iemAImpl_fsin_r80, iemAImpl_fsin_r80_amd, iemAImpl_fsin_r80_intel;
1651FNIEMAIMPLFPUR80UNARY iemAImpl_fcos_r80, iemAImpl_fcos_r80_amd, iemAImpl_fcos_r80_intel;
1652
1653typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80UNARYFSW,(PCX86FXSTATE pFpuState, uint16_t *pu16Fsw, PCRTFLOAT80U pr80Val));
1654typedef FNIEMAIMPLFPUR80UNARYFSW *PFNIEMAIMPLFPUR80UNARYFSW;
1655FNIEMAIMPLFPUR80UNARYFSW iemAImpl_ftst_r80;
1656FNIEMAIMPLFPUR80UNARYFSW iemAImpl_fxam_r80;
1657
1658typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80LDCONST,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes));
1659typedef FNIEMAIMPLFPUR80LDCONST *PFNIEMAIMPLFPUR80LDCONST;
1660FNIEMAIMPLFPUR80LDCONST iemAImpl_fld1;
1661FNIEMAIMPLFPUR80LDCONST iemAImpl_fldl2t;
1662FNIEMAIMPLFPUR80LDCONST iemAImpl_fldl2e;
1663FNIEMAIMPLFPUR80LDCONST iemAImpl_fldpi;
1664FNIEMAIMPLFPUR80LDCONST iemAImpl_fldlg2;
1665FNIEMAIMPLFPUR80LDCONST iemAImpl_fldln2;
1666FNIEMAIMPLFPUR80LDCONST iemAImpl_fldz;
1667
1668typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUR80UNARYTWO,(PCX86FXSTATE pFpuState, PIEMFPURESULTTWO pFpuResTwo,
1669 PCRTFLOAT80U pr80Val));
1670typedef FNIEMAIMPLFPUR80UNARYTWO *PFNIEMAIMPLFPUR80UNARYTWO;
1671FNIEMAIMPLFPUR80UNARYTWO iemAImpl_fptan_r80_r80, iemAImpl_fptan_r80_r80_amd, iemAImpl_fptan_r80_r80_intel;
1672FNIEMAIMPLFPUR80UNARYTWO iemAImpl_fxtract_r80_r80;
1673FNIEMAIMPLFPUR80UNARYTWO iemAImpl_fsincos_r80_r80, iemAImpl_fsincos_r80_r80_amd, iemAImpl_fsincos_r80_r80_intel;
1674
1675IEM_DECL_IMPL_DEF(void, iemAImpl_fld_r80_from_r80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTFLOAT80U pr80Val));
1676IEM_DECL_IMPL_DEF(void, iemAImpl_fst_r80_to_r80,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1677 PRTFLOAT80U pr80Dst, PCRTFLOAT80U pr80Src));
1678
1679IEM_DECL_IMPL_DEF(void, iemAImpl_fld_r80_from_d80,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, PCRTPBCD80U pd80Val));
1680IEM_DECL_IMPL_DEF(void, iemAImpl_fst_r80_to_d80,(PCX86FXSTATE pFpuState, uint16_t *pu16FSW,
1681 PRTPBCD80U pd80Dst, PCRTFLOAT80U pr80Src));
1682
1683/** @} */
1684
1685/** @name FPU operations taking a 16-bit signed integer argument
1686 * @{ */
1687typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUI16,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1688 PCRTFLOAT80U pr80Val1, int16_t const *pi16Val2));
1689typedef FNIEMAIMPLFPUI16 *PFNIEMAIMPLFPUI16;
1690typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUSTR80TOI16,(PCX86FXSTATE pFpuState, uint16_t *pFpuRes,
1691 int16_t *pi16Dst, PCRTFLOAT80U pr80Src));
1692typedef FNIEMAIMPLFPUSTR80TOI16 *PFNIEMAIMPLFPUSTR80TOI16;
1693
1694FNIEMAIMPLFPUI16 iemAImpl_fiadd_r80_by_i16;
1695FNIEMAIMPLFPUI16 iemAImpl_fimul_r80_by_i16;
1696FNIEMAIMPLFPUI16 iemAImpl_fisub_r80_by_i16;
1697FNIEMAIMPLFPUI16 iemAImpl_fisubr_r80_by_i16;
1698FNIEMAIMPLFPUI16 iemAImpl_fidiv_r80_by_i16;
1699FNIEMAIMPLFPUI16 iemAImpl_fidivr_r80_by_i16;
1700
1701typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUI16FSW,(PCX86FXSTATE pFpuState, uint16_t *pFSW,
1702 PCRTFLOAT80U pr80Val1, int16_t const *pi16Val2));
1703typedef FNIEMAIMPLFPUI16FSW *PFNIEMAIMPLFPUI16FSW;
1704FNIEMAIMPLFPUI16FSW iemAImpl_ficom_r80_by_i16;
1705
1706IEM_DECL_IMPL_DEF(void, iemAImpl_fild_r80_from_i16,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, int16_t const *pi16Val));
1707FNIEMAIMPLFPUSTR80TOI16 iemAImpl_fist_r80_to_i16;
1708FNIEMAIMPLFPUSTR80TOI16 iemAImpl_fistt_r80_to_i16, iemAImpl_fistt_r80_to_i16_amd, iemAImpl_fistt_r80_to_i16_intel;
1709/** @} */
1710
1711/** @name FPU operations taking a 32-bit signed integer argument
1712 * @{ */
1713typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUI32,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes,
1714 PCRTFLOAT80U pr80Val1, int32_t const *pi32Val2));
1715typedef FNIEMAIMPLFPUI32 *PFNIEMAIMPLFPUI32;
1716typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUSTR80TOI32,(PCX86FXSTATE pFpuState, uint16_t *pFpuRes,
1717 int32_t *pi32Dst, PCRTFLOAT80U pr80Src));
1718typedef FNIEMAIMPLFPUSTR80TOI32 *PFNIEMAIMPLFPUSTR80TOI32;
1719
1720FNIEMAIMPLFPUI32 iemAImpl_fiadd_r80_by_i32;
1721FNIEMAIMPLFPUI32 iemAImpl_fimul_r80_by_i32;
1722FNIEMAIMPLFPUI32 iemAImpl_fisub_r80_by_i32;
1723FNIEMAIMPLFPUI32 iemAImpl_fisubr_r80_by_i32;
1724FNIEMAIMPLFPUI32 iemAImpl_fidiv_r80_by_i32;
1725FNIEMAIMPLFPUI32 iemAImpl_fidivr_r80_by_i32;
1726
1727typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUI32FSW,(PCX86FXSTATE pFpuState, uint16_t *pFSW,
1728 PCRTFLOAT80U pr80Val1, int32_t const *pi32Val2));
1729typedef FNIEMAIMPLFPUI32FSW *PFNIEMAIMPLFPUI32FSW;
1730FNIEMAIMPLFPUI32FSW iemAImpl_ficom_r80_by_i32;
1731
1732IEM_DECL_IMPL_DEF(void, iemAImpl_fild_r80_from_i32,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, int32_t const *pi32Val));
1733FNIEMAIMPLFPUSTR80TOI32 iemAImpl_fist_r80_to_i32;
1734FNIEMAIMPLFPUSTR80TOI32 iemAImpl_fistt_r80_to_i32;
1735/** @} */
1736
1737/** @name FPU operations taking a 64-bit signed integer argument
1738 * @{ */
1739typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUSTR80TOI64,(PCX86FXSTATE pFpuState, uint16_t *pFpuRes,
1740 int64_t *pi64Dst, PCRTFLOAT80U pr80Src));
1741typedef FNIEMAIMPLFPUSTR80TOI64 *PFNIEMAIMPLFPUSTR80TOI64;
1742
1743IEM_DECL_IMPL_DEF(void, iemAImpl_fild_r80_from_i64,(PCX86FXSTATE pFpuState, PIEMFPURESULT pFpuRes, int64_t const *pi64Val));
1744FNIEMAIMPLFPUSTR80TOI64 iemAImpl_fist_r80_to_i64;
1745FNIEMAIMPLFPUSTR80TOI64 iemAImpl_fistt_r80_to_i64;
1746/** @} */
1747
1748
1749/** Temporary type representing a 256-bit vector register. */
1750typedef struct { uint64_t au64[4]; } IEMVMM256;
1751/** Temporary type pointing to a 256-bit vector register. */
1752typedef IEMVMM256 *PIEMVMM256;
1753/** Temporary type pointing to a const 256-bit vector register. */
1754typedef IEMVMM256 *PCIEMVMM256;
1755
1756
1757/** @name Media (SSE/MMX/AVX) operations: full1 + full2 -> full1.
1758 * @{ */
1759typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAF2U64,(PCX86FXSTATE pFpuState, uint64_t *puDst, uint64_t const *puSrc));
1760typedef FNIEMAIMPLMEDIAF2U64 *PFNIEMAIMPLMEDIAF2U64;
1761typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAF2U128,(PCX86FXSTATE pFpuState, PRTUINT128U puDst, PCRTUINT128U puSrc));
1762typedef FNIEMAIMPLMEDIAF2U128 *PFNIEMAIMPLMEDIAF2U128;
1763typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAF3U128,(PX86XSAVEAREA pExtState, PRTUINT128U puDst, PCRTUINT128U puSrc1, PCRTUINT128U puSrc2));
1764typedef FNIEMAIMPLMEDIAF3U128 *PFNIEMAIMPLMEDIAF3U128;
1765typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAF3U256,(PX86XSAVEAREA pExtState, PRTUINT256U puDst, PCRTUINT256U puSrc1, PCRTUINT256U puSrc2));
1766typedef FNIEMAIMPLMEDIAF3U256 *PFNIEMAIMPLMEDIAF3U256;
1767typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAOPTF2U64,(uint64_t *puDst, uint64_t const *puSrc));
1768typedef FNIEMAIMPLMEDIAOPTF2U64 *PFNIEMAIMPLMEDIAOPTF2U64;
1769typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAOPTF2U128,(PRTUINT128U puDst, PCRTUINT128U puSrc));
1770typedef FNIEMAIMPLMEDIAOPTF2U128 *PFNIEMAIMPLMEDIAOPTF2U128;
1771typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAOPTF3U128,(PRTUINT128U puDst, PCRTUINT128U puSrc1, PCRTUINT128U puSrc2));
1772typedef FNIEMAIMPLMEDIAOPTF3U128 *PFNIEMAIMPLMEDIAOPTF3U128;
1773typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAOPTF3U256,(PRTUINT256U puDst, PCRTUINT256U puSrc1, PCRTUINT256U puSrc2));
1774typedef FNIEMAIMPLMEDIAOPTF3U256 *PFNIEMAIMPLMEDIAOPTF3U256;
1775typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAOPTF2U256,(PRTUINT256U puDst, PCRTUINT256U puSrc));
1776typedef FNIEMAIMPLMEDIAOPTF2U256 *PFNIEMAIMPLMEDIAOPTF2U256;
1777FNIEMAIMPLMEDIAF2U64 iemAImpl_pshufb_u64, iemAImpl_pshufb_u64_fallback;
1778FNIEMAIMPLMEDIAF2U64 iemAImpl_pand_u64, iemAImpl_pandn_u64, iemAImpl_por_u64, iemAImpl_pxor_u64;
1779FNIEMAIMPLMEDIAF2U64 iemAImpl_pcmpeqb_u64, iemAImpl_pcmpeqw_u64, iemAImpl_pcmpeqd_u64;
1780FNIEMAIMPLMEDIAF2U64 iemAImpl_pcmpgtb_u64, iemAImpl_pcmpgtw_u64, iemAImpl_pcmpgtd_u64;
1781FNIEMAIMPLMEDIAF2U64 iemAImpl_paddb_u64, iemAImpl_paddsb_u64, iemAImpl_paddusb_u64;
1782FNIEMAIMPLMEDIAF2U64 iemAImpl_paddw_u64, iemAImpl_paddsw_u64, iemAImpl_paddusw_u64;
1783FNIEMAIMPLMEDIAF2U64 iemAImpl_paddd_u64;
1784FNIEMAIMPLMEDIAF2U64 iemAImpl_paddq_u64;
1785FNIEMAIMPLMEDIAF2U64 iemAImpl_psubb_u64, iemAImpl_psubsb_u64, iemAImpl_psubusb_u64;
1786FNIEMAIMPLMEDIAF2U64 iemAImpl_psubw_u64, iemAImpl_psubsw_u64, iemAImpl_psubusw_u64;
1787FNIEMAIMPLMEDIAF2U64 iemAImpl_psubd_u64;
1788FNIEMAIMPLMEDIAF2U64 iemAImpl_psubq_u64;
1789FNIEMAIMPLMEDIAF2U64 iemAImpl_pmaddwd_u64;
1790FNIEMAIMPLMEDIAF2U64 iemAImpl_pmullw_u64, iemAImpl_pmulhw_u64;
1791FNIEMAIMPLMEDIAF2U64 iemAImpl_pminub_u64, iemAImpl_pmaxub_u64;
1792FNIEMAIMPLMEDIAF2U64 iemAImpl_pminsw_u64, iemAImpl_pmaxsw_u64;
1793FNIEMAIMPLMEDIAF2U64 iemAImpl_pabsb_u64, iemAImpl_pabsb_u64_fallback;
1794FNIEMAIMPLMEDIAF2U64 iemAImpl_pabsw_u64, iemAImpl_pabsw_u64_fallback;
1795FNIEMAIMPLMEDIAF2U64 iemAImpl_pabsd_u64, iemAImpl_pabsd_u64_fallback;
1796FNIEMAIMPLMEDIAF2U64 iemAImpl_psignb_u64, iemAImpl_psignb_u64_fallback;
1797FNIEMAIMPLMEDIAF2U64 iemAImpl_psignw_u64, iemAImpl_psignw_u64_fallback;
1798FNIEMAIMPLMEDIAF2U64 iemAImpl_psignd_u64, iemAImpl_psignd_u64_fallback;
1799FNIEMAIMPLMEDIAF2U64 iemAImpl_phaddw_u64, iemAImpl_phaddw_u64_fallback;
1800FNIEMAIMPLMEDIAF2U64 iemAImpl_phaddd_u64, iemAImpl_phaddd_u64_fallback;
1801FNIEMAIMPLMEDIAF2U64 iemAImpl_phsubw_u64, iemAImpl_phsubw_u64_fallback;
1802FNIEMAIMPLMEDIAF2U64 iemAImpl_phsubd_u64, iemAImpl_phsubd_u64_fallback;
1803FNIEMAIMPLMEDIAF2U64 iemAImpl_phaddsw_u64, iemAImpl_phaddsw_u64_fallback;
1804FNIEMAIMPLMEDIAF2U64 iemAImpl_phsubsw_u64, iemAImpl_phsubsw_u64_fallback;
1805FNIEMAIMPLMEDIAF2U64 iemAImpl_pmaddubsw_u64, iemAImpl_pmaddubsw_u64_fallback;
1806FNIEMAIMPLMEDIAF2U64 iemAImpl_pmulhrsw_u64, iemAImpl_pmulhrsw_u64_fallback;
1807FNIEMAIMPLMEDIAF2U64 iemAImpl_pmuludq_u64;
1808FNIEMAIMPLMEDIAOPTF2U64 iemAImpl_psllw_u64, iemAImpl_psrlw_u64, iemAImpl_psraw_u64;
1809FNIEMAIMPLMEDIAOPTF2U64 iemAImpl_pslld_u64, iemAImpl_psrld_u64, iemAImpl_psrad_u64;
1810FNIEMAIMPLMEDIAOPTF2U64 iemAImpl_psllq_u64, iemAImpl_psrlq_u64;
1811FNIEMAIMPLMEDIAOPTF2U64 iemAImpl_packsswb_u64, iemAImpl_packuswb_u64;
1812FNIEMAIMPLMEDIAOPTF2U64 iemAImpl_packssdw_u64;
1813FNIEMAIMPLMEDIAOPTF2U64 iemAImpl_pmulhuw_u64;
1814FNIEMAIMPLMEDIAOPTF2U64 iemAImpl_pavgb_u64, iemAImpl_pavgw_u64;
1815FNIEMAIMPLMEDIAOPTF2U64 iemAImpl_psadbw_u64;
1816
1817FNIEMAIMPLMEDIAF2U128 iemAImpl_pshufb_u128, iemAImpl_pshufb_u128_fallback;
1818FNIEMAIMPLMEDIAF2U128 iemAImpl_pand_u128, iemAImpl_pandn_u128, iemAImpl_por_u128, iemAImpl_pxor_u128;
1819FNIEMAIMPLMEDIAF2U128 iemAImpl_pcmpeqb_u128, iemAImpl_pcmpeqw_u128, iemAImpl_pcmpeqd_u128;
1820FNIEMAIMPLMEDIAF2U128 iemAImpl_pcmpeqq_u128, iemAImpl_pcmpeqq_u128_fallback;
1821FNIEMAIMPLMEDIAF2U128 iemAImpl_pcmpgtb_u128, iemAImpl_pcmpgtw_u128, iemAImpl_pcmpgtd_u128;
1822FNIEMAIMPLMEDIAF2U128 iemAImpl_pcmpgtq_u128, iemAImpl_pcmpgtq_u128_fallback;
1823FNIEMAIMPLMEDIAF2U128 iemAImpl_paddb_u128, iemAImpl_paddsb_u128, iemAImpl_paddusb_u128;
1824FNIEMAIMPLMEDIAF2U128 iemAImpl_paddw_u128, iemAImpl_paddsw_u128, iemAImpl_paddusw_u128;
1825FNIEMAIMPLMEDIAF2U128 iemAImpl_paddd_u128;
1826FNIEMAIMPLMEDIAF2U128 iemAImpl_paddq_u128;
1827FNIEMAIMPLMEDIAF2U128 iemAImpl_psubb_u128, iemAImpl_psubsb_u128, iemAImpl_psubusb_u128;
1828FNIEMAIMPLMEDIAF2U128 iemAImpl_psubw_u128, iemAImpl_psubsw_u128, iemAImpl_psubusw_u128;
1829FNIEMAIMPLMEDIAF2U128 iemAImpl_psubd_u128;
1830FNIEMAIMPLMEDIAF2U128 iemAImpl_psubq_u128;
1831FNIEMAIMPLMEDIAF2U128 iemAImpl_pmullw_u128, iemAImpl_pmullw_u128_fallback;
1832FNIEMAIMPLMEDIAF2U128 iemAImpl_pmulhw_u128;
1833FNIEMAIMPLMEDIAF2U128 iemAImpl_pmulld_u128, iemAImpl_pmulld_u128_fallback;
1834FNIEMAIMPLMEDIAF2U128 iemAImpl_pmaddwd_u128;
1835FNIEMAIMPLMEDIAF2U128 iemAImpl_pminub_u128;
1836FNIEMAIMPLMEDIAF2U128 iemAImpl_pminud_u128, iemAImpl_pminud_u128_fallback;
1837FNIEMAIMPLMEDIAF2U128 iemAImpl_pminuw_u128, iemAImpl_pminuw_u128_fallback;
1838FNIEMAIMPLMEDIAF2U128 iemAImpl_pminsb_u128, iemAImpl_pminsb_u128_fallback;
1839FNIEMAIMPLMEDIAF2U128 iemAImpl_pminsd_u128, iemAImpl_pminsd_u128_fallback;
1840FNIEMAIMPLMEDIAF2U128 iemAImpl_pminsw_u128, iemAImpl_pminsw_u128_fallback;
1841FNIEMAIMPLMEDIAF2U128 iemAImpl_pmaxub_u128;
1842FNIEMAIMPLMEDIAF2U128 iemAImpl_pmaxud_u128, iemAImpl_pmaxud_u128_fallback;
1843FNIEMAIMPLMEDIAF2U128 iemAImpl_pmaxuw_u128, iemAImpl_pmaxuw_u128_fallback;
1844FNIEMAIMPLMEDIAF2U128 iemAImpl_pmaxsb_u128, iemAImpl_pmaxsb_u128_fallback;
1845FNIEMAIMPLMEDIAF2U128 iemAImpl_pmaxsw_u128;
1846FNIEMAIMPLMEDIAF2U128 iemAImpl_pmaxsd_u128, iemAImpl_pmaxsd_u128_fallback;
1847FNIEMAIMPLMEDIAF2U128 iemAImpl_pabsb_u128, iemAImpl_pabsb_u128_fallback;
1848FNIEMAIMPLMEDIAF2U128 iemAImpl_pabsw_u128, iemAImpl_pabsw_u128_fallback;
1849FNIEMAIMPLMEDIAF2U128 iemAImpl_pabsd_u128, iemAImpl_pabsd_u128_fallback;
1850FNIEMAIMPLMEDIAF2U128 iemAImpl_psignb_u128, iemAImpl_psignb_u128_fallback;
1851FNIEMAIMPLMEDIAF2U128 iemAImpl_psignw_u128, iemAImpl_psignw_u128_fallback;
1852FNIEMAIMPLMEDIAF2U128 iemAImpl_psignd_u128, iemAImpl_psignd_u128_fallback;
1853FNIEMAIMPLMEDIAF2U128 iemAImpl_phaddw_u128, iemAImpl_phaddw_u128_fallback;
1854FNIEMAIMPLMEDIAF2U128 iemAImpl_phaddd_u128, iemAImpl_phaddd_u128_fallback;
1855FNIEMAIMPLMEDIAF2U128 iemAImpl_phsubw_u128, iemAImpl_phsubw_u128_fallback;
1856FNIEMAIMPLMEDIAF2U128 iemAImpl_phsubd_u128, iemAImpl_phsubd_u128_fallback;
1857FNIEMAIMPLMEDIAF2U128 iemAImpl_phaddsw_u128, iemAImpl_phaddsw_u128_fallback;
1858FNIEMAIMPLMEDIAF2U128 iemAImpl_phsubsw_u128, iemAImpl_phsubsw_u128_fallback;
1859FNIEMAIMPLMEDIAF2U128 iemAImpl_pmaddubsw_u128, iemAImpl_pmaddubsw_u128_fallback;
1860FNIEMAIMPLMEDIAF2U128 iemAImpl_pmulhrsw_u128, iemAImpl_pmulhrsw_u128_fallback;
1861FNIEMAIMPLMEDIAF2U128 iemAImpl_pmuludq_u128;
1862FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_packsswb_u128, iemAImpl_packuswb_u128;
1863FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_packssdw_u128, iemAImpl_packusdw_u128;
1864FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_psllw_u128, iemAImpl_psrlw_u128, iemAImpl_psraw_u128;
1865FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_pslld_u128, iemAImpl_psrld_u128, iemAImpl_psrad_u128;
1866FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_psllq_u128, iemAImpl_psrlq_u128;
1867FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_pmulhuw_u128;
1868FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_pavgb_u128, iemAImpl_pavgw_u128;
1869FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_psadbw_u128;
1870FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_pmuldq_u128, iemAImpl_pmuldq_u128_fallback;
1871FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_unpcklps_u128, iemAImpl_unpcklpd_u128;
1872FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_unpckhps_u128, iemAImpl_unpckhpd_u128;
1873FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_phminposuw_u128, iemAImpl_phminposuw_u128_fallback;
1874
1875FNIEMAIMPLMEDIAF3U128 iemAImpl_vpshufb_u128, iemAImpl_vpshufb_u128_fallback;
1876FNIEMAIMPLMEDIAF3U128 iemAImpl_vpand_u128, iemAImpl_vpand_u128_fallback;
1877FNIEMAIMPLMEDIAF3U128 iemAImpl_vpandn_u128, iemAImpl_vpandn_u128_fallback;
1878FNIEMAIMPLMEDIAF3U128 iemAImpl_vpor_u128, iemAImpl_vpor_u128_fallback;
1879FNIEMAIMPLMEDIAF3U128 iemAImpl_vpxor_u128, iemAImpl_vpxor_u128_fallback;
1880FNIEMAIMPLMEDIAF3U128 iemAImpl_vpcmpeqb_u128, iemAImpl_vpcmpeqb_u128_fallback;
1881FNIEMAIMPLMEDIAF3U128 iemAImpl_vpcmpeqw_u128, iemAImpl_vpcmpeqw_u128_fallback;
1882FNIEMAIMPLMEDIAF3U128 iemAImpl_vpcmpeqd_u128, iemAImpl_vpcmpeqd_u128_fallback;
1883FNIEMAIMPLMEDIAF3U128 iemAImpl_vpcmpeqq_u128, iemAImpl_vpcmpeqq_u128_fallback;
1884FNIEMAIMPLMEDIAF3U128 iemAImpl_vpcmpgtb_u128, iemAImpl_vpcmpgtb_u128_fallback;
1885FNIEMAIMPLMEDIAF3U128 iemAImpl_vpcmpgtw_u128, iemAImpl_vpcmpgtw_u128_fallback;
1886FNIEMAIMPLMEDIAF3U128 iemAImpl_vpcmpgtd_u128, iemAImpl_vpcmpgtd_u128_fallback;
1887FNIEMAIMPLMEDIAF3U128 iemAImpl_vpcmpgtq_u128, iemAImpl_vpcmpgtq_u128_fallback;
1888FNIEMAIMPLMEDIAF3U128 iemAImpl_vpaddb_u128, iemAImpl_vpaddb_u128_fallback;
1889FNIEMAIMPLMEDIAF3U128 iemAImpl_vpaddw_u128, iemAImpl_vpaddw_u128_fallback;
1890FNIEMAIMPLMEDIAF3U128 iemAImpl_vpaddd_u128, iemAImpl_vpaddd_u128_fallback;
1891FNIEMAIMPLMEDIAF3U128 iemAImpl_vpaddq_u128, iemAImpl_vpaddq_u128_fallback;
1892FNIEMAIMPLMEDIAF3U128 iemAImpl_vpsubb_u128, iemAImpl_vpsubb_u128_fallback;
1893FNIEMAIMPLMEDIAF3U128 iemAImpl_vpsubw_u128, iemAImpl_vpsubw_u128_fallback;
1894FNIEMAIMPLMEDIAF3U128 iemAImpl_vpsubd_u128, iemAImpl_vpsubd_u128_fallback;
1895FNIEMAIMPLMEDIAF3U128 iemAImpl_vpsubq_u128, iemAImpl_vpsubq_u128_fallback;
1896FNIEMAIMPLMEDIAF3U128 iemAImpl_vpminub_u128, iemAImpl_vpminub_u128_fallback;
1897FNIEMAIMPLMEDIAF3U128 iemAImpl_vpminuw_u128, iemAImpl_vpminuw_u128_fallback;
1898FNIEMAIMPLMEDIAF3U128 iemAImpl_vpminud_u128, iemAImpl_vpminud_u128_fallback;
1899FNIEMAIMPLMEDIAF3U128 iemAImpl_vpminsb_u128, iemAImpl_vpminsb_u128_fallback;
1900FNIEMAIMPLMEDIAF3U128 iemAImpl_vpminsw_u128, iemAImpl_vpminsw_u128_fallback;
1901FNIEMAIMPLMEDIAF3U128 iemAImpl_vpminsd_u128, iemAImpl_vpminsd_u128_fallback;
1902FNIEMAIMPLMEDIAF3U128 iemAImpl_vpmaxub_u128, iemAImpl_vpmaxub_u128_fallback;
1903FNIEMAIMPLMEDIAF3U128 iemAImpl_vpmaxuw_u128, iemAImpl_vpmaxuw_u128_fallback;
1904FNIEMAIMPLMEDIAF3U128 iemAImpl_vpmaxud_u128, iemAImpl_vpmaxud_u128_fallback;
1905FNIEMAIMPLMEDIAF3U128 iemAImpl_vpmaxsb_u128, iemAImpl_vpmaxsb_u128_fallback;
1906FNIEMAIMPLMEDIAF3U128 iemAImpl_vpmaxsw_u128, iemAImpl_vpmaxsw_u128_fallback;
1907FNIEMAIMPLMEDIAF3U128 iemAImpl_vpmaxsd_u128, iemAImpl_vpmaxsd_u128_fallback;
1908FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpacksswb_u128, iemAImpl_vpacksswb_u128_fallback;
1909FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpackssdw_u128, iemAImpl_vpackssdw_u128_fallback;
1910FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpackuswb_u128, iemAImpl_vpackuswb_u128_fallback;
1911FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpackusdw_u128, iemAImpl_vpackusdw_u128_fallback;
1912FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpmullw_u128, iemAImpl_vpmullw_u128_fallback;
1913FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpmulld_u128, iemAImpl_vpmulld_u128_fallback;
1914FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpmulhw_u128, iemAImpl_vpmulhw_u128_fallback;
1915FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpmulhuw_u128, iemAImpl_vpmulhuw_u128_fallback;
1916FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpavgb_u128, iemAImpl_vpavgb_u128_fallback;
1917FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpavgw_u128, iemAImpl_vpavgw_u128_fallback;
1918FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpsignb_u128, iemAImpl_vpsignb_u128_fallback;
1919FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpsignw_u128, iemAImpl_vpsignw_u128_fallback;
1920FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpsignd_u128, iemAImpl_vpsignd_u128_fallback;
1921FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vphaddw_u128, iemAImpl_vphaddw_u128_fallback;
1922FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vphaddd_u128, iemAImpl_vphaddd_u128_fallback;
1923FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vphsubw_u128, iemAImpl_vphsubw_u128_fallback;
1924FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vphsubd_u128, iemAImpl_vphsubd_u128_fallback;
1925FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vphaddsw_u128, iemAImpl_vphaddsw_u128_fallback;
1926FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vphsubsw_u128, iemAImpl_vphsubsw_u128_fallback;
1927FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpmaddubsw_u128, iemAImpl_vpmaddubsw_u128_fallback;
1928FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpmulhrsw_u128, iemAImpl_vpmulhrsw_u128_fallback;
1929FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpsadbw_u128, iemAImpl_vpsadbw_u128_fallback;
1930FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpmuldq_u128, iemAImpl_vpmuldq_u128_fallback;
1931FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpmuludq_u128, iemAImpl_vpmuludq_u128_fallback;
1932
1933FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_vpabsb_u128, iemAImpl_vpabsb_u128_fallback;
1934FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_vpabsw_u128, iemAImpl_vpabsd_u128_fallback;
1935FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_vpabsd_u128, iemAImpl_vpabsw_u128_fallback;
1936FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_vphminposuw_u128, iemAImpl_vphminposuw_u128_fallback;
1937
1938FNIEMAIMPLMEDIAF3U256 iemAImpl_vpshufb_u256, iemAImpl_vpshufb_u256_fallback;
1939FNIEMAIMPLMEDIAF3U256 iemAImpl_vpand_u256, iemAImpl_vpand_u256_fallback;
1940FNIEMAIMPLMEDIAF3U256 iemAImpl_vpandn_u256, iemAImpl_vpandn_u256_fallback;
1941FNIEMAIMPLMEDIAF3U256 iemAImpl_vpor_u256, iemAImpl_vpor_u256_fallback;
1942FNIEMAIMPLMEDIAF3U256 iemAImpl_vpxor_u256, iemAImpl_vpxor_u256_fallback;
1943FNIEMAIMPLMEDIAF3U256 iemAImpl_vpcmpeqb_u256, iemAImpl_vpcmpeqb_u256_fallback;
1944FNIEMAIMPLMEDIAF3U256 iemAImpl_vpcmpeqw_u256, iemAImpl_vpcmpeqw_u256_fallback;
1945FNIEMAIMPLMEDIAF3U256 iemAImpl_vpcmpeqd_u256, iemAImpl_vpcmpeqd_u256_fallback;
1946FNIEMAIMPLMEDIAF3U256 iemAImpl_vpcmpeqq_u256, iemAImpl_vpcmpeqq_u256_fallback;
1947FNIEMAIMPLMEDIAF3U256 iemAImpl_vpcmpgtb_u256, iemAImpl_vpcmpgtb_u256_fallback;
1948FNIEMAIMPLMEDIAF3U256 iemAImpl_vpcmpgtw_u256, iemAImpl_vpcmpgtw_u256_fallback;
1949FNIEMAIMPLMEDIAF3U256 iemAImpl_vpcmpgtd_u256, iemAImpl_vpcmpgtd_u256_fallback;
1950FNIEMAIMPLMEDIAF3U256 iemAImpl_vpcmpgtq_u256, iemAImpl_vpcmpgtq_u256_fallback;
1951FNIEMAIMPLMEDIAF3U256 iemAImpl_vpaddb_u256, iemAImpl_vpaddb_u256_fallback;
1952FNIEMAIMPLMEDIAF3U256 iemAImpl_vpaddw_u256, iemAImpl_vpaddw_u256_fallback;
1953FNIEMAIMPLMEDIAF3U256 iemAImpl_vpaddd_u256, iemAImpl_vpaddd_u256_fallback;
1954FNIEMAIMPLMEDIAF3U256 iemAImpl_vpaddq_u256, iemAImpl_vpaddq_u256_fallback;
1955FNIEMAIMPLMEDIAF3U256 iemAImpl_vpsubb_u256, iemAImpl_vpsubb_u256_fallback;
1956FNIEMAIMPLMEDIAF3U256 iemAImpl_vpsubw_u256, iemAImpl_vpsubw_u256_fallback;
1957FNIEMAIMPLMEDIAF3U256 iemAImpl_vpsubd_u256, iemAImpl_vpsubd_u256_fallback;
1958FNIEMAIMPLMEDIAF3U256 iemAImpl_vpsubq_u256, iemAImpl_vpsubq_u256_fallback;
1959FNIEMAIMPLMEDIAF3U256 iemAImpl_vpminub_u256, iemAImpl_vpminub_u256_fallback;
1960FNIEMAIMPLMEDIAF3U256 iemAImpl_vpminuw_u256, iemAImpl_vpminuw_u256_fallback;
1961FNIEMAIMPLMEDIAF3U256 iemAImpl_vpminud_u256, iemAImpl_vpminud_u256_fallback;
1962FNIEMAIMPLMEDIAF3U256 iemAImpl_vpminsb_u256, iemAImpl_vpminsb_u256_fallback;
1963FNIEMAIMPLMEDIAF3U256 iemAImpl_vpminsw_u256, iemAImpl_vpminsw_u256_fallback;
1964FNIEMAIMPLMEDIAF3U256 iemAImpl_vpminsd_u256, iemAImpl_vpminsd_u256_fallback;
1965FNIEMAIMPLMEDIAF3U256 iemAImpl_vpmaxub_u256, iemAImpl_vpmaxub_u256_fallback;
1966FNIEMAIMPLMEDIAF3U256 iemAImpl_vpmaxuw_u256, iemAImpl_vpmaxuw_u256_fallback;
1967FNIEMAIMPLMEDIAF3U256 iemAImpl_vpmaxud_u256, iemAImpl_vpmaxud_u256_fallback;
1968FNIEMAIMPLMEDIAF3U256 iemAImpl_vpmaxsb_u256, iemAImpl_vpmaxsb_u256_fallback;
1969FNIEMAIMPLMEDIAF3U256 iemAImpl_vpmaxsw_u256, iemAImpl_vpmaxsw_u256_fallback;
1970FNIEMAIMPLMEDIAF3U256 iemAImpl_vpmaxsd_u256, iemAImpl_vpmaxsd_u256_fallback;
1971FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpacksswb_u256, iemAImpl_vpacksswb_u256_fallback;
1972FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpackssdw_u256, iemAImpl_vpackssdw_u256_fallback;
1973FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpackuswb_u256, iemAImpl_vpackuswb_u256_fallback;
1974FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpackusdw_u256, iemAImpl_vpackusdw_u256_fallback;
1975FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpmullw_u256, iemAImpl_vpmullw_u256_fallback;
1976FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpmulld_u256, iemAImpl_vpmulld_u256_fallback;
1977FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpmulhw_u256, iemAImpl_vpmulhw_u256_fallback;
1978FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpmulhuw_u256, iemAImpl_vpmulhuw_u256_fallback;
1979FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpavgb_u256, iemAImpl_vpavgb_u256_fallback;
1980FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpavgw_u256, iemAImpl_vpavgw_u256_fallback;
1981FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpsignb_u256, iemAImpl_vpsignb_u256_fallback;
1982FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpsignw_u256, iemAImpl_vpsignw_u256_fallback;
1983FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpsignd_u256, iemAImpl_vpsignd_u256_fallback;
1984FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vphaddw_u256, iemAImpl_vphaddw_u256_fallback;
1985FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vphaddd_u256, iemAImpl_vphaddd_u256_fallback;
1986FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vphsubw_u256, iemAImpl_vphsubw_u256_fallback;
1987FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vphsubd_u256, iemAImpl_vphsubd_u256_fallback;
1988FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vphaddsw_u256, iemAImpl_vphaddsw_u256_fallback;
1989FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vphsubsw_u256, iemAImpl_vphsubsw_u256_fallback;
1990FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpmaddubsw_u256, iemAImpl_vpmaddubsw_u256_fallback;
1991FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpmulhrsw_u256, iemAImpl_vpmulhrsw_u256_fallback;
1992FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpsadbw_u256, iemAImpl_vpsadbw_u256_fallback;
1993FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpmuldq_u256, iemAImpl_vpmuldq_u256_fallback;
1994FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpmuludq_u256, iemAImpl_vpmuludq_u256_fallback;
1995
1996FNIEMAIMPLMEDIAOPTF2U256 iemAImpl_vpabsb_u256, iemAImpl_vpabsb_u256_fallback;
1997FNIEMAIMPLMEDIAOPTF2U256 iemAImpl_vpabsw_u256, iemAImpl_vpabsw_u256_fallback;
1998FNIEMAIMPLMEDIAOPTF2U256 iemAImpl_vpabsd_u256, iemAImpl_vpabsd_u256_fallback;
1999/** @} */
2000
2001/** @name Media (SSE/MMX/AVX) operations: lowhalf1 + lowhalf1 -> full1.
2002 * @{ */
2003FNIEMAIMPLMEDIAOPTF2U64 iemAImpl_punpcklbw_u64, iemAImpl_punpcklwd_u64, iemAImpl_punpckldq_u64;
2004FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_punpcklbw_u128, iemAImpl_punpcklwd_u128, iemAImpl_punpckldq_u128, iemAImpl_punpcklqdq_u128;
2005FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpunpcklbw_u128, iemAImpl_vpunpcklbw_u128_fallback,
2006 iemAImpl_vpunpcklwd_u128, iemAImpl_vpunpcklwd_u128_fallback,
2007 iemAImpl_vpunpckldq_u128, iemAImpl_vpunpckldq_u128_fallback,
2008 iemAImpl_vpunpcklqdq_u128, iemAImpl_vpunpcklqdq_u128_fallback,
2009 iemAImpl_vunpcklps_u128, iemAImpl_vunpcklps_u128_fallback,
2010 iemAImpl_vunpcklpd_u128, iemAImpl_vunpcklpd_u128_fallback,
2011 iemAImpl_vunpckhps_u128, iemAImpl_vunpckhps_u128_fallback,
2012 iemAImpl_vunpckhpd_u128, iemAImpl_vunpckhpd_u128_fallback;
2013
2014FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpunpcklbw_u256, iemAImpl_vpunpcklbw_u256_fallback,
2015 iemAImpl_vpunpcklwd_u256, iemAImpl_vpunpcklwd_u256_fallback,
2016 iemAImpl_vpunpckldq_u256, iemAImpl_vpunpckldq_u256_fallback,
2017 iemAImpl_vpunpcklqdq_u256, iemAImpl_vpunpcklqdq_u256_fallback,
2018 iemAImpl_vunpcklps_u256, iemAImpl_vunpcklps_u256_fallback,
2019 iemAImpl_vunpcklpd_u256, iemAImpl_vunpcklpd_u256_fallback,
2020 iemAImpl_vunpckhps_u256, iemAImpl_vunpckhps_u256_fallback,
2021 iemAImpl_vunpckhpd_u256, iemAImpl_vunpckhpd_u256_fallback;
2022/** @} */
2023
2024/** @name Media (SSE/MMX/AVX) operations: hihalf1 + hihalf2 -> full1.
2025 * @{ */
2026FNIEMAIMPLMEDIAOPTF2U64 iemAImpl_punpckhbw_u64, iemAImpl_punpckhwd_u64, iemAImpl_punpckhdq_u64;
2027FNIEMAIMPLMEDIAOPTF2U128 iemAImpl_punpckhbw_u128, iemAImpl_punpckhwd_u128, iemAImpl_punpckhdq_u128, iemAImpl_punpckhqdq_u128;
2028FNIEMAIMPLMEDIAOPTF3U128 iemAImpl_vpunpckhbw_u128, iemAImpl_vpunpckhbw_u128_fallback,
2029 iemAImpl_vpunpckhwd_u128, iemAImpl_vpunpckhwd_u128_fallback,
2030 iemAImpl_vpunpckhdq_u128, iemAImpl_vpunpckhdq_u128_fallback,
2031 iemAImpl_vpunpckhqdq_u128, iemAImpl_vpunpckhqdq_u128_fallback;
2032FNIEMAIMPLMEDIAOPTF3U256 iemAImpl_vpunpckhbw_u256, iemAImpl_vpunpckhbw_u256_fallback,
2033 iemAImpl_vpunpckhwd_u256, iemAImpl_vpunpckhwd_u256_fallback,
2034 iemAImpl_vpunpckhdq_u256, iemAImpl_vpunpckhdq_u256_fallback,
2035 iemAImpl_vpunpckhqdq_u256, iemAImpl_vpunpckhqdq_u256_fallback;
2036/** @} */
2037
2038/** @name Media (SSE/MMX/AVX) operation: Packed Shuffle Stuff (evil)
2039 * @{ */
2040typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAPSHUFU128,(PRTUINT128U puDst, PCRTUINT128U puSrc, uint8_t bEvil));
2041typedef FNIEMAIMPLMEDIAPSHUFU128 *PFNIEMAIMPLMEDIAPSHUFU128;
2042typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAPSHUFU256,(PRTUINT256U puDst, PCRTUINT256U puSrc, uint8_t bEvil));
2043typedef FNIEMAIMPLMEDIAPSHUFU256 *PFNIEMAIMPLMEDIAPSHUFU256;
2044IEM_DECL_IMPL_DEF(void, iemAImpl_pshufw_u64,(uint64_t *puDst, uint64_t const *puSrc, uint8_t bEvil));
2045FNIEMAIMPLMEDIAPSHUFU128 iemAImpl_pshufhw_u128, iemAImpl_pshuflw_u128, iemAImpl_pshufd_u128;
2046#ifndef IEM_WITHOUT_ASSEMBLY
2047FNIEMAIMPLMEDIAPSHUFU256 iemAImpl_vpshufhw_u256, iemAImpl_vpshuflw_u256, iemAImpl_vpshufd_u256;
2048#endif
2049FNIEMAIMPLMEDIAPSHUFU256 iemAImpl_vpshufhw_u256_fallback, iemAImpl_vpshuflw_u256_fallback, iemAImpl_vpshufd_u256_fallback;
2050/** @} */
2051
2052/** @name Media (SSE/MMX/AVX) operation: Shift Immediate Stuff (evil)
2053 * @{ */
2054typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAPSHIFTU64,(uint64_t *puDst, uint8_t bShift));
2055typedef FNIEMAIMPLMEDIAPSHIFTU64 *PFNIEMAIMPLMEDIAPSHIFTU64;
2056typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAPSHIFTU128,(PRTUINT128U puDst, uint8_t bShift));
2057typedef FNIEMAIMPLMEDIAPSHIFTU128 *PFNIEMAIMPLMEDIAPSHIFTU128;
2058typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAPSHIFTU256,(PRTUINT256U puDst, uint8_t bShift));
2059typedef FNIEMAIMPLMEDIAPSHIFTU256 *PFNIEMAIMPLMEDIAPSHIFTU256;
2060FNIEMAIMPLMEDIAPSHIFTU64 iemAImpl_psllw_imm_u64, iemAImpl_pslld_imm_u64, iemAImpl_psllq_imm_u64;
2061FNIEMAIMPLMEDIAPSHIFTU64 iemAImpl_psrlw_imm_u64, iemAImpl_psrld_imm_u64, iemAImpl_psrlq_imm_u64;
2062FNIEMAIMPLMEDIAPSHIFTU64 iemAImpl_psraw_imm_u64, iemAImpl_psrad_imm_u64;
2063FNIEMAIMPLMEDIAPSHIFTU128 iemAImpl_psllw_imm_u128, iemAImpl_pslld_imm_u128, iemAImpl_psllq_imm_u128;
2064FNIEMAIMPLMEDIAPSHIFTU128 iemAImpl_psrlw_imm_u128, iemAImpl_psrld_imm_u128, iemAImpl_psrlq_imm_u128;
2065FNIEMAIMPLMEDIAPSHIFTU128 iemAImpl_psraw_imm_u128, iemAImpl_psrad_imm_u128;
2066FNIEMAIMPLMEDIAPSHIFTU128 iemAImpl_pslldq_imm_u128, iemAImpl_psrldq_imm_u128;
2067/** @} */
2068
2069/** @name Media (SSE/MMX/AVX) operation: Move Byte Mask
2070 * @{ */
2071IEM_DECL_IMPL_DEF(void, iemAImpl_pmovmskb_u64,(uint64_t *pu64Dst, uint64_t const *puSrc));
2072IEM_DECL_IMPL_DEF(void, iemAImpl_pmovmskb_u128,(uint64_t *pu64Dst, PCRTUINT128U puSrc));
2073#ifndef IEM_WITHOUT_ASSEMBLY
2074IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovmskb_u256,(uint64_t *pu64Dst, PCRTUINT256U puSrc));
2075#endif
2076IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovmskb_u256_fallback,(uint64_t *pu64Dst, PCRTUINT256U puSrc));
2077/** @} */
2078
2079/** @name Media (SSE/MMX/AVX) operations: Variable Blend Packed Bytes/R32/R64.
2080 * @{ */
2081typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLBLENDU128,(PRTUINT128U puDst, PCRTUINT128U puSrc, PCRTUINT128U puMask));
2082typedef FNIEMAIMPLBLENDU128 *PFNIEMAIMPLBLENDU128;
2083typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLAVXBLENDU128,(PRTUINT128U puDst, PCRTUINT128U puSrc1, PCRTUINT128U puSrc2, PCRTUINT128U puMask));
2084typedef FNIEMAIMPLAVXBLENDU128 *PFNIEMAIMPLAVXBLENDU128;
2085typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLAVXBLENDU256,(PRTUINT256U puDst, PCRTUINT256U puSrc1, PCRTUINT256U puSrc2, PCRTUINT256U puMask));
2086typedef FNIEMAIMPLAVXBLENDU256 *PFNIEMAIMPLAVXBLENDU256;
2087
2088FNIEMAIMPLBLENDU128 iemAImpl_pblendvb_u128;
2089FNIEMAIMPLBLENDU128 iemAImpl_pblendvb_u128_fallback;
2090FNIEMAIMPLAVXBLENDU128 iemAImpl_vpblendvb_u128;
2091FNIEMAIMPLAVXBLENDU128 iemAImpl_vpblendvb_u128_fallback;
2092FNIEMAIMPLAVXBLENDU256 iemAImpl_vpblendvb_u256;
2093FNIEMAIMPLAVXBLENDU256 iemAImpl_vpblendvb_u256_fallback;
2094
2095FNIEMAIMPLBLENDU128 iemAImpl_blendvps_u128;
2096FNIEMAIMPLBLENDU128 iemAImpl_blendvps_u128_fallback;
2097FNIEMAIMPLAVXBLENDU128 iemAImpl_vblendvps_u128;
2098FNIEMAIMPLAVXBLENDU128 iemAImpl_vblendvps_u128_fallback;
2099FNIEMAIMPLAVXBLENDU256 iemAImpl_vblendvps_u256;
2100FNIEMAIMPLAVXBLENDU256 iemAImpl_vblendvps_u256_fallback;
2101
2102FNIEMAIMPLBLENDU128 iemAImpl_blendvpd_u128;
2103FNIEMAIMPLBLENDU128 iemAImpl_blendvpd_u128_fallback;
2104FNIEMAIMPLAVXBLENDU128 iemAImpl_vblendvpd_u128;
2105FNIEMAIMPLAVXBLENDU128 iemAImpl_vblendvpd_u128_fallback;
2106FNIEMAIMPLAVXBLENDU256 iemAImpl_vblendvpd_u256;
2107FNIEMAIMPLAVXBLENDU256 iemAImpl_vblendvpd_u256_fallback;
2108/** @} */
2109
2110
2111/** @name Media (SSE/MMX/AVX) operation: Sort this later
2112 * @{ */
2113IEM_DECL_IMPL_DEF(void, iemAImpl_movsldup,(PRTUINT128U puDst, PCRTUINT128U puSrc));
2114IEM_DECL_IMPL_DEF(void, iemAImpl_movshdup,(PRTUINT128U puDst, PCRTUINT128U puSrc));
2115IEM_DECL_IMPL_DEF(void, iemAImpl_movddup,(PRTUINT128U puDst, uint64_t uSrc));
2116
2117IEM_DECL_IMPL_DEF(void, iemAImpl_vmovsldup_256_rr,(PX86XSAVEAREA pXState, uint8_t iYRegDst, uint8_t iYRegSrc));
2118IEM_DECL_IMPL_DEF(void, iemAImpl_vmovsldup_256_rm,(PX86XSAVEAREA pXState, uint8_t iYRegDst, PCRTUINT256U pSrc));
2119IEM_DECL_IMPL_DEF(void, iemAImpl_vmovshdup_256_rr,(PX86XSAVEAREA pXState, uint8_t iYRegDst, uint8_t iYRegSrc));
2120IEM_DECL_IMPL_DEF(void, iemAImpl_vmovshdup_256_rm,(PX86XSAVEAREA pXState, uint8_t iYRegDst, PCRTUINT256U pSrc));
2121IEM_DECL_IMPL_DEF(void, iemAImpl_vmovddup_256_rr,(PX86XSAVEAREA pXState, uint8_t iYRegDst, uint8_t iYRegSrc));
2122IEM_DECL_IMPL_DEF(void, iemAImpl_vmovddup_256_rm,(PX86XSAVEAREA pXState, uint8_t iYRegDst, PCRTUINT256U pSrc));
2123
2124IEM_DECL_IMPL_DEF(void, iemAImpl_pmovsxbw_u128,(PRTUINT128U puDst, uint64_t uSrc));
2125IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbw_u128,(PRTUINT128U puDst, uint64_t uSrc));
2126IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbw_u128_fallback,(PRTUINT128U puDst, uint64_t uSrc));
2127IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbw_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2128IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbw_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2129
2130IEM_DECL_IMPL_DEF(void, iemAImpl_pmovsxbd_u128,(PRTUINT128U puDst, uint32_t uSrc));
2131IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbd_u128,(PRTUINT128U puDst, uint32_t uSrc));
2132IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbd_u128_fallback,(PRTUINT128U puDst, uint32_t uSrc));
2133IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbd_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2134IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbd_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2135
2136IEM_DECL_IMPL_DEF(void, iemAImpl_pmovsxbq_u128,(PRTUINT128U puDst, uint16_t uSrc));
2137IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbq_u128,(PRTUINT128U puDst, uint16_t uSrc));
2138IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbq_u128_fallback,(PRTUINT128U puDst, uint16_t uSrc));
2139IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbq_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2140IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxbq_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2141
2142IEM_DECL_IMPL_DEF(void, iemAImpl_pmovsxwd_u128,(PRTUINT128U puDst, uint64_t uSrc));
2143IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxwd_u128,(PRTUINT128U puDst, uint64_t uSrc));
2144IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxwd_u128_fallback,(PRTUINT128U puDst, uint64_t uSrc));
2145IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxwd_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2146IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxwd_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2147
2148IEM_DECL_IMPL_DEF(void, iemAImpl_pmovsxwq_u128,(PRTUINT128U puDst, uint32_t uSrc));
2149IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxwq_u128,(PRTUINT128U puDst, uint32_t uSrc));
2150IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxwq_u128_fallback,(PRTUINT128U puDst, uint32_t uSrc));
2151IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxwq_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2152IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxwq_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2153
2154IEM_DECL_IMPL_DEF(void, iemAImpl_pmovsxdq_u128,(PRTUINT128U puDst, uint64_t uSrc));
2155IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxdq_u128,(PRTUINT128U puDst, uint64_t uSrc));
2156IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxdq_u128_fallback,(PRTUINT128U puDst, uint64_t uSrc));
2157IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxdq_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2158IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovsxdq_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2159
2160IEM_DECL_IMPL_DEF(void, iemAImpl_pmovzxbw_u128,(PRTUINT128U puDst, uint64_t uSrc));
2161IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbw_u128,(PRTUINT128U puDst, uint64_t uSrc));
2162IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbw_u128_fallback,(PRTUINT128U puDst, uint64_t uSrc));
2163IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbw_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2164IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbw_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2165
2166IEM_DECL_IMPL_DEF(void, iemAImpl_pmovzxbd_u128,(PRTUINT128U puDst, uint32_t uSrc));
2167IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbd_u128,(PRTUINT128U puDst, uint32_t uSrc));
2168IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbd_u128_fallback,(PRTUINT128U puDst, uint32_t uSrc));
2169IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbd_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2170IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbd_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2171
2172IEM_DECL_IMPL_DEF(void, iemAImpl_pmovzxbq_u128,(PRTUINT128U puDst, uint16_t uSrc));
2173IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbq_u128,(PRTUINT128U puDst, uint16_t uSrc));
2174IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbq_u128_fallback,(PRTUINT128U puDst, uint16_t uSrc));
2175IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbq_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2176IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxbq_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2177
2178IEM_DECL_IMPL_DEF(void, iemAImpl_pmovzxwd_u128,(PRTUINT128U puDst, uint64_t uSrc));
2179IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxwd_u128,(PRTUINT128U puDst, uint64_t uSrc));
2180IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxwd_u128_fallback,(PRTUINT128U puDst, uint64_t uSrc));
2181IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxwd_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2182IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxwd_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2183
2184IEM_DECL_IMPL_DEF(void, iemAImpl_pmovzxwq_u128,(PRTUINT128U puDst, uint32_t uSrc));
2185IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxwq_u128,(PRTUINT128U puDst, uint32_t uSrc));
2186IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxwq_u128_fallback,(PRTUINT128U puDst, uint32_t uSrc));
2187IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxwq_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2188IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxwq_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2189
2190IEM_DECL_IMPL_DEF(void, iemAImpl_pmovzxdq_u128,(PRTUINT128U puDst, uint64_t uSrc));
2191IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxdq_u128,(PRTUINT128U puDst, uint64_t uSrc));
2192IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxdq_u128_fallback,(PRTUINT128U puDst, uint64_t uSrc));
2193IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxdq_u256,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2194IEM_DECL_IMPL_DEF(void, iemAImpl_vpmovzxdq_u256_fallback,(PRTUINT256U puDst, PCRTUINT128U puSrc));
2195
2196IEM_DECL_IMPL_DEF(void, iemAImpl_shufpd_u128,(PRTUINT128U puDst, PCRTUINT128U puSrc, uint8_t bEvil));
2197IEM_DECL_IMPL_DEF(void, iemAImpl_vshufpd_u128,(PRTUINT128U puDst, PCRTUINT128U puSrc1, PCRTUINT128U puSrc2, uint8_t bEvil));
2198IEM_DECL_IMPL_DEF(void, iemAImpl_vshufpd_u128_fallback,(PRTUINT128U puDst, PCRTUINT128U puSrc1, PCRTUINT128U puSrc2, uint8_t bEvil));
2199IEM_DECL_IMPL_DEF(void, iemAImpl_vshufpd_u256,(PRTUINT256U puDst, PCRTUINT256U puSrc1, PCRTUINT256U puSrc2, uint8_t bEvil));
2200IEM_DECL_IMPL_DEF(void, iemAImpl_vshufpd_u256_fallback,(PRTUINT256U puDst, PCRTUINT256U puSrc1, PCRTUINT256U puSrc2, uint8_t bEvil));
2201
2202IEM_DECL_IMPL_DEF(void, iemAImpl_shufps_u128,(PRTUINT128U puDst, PCRTUINT128U puSrc, uint8_t bEvil));
2203IEM_DECL_IMPL_DEF(void, iemAImpl_vshufps_u128,(PRTUINT128U puDst, PCRTUINT128U puSrc1, PCRTUINT128U puSrc2, uint8_t bEvil));
2204IEM_DECL_IMPL_DEF(void, iemAImpl_vshufps_u128_fallback,(PRTUINT128U puDst, PCRTUINT128U puSrc1, PCRTUINT128U puSrc2, uint8_t bEvil));
2205IEM_DECL_IMPL_DEF(void, iemAImpl_vshufps_u256,(PRTUINT256U puDst, PCRTUINT256U puSrc1, PCRTUINT256U puSrc2, uint8_t bEvil));
2206IEM_DECL_IMPL_DEF(void, iemAImpl_vshufps_u256_fallback,(PRTUINT256U puDst, PCRTUINT256U puSrc1, PCRTUINT256U puSrc2, uint8_t bEvil));
2207
2208IEM_DECL_IMPL_DEF(void, iemAImpl_palignr_u64,(uint64_t *pu64Dst, uint64_t u64Src, uint8_t bEvil));
2209IEM_DECL_IMPL_DEF(void, iemAImpl_palignr_u64_fallback,(uint64_t *pu64Dst, uint64_t u64Src, uint8_t bEvil));
2210
2211typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAOPTF2U128IMM8,(PRTUINT128U puDst, PCRTUINT128U puSrc, uint8_t bEvil));
2212typedef FNIEMAIMPLMEDIAOPTF2U128IMM8 *PFNIEMAIMPLMEDIAOPTF2U128IMM8;
2213typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAOPTF3U128IMM8,(PRTUINT128U puDst, PCRTUINT128U puSrc1, PCRTUINT128U puSrc2, uint8_t bEvil));
2214typedef FNIEMAIMPLMEDIAOPTF3U128IMM8 *PFNIEMAIMPLMEDIAOPTF3U128IMM8;
2215typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLMEDIAOPTF3U256IMM8,(PRTUINT256U puDst, PCRTUINT256U puSrc1, PCRTUINT256U puSrc2, uint8_t bEvil));
2216typedef FNIEMAIMPLMEDIAOPTF3U256IMM8 *PFNIEMAIMPLMEDIAOPTF3U256IMM8;
2217
2218FNIEMAIMPLMEDIAOPTF2U128IMM8 iemAImpl_palignr_u128, iemAImpl_palignr_u128_fallback;
2219FNIEMAIMPLMEDIAOPTF2U128IMM8 iemAImpl_pblendw_u128, iemAImpl_pblendw_u128_fallback;
2220FNIEMAIMPLMEDIAOPTF2U128IMM8 iemAImpl_blendps_u128, iemAImpl_blendps_u128_fallback;
2221FNIEMAIMPLMEDIAOPTF2U128IMM8 iemAImpl_blendpd_u128, iemAImpl_blendpd_u128_fallback;
2222
2223FNIEMAIMPLMEDIAOPTF3U128IMM8 iemAImpl_vpalignr_u128, iemAImpl_vpalignr_u128_fallback;
2224FNIEMAIMPLMEDIAOPTF3U128IMM8 iemAImpl_vpblendw_u128, iemAImpl_vpblendw_u128_fallback;
2225FNIEMAIMPLMEDIAOPTF3U128IMM8 iemAImpl_vblendps_u128, iemAImpl_vblendps_u128_fallback;
2226FNIEMAIMPLMEDIAOPTF3U128IMM8 iemAImpl_vblendpd_u128, iemAImpl_vblendpd_u128_fallback;
2227
2228FNIEMAIMPLMEDIAOPTF3U256IMM8 iemAImpl_vpalignr_u256, iemAImpl_vpalignr_u256_fallback;
2229FNIEMAIMPLMEDIAOPTF3U256IMM8 iemAImpl_vpblendw_u256, iemAImpl_vpblendw_u256_fallback;
2230FNIEMAIMPLMEDIAOPTF3U256IMM8 iemAImpl_vblendps_u256, iemAImpl_vblendps_u256_fallback;
2231FNIEMAIMPLMEDIAOPTF3U256IMM8 iemAImpl_vblendpd_u256, iemAImpl_vblendpd_u256_fallback;
2232/** @} */
2233
2234/** @name Media Odds and Ends
2235 * @{ */
2236typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLCR32U8,(uint32_t *puDst, uint8_t uSrc));
2237typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLCR32U16,(uint32_t *puDst, uint16_t uSrc));
2238typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLCR32U32,(uint32_t *puDst, uint32_t uSrc));
2239typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLCR32U64,(uint32_t *puDst, uint64_t uSrc));
2240FNIEMAIMPLCR32U8 iemAImpl_crc32_u8, iemAImpl_crc32_u8_fallback;
2241FNIEMAIMPLCR32U16 iemAImpl_crc32_u16, iemAImpl_crc32_u16_fallback;
2242FNIEMAIMPLCR32U32 iemAImpl_crc32_u32, iemAImpl_crc32_u32_fallback;
2243FNIEMAIMPLCR32U64 iemAImpl_crc32_u64, iemAImpl_crc32_u64_fallback;
2244
2245typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLF2EFL128,(PCRTUINT128U puSrc1, PCRTUINT128U puSrc2, uint32_t *pEFlags));
2246typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLF2EFL256,(PCRTUINT256U puSrc1, PCRTUINT256U puSrc2, uint32_t *pEFlags));
2247FNIEMAIMPLF2EFL128 iemAImpl_ptest_u128;
2248FNIEMAIMPLF2EFL256 iemAImpl_vptest_u256, iemAImpl_vptest_u256_fallback;
2249/** @} */
2250
2251
2252/** @name Function tables.
2253 * @{
2254 */
2255
2256/**
2257 * Function table for a binary operator providing implementation based on
2258 * operand size.
2259 */
2260typedef struct IEMOPBINSIZES
2261{
2262 PFNIEMAIMPLBINU8 pfnNormalU8, pfnLockedU8;
2263 PFNIEMAIMPLBINU16 pfnNormalU16, pfnLockedU16;
2264 PFNIEMAIMPLBINU32 pfnNormalU32, pfnLockedU32;
2265 PFNIEMAIMPLBINU64 pfnNormalU64, pfnLockedU64;
2266} IEMOPBINSIZES;
2267/** Pointer to a binary operator function table. */
2268typedef IEMOPBINSIZES const *PCIEMOPBINSIZES;
2269
2270
2271/**
2272 * Function table for a unary operator providing implementation based on
2273 * operand size.
2274 */
2275typedef struct IEMOPUNARYSIZES
2276{
2277 PFNIEMAIMPLUNARYU8 pfnNormalU8, pfnLockedU8;
2278 PFNIEMAIMPLUNARYU16 pfnNormalU16, pfnLockedU16;
2279 PFNIEMAIMPLUNARYU32 pfnNormalU32, pfnLockedU32;
2280 PFNIEMAIMPLUNARYU64 pfnNormalU64, pfnLockedU64;
2281} IEMOPUNARYSIZES;
2282/** Pointer to a unary operator function table. */
2283typedef IEMOPUNARYSIZES const *PCIEMOPUNARYSIZES;
2284
2285
2286/**
2287 * Function table for a shift operator providing implementation based on
2288 * operand size.
2289 */
2290typedef struct IEMOPSHIFTSIZES
2291{
2292 PFNIEMAIMPLSHIFTU8 pfnNormalU8;
2293 PFNIEMAIMPLSHIFTU16 pfnNormalU16;
2294 PFNIEMAIMPLSHIFTU32 pfnNormalU32;
2295 PFNIEMAIMPLSHIFTU64 pfnNormalU64;
2296} IEMOPSHIFTSIZES;
2297/** Pointer to a shift operator function table. */
2298typedef IEMOPSHIFTSIZES const *PCIEMOPSHIFTSIZES;
2299
2300
2301/**
2302 * Function table for a multiplication or division operation.
2303 */
2304typedef struct IEMOPMULDIVSIZES
2305{
2306 PFNIEMAIMPLMULDIVU8 pfnU8;
2307 PFNIEMAIMPLMULDIVU16 pfnU16;
2308 PFNIEMAIMPLMULDIVU32 pfnU32;
2309 PFNIEMAIMPLMULDIVU64 pfnU64;
2310} IEMOPMULDIVSIZES;
2311/** Pointer to a multiplication or division operation function table. */
2312typedef IEMOPMULDIVSIZES const *PCIEMOPMULDIVSIZES;
2313
2314
2315/**
2316 * Function table for a double precision shift operator providing implementation
2317 * based on operand size.
2318 */
2319typedef struct IEMOPSHIFTDBLSIZES
2320{
2321 PFNIEMAIMPLSHIFTDBLU16 pfnNormalU16;
2322 PFNIEMAIMPLSHIFTDBLU32 pfnNormalU32;
2323 PFNIEMAIMPLSHIFTDBLU64 pfnNormalU64;
2324} IEMOPSHIFTDBLSIZES;
2325/** Pointer to a double precision shift function table. */
2326typedef IEMOPSHIFTDBLSIZES const *PCIEMOPSHIFTDBLSIZES;
2327
2328
2329/**
2330 * Function table for media instruction taking two full sized media source
2331 * registers and one full sized destination register (AVX).
2332 */
2333typedef struct IEMOPMEDIAF3
2334{
2335 PFNIEMAIMPLMEDIAF3U128 pfnU128;
2336 PFNIEMAIMPLMEDIAF3U256 pfnU256;
2337} IEMOPMEDIAF3;
2338/** Pointer to a media operation function table for 3 full sized ops (AVX). */
2339typedef IEMOPMEDIAF3 const *PCIEMOPMEDIAF3;
2340
2341/** @def IEMOPMEDIAF3_INIT_VARS_EX
2342 * Declares a s_Host (x86 & amd64 only) and a s_Fallback variable with the
2343 * given functions as initializers. For use in AVX functions where a pair of
2344 * functions are only used once and the function table need not be public. */
2345#ifndef TST_IEM_CHECK_MC
2346# if (defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)) && !defined(IEM_WITHOUT_ASSEMBLY)
2347# define IEMOPMEDIAF3_INIT_VARS_EX(a_pfnHostU128, a_pfnHostU256, a_pfnFallbackU128, a_pfnFallbackU256) \
2348 static IEMOPMEDIAF3 const s_Host = { a_pfnHostU128, a_pfnHostU256 }; \
2349 static IEMOPMEDIAF3 const s_Fallback = { a_pfnFallbackU128, a_pfnFallbackU256 }
2350# else
2351# define IEMOPMEDIAF3_INIT_VARS_EX(a_pfnU128, a_pfnU256, a_pfnFallbackU128, a_pfnFallbackU256) \
2352 static IEMOPMEDIAF3 const s_Fallback = { a_pfnFallbackU128, a_pfnFallbackU256 }
2353# endif
2354#else
2355# define IEMOPMEDIAF3_INIT_VARS_EX(a_pfnU128, a_pfnU256, a_pfnFallbackU128, a_pfnFallbackU256) (void)0
2356#endif
2357/** @def IEMOPMEDIAF3_INIT_VARS
2358 * Generate AVX function tables for the @a a_InstrNm instruction.
2359 * @sa IEMOPMEDIAF3_INIT_VARS_EX */
2360#define IEMOPMEDIAF3_INIT_VARS(a_InstrNm) \
2361 IEMOPMEDIAF3_INIT_VARS_EX(RT_CONCAT3(iemAImpl_,a_InstrNm,_u128), RT_CONCAT3(iemAImpl_,a_InstrNm,_u256),\
2362 RT_CONCAT3(iemAImpl_,a_InstrNm,_u128_fallback), RT_CONCAT3(iemAImpl_,a_InstrNm,_u256_fallback))
2363
2364/**
2365 * Function table for media instruction taking two full sized media source
2366 * registers and one full sized destination register, but no additional state
2367 * (AVX).
2368 */
2369typedef struct IEMOPMEDIAOPTF3
2370{
2371 PFNIEMAIMPLMEDIAOPTF3U128 pfnU128;
2372 PFNIEMAIMPLMEDIAOPTF3U256 pfnU256;
2373} IEMOPMEDIAOPTF3;
2374/** Pointer to a media operation function table for 3 full sized ops (AVX). */
2375typedef IEMOPMEDIAOPTF3 const *PCIEMOPMEDIAOPTF3;
2376
2377/** @def IEMOPMEDIAOPTF3_INIT_VARS_EX
2378 * Declares a s_Host (x86 & amd64 only) and a s_Fallback variable with the
2379 * given functions as initializers. For use in AVX functions where a pair of
2380 * functions are only used once and the function table need not be public. */
2381#ifndef TST_IEM_CHECK_MC
2382# if (defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)) && !defined(IEM_WITHOUT_ASSEMBLY)
2383# define IEMOPMEDIAOPTF3_INIT_VARS_EX(a_pfnHostU128, a_pfnHostU256, a_pfnFallbackU128, a_pfnFallbackU256) \
2384 static IEMOPMEDIAOPTF3 const s_Host = { a_pfnHostU128, a_pfnHostU256 }; \
2385 static IEMOPMEDIAOPTF3 const s_Fallback = { a_pfnFallbackU128, a_pfnFallbackU256 }
2386# else
2387# define IEMOPMEDIAOPTF3_INIT_VARS_EX(a_pfnU128, a_pfnU256, a_pfnFallbackU128, a_pfnFallbackU256) \
2388 static IEMOPMEDIAOPTF3 const s_Fallback = { a_pfnFallbackU128, a_pfnFallbackU256 }
2389# endif
2390#else
2391# define IEMOPMEDIAOPTF3_INIT_VARS_EX(a_pfnU128, a_pfnU256, a_pfnFallbackU128, a_pfnFallbackU256) (void)0
2392#endif
2393/** @def IEMOPMEDIAOPTF3_INIT_VARS
2394 * Generate AVX function tables for the @a a_InstrNm instruction.
2395 * @sa IEMOPMEDIAOPTF3_INIT_VARS_EX */
2396#define IEMOPMEDIAOPTF3_INIT_VARS(a_InstrNm) \
2397 IEMOPMEDIAOPTF3_INIT_VARS_EX(RT_CONCAT3(iemAImpl_,a_InstrNm,_u128), RT_CONCAT3(iemAImpl_,a_InstrNm,_u256),\
2398 RT_CONCAT3(iemAImpl_,a_InstrNm,_u128_fallback), RT_CONCAT3(iemAImpl_,a_InstrNm,_u256_fallback))
2399
2400/**
2401 * Function table for media instruction taking one full sized media source
2402 * registers and one full sized destination register, but no additional state
2403 * (AVX).
2404 */
2405typedef struct IEMOPMEDIAOPTF2
2406{
2407 PFNIEMAIMPLMEDIAOPTF2U128 pfnU128;
2408 PFNIEMAIMPLMEDIAOPTF2U256 pfnU256;
2409} IEMOPMEDIAOPTF2;
2410/** Pointer to a media operation function table for 2 full sized ops (AVX). */
2411typedef IEMOPMEDIAOPTF2 const *PCIEMOPMEDIAOPTF2;
2412
2413/** @def IEMOPMEDIAOPTF2_INIT_VARS_EX
2414 * Declares a s_Host (x86 & amd64 only) and a s_Fallback variable with the
2415 * given functions as initializers. For use in AVX functions where a pair of
2416 * functions are only used once and the function table need not be public. */
2417#ifndef TST_IEM_CHECK_MC
2418# if (defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)) && !defined(IEM_WITHOUT_ASSEMBLY)
2419# define IEMOPMEDIAOPTF2_INIT_VARS_EX(a_pfnHostU128, a_pfnHostU256, a_pfnFallbackU128, a_pfnFallbackU256) \
2420 static IEMOPMEDIAOPTF2 const s_Host = { a_pfnHostU128, a_pfnHostU256 }; \
2421 static IEMOPMEDIAOPTF2 const s_Fallback = { a_pfnFallbackU128, a_pfnFallbackU256 }
2422# else
2423# define IEMOPMEDIAOPTF2_INIT_VARS_EX(a_pfnU128, a_pfnU256, a_pfnFallbackU128, a_pfnFallbackU256) \
2424 static IEMOPMEDIAOPTF2 const s_Fallback = { a_pfnFallbackU128, a_pfnFallbackU256 }
2425# endif
2426#else
2427# define IEMOPMEDIAOPTF2_INIT_VARS_EX(a_pfnU128, a_pfnU256, a_pfnFallbackU128, a_pfnFallbackU256) (void)0
2428#endif
2429/** @def IEMOPMEDIAOPTF2_INIT_VARS
2430 * Generate AVX function tables for the @a a_InstrNm instruction.
2431 * @sa IEMOPMEDIAOPTF2_INIT_VARS_EX */
2432#define IEMOPMEDIAOPTF2_INIT_VARS(a_InstrNm) \
2433 IEMOPMEDIAOPTF2_INIT_VARS_EX(RT_CONCAT3(iemAImpl_,a_InstrNm,_u128), RT_CONCAT3(iemAImpl_,a_InstrNm,_u256),\
2434 RT_CONCAT3(iemAImpl_,a_InstrNm,_u128_fallback), RT_CONCAT3(iemAImpl_,a_InstrNm,_u256_fallback))
2435
2436/**
2437 * Function table for media instruction taking two full sized media source
2438 * registers and one full sized destination register and an 8-bit immediate, but no additional state
2439 * (AVX).
2440 */
2441typedef struct IEMOPMEDIAOPTF3IMM8
2442{
2443 PFNIEMAIMPLMEDIAOPTF3U128IMM8 pfnU128;
2444 PFNIEMAIMPLMEDIAOPTF3U256IMM8 pfnU256;
2445} IEMOPMEDIAOPTF3IMM8;
2446/** Pointer to a media operation function table for 3 full sized ops (AVX). */
2447typedef IEMOPMEDIAOPTF3IMM8 const *PCIEMOPMEDIAOPTF3IMM8;
2448
2449/** @def IEMOPMEDIAOPTF3IMM8_INIT_VARS_EX
2450 * Declares a s_Host (x86 & amd64 only) and a s_Fallback variable with the
2451 * given functions as initializers. For use in AVX functions where a pair of
2452 * functions are only used once and the function table need not be public. */
2453#ifndef TST_IEM_CHECK_MC
2454# if (defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)) && !defined(IEM_WITHOUT_ASSEMBLY)
2455# define IEMOPMEDIAOPTF3IMM8_INIT_VARS_EX(a_pfnHostU128, a_pfnHostU256, a_pfnFallbackU128, a_pfnFallbackU256) \
2456 static IEMOPMEDIAOPTF3IMM8 const s_Host = { a_pfnHostU128, a_pfnHostU256 }; \
2457 static IEMOPMEDIAOPTF3IMM8 const s_Fallback = { a_pfnFallbackU128, a_pfnFallbackU256 }
2458# else
2459# define IEMOPMEDIAOPTF3IMM8_INIT_VARS_EX(a_pfnU128, a_pfnU256, a_pfnFallbackU128, a_pfnFallbackU256) \
2460 static IEMOPMEDIAOPTF3IMM8 const s_Fallback = { a_pfnFallbackU128, a_pfnFallbackU256 }
2461# endif
2462#else
2463# define IEMOPMEDIAOPTF3IMM8_INIT_VARS_EX(a_pfnU128, a_pfnU256, a_pfnFallbackU128, a_pfnFallbackU256) (void)0
2464#endif
2465/** @def IEMOPMEDIAOPTF3IMM8_INIT_VARS
2466 * Generate AVX function tables for the @a a_InstrNm instruction.
2467 * @sa IEMOPMEDIAOPTF3IMM8_INIT_VARS_EX */
2468#define IEMOPMEDIAOPTF3IMM8_INIT_VARS(a_InstrNm) \
2469 IEMOPMEDIAOPTF3IMM8_INIT_VARS_EX(RT_CONCAT3(iemAImpl_,a_InstrNm,_u128), RT_CONCAT3(iemAImpl_,a_InstrNm,_u256),\
2470 RT_CONCAT3(iemAImpl_,a_InstrNm,_u128_fallback), RT_CONCAT3(iemAImpl_,a_InstrNm,_u256_fallback))
2471/** @} */
2472
2473
2474/**
2475 * Function table for blend type instruction taking three full sized media source
2476 * registers and one full sized destination register, but no additional state
2477 * (AVX).
2478 */
2479typedef struct IEMOPBLENDOP
2480{
2481 PFNIEMAIMPLAVXBLENDU128 pfnU128;
2482 PFNIEMAIMPLAVXBLENDU256 pfnU256;
2483} IEMOPBLENDOP;
2484/** Pointer to a media operation function table for 4 full sized ops (AVX). */
2485typedef IEMOPBLENDOP const *PCIEMOPBLENDOP;
2486
2487/** @def IEMOPBLENDOP_INIT_VARS_EX
2488 * Declares a s_Host (x86 & amd64 only) and a s_Fallback variable with the
2489 * given functions as initializers. For use in AVX functions where a pair of
2490 * functions are only used once and the function table need not be public. */
2491#ifndef TST_IEM_CHECK_MC
2492# if (defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)) && !defined(IEM_WITHOUT_ASSEMBLY)
2493# define IEMOPBLENDOP_INIT_VARS_EX(a_pfnHostU128, a_pfnHostU256, a_pfnFallbackU128, a_pfnFallbackU256) \
2494 static IEMOPBLENDOP const s_Host = { a_pfnHostU128, a_pfnHostU256 }; \
2495 static IEMOPBLENDOP const s_Fallback = { a_pfnFallbackU128, a_pfnFallbackU256 }
2496# else
2497# define IEMOPBLENDOP_INIT_VARS_EX(a_pfnU128, a_pfnU256, a_pfnFallbackU128, a_pfnFallbackU256) \
2498 static IEMOPBLENDOP const s_Fallback = { a_pfnFallbackU128, a_pfnFallbackU256 }
2499# endif
2500#else
2501# define IEMOPBLENDOP_INIT_VARS_EX(a_pfnU128, a_pfnU256, a_pfnFallbackU128, a_pfnFallbackU256) (void)0
2502#endif
2503/** @def IEMOPBLENDOP_INIT_VARS
2504 * Generate AVX function tables for the @a a_InstrNm instruction.
2505 * @sa IEMOPBLENDOP_INIT_VARS_EX */
2506#define IEMOPBLENDOP_INIT_VARS(a_InstrNm) \
2507 IEMOPBLENDOP_INIT_VARS_EX(RT_CONCAT3(iemAImpl_,a_InstrNm,_u128), RT_CONCAT3(iemAImpl_,a_InstrNm,_u256),\
2508 RT_CONCAT3(iemAImpl_,a_InstrNm,_u128_fallback), RT_CONCAT3(iemAImpl_,a_InstrNm,_u256_fallback))
2509
2510
2511/** @name SSE/AVX single/double precision floating point operations.
2512 * @{ */
2513/**
2514 * A SSE result.
2515 */
2516typedef struct IEMSSERESULT
2517{
2518 /** The output value. */
2519 X86XMMREG uResult;
2520 /** The output status. */
2521 uint32_t MXCSR;
2522} IEMSSERESULT;
2523AssertCompileMemberOffset(IEMSSERESULT, MXCSR, 128 / 8);
2524/** Pointer to a SSE result. */
2525typedef IEMSSERESULT *PIEMSSERESULT;
2526/** Pointer to a const SSE result. */
2527typedef IEMSSERESULT const *PCIEMSSERESULT;
2528
2529
2530/**
2531 * A AVX128 result.
2532 */
2533typedef struct IEMAVX128RESULT
2534{
2535 /** The output value. */
2536 X86XMMREG uResult;
2537 /** The output status. */
2538 uint32_t MXCSR;
2539} IEMAVX128RESULT;
2540AssertCompileMemberOffset(IEMAVX128RESULT, MXCSR, 128 / 8);
2541/** Pointer to a AVX128 result. */
2542typedef IEMAVX128RESULT *PIEMAVX128RESULT;
2543/** Pointer to a const AVX128 result. */
2544typedef IEMAVX128RESULT const *PCIEMAVX128RESULT;
2545
2546
2547/**
2548 * A AVX256 result.
2549 */
2550typedef struct IEMAVX256RESULT
2551{
2552 /** The output value. */
2553 X86YMMREG uResult;
2554 /** The output status. */
2555 uint32_t MXCSR;
2556} IEMAVX256RESULT;
2557AssertCompileMemberOffset(IEMAVX256RESULT, MXCSR, 256 / 8);
2558/** Pointer to a AVX256 result. */
2559typedef IEMAVX256RESULT *PIEMAVX256RESULT;
2560/** Pointer to a const AVX256 result. */
2561typedef IEMAVX256RESULT const *PCIEMAVX256RESULT;
2562
2563
2564typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPSSEF2U128,(PX86FXSTATE pFpuState, PIEMSSERESULT pResult, PCX86XMMREG puSrc1, PCX86XMMREG puSrc2));
2565typedef FNIEMAIMPLFPSSEF2U128 *PFNIEMAIMPLFPSSEF2U128;
2566typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPSSEF2U128R32,(PX86FXSTATE pFpuState, PIEMSSERESULT pResult, PCX86XMMREG puSrc1, PCRTFLOAT32U pr32Src2));
2567typedef FNIEMAIMPLFPSSEF2U128R32 *PFNIEMAIMPLFPSSEF2U128R32;
2568typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPSSEF2U128R64,(PX86FXSTATE pFpuState, PIEMSSERESULT pResult, PCX86XMMREG puSrc1, PCRTFLOAT64U pr64Src2));
2569typedef FNIEMAIMPLFPSSEF2U128R64 *PFNIEMAIMPLFPSSEF2U128R64;
2570
2571typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPAVXF3U128,(PX86XSAVEAREA pExtState, PIEMAVX128RESULT pResult, PCX86XMMREG puSrc1, PCX86XMMREG puSrc2));
2572typedef FNIEMAIMPLFPAVXF3U128 *PFNIEMAIMPLFPAVXF3U128;
2573typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPAVXF3U128R32,(PX86XSAVEAREA pExtState, PIEMAVX128RESULT pResult, PCX86XMMREG puSrc1, PCRTFLOAT32U pr32Src2));
2574typedef FNIEMAIMPLFPAVXF3U128R32 *PFNIEMAIMPLFPAVXF3U128R32;
2575typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPAVXF3U128R64,(PX86XSAVEAREA pExtState, PIEMAVX128RESULT pResult, PCX86XMMREG puSrc1, PCRTFLOAT64U pr64Src2));
2576typedef FNIEMAIMPLFPAVXF3U128R64 *PFNIEMAIMPLFPAVXF3U128R64;
2577
2578typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPAVXF3U256,(PX86XSAVEAREA pExtState, PIEMAVX256RESULT pResult, PCX86YMMREG puSrc1, PCX86YMMREG puSrc2));
2579typedef FNIEMAIMPLFPAVXF3U256 *PFNIEMAIMPLFPAVXF3U256;
2580
2581FNIEMAIMPLFPSSEF2U128 iemAImpl_addps_u128;
2582FNIEMAIMPLFPSSEF2U128 iemAImpl_addpd_u128;
2583FNIEMAIMPLFPSSEF2U128 iemAImpl_mulps_u128;
2584FNIEMAIMPLFPSSEF2U128 iemAImpl_mulpd_u128;
2585FNIEMAIMPLFPSSEF2U128 iemAImpl_subps_u128;
2586FNIEMAIMPLFPSSEF2U128 iemAImpl_subpd_u128;
2587FNIEMAIMPLFPSSEF2U128 iemAImpl_minps_u128;
2588FNIEMAIMPLFPSSEF2U128 iemAImpl_minpd_u128;
2589FNIEMAIMPLFPSSEF2U128 iemAImpl_divps_u128;
2590FNIEMAIMPLFPSSEF2U128 iemAImpl_divpd_u128;
2591FNIEMAIMPLFPSSEF2U128 iemAImpl_maxps_u128;
2592FNIEMAIMPLFPSSEF2U128 iemAImpl_maxpd_u128;
2593FNIEMAIMPLFPSSEF2U128 iemAImpl_haddps_u128;
2594FNIEMAIMPLFPSSEF2U128 iemAImpl_haddpd_u128;
2595FNIEMAIMPLFPSSEF2U128 iemAImpl_hsubps_u128;
2596FNIEMAIMPLFPSSEF2U128 iemAImpl_hsubpd_u128;
2597FNIEMAIMPLFPSSEF2U128 iemAImpl_sqrtps_u128;
2598FNIEMAIMPLFPSSEF2U128 iemAImpl_sqrtpd_u128;
2599FNIEMAIMPLFPSSEF2U128 iemAImpl_addsubps_u128;
2600FNIEMAIMPLFPSSEF2U128 iemAImpl_addsubpd_u128;
2601FNIEMAIMPLFPSSEF2U128 iemAImpl_cvtpd2ps_u128;
2602
2603FNIEMAIMPLFPSSEF2U128R32 iemAImpl_addss_u128_r32;
2604FNIEMAIMPLFPSSEF2U128R64 iemAImpl_addsd_u128_r64;
2605FNIEMAIMPLFPSSEF2U128R32 iemAImpl_mulss_u128_r32;
2606FNIEMAIMPLFPSSEF2U128R64 iemAImpl_mulsd_u128_r64;
2607FNIEMAIMPLFPSSEF2U128R32 iemAImpl_subss_u128_r32;
2608FNIEMAIMPLFPSSEF2U128R64 iemAImpl_subsd_u128_r64;
2609FNIEMAIMPLFPSSEF2U128R32 iemAImpl_minss_u128_r32;
2610FNIEMAIMPLFPSSEF2U128R64 iemAImpl_minsd_u128_r64;
2611FNIEMAIMPLFPSSEF2U128R32 iemAImpl_divss_u128_r32;
2612FNIEMAIMPLFPSSEF2U128R64 iemAImpl_divsd_u128_r64;
2613FNIEMAIMPLFPSSEF2U128R32 iemAImpl_maxss_u128_r32;
2614FNIEMAIMPLFPSSEF2U128R64 iemAImpl_maxsd_u128_r64;
2615FNIEMAIMPLFPSSEF2U128R32 iemAImpl_cvtss2sd_u128_r32;
2616FNIEMAIMPLFPSSEF2U128R64 iemAImpl_cvtsd2ss_u128_r64;
2617FNIEMAIMPLFPSSEF2U128R32 iemAImpl_sqrtss_u128_r32;
2618FNIEMAIMPLFPSSEF2U128R64 iemAImpl_sqrtsd_u128_r64;
2619
2620FNIEMAIMPLFPAVXF3U128 iemAImpl_vaddps_u128, iemAImpl_vaddps_u128_fallback;
2621FNIEMAIMPLFPAVXF3U128 iemAImpl_vaddpd_u128, iemAImpl_vaddpd_u128_fallback;
2622FNIEMAIMPLFPAVXF3U128 iemAImpl_vmulps_u128, iemAImpl_vmulps_u128_fallback;
2623FNIEMAIMPLFPAVXF3U128 iemAImpl_vmulpd_u128, iemAImpl_vmulpd_u128_fallback;
2624FNIEMAIMPLFPAVXF3U128 iemAImpl_vsubps_u128, iemAImpl_vsubps_u128_fallback;
2625FNIEMAIMPLFPAVXF3U128 iemAImpl_vsubpd_u128, iemAImpl_vsubpd_u128_fallback;
2626FNIEMAIMPLFPAVXF3U128 iemAImpl_vminps_u128, iemAImpl_vminps_u128_fallback;
2627FNIEMAIMPLFPAVXF3U128 iemAImpl_vminpd_u128, iemAImpl_vminpd_u128_fallback;
2628FNIEMAIMPLFPAVXF3U128 iemAImpl_vdivps_u128, iemAImpl_vdivps_u128_fallback;
2629FNIEMAIMPLFPAVXF3U128 iemAImpl_vdivpd_u128, iemAImpl_vdivpd_u128_fallback;
2630FNIEMAIMPLFPAVXF3U128 iemAImpl_vmaxps_u128, iemAImpl_vmaxps_u128_fallback;
2631FNIEMAIMPLFPAVXF3U128 iemAImpl_vmaxpd_u128, iemAImpl_vmaxpd_u128_fallback;
2632FNIEMAIMPLFPAVXF3U128 iemAImpl_vhaddps_u128, iemAImpl_vhaddps_u128_fallback;
2633FNIEMAIMPLFPAVXF3U128 iemAImpl_vhaddpd_u128, iemAImpl_vhaddpd_u128_fallback;
2634FNIEMAIMPLFPAVXF3U128 iemAImpl_vhsubps_u128, iemAImpl_vhsubps_u128_fallback;
2635FNIEMAIMPLFPAVXF3U128 iemAImpl_vhsubpd_u128, iemAImpl_vhsubpd_u128_fallback;
2636FNIEMAIMPLFPAVXF3U128 iemAImpl_vsqrtps_u128, iemAImpl_vsqrtps_u128_fallback;
2637FNIEMAIMPLFPAVXF3U128 iemAImpl_vsqrtpd_u128, iemAImpl_vsqrtpd_u128_fallback;
2638FNIEMAIMPLFPAVXF3U128 iemAImpl_vaddsubps_u128, iemAImpl_vaddsubps_u128_fallback;
2639FNIEMAIMPLFPAVXF3U128 iemAImpl_vaddsubpd_u128, iemAImpl_vaddsubpd_u128_fallback;
2640FNIEMAIMPLFPAVXF3U128 iemAImpl_vcvtpd2ps_u128, iemAImpl_vcvtpd2ps_u128_fallback;
2641
2642FNIEMAIMPLFPAVXF3U128R32 iemAImpl_vaddss_u128_r32, iemAImpl_vaddss_u128_r32_fallback;
2643FNIEMAIMPLFPAVXF3U128R64 iemAImpl_vaddsd_u128_r64, iemAImpl_vaddsd_u128_r64_fallback;
2644FNIEMAIMPLFPAVXF3U128R32 iemAImpl_vmulss_u128_r32, iemAImpl_vmulss_u128_r32_fallback;
2645FNIEMAIMPLFPAVXF3U128R64 iemAImpl_vmulsd_u128_r64, iemAImpl_vmulsd_u128_r64_fallback;
2646FNIEMAIMPLFPAVXF3U128R32 iemAImpl_vsubss_u128_r32, iemAImpl_vsubss_u128_r32_fallback;
2647FNIEMAIMPLFPAVXF3U128R64 iemAImpl_vsubsd_u128_r64, iemAImpl_vsubsd_u128_r64_fallback;
2648FNIEMAIMPLFPAVXF3U128R32 iemAImpl_vminss_u128_r32, iemAImpl_vminss_u128_r32_fallback;
2649FNIEMAIMPLFPAVXF3U128R64 iemAImpl_vminsd_u128_r64, iemAImpl_vminsd_u128_r64_fallback;
2650FNIEMAIMPLFPAVXF3U128R32 iemAImpl_vdivss_u128_r32, iemAImpl_vdivss_u128_r32_fallback;
2651FNIEMAIMPLFPAVXF3U128R64 iemAImpl_vdivsd_u128_r64, iemAImpl_vdivsd_u128_r64_fallback;
2652FNIEMAIMPLFPAVXF3U128R32 iemAImpl_vmaxss_u128_r32, iemAImpl_vmaxss_u128_r32_fallback;
2653FNIEMAIMPLFPAVXF3U128R64 iemAImpl_vmaxsd_u128_r64, iemAImpl_vmaxsd_u128_r64_fallback;
2654FNIEMAIMPLFPAVXF3U128R32 iemAImpl_vsqrtss_u128_r32, iemAImpl_vsqrtss_u128_r32_fallback;
2655FNIEMAIMPLFPAVXF3U128R64 iemAImpl_vsqrtsd_u128_r64, iemAImpl_vsqrtsd_u128_r64_fallback;
2656
2657FNIEMAIMPLFPAVXF3U256 iemAImpl_vaddps_u256, iemAImpl_vaddps_u256_fallback;
2658FNIEMAIMPLFPAVXF3U256 iemAImpl_vaddpd_u256, iemAImpl_vaddpd_u256_fallback;
2659FNIEMAIMPLFPAVXF3U256 iemAImpl_vmulps_u256, iemAImpl_vmulps_u256_fallback;
2660FNIEMAIMPLFPAVXF3U256 iemAImpl_vmulpd_u256, iemAImpl_vmulpd_u256_fallback;
2661FNIEMAIMPLFPAVXF3U256 iemAImpl_vsubps_u256, iemAImpl_vsubps_u256_fallback;
2662FNIEMAIMPLFPAVXF3U256 iemAImpl_vsubpd_u256, iemAImpl_vsubpd_u256_fallback;
2663FNIEMAIMPLFPAVXF3U256 iemAImpl_vminps_u256, iemAImpl_vminps_u256_fallback;
2664FNIEMAIMPLFPAVXF3U256 iemAImpl_vminpd_u256, iemAImpl_vminpd_u256_fallback;
2665FNIEMAIMPLFPAVXF3U256 iemAImpl_vdivps_u256, iemAImpl_vdivps_u256_fallback;
2666FNIEMAIMPLFPAVXF3U256 iemAImpl_vdivpd_u256, iemAImpl_vdivpd_u256_fallback;
2667FNIEMAIMPLFPAVXF3U256 iemAImpl_vmaxps_u256, iemAImpl_vmaxps_u256_fallback;
2668FNIEMAIMPLFPAVXF3U256 iemAImpl_vmaxpd_u256, iemAImpl_vmaxpd_u256_fallback;
2669FNIEMAIMPLFPAVXF3U256 iemAImpl_vhaddps_u256, iemAImpl_vhaddps_u256_fallback;
2670FNIEMAIMPLFPAVXF3U256 iemAImpl_vhaddpd_u256, iemAImpl_vhaddpd_u256_fallback;
2671FNIEMAIMPLFPAVXF3U256 iemAImpl_vhsubps_u256, iemAImpl_vhsubps_u256_fallback;
2672FNIEMAIMPLFPAVXF3U256 iemAImpl_vhsubpd_u256, iemAImpl_vhsubpd_u256_fallback;
2673FNIEMAIMPLFPAVXF3U256 iemAImpl_vhaddsubps_u256, iemAImpl_vhaddsubps_u256_fallback;
2674FNIEMAIMPLFPAVXF3U256 iemAImpl_vhaddsubpd_u256, iemAImpl_vhaddsubpd_u256_fallback;
2675FNIEMAIMPLFPAVXF3U256 iemAImpl_vcvtpd2ps_u256, iemAImpl_vcvtpd2ps_u256_fallback;
2676/** @} */
2677
2678/** @name C instruction implementations for anything slightly complicated.
2679 * @{ */
2680
2681/**
2682 * For typedef'ing or declaring a C instruction implementation function taking
2683 * no extra arguments.
2684 *
2685 * @param a_Name The name of the type.
2686 */
2687# define IEM_CIMPL_DECL_TYPE_0(a_Name) \
2688 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr))
2689/**
2690 * For defining a C instruction implementation function taking no extra
2691 * arguments.
2692 *
2693 * @param a_Name The name of the function
2694 */
2695# define IEM_CIMPL_DEF_0(a_Name) \
2696 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr))
2697/**
2698 * Prototype version of IEM_CIMPL_DEF_0.
2699 */
2700# define IEM_CIMPL_PROTO_0(a_Name) \
2701 IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr))
2702/**
2703 * For calling a C instruction implementation function taking no extra
2704 * arguments.
2705 *
2706 * This special call macro adds default arguments to the call and allow us to
2707 * change these later.
2708 *
2709 * @param a_fn The name of the function.
2710 */
2711# define IEM_CIMPL_CALL_0(a_fn) a_fn(pVCpu, cbInstr)
2712
2713/**
2714 * For typedef'ing or declaring a C instruction implementation function taking
2715 * one extra argument.
2716 *
2717 * @param a_Name The name of the type.
2718 * @param a_Type0 The argument type.
2719 * @param a_Arg0 The argument name.
2720 */
2721# define IEM_CIMPL_DECL_TYPE_1(a_Name, a_Type0, a_Arg0) \
2722 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0))
2723/**
2724 * For defining a C instruction implementation function taking one extra
2725 * argument.
2726 *
2727 * @param a_Name The name of the function
2728 * @param a_Type0 The argument type.
2729 * @param a_Arg0 The argument name.
2730 */
2731# define IEM_CIMPL_DEF_1(a_Name, a_Type0, a_Arg0) \
2732 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0))
2733/**
2734 * Prototype version of IEM_CIMPL_DEF_1.
2735 */
2736# define IEM_CIMPL_PROTO_1(a_Name, a_Type0, a_Arg0) \
2737 IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0))
2738/**
2739 * For calling a C instruction implementation function taking one extra
2740 * argument.
2741 *
2742 * This special call macro adds default arguments to the call and allow us to
2743 * change these later.
2744 *
2745 * @param a_fn The name of the function.
2746 * @param a0 The name of the 1st argument.
2747 */
2748# define IEM_CIMPL_CALL_1(a_fn, a0) a_fn(pVCpu, cbInstr, (a0))
2749
2750/**
2751 * For typedef'ing or declaring a C instruction implementation function taking
2752 * two extra arguments.
2753 *
2754 * @param a_Name The name of the type.
2755 * @param a_Type0 The type of the 1st argument
2756 * @param a_Arg0 The name of the 1st argument.
2757 * @param a_Type1 The type of the 2nd argument.
2758 * @param a_Arg1 The name of the 2nd argument.
2759 */
2760# define IEM_CIMPL_DECL_TYPE_2(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1) \
2761 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1))
2762/**
2763 * For defining a C instruction implementation function taking two extra
2764 * arguments.
2765 *
2766 * @param a_Name The name of the function.
2767 * @param a_Type0 The type of the 1st argument
2768 * @param a_Arg0 The name of the 1st argument.
2769 * @param a_Type1 The type of the 2nd argument.
2770 * @param a_Arg1 The name of the 2nd argument.
2771 */
2772# define IEM_CIMPL_DEF_2(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1) \
2773 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1))
2774/**
2775 * Prototype version of IEM_CIMPL_DEF_2.
2776 */
2777# define IEM_CIMPL_PROTO_2(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1) \
2778 IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1))
2779/**
2780 * For calling a C instruction implementation function taking two extra
2781 * arguments.
2782 *
2783 * This special call macro adds default arguments to the call and allow us to
2784 * change these later.
2785 *
2786 * @param a_fn The name of the function.
2787 * @param a0 The name of the 1st argument.
2788 * @param a1 The name of the 2nd argument.
2789 */
2790# define IEM_CIMPL_CALL_2(a_fn, a0, a1) a_fn(pVCpu, cbInstr, (a0), (a1))
2791
2792/**
2793 * For typedef'ing or declaring a C instruction implementation function taking
2794 * three extra arguments.
2795 *
2796 * @param a_Name The name of the type.
2797 * @param a_Type0 The type of the 1st argument
2798 * @param a_Arg0 The name of the 1st argument.
2799 * @param a_Type1 The type of the 2nd argument.
2800 * @param a_Arg1 The name of the 2nd argument.
2801 * @param a_Type2 The type of the 3rd argument.
2802 * @param a_Arg2 The name of the 3rd argument.
2803 */
2804# define IEM_CIMPL_DECL_TYPE_3(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2) \
2805 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2))
2806/**
2807 * For defining a C instruction implementation function taking three extra
2808 * arguments.
2809 *
2810 * @param a_Name The name of the function.
2811 * @param a_Type0 The type of the 1st argument
2812 * @param a_Arg0 The name of the 1st argument.
2813 * @param a_Type1 The type of the 2nd argument.
2814 * @param a_Arg1 The name of the 2nd argument.
2815 * @param a_Type2 The type of the 3rd argument.
2816 * @param a_Arg2 The name of the 3rd argument.
2817 */
2818# define IEM_CIMPL_DEF_3(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2) \
2819 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2))
2820/**
2821 * Prototype version of IEM_CIMPL_DEF_3.
2822 */
2823# define IEM_CIMPL_PROTO_3(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2) \
2824 IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2))
2825/**
2826 * For calling a C instruction implementation function taking three extra
2827 * arguments.
2828 *
2829 * This special call macro adds default arguments to the call and allow us to
2830 * change these later.
2831 *
2832 * @param a_fn The name of the function.
2833 * @param a0 The name of the 1st argument.
2834 * @param a1 The name of the 2nd argument.
2835 * @param a2 The name of the 3rd argument.
2836 */
2837# define IEM_CIMPL_CALL_3(a_fn, a0, a1, a2) a_fn(pVCpu, cbInstr, (a0), (a1), (a2))
2838
2839
2840/**
2841 * For typedef'ing or declaring a C instruction implementation function taking
2842 * four extra arguments.
2843 *
2844 * @param a_Name The name of the type.
2845 * @param a_Type0 The type of the 1st argument
2846 * @param a_Arg0 The name of the 1st argument.
2847 * @param a_Type1 The type of the 2nd argument.
2848 * @param a_Arg1 The name of the 2nd argument.
2849 * @param a_Type2 The type of the 3rd argument.
2850 * @param a_Arg2 The name of the 3rd argument.
2851 * @param a_Type3 The type of the 4th argument.
2852 * @param a_Arg3 The name of the 4th argument.
2853 */
2854# define IEM_CIMPL_DECL_TYPE_4(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2, a_Type3, a_Arg3) \
2855 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2, a_Type3 a_Arg3))
2856/**
2857 * For defining a C instruction implementation function taking four extra
2858 * arguments.
2859 *
2860 * @param a_Name The name of the function.
2861 * @param a_Type0 The type of the 1st argument
2862 * @param a_Arg0 The name of the 1st argument.
2863 * @param a_Type1 The type of the 2nd argument.
2864 * @param a_Arg1 The name of the 2nd argument.
2865 * @param a_Type2 The type of the 3rd argument.
2866 * @param a_Arg2 The name of the 3rd argument.
2867 * @param a_Type3 The type of the 4th argument.
2868 * @param a_Arg3 The name of the 4th argument.
2869 */
2870# define IEM_CIMPL_DEF_4(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2, a_Type3, a_Arg3) \
2871 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, \
2872 a_Type2 a_Arg2, a_Type3 a_Arg3))
2873/**
2874 * Prototype version of IEM_CIMPL_DEF_4.
2875 */
2876# define IEM_CIMPL_PROTO_4(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2, a_Type3, a_Arg3) \
2877 IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, \
2878 a_Type2 a_Arg2, a_Type3 a_Arg3))
2879/**
2880 * For calling a C instruction implementation function taking four extra
2881 * arguments.
2882 *
2883 * This special call macro adds default arguments to the call and allow us to
2884 * change these later.
2885 *
2886 * @param a_fn The name of the function.
2887 * @param a0 The name of the 1st argument.
2888 * @param a1 The name of the 2nd argument.
2889 * @param a2 The name of the 3rd argument.
2890 * @param a3 The name of the 4th argument.
2891 */
2892# define IEM_CIMPL_CALL_4(a_fn, a0, a1, a2, a3) a_fn(pVCpu, cbInstr, (a0), (a1), (a2), (a3))
2893
2894
2895/**
2896 * For typedef'ing or declaring a C instruction implementation function taking
2897 * five extra arguments.
2898 *
2899 * @param a_Name The name of the type.
2900 * @param a_Type0 The type of the 1st argument
2901 * @param a_Arg0 The name of the 1st argument.
2902 * @param a_Type1 The type of the 2nd argument.
2903 * @param a_Arg1 The name of the 2nd argument.
2904 * @param a_Type2 The type of the 3rd argument.
2905 * @param a_Arg2 The name of the 3rd argument.
2906 * @param a_Type3 The type of the 4th argument.
2907 * @param a_Arg3 The name of the 4th argument.
2908 * @param a_Type4 The type of the 5th argument.
2909 * @param a_Arg4 The name of the 5th argument.
2910 */
2911# 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) \
2912 IEM_DECL_IMPL_TYPE(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, \
2913 a_Type0 a_Arg0, a_Type1 a_Arg1, a_Type2 a_Arg2, \
2914 a_Type3 a_Arg3, a_Type4 a_Arg4))
2915/**
2916 * For defining a C instruction implementation function taking five extra
2917 * arguments.
2918 *
2919 * @param a_Name The name of the function.
2920 * @param a_Type0 The type of the 1st argument
2921 * @param a_Arg0 The name of the 1st argument.
2922 * @param a_Type1 The type of the 2nd argument.
2923 * @param a_Arg1 The name of the 2nd argument.
2924 * @param a_Type2 The type of the 3rd argument.
2925 * @param a_Arg2 The name of the 3rd argument.
2926 * @param a_Type3 The type of the 4th argument.
2927 * @param a_Arg3 The name of the 4th argument.
2928 * @param a_Type4 The type of the 5th argument.
2929 * @param a_Arg4 The name of the 5th argument.
2930 */
2931# 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) \
2932 IEM_DECL_IMPL_DEF(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, \
2933 a_Type2 a_Arg2, a_Type3 a_Arg3, a_Type4 a_Arg4))
2934/**
2935 * Prototype version of IEM_CIMPL_DEF_5.
2936 */
2937# define IEM_CIMPL_PROTO_5(a_Name, a_Type0, a_Arg0, a_Type1, a_Arg1, a_Type2, a_Arg2, a_Type3, a_Arg3, a_Type4, a_Arg4) \
2938 IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, a_Name, (PVMCPUCC pVCpu, uint8_t cbInstr, a_Type0 a_Arg0, a_Type1 a_Arg1, \
2939 a_Type2 a_Arg2, a_Type3 a_Arg3, a_Type4 a_Arg4))
2940/**
2941 * For calling a C instruction implementation function taking five extra
2942 * arguments.
2943 *
2944 * This special call macro adds default arguments to the call and allow us to
2945 * change these later.
2946 *
2947 * @param a_fn The name of the function.
2948 * @param a0 The name of the 1st argument.
2949 * @param a1 The name of the 2nd argument.
2950 * @param a2 The name of the 3rd argument.
2951 * @param a3 The name of the 4th argument.
2952 * @param a4 The name of the 5th argument.
2953 */
2954# define IEM_CIMPL_CALL_5(a_fn, a0, a1, a2, a3, a4) a_fn(pVCpu, cbInstr, (a0), (a1), (a2), (a3), (a4))
2955
2956/** @} */
2957
2958
2959/** @name Opcode Decoder Function Types.
2960 * @{ */
2961
2962/** @typedef PFNIEMOP
2963 * Pointer to an opcode decoder function.
2964 */
2965
2966/** @def FNIEMOP_DEF
2967 * Define an opcode decoder function.
2968 *
2969 * We're using macors for this so that adding and removing parameters as well as
2970 * tweaking compiler specific attributes becomes easier. See FNIEMOP_CALL
2971 *
2972 * @param a_Name The function name.
2973 */
2974
2975/** @typedef PFNIEMOPRM
2976 * Pointer to an opcode decoder function with RM byte.
2977 */
2978
2979/** @def FNIEMOPRM_DEF
2980 * Define an opcode decoder function with RM byte.
2981 *
2982 * We're using macors for this so that adding and removing parameters as well as
2983 * tweaking compiler specific attributes becomes easier. See FNIEMOP_CALL_1
2984 *
2985 * @param a_Name The function name.
2986 */
2987
2988#if defined(__GNUC__) && defined(RT_ARCH_X86)
2989typedef VBOXSTRICTRC (__attribute__((__fastcall__)) * PFNIEMOP)(PVMCPUCC pVCpu);
2990typedef VBOXSTRICTRC (__attribute__((__fastcall__)) * PFNIEMOPRM)(PVMCPUCC pVCpu, uint8_t bRm);
2991# define FNIEMOP_DEF(a_Name) \
2992 IEM_STATIC VBOXSTRICTRC __attribute__((__fastcall__, __nothrow__)) a_Name(PVMCPUCC pVCpu)
2993# define FNIEMOP_DEF_1(a_Name, a_Type0, a_Name0) \
2994 IEM_STATIC VBOXSTRICTRC __attribute__((__fastcall__, __nothrow__)) a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0)
2995# define FNIEMOP_DEF_2(a_Name, a_Type0, a_Name0, a_Type1, a_Name1) \
2996 IEM_STATIC VBOXSTRICTRC __attribute__((__fastcall__, __nothrow__)) a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0, a_Type1 a_Name1)
2997
2998#elif defined(_MSC_VER) && defined(RT_ARCH_X86)
2999typedef VBOXSTRICTRC (__fastcall * PFNIEMOP)(PVMCPUCC pVCpu);
3000typedef VBOXSTRICTRC (__fastcall * PFNIEMOPRM)(PVMCPUCC pVCpu, uint8_t bRm);
3001# define FNIEMOP_DEF(a_Name) \
3002 IEM_STATIC /*__declspec(naked)*/ VBOXSTRICTRC __fastcall a_Name(PVMCPUCC pVCpu) RT_NO_THROW_DEF
3003# define FNIEMOP_DEF_1(a_Name, a_Type0, a_Name0) \
3004 IEM_STATIC /*__declspec(naked)*/ VBOXSTRICTRC __fastcall a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0) RT_NO_THROW_DEF
3005# define FNIEMOP_DEF_2(a_Name, a_Type0, a_Name0, a_Type1, a_Name1) \
3006 IEM_STATIC /*__declspec(naked)*/ VBOXSTRICTRC __fastcall a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0, a_Type1 a_Name1) RT_NO_THROW_DEF
3007
3008#elif defined(__GNUC__)
3009typedef VBOXSTRICTRC (* PFNIEMOP)(PVMCPUCC pVCpu);
3010typedef VBOXSTRICTRC (* PFNIEMOPRM)(PVMCPUCC pVCpu, uint8_t bRm);
3011# define FNIEMOP_DEF(a_Name) \
3012 IEM_STATIC VBOXSTRICTRC __attribute__((__nothrow__)) a_Name(PVMCPUCC pVCpu)
3013# define FNIEMOP_DEF_1(a_Name, a_Type0, a_Name0) \
3014 IEM_STATIC VBOXSTRICTRC __attribute__((__nothrow__)) a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0)
3015# define FNIEMOP_DEF_2(a_Name, a_Type0, a_Name0, a_Type1, a_Name1) \
3016 IEM_STATIC VBOXSTRICTRC __attribute__((__nothrow__)) a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0, a_Type1 a_Name1)
3017
3018#else
3019typedef VBOXSTRICTRC (* PFNIEMOP)(PVMCPUCC pVCpu);
3020typedef VBOXSTRICTRC (* PFNIEMOPRM)(PVMCPUCC pVCpu, uint8_t bRm);
3021# define FNIEMOP_DEF(a_Name) \
3022 IEM_STATIC VBOXSTRICTRC a_Name(PVMCPUCC pVCpu) RT_NO_THROW_DEF
3023# define FNIEMOP_DEF_1(a_Name, a_Type0, a_Name0) \
3024 IEM_STATIC VBOXSTRICTRC a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0) RT_NO_THROW_DEF
3025# define FNIEMOP_DEF_2(a_Name, a_Type0, a_Name0, a_Type1, a_Name1) \
3026 IEM_STATIC VBOXSTRICTRC a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0, a_Type1 a_Name1) RT_NO_THROW_DEF
3027
3028#endif
3029#define FNIEMOPRM_DEF(a_Name) FNIEMOP_DEF_1(a_Name, uint8_t, bRm)
3030
3031/**
3032 * Call an opcode decoder function.
3033 *
3034 * We're using macors for this so that adding and removing parameters can be
3035 * done as we please. See FNIEMOP_DEF.
3036 */
3037#define FNIEMOP_CALL(a_pfn) (a_pfn)(pVCpu)
3038
3039/**
3040 * Call a common opcode decoder function taking one extra argument.
3041 *
3042 * We're using macors for this so that adding and removing parameters can be
3043 * done as we please. See FNIEMOP_DEF_1.
3044 */
3045#define FNIEMOP_CALL_1(a_pfn, a0) (a_pfn)(pVCpu, a0)
3046
3047/**
3048 * Call a common opcode decoder function taking one extra argument.
3049 *
3050 * We're using macors for this so that adding and removing parameters can be
3051 * done as we please. See FNIEMOP_DEF_1.
3052 */
3053#define FNIEMOP_CALL_2(a_pfn, a0, a1) (a_pfn)(pVCpu, a0, a1)
3054/** @} */
3055
3056
3057/** @name Misc Helpers
3058 * @{ */
3059
3060/** Used to shut up GCC warnings about variables that 'may be used uninitialized'
3061 * due to GCC lacking knowledge about the value range of a switch. */
3062#define IEM_NOT_REACHED_DEFAULT_CASE_RET() default: AssertFailedReturn(VERR_IPE_NOT_REACHED_DEFAULT_CASE)
3063
3064/** Variant of IEM_NOT_REACHED_DEFAULT_CASE_RET that returns a custom value. */
3065#define IEM_NOT_REACHED_DEFAULT_CASE_RET2(a_RetValue) default: AssertFailedReturn(a_RetValue)
3066
3067/**
3068 * Returns IEM_RETURN_ASPECT_NOT_IMPLEMENTED, and in debug builds logs the
3069 * occation.
3070 */
3071#ifdef LOG_ENABLED
3072# define IEM_RETURN_ASPECT_NOT_IMPLEMENTED() \
3073 do { \
3074 /*Log*/ LogAlways(("%s: returning IEM_RETURN_ASPECT_NOT_IMPLEMENTED (line %d)\n", __FUNCTION__, __LINE__)); \
3075 return VERR_IEM_ASPECT_NOT_IMPLEMENTED; \
3076 } while (0)
3077#else
3078# define IEM_RETURN_ASPECT_NOT_IMPLEMENTED() \
3079 return VERR_IEM_ASPECT_NOT_IMPLEMENTED
3080#endif
3081
3082/**
3083 * Returns IEM_RETURN_ASPECT_NOT_IMPLEMENTED, and in debug builds logs the
3084 * occation using the supplied logger statement.
3085 *
3086 * @param a_LoggerArgs What to log on failure.
3087 */
3088#ifdef LOG_ENABLED
3089# define IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(a_LoggerArgs) \
3090 do { \
3091 LogAlways((LOG_FN_FMT ": ", __PRETTY_FUNCTION__)); LogAlways(a_LoggerArgs); \
3092 /*LogFunc(a_LoggerArgs);*/ \
3093 return VERR_IEM_ASPECT_NOT_IMPLEMENTED; \
3094 } while (0)
3095#else
3096# define IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(a_LoggerArgs) \
3097 return VERR_IEM_ASPECT_NOT_IMPLEMENTED
3098#endif
3099
3100/**
3101 * Check if we're currently executing in real or virtual 8086 mode.
3102 *
3103 * @returns @c true if it is, @c false if not.
3104 * @param a_pVCpu The IEM state of the current CPU.
3105 */
3106#define IEM_IS_REAL_OR_V86_MODE(a_pVCpu) (CPUMIsGuestInRealOrV86ModeEx(IEM_GET_CTX(a_pVCpu)))
3107
3108/**
3109 * Check if we're currently executing in virtual 8086 mode.
3110 *
3111 * @returns @c true if it is, @c false if not.
3112 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
3113 */
3114#define IEM_IS_V86_MODE(a_pVCpu) (CPUMIsGuestInV86ModeEx(IEM_GET_CTX(a_pVCpu)))
3115
3116/**
3117 * Check if we're currently executing in long mode.
3118 *
3119 * @returns @c true if it is, @c false if not.
3120 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
3121 */
3122#define IEM_IS_LONG_MODE(a_pVCpu) (CPUMIsGuestInLongModeEx(IEM_GET_CTX(a_pVCpu)))
3123
3124/**
3125 * Check if we're currently executing in a 64-bit code segment.
3126 *
3127 * @returns @c true if it is, @c false if not.
3128 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
3129 */
3130#define IEM_IS_64BIT_CODE(a_pVCpu) (CPUMIsGuestIn64BitCodeEx(IEM_GET_CTX(a_pVCpu)))
3131
3132/**
3133 * Check if we're currently executing in real mode.
3134 *
3135 * @returns @c true if it is, @c false if not.
3136 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
3137 */
3138#define IEM_IS_REAL_MODE(a_pVCpu) (CPUMIsGuestInRealModeEx(IEM_GET_CTX(a_pVCpu)))
3139
3140/**
3141 * Returns a (const) pointer to the CPUMFEATURES for the guest CPU.
3142 * @returns PCCPUMFEATURES
3143 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
3144 */
3145#define IEM_GET_GUEST_CPU_FEATURES(a_pVCpu) (&((a_pVCpu)->CTX_SUFF(pVM)->cpum.ro.GuestFeatures))
3146
3147/**
3148 * Returns a (const) pointer to the CPUMFEATURES for the host CPU.
3149 * @returns PCCPUMFEATURES
3150 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
3151 */
3152#define IEM_GET_HOST_CPU_FEATURES(a_pVCpu) (&g_CpumHostFeatures.s)
3153
3154/**
3155 * Evaluates to true if we're presenting an Intel CPU to the guest.
3156 */
3157#define IEM_IS_GUEST_CPU_INTEL(a_pVCpu) ( (a_pVCpu)->iem.s.enmCpuVendor == CPUMCPUVENDOR_INTEL )
3158
3159/**
3160 * Evaluates to true if we're presenting an AMD CPU to the guest.
3161 */
3162#define IEM_IS_GUEST_CPU_AMD(a_pVCpu) ( (a_pVCpu)->iem.s.enmCpuVendor == CPUMCPUVENDOR_AMD || (a_pVCpu)->iem.s.enmCpuVendor == CPUMCPUVENDOR_HYGON )
3163
3164/**
3165 * Check if the address is canonical.
3166 */
3167#define IEM_IS_CANONICAL(a_u64Addr) X86_IS_CANONICAL(a_u64Addr)
3168
3169/** Checks if the ModR/M byte is in register mode or not. */
3170#define IEM_IS_MODRM_REG_MODE(a_bRm) ( ((a_bRm) & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT) )
3171/** Checks if the ModR/M byte is in memory mode or not. */
3172#define IEM_IS_MODRM_MEM_MODE(a_bRm) ( ((a_bRm) & X86_MODRM_MOD_MASK) != (3 << X86_MODRM_MOD_SHIFT) )
3173
3174/**
3175 * Gets the register (reg) part of a ModR/M encoding, with REX.R added in.
3176 *
3177 * For use during decoding.
3178 */
3179#define IEM_GET_MODRM_REG(a_pVCpu, a_bRm) ( (((a_bRm) >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | (a_pVCpu)->iem.s.uRexReg )
3180/**
3181 * Gets the r/m part of a ModR/M encoding as a register index, with REX.B added in.
3182 *
3183 * For use during decoding.
3184 */
3185#define IEM_GET_MODRM_RM(a_pVCpu, a_bRm) ( ((a_bRm) & X86_MODRM_RM_MASK) | (a_pVCpu)->iem.s.uRexB )
3186
3187/**
3188 * Gets the register (reg) part of a ModR/M encoding, without REX.R.
3189 *
3190 * For use during decoding.
3191 */
3192#define IEM_GET_MODRM_REG_8(a_bRm) ( (((a_bRm) >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) )
3193/**
3194 * Gets the r/m part of a ModR/M encoding as a register index, without REX.B.
3195 *
3196 * For use during decoding.
3197 */
3198#define IEM_GET_MODRM_RM_8(a_bRm) ( ((a_bRm) & X86_MODRM_RM_MASK) )
3199
3200/**
3201 * Gets the effective VEX.VVVV value.
3202 *
3203 * The 4th bit is ignored if not 64-bit code.
3204 * @returns effective V-register value.
3205 * @param a_pVCpu The cross context virtual CPU structure of the calling thread.
3206 */
3207#define IEM_GET_EFFECTIVE_VVVV(a_pVCpu) \
3208 ((a_pVCpu)->iem.s.enmCpuMode == IEMMODE_64BIT ? (a_pVCpu)->iem.s.uVex3rdReg : (a_pVCpu)->iem.s.uVex3rdReg & 7)
3209
3210
3211#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
3212
3213/**
3214 * Check if the guest has entered VMX root operation.
3215 */
3216# define IEM_VMX_IS_ROOT_MODE(a_pVCpu) (CPUMIsGuestInVmxRootMode(IEM_GET_CTX(a_pVCpu)))
3217
3218/**
3219 * Check if the guest has entered VMX non-root operation.
3220 */
3221# define IEM_VMX_IS_NON_ROOT_MODE(a_pVCpu) (CPUMIsGuestInVmxNonRootMode(IEM_GET_CTX(a_pVCpu)))
3222
3223/**
3224 * Check if the nested-guest has the given Pin-based VM-execution control set.
3225 */
3226# define IEM_VMX_IS_PINCTLS_SET(a_pVCpu, a_PinCtl) \
3227 (CPUMIsGuestVmxPinCtlsSet(IEM_GET_CTX(a_pVCpu), (a_PinCtl)))
3228
3229/**
3230 * Check if the nested-guest has the given Processor-based VM-execution control set.
3231 */
3232# define IEM_VMX_IS_PROCCTLS_SET(a_pVCpu, a_ProcCtl) \
3233 (CPUMIsGuestVmxProcCtlsSet(IEM_GET_CTX(a_pVCpu), (a_ProcCtl)))
3234
3235/**
3236 * Check if the nested-guest has the given Secondary Processor-based VM-execution
3237 * control set.
3238 */
3239# define IEM_VMX_IS_PROCCTLS2_SET(a_pVCpu, a_ProcCtl2) \
3240 (CPUMIsGuestVmxProcCtls2Set(IEM_GET_CTX(a_pVCpu), (a_ProcCtl2)))
3241
3242/** Gets the guest-physical address of the shadows VMCS for the given VCPU. */
3243# define IEM_VMX_GET_SHADOW_VMCS(a_pVCpu) ((a_pVCpu)->cpum.GstCtx.hwvirt.vmx.GCPhysShadowVmcs)
3244
3245/** Whether a shadow VMCS is present for the given VCPU. */
3246# define IEM_VMX_HAS_SHADOW_VMCS(a_pVCpu) RT_BOOL(IEM_VMX_GET_SHADOW_VMCS(a_pVCpu) != NIL_RTGCPHYS)
3247
3248/** Gets the VMXON region pointer. */
3249# define IEM_VMX_GET_VMXON_PTR(a_pVCpu) ((a_pVCpu)->cpum.GstCtx.hwvirt.vmx.GCPhysVmxon)
3250
3251/** Gets the guest-physical address of the current VMCS for the given VCPU. */
3252# define IEM_VMX_GET_CURRENT_VMCS(a_pVCpu) ((a_pVCpu)->cpum.GstCtx.hwvirt.vmx.GCPhysVmcs)
3253
3254/** Whether a current VMCS is present for the given VCPU. */
3255# define IEM_VMX_HAS_CURRENT_VMCS(a_pVCpu) RT_BOOL(IEM_VMX_GET_CURRENT_VMCS(a_pVCpu) != NIL_RTGCPHYS)
3256
3257/** Assigns the guest-physical address of the current VMCS for the given VCPU. */
3258# define IEM_VMX_SET_CURRENT_VMCS(a_pVCpu, a_GCPhysVmcs) \
3259 do \
3260 { \
3261 Assert((a_GCPhysVmcs) != NIL_RTGCPHYS); \
3262 (a_pVCpu)->cpum.GstCtx.hwvirt.vmx.GCPhysVmcs = (a_GCPhysVmcs); \
3263 } while (0)
3264
3265/** Clears any current VMCS for the given VCPU. */
3266# define IEM_VMX_CLEAR_CURRENT_VMCS(a_pVCpu) \
3267 do \
3268 { \
3269 (a_pVCpu)->cpum.GstCtx.hwvirt.vmx.GCPhysVmcs = NIL_RTGCPHYS; \
3270 } while (0)
3271
3272/**
3273 * Invokes the VMX VM-exit handler for an instruction intercept.
3274 */
3275# define IEM_VMX_VMEXIT_INSTR_RET(a_pVCpu, a_uExitReason, a_cbInstr) \
3276 do { return iemVmxVmexitInstr((a_pVCpu), (a_uExitReason), (a_cbInstr)); } while (0)
3277
3278/**
3279 * Invokes the VMX VM-exit handler for an instruction intercept where the
3280 * instruction provides additional VM-exit information.
3281 */
3282# define IEM_VMX_VMEXIT_INSTR_NEEDS_INFO_RET(a_pVCpu, a_uExitReason, a_uInstrId, a_cbInstr) \
3283 do { return iemVmxVmexitInstrNeedsInfo((a_pVCpu), (a_uExitReason), (a_uInstrId), (a_cbInstr)); } while (0)
3284
3285/**
3286 * Invokes the VMX VM-exit handler for a task switch.
3287 */
3288# define IEM_VMX_VMEXIT_TASK_SWITCH_RET(a_pVCpu, a_enmTaskSwitch, a_SelNewTss, a_cbInstr) \
3289 do { return iemVmxVmexitTaskSwitch((a_pVCpu), (a_enmTaskSwitch), (a_SelNewTss), (a_cbInstr)); } while (0)
3290
3291/**
3292 * Invokes the VMX VM-exit handler for MWAIT.
3293 */
3294# define IEM_VMX_VMEXIT_MWAIT_RET(a_pVCpu, a_fMonitorArmed, a_cbInstr) \
3295 do { return iemVmxVmexitInstrMwait((a_pVCpu), (a_fMonitorArmed), (a_cbInstr)); } while (0)
3296
3297/**
3298 * Invokes the VMX VM-exit handler for EPT faults.
3299 */
3300# define IEM_VMX_VMEXIT_EPT_RET(a_pVCpu, a_pPtWalk, a_fAccess, a_fSlatFail, a_cbInstr) \
3301 do { return iemVmxVmexitEpt(a_pVCpu, a_pPtWalk, a_fAccess, a_fSlatFail, a_cbInstr); } while (0)
3302
3303/**
3304 * Invokes the VMX VM-exit handler.
3305 */
3306# define IEM_VMX_VMEXIT_TRIPLE_FAULT_RET(a_pVCpu, a_uExitReason, a_uExitQual) \
3307 do { return iemVmxVmexit((a_pVCpu), (a_uExitReason), (a_uExitQual)); } while (0)
3308
3309#else
3310# define IEM_VMX_IS_ROOT_MODE(a_pVCpu) (false)
3311# define IEM_VMX_IS_NON_ROOT_MODE(a_pVCpu) (false)
3312# define IEM_VMX_IS_PINCTLS_SET(a_pVCpu, a_cbInstr) (false)
3313# define IEM_VMX_IS_PROCCTLS_SET(a_pVCpu, a_cbInstr) (false)
3314# define IEM_VMX_IS_PROCCTLS2_SET(a_pVCpu, a_cbInstr) (false)
3315# define IEM_VMX_VMEXIT_INSTR_RET(a_pVCpu, a_uExitReason, a_cbInstr) do { return VERR_VMX_IPE_1; } while (0)
3316# define IEM_VMX_VMEXIT_INSTR_NEEDS_INFO_RET(a_pVCpu, a_uExitReason, a_uInstrId, a_cbInstr) do { return VERR_VMX_IPE_1; } while (0)
3317# define IEM_VMX_VMEXIT_TASK_SWITCH_RET(a_pVCpu, a_enmTaskSwitch, a_SelNewTss, a_cbInstr) do { return VERR_VMX_IPE_1; } while (0)
3318# define IEM_VMX_VMEXIT_MWAIT_RET(a_pVCpu, a_fMonitorArmed, a_cbInstr) do { return VERR_VMX_IPE_1; } while (0)
3319# define IEM_VMX_VMEXIT_EPT_RET(a_pVCpu, a_pPtWalk, a_fAccess, a_fSlatFail, a_cbInstr) do { return VERR_VMX_IPE_1; } while (0)
3320# define IEM_VMX_VMEXIT_TRIPLE_FAULT_RET(a_pVCpu, a_uExitReason, a_uExitQual) do { return VERR_VMX_IPE_1; } while (0)
3321
3322#endif
3323
3324#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
3325/**
3326 * Check if an SVM control/instruction intercept is set.
3327 */
3328# define IEM_SVM_IS_CTRL_INTERCEPT_SET(a_pVCpu, a_Intercept) \
3329 (CPUMIsGuestSvmCtrlInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_Intercept)))
3330
3331/**
3332 * Check if an SVM read CRx intercept is set.
3333 */
3334# define IEM_SVM_IS_READ_CR_INTERCEPT_SET(a_pVCpu, a_uCr) \
3335 (CPUMIsGuestSvmReadCRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uCr)))
3336
3337/**
3338 * Check if an SVM write CRx intercept is set.
3339 */
3340# define IEM_SVM_IS_WRITE_CR_INTERCEPT_SET(a_pVCpu, a_uCr) \
3341 (CPUMIsGuestSvmWriteCRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uCr)))
3342
3343/**
3344 * Check if an SVM read DRx intercept is set.
3345 */
3346# define IEM_SVM_IS_READ_DR_INTERCEPT_SET(a_pVCpu, a_uDr) \
3347 (CPUMIsGuestSvmReadDRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uDr)))
3348
3349/**
3350 * Check if an SVM write DRx intercept is set.
3351 */
3352# define IEM_SVM_IS_WRITE_DR_INTERCEPT_SET(a_pVCpu, a_uDr) \
3353 (CPUMIsGuestSvmWriteDRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uDr)))
3354
3355/**
3356 * Check if an SVM exception intercept is set.
3357 */
3358# define IEM_SVM_IS_XCPT_INTERCEPT_SET(a_pVCpu, a_uVector) \
3359 (CPUMIsGuestSvmXcptInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uVector)))
3360
3361/**
3362 * Invokes the SVM \#VMEXIT handler for the nested-guest.
3363 */
3364# define IEM_SVM_VMEXIT_RET(a_pVCpu, a_uExitCode, a_uExitInfo1, a_uExitInfo2) \
3365 do { return iemSvmVmexit((a_pVCpu), (a_uExitCode), (a_uExitInfo1), (a_uExitInfo2)); } while (0)
3366
3367/**
3368 * Invokes the 'MOV CRx' SVM \#VMEXIT handler after constructing the
3369 * corresponding decode assist information.
3370 */
3371# define IEM_SVM_CRX_VMEXIT_RET(a_pVCpu, a_uExitCode, a_enmAccessCrX, a_iGReg) \
3372 do \
3373 { \
3374 uint64_t uExitInfo1; \
3375 if ( IEM_GET_GUEST_CPU_FEATURES(a_pVCpu)->fSvmDecodeAssists \
3376 && (a_enmAccessCrX) == IEMACCESSCRX_MOV_CRX) \
3377 uExitInfo1 = SVM_EXIT1_MOV_CRX_MASK | ((a_iGReg) & 7); \
3378 else \
3379 uExitInfo1 = 0; \
3380 IEM_SVM_VMEXIT_RET(a_pVCpu, a_uExitCode, uExitInfo1, 0); \
3381 } while (0)
3382
3383/** Check and handles SVM nested-guest instruction intercept and updates
3384 * NRIP if needed.
3385 */
3386# define IEM_SVM_CHECK_INSTR_INTERCEPT(a_pVCpu, a_Intercept, a_uExitCode, a_uExitInfo1, a_uExitInfo2) \
3387 do \
3388 { \
3389 if (IEM_SVM_IS_CTRL_INTERCEPT_SET(a_pVCpu, a_Intercept)) \
3390 { \
3391 IEM_SVM_UPDATE_NRIP(a_pVCpu); \
3392 IEM_SVM_VMEXIT_RET(a_pVCpu, a_uExitCode, a_uExitInfo1, a_uExitInfo2); \
3393 } \
3394 } while (0)
3395
3396/** Checks and handles SVM nested-guest CR0 read intercept. */
3397# define IEM_SVM_CHECK_READ_CR0_INTERCEPT(a_pVCpu, a_uExitInfo1, a_uExitInfo2) \
3398 do \
3399 { \
3400 if (!IEM_SVM_IS_READ_CR_INTERCEPT_SET(a_pVCpu, 0)) \
3401 { /* probably likely */ } \
3402 else \
3403 { \
3404 IEM_SVM_UPDATE_NRIP(a_pVCpu); \
3405 IEM_SVM_VMEXIT_RET(a_pVCpu, SVM_EXIT_READ_CR0, a_uExitInfo1, a_uExitInfo2); \
3406 } \
3407 } while (0)
3408
3409/**
3410 * Updates the NextRIP (NRI) field in the nested-guest VMCB.
3411 */
3412# define IEM_SVM_UPDATE_NRIP(a_pVCpu) \
3413 do { \
3414 if (IEM_GET_GUEST_CPU_FEATURES(a_pVCpu)->fSvmNextRipSave) \
3415 CPUMGuestSvmUpdateNRip(a_pVCpu, IEM_GET_CTX(a_pVCpu), IEM_GET_INSTR_LEN(a_pVCpu)); \
3416 } while (0)
3417
3418#else
3419# define IEM_SVM_IS_CTRL_INTERCEPT_SET(a_pVCpu, a_Intercept) (false)
3420# define IEM_SVM_IS_READ_CR_INTERCEPT_SET(a_pVCpu, a_uCr) (false)
3421# define IEM_SVM_IS_WRITE_CR_INTERCEPT_SET(a_pVCpu, a_uCr) (false)
3422# define IEM_SVM_IS_READ_DR_INTERCEPT_SET(a_pVCpu, a_uDr) (false)
3423# define IEM_SVM_IS_WRITE_DR_INTERCEPT_SET(a_pVCpu, a_uDr) (false)
3424# define IEM_SVM_IS_XCPT_INTERCEPT_SET(a_pVCpu, a_uVector) (false)
3425# define IEM_SVM_VMEXIT_RET(a_pVCpu, a_uExitCode, a_uExitInfo1, a_uExitInfo2) do { return VERR_SVM_IPE_1; } while (0)
3426# define IEM_SVM_CRX_VMEXIT_RET(a_pVCpu, a_uExitCode, a_enmAccessCrX, a_iGReg) do { return VERR_SVM_IPE_1; } while (0)
3427# define IEM_SVM_CHECK_INSTR_INTERCEPT(a_pVCpu, a_Intercept, a_uExitCode, a_uExitInfo1, a_uExitInfo2) do { } while (0)
3428# define IEM_SVM_CHECK_READ_CR0_INTERCEPT(a_pVCpu, a_uExitInfo1, a_uExitInfo2) do { } while (0)
3429# define IEM_SVM_UPDATE_NRIP(a_pVCpu) do { } while (0)
3430
3431#endif
3432
3433/** @} */
3434
3435
3436
3437/**
3438 * Selector descriptor table entry as fetched by iemMemFetchSelDesc.
3439 */
3440typedef union IEMSELDESC
3441{
3442 /** The legacy view. */
3443 X86DESC Legacy;
3444 /** The long mode view. */
3445 X86DESC64 Long;
3446} IEMSELDESC;
3447/** Pointer to a selector descriptor table entry. */
3448typedef IEMSELDESC *PIEMSELDESC;
3449
3450/** @name Raising Exceptions.
3451 * @{ */
3452VBOXSTRICTRC iemTaskSwitch(PVMCPUCC pVCpu, IEMTASKSWITCH enmTaskSwitch, uint32_t uNextEip, uint32_t fFlags,
3453 uint16_t uErr, uint64_t uCr2, RTSEL SelTSS, PIEMSELDESC pNewDescTSS) RT_NOEXCEPT;
3454
3455VBOXSTRICTRC iemRaiseXcptOrInt(PVMCPUCC pVCpu, uint8_t cbInstr, uint8_t u8Vector, uint32_t fFlags,
3456 uint16_t uErr, uint64_t uCr2) RT_NOEXCEPT;
3457#ifdef IEM_WITH_SETJMP
3458DECL_NO_RETURN(void) iemRaiseXcptOrIntJmp(PVMCPUCC pVCpu, uint8_t cbInstr, uint8_t u8Vector,
3459 uint32_t fFlags, uint16_t uErr, uint64_t uCr2) RT_NOEXCEPT;
3460#endif
3461VBOXSTRICTRC iemRaiseDivideError(PVMCPUCC pVCpu) RT_NOEXCEPT;
3462VBOXSTRICTRC iemRaiseDebugException(PVMCPUCC pVCpu) RT_NOEXCEPT;
3463VBOXSTRICTRC iemRaiseBoundRangeExceeded(PVMCPUCC pVCpu) RT_NOEXCEPT;
3464VBOXSTRICTRC iemRaiseUndefinedOpcode(PVMCPUCC pVCpu) RT_NOEXCEPT;
3465VBOXSTRICTRC iemRaiseDeviceNotAvailable(PVMCPUCC pVCpu) RT_NOEXCEPT;
3466VBOXSTRICTRC iemRaiseTaskSwitchFaultWithErr(PVMCPUCC pVCpu, uint16_t uErr) RT_NOEXCEPT;
3467VBOXSTRICTRC iemRaiseTaskSwitchFaultCurrentTSS(PVMCPUCC pVCpu) RT_NOEXCEPT;
3468VBOXSTRICTRC iemRaiseTaskSwitchFault0(PVMCPUCC pVCpu) RT_NOEXCEPT;
3469VBOXSTRICTRC iemRaiseTaskSwitchFaultBySelector(PVMCPUCC pVCpu, uint16_t uSel) RT_NOEXCEPT;
3470/*VBOXSTRICTRC iemRaiseSelectorNotPresent(PVMCPUCC pVCpu, uint32_t iSegReg, uint32_t fAccess) RT_NOEXCEPT;*/
3471VBOXSTRICTRC iemRaiseSelectorNotPresentWithErr(PVMCPUCC pVCpu, uint16_t uErr) RT_NOEXCEPT;
3472VBOXSTRICTRC iemRaiseSelectorNotPresentBySelector(PVMCPUCC pVCpu, uint16_t uSel) RT_NOEXCEPT;
3473VBOXSTRICTRC iemRaiseStackSelectorNotPresentBySelector(PVMCPUCC pVCpu, uint16_t uSel) RT_NOEXCEPT;
3474VBOXSTRICTRC iemRaiseStackSelectorNotPresentWithErr(PVMCPUCC pVCpu, uint16_t uErr) RT_NOEXCEPT;
3475VBOXSTRICTRC iemRaiseGeneralProtectionFault(PVMCPUCC pVCpu, uint16_t uErr) RT_NOEXCEPT;
3476VBOXSTRICTRC iemRaiseGeneralProtectionFault0(PVMCPUCC pVCpu) RT_NOEXCEPT;
3477#ifdef IEM_WITH_SETJMP
3478DECL_NO_RETURN(void) iemRaiseGeneralProtectionFault0Jmp(PVMCPUCC pVCpu) RT_NOEXCEPT;
3479#endif
3480VBOXSTRICTRC iemRaiseGeneralProtectionFaultBySelector(PVMCPUCC pVCpu, RTSEL Sel) RT_NOEXCEPT;
3481VBOXSTRICTRC iemRaiseNotCanonical(PVMCPUCC pVCpu) RT_NOEXCEPT;
3482VBOXSTRICTRC iemRaiseSelectorBounds(PVMCPUCC pVCpu, uint32_t iSegReg, uint32_t fAccess) RT_NOEXCEPT;
3483#ifdef IEM_WITH_SETJMP
3484DECL_NO_RETURN(void) iemRaiseSelectorBoundsJmp(PVMCPUCC pVCpu, uint32_t iSegReg, uint32_t fAccess) RT_NOEXCEPT;
3485#endif
3486VBOXSTRICTRC iemRaiseSelectorBoundsBySelector(PVMCPUCC pVCpu, RTSEL Sel) RT_NOEXCEPT;
3487#ifdef IEM_WITH_SETJMP
3488DECL_NO_RETURN(void) iemRaiseSelectorBoundsBySelectorJmp(PVMCPUCC pVCpu, RTSEL Sel) RT_NOEXCEPT;
3489#endif
3490VBOXSTRICTRC iemRaiseSelectorInvalidAccess(PVMCPUCC pVCpu, uint32_t iSegReg, uint32_t fAccess) RT_NOEXCEPT;
3491#ifdef IEM_WITH_SETJMP
3492DECL_NO_RETURN(void) iemRaiseSelectorInvalidAccessJmp(PVMCPUCC pVCpu, uint32_t iSegReg, uint32_t fAccess) RT_NOEXCEPT;
3493#endif
3494VBOXSTRICTRC iemRaisePageFault(PVMCPUCC pVCpu, RTGCPTR GCPtrWhere, uint32_t fAccess, int rc) RT_NOEXCEPT;
3495#ifdef IEM_WITH_SETJMP
3496DECL_NO_RETURN(void) iemRaisePageFaultJmp(PVMCPUCC pVCpu, RTGCPTR GCPtrWhere, uint32_t fAccess, int rc) RT_NOEXCEPT;
3497#endif
3498VBOXSTRICTRC iemRaiseMathFault(PVMCPUCC pVCpu);
3499VBOXSTRICTRC iemRaiseAlignmentCheckException(PVMCPUCC pVCpu);
3500#ifdef IEM_WITH_SETJMP
3501DECL_NO_RETURN(void) iemRaiseAlignmentCheckExceptionJmp(PVMCPUCC pVCpu) RT_NOEXCEPT;
3502#endif
3503VBOXSTRICTRC iemRaiseSimdFpException(PVMCPUCC pVCpu) RT_NOEXCEPT;
3504
3505IEM_CIMPL_DEF_0(iemCImplRaiseDivideError);
3506IEM_CIMPL_DEF_0(iemCImplRaiseInvalidLockPrefix);
3507IEM_CIMPL_DEF_0(iemCImplRaiseInvalidOpcode);
3508
3509/**
3510 * Macro for calling iemCImplRaiseDivideError().
3511 *
3512 * This enables us to add/remove arguments and force different levels of
3513 * inlining as we wish.
3514 *
3515 * @return Strict VBox status code.
3516 */
3517#define IEMOP_RAISE_DIVIDE_ERROR() IEM_MC_DEFER_TO_CIMPL_0(iemCImplRaiseDivideError)
3518
3519/**
3520 * Macro for calling iemCImplRaiseInvalidLockPrefix().
3521 *
3522 * This enables us to add/remove arguments and force different levels of
3523 * inlining as we wish.
3524 *
3525 * @return Strict VBox status code.
3526 */
3527#define IEMOP_RAISE_INVALID_LOCK_PREFIX() IEM_MC_DEFER_TO_CIMPL_0(iemCImplRaiseInvalidLockPrefix)
3528
3529/**
3530 * Macro for calling iemCImplRaiseInvalidOpcode().
3531 *
3532 * This enables us to add/remove arguments and force different levels of
3533 * inlining as we wish.
3534 *
3535 * @return Strict VBox status code.
3536 */
3537#define IEMOP_RAISE_INVALID_OPCODE() IEM_MC_DEFER_TO_CIMPL_0(iemCImplRaiseInvalidOpcode)
3538/** @} */
3539
3540/** @name Register Access.
3541 * @{ */
3542VBOXSTRICTRC iemRegRipRelativeJumpS8(PVMCPUCC pVCpu, int8_t offNextInstr) RT_NOEXCEPT;
3543VBOXSTRICTRC iemRegRipRelativeJumpS16(PVMCPUCC pVCpu, int16_t offNextInstr) RT_NOEXCEPT;
3544VBOXSTRICTRC iemRegRipRelativeJumpS32(PVMCPUCC pVCpu, int32_t offNextInstr) RT_NOEXCEPT;
3545VBOXSTRICTRC iemRegRipJump(PVMCPUCC pVCpu, uint64_t uNewRip) RT_NOEXCEPT;
3546/** @} */
3547
3548/** @name FPU access and helpers.
3549 * @{ */
3550void iemFpuPushResult(PVMCPUCC pVCpu, PIEMFPURESULT pResult) RT_NOEXCEPT;
3551void iemFpuPushResultWithMemOp(PVMCPUCC pVCpu, PIEMFPURESULT pResult, uint8_t iEffSeg, RTGCPTR GCPtrEff) RT_NOEXCEPT;
3552void iemFpuPushResultTwo(PVMCPUCC pVCpu, PIEMFPURESULTTWO pResult) RT_NOEXCEPT;
3553void iemFpuStoreResult(PVMCPUCC pVCpu, PIEMFPURESULT pResult, uint8_t iStReg) RT_NOEXCEPT;
3554void iemFpuStoreResultThenPop(PVMCPUCC pVCpu, PIEMFPURESULT pResult, uint8_t iStReg) RT_NOEXCEPT;
3555void iemFpuStoreResultWithMemOp(PVMCPUCC pVCpu, PIEMFPURESULT pResult, uint8_t iStReg,
3556 uint8_t iEffSeg, RTGCPTR GCPtrEff) RT_NOEXCEPT;
3557void iemFpuStoreResultWithMemOpThenPop(PVMCPUCC pVCpu, PIEMFPURESULT pResult, uint8_t iStReg,
3558 uint8_t iEffSeg, RTGCPTR GCPtrEff) RT_NOEXCEPT;
3559void iemFpuUpdateOpcodeAndIp(PVMCPUCC pVCpu) RT_NOEXCEPT;
3560void iemFpuUpdateFSW(PVMCPUCC pVCpu, uint16_t u16FSW) RT_NOEXCEPT;
3561void iemFpuUpdateFSWThenPop(PVMCPUCC pVCpu, uint16_t u16FSW) RT_NOEXCEPT;
3562void iemFpuUpdateFSWWithMemOp(PVMCPUCC pVCpu, uint16_t u16FSW, uint8_t iEffSeg, RTGCPTR GCPtrEff) RT_NOEXCEPT;
3563void iemFpuUpdateFSWThenPopPop(PVMCPUCC pVCpu, uint16_t u16FSW) RT_NOEXCEPT;
3564void iemFpuUpdateFSWWithMemOpThenPop(PVMCPUCC pVCpu, uint16_t u16FSW, uint8_t iEffSeg, RTGCPTR GCPtrEff) RT_NOEXCEPT;
3565void iemFpuStackUnderflow(PVMCPUCC pVCpu, uint8_t iStReg) RT_NOEXCEPT;
3566void iemFpuStackUnderflowWithMemOp(PVMCPUCC pVCpu, uint8_t iStReg, uint8_t iEffSeg, RTGCPTR GCPtrEff) RT_NOEXCEPT;
3567void iemFpuStackUnderflowThenPop(PVMCPUCC pVCpu, uint8_t iStReg) RT_NOEXCEPT;
3568void iemFpuStackUnderflowWithMemOpThenPop(PVMCPUCC pVCpu, uint8_t iStReg, uint8_t iEffSeg, RTGCPTR GCPtrEff) RT_NOEXCEPT;
3569void iemFpuStackUnderflowThenPopPop(PVMCPUCC pVCpu) RT_NOEXCEPT;
3570void iemFpuStackPushUnderflow(PVMCPUCC pVCpu) RT_NOEXCEPT;
3571void iemFpuStackPushUnderflowTwo(PVMCPUCC pVCpu) RT_NOEXCEPT;
3572void iemFpuStackPushOverflow(PVMCPUCC pVCpu) RT_NOEXCEPT;
3573void iemFpuStackPushOverflowWithMemOp(PVMCPUCC pVCpu, uint8_t iEffSeg, RTGCPTR GCPtrEff) RT_NOEXCEPT;
3574/** @} */
3575
3576/** @name SSE+AVX SIMD access and helpers.
3577 * @{ */
3578void iemSseStoreResult(PVMCPUCC pVCpu, PCIEMSSERESULT pResult, uint8_t iXmmReg) RT_NOEXCEPT;
3579/** @} */
3580
3581/** @name Memory access.
3582 * @{ */
3583
3584/** Report a \#GP instead of \#AC and do not restrict to ring-3 */
3585#define IEM_MEMMAP_F_ALIGN_GP RT_BIT_32(16)
3586/** SSE access that should report a \#GP instead of \#AC, unless MXCSR.MM=1
3587 * when it works like normal \#AC. Always used with IEM_MEMMAP_F_ALIGN_GP. */
3588#define IEM_MEMMAP_F_ALIGN_SSE RT_BIT_32(17)
3589/** If \#AC is applicable, raise it. Always used with IEM_MEMMAP_F_ALIGN_GP.
3590 * Users include FXSAVE & FXRSTOR. */
3591#define IEM_MEMMAP_F_ALIGN_GP_OR_AC RT_BIT_32(18)
3592
3593VBOXSTRICTRC iemMemMap(PVMCPUCC pVCpu, void **ppvMem, size_t cbMem, uint8_t iSegReg, RTGCPTR GCPtrMem,
3594 uint32_t fAccess, uint32_t uAlignCtl) RT_NOEXCEPT;
3595VBOXSTRICTRC iemMemCommitAndUnmap(PVMCPUCC pVCpu, void *pvMem, uint32_t fAccess) RT_NOEXCEPT;
3596#ifndef IN_RING3
3597VBOXSTRICTRC iemMemCommitAndUnmapPostponeTroubleToR3(PVMCPUCC pVCpu, void *pvMem, uint32_t fAccess) RT_NOEXCEPT;
3598#endif
3599void iemMemRollback(PVMCPUCC pVCpu) RT_NOEXCEPT;
3600VBOXSTRICTRC iemMemApplySegment(PVMCPUCC pVCpu, uint32_t fAccess, uint8_t iSegReg, size_t cbMem, PRTGCPTR pGCPtrMem) RT_NOEXCEPT;
3601VBOXSTRICTRC iemMemMarkSelDescAccessed(PVMCPUCC pVCpu, uint16_t uSel) RT_NOEXCEPT;
3602VBOXSTRICTRC iemMemPageTranslateAndCheckAccess(PVMCPUCC pVCpu, RTGCPTR GCPtrMem, uint32_t fAccess, PRTGCPHYS pGCPhysMem) RT_NOEXCEPT;
3603
3604#ifdef IEM_WITH_CODE_TLB
3605void iemOpcodeFetchBytesJmp(PVMCPUCC pVCpu, size_t cbDst, void *pvDst) RT_NOEXCEPT;
3606#else
3607VBOXSTRICTRC iemOpcodeFetchMoreBytes(PVMCPUCC pVCpu, size_t cbMin) RT_NOEXCEPT;
3608#endif
3609#ifdef IEM_WITH_SETJMP
3610uint8_t iemOpcodeGetNextU8SlowJmp(PVMCPUCC pVCpu) RT_NOEXCEPT;
3611uint16_t iemOpcodeGetNextU16SlowJmp(PVMCPUCC pVCpu) RT_NOEXCEPT;
3612uint32_t iemOpcodeGetNextU32SlowJmp(PVMCPUCC pVCpu) RT_NOEXCEPT;
3613uint64_t iemOpcodeGetNextU64SlowJmp(PVMCPUCC pVCpu) RT_NOEXCEPT;
3614#else
3615VBOXSTRICTRC iemOpcodeGetNextU8Slow(PVMCPUCC pVCpu, uint8_t *pb) RT_NOEXCEPT;
3616VBOXSTRICTRC iemOpcodeGetNextS8SxU16Slow(PVMCPUCC pVCpu, uint16_t *pu16) RT_NOEXCEPT;
3617VBOXSTRICTRC iemOpcodeGetNextS8SxU32Slow(PVMCPUCC pVCpu, uint32_t *pu32) RT_NOEXCEPT;
3618VBOXSTRICTRC iemOpcodeGetNextS8SxU64Slow(PVMCPUCC pVCpu, uint64_t *pu64) RT_NOEXCEPT;
3619VBOXSTRICTRC iemOpcodeGetNextU16Slow(PVMCPUCC pVCpu, uint16_t *pu16) RT_NOEXCEPT;
3620VBOXSTRICTRC iemOpcodeGetNextU16ZxU32Slow(PVMCPUCC pVCpu, uint32_t *pu32) RT_NOEXCEPT;
3621VBOXSTRICTRC iemOpcodeGetNextU16ZxU64Slow(PVMCPUCC pVCpu, uint64_t *pu64) RT_NOEXCEPT;
3622VBOXSTRICTRC iemOpcodeGetNextU32Slow(PVMCPUCC pVCpu, uint32_t *pu32) RT_NOEXCEPT;
3623VBOXSTRICTRC iemOpcodeGetNextU32ZxU64Slow(PVMCPUCC pVCpu, uint64_t *pu64) RT_NOEXCEPT;
3624VBOXSTRICTRC iemOpcodeGetNextS32SxU64Slow(PVMCPUCC pVCpu, uint64_t *pu64) RT_NOEXCEPT;
3625VBOXSTRICTRC iemOpcodeGetNextU64Slow(PVMCPUCC pVCpu, uint64_t *pu64) RT_NOEXCEPT;
3626#endif
3627
3628VBOXSTRICTRC iemMemFetchDataU8(PVMCPUCC pVCpu, uint8_t *pu8Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3629VBOXSTRICTRC iemMemFetchDataU16(PVMCPUCC pVCpu, uint16_t *pu16Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3630VBOXSTRICTRC iemMemFetchDataU32(PVMCPUCC pVCpu, uint32_t *pu32Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3631VBOXSTRICTRC iemMemFetchDataU32_ZX_U64(PVMCPUCC pVCpu, uint64_t *pu64Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3632VBOXSTRICTRC iemMemFetchDataU64(PVMCPUCC pVCpu, uint64_t *pu64Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3633VBOXSTRICTRC iemMemFetchDataU64AlignedU128(PVMCPUCC pVCpu, uint64_t *pu64Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3634VBOXSTRICTRC iemMemFetchDataR80(PVMCPUCC pVCpu, PRTFLOAT80U pr80Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3635VBOXSTRICTRC iemMemFetchDataD80(PVMCPUCC pVCpu, PRTPBCD80U pd80Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3636VBOXSTRICTRC iemMemFetchDataU128(PVMCPUCC pVCpu, PRTUINT128U pu128Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3637VBOXSTRICTRC iemMemFetchDataU128AlignedSse(PVMCPUCC pVCpu, PRTUINT128U pu128Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3638VBOXSTRICTRC iemMemFetchDataU256(PVMCPUCC pVCpu, PRTUINT256U pu256Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3639VBOXSTRICTRC iemMemFetchDataU256AlignedSse(PVMCPUCC pVCpu, PRTUINT256U pu256Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3640VBOXSTRICTRC iemMemFetchDataXdtr(PVMCPUCC pVCpu, uint16_t *pcbLimit, PRTGCPTR pGCPtrBase, uint8_t iSegReg,
3641 RTGCPTR GCPtrMem, IEMMODE enmOpSize) RT_NOEXCEPT;
3642#ifdef IEM_WITH_SETJMP
3643uint8_t iemMemFetchDataU8Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3644uint16_t iemMemFetchDataU16Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3645uint32_t iemMemFetchDataU32Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3646uint64_t iemMemFetchDataU64Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3647uint64_t iemMemFetchDataU64AlignedU128Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3648void iemMemFetchDataR80Jmp(PVMCPUCC pVCpu, PRTFLOAT80U pr80Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3649void iemMemFetchDataD80Jmp(PVMCPUCC pVCpu, PRTPBCD80U pd80Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3650void iemMemFetchDataU128Jmp(PVMCPUCC pVCpu, PRTUINT128U pu128Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3651void iemMemFetchDataU128AlignedSseJmp(PVMCPUCC pVCpu, PRTUINT128U pu128Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3652void iemMemFetchDataU256Jmp(PVMCPUCC pVCpu, PRTUINT256U pu256Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3653void iemMemFetchDataU256AlignedSseJmp(PVMCPUCC pVCpu, PRTUINT256U pu256Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3654#endif
3655
3656VBOXSTRICTRC iemMemFetchSysU8(PVMCPUCC pVCpu, uint8_t *pu8Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3657VBOXSTRICTRC iemMemFetchSysU16(PVMCPUCC pVCpu, uint16_t *pu16Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3658VBOXSTRICTRC iemMemFetchSysU32(PVMCPUCC pVCpu, uint32_t *pu32Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3659VBOXSTRICTRC iemMemFetchSysU64(PVMCPUCC pVCpu, uint64_t *pu64Dst, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3660VBOXSTRICTRC iemMemFetchSelDesc(PVMCPUCC pVCpu, PIEMSELDESC pDesc, uint16_t uSel, uint8_t uXcpt) RT_NOEXCEPT;
3661
3662VBOXSTRICTRC iemMemStoreDataU8(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, uint8_t u8Value) RT_NOEXCEPT;
3663VBOXSTRICTRC iemMemStoreDataU16(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, uint16_t u16Value) RT_NOEXCEPT;
3664VBOXSTRICTRC iemMemStoreDataU32(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, uint32_t u32Value) RT_NOEXCEPT;
3665VBOXSTRICTRC iemMemStoreDataU64(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, uint64_t u64Value) RT_NOEXCEPT;
3666VBOXSTRICTRC iemMemStoreDataU128(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, RTUINT128U u128Value) RT_NOEXCEPT;
3667VBOXSTRICTRC iemMemStoreDataU128AlignedSse(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, RTUINT128U u128Value) RT_NOEXCEPT;
3668VBOXSTRICTRC iemMemStoreDataU256(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, PCRTUINT256U pu256Value) RT_NOEXCEPT;
3669VBOXSTRICTRC iemMemStoreDataU256AlignedAvx(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, PCRTUINT256U pu256Value) RT_NOEXCEPT;
3670VBOXSTRICTRC iemMemStoreDataXdtr(PVMCPUCC pVCpu, uint16_t cbLimit, RTGCPTR GCPtrBase, uint8_t iSegReg, RTGCPTR GCPtrMem) RT_NOEXCEPT;
3671#ifdef IEM_WITH_SETJMP
3672void iemMemStoreDataU8Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, uint8_t u8Value) RT_NOEXCEPT;
3673void iemMemStoreDataU16Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, uint16_t u16Value) RT_NOEXCEPT;
3674void iemMemStoreDataU32Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, uint32_t u32Value) RT_NOEXCEPT;
3675void iemMemStoreDataU64Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, uint64_t u64Value) RT_NOEXCEPT;
3676void iemMemStoreDataU128Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, RTUINT128U u128Value) RT_NOEXCEPT;
3677void iemMemStoreDataU128AlignedSseJmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, RTUINT128U u128Value) RT_NOEXCEPT;
3678void iemMemStoreDataU256Jmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, PCRTUINT256U pu256Value) RT_NOEXCEPT;
3679void iemMemStoreDataU256AlignedAvxJmp(PVMCPUCC pVCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, PCRTUINT256U pu256Value) RT_NOEXCEPT;
3680#endif
3681
3682VBOXSTRICTRC iemMemStackPushBeginSpecial(PVMCPUCC pVCpu, size_t cbMem, uint32_t cbAlign,
3683 void **ppvMem, uint64_t *puNewRsp) RT_NOEXCEPT;
3684VBOXSTRICTRC iemMemStackPushCommitSpecial(PVMCPUCC pVCpu, void *pvMem, uint64_t uNewRsp) RT_NOEXCEPT;
3685VBOXSTRICTRC iemMemStackPushU16(PVMCPUCC pVCpu, uint16_t u16Value) RT_NOEXCEPT;
3686VBOXSTRICTRC iemMemStackPushU32(PVMCPUCC pVCpu, uint32_t u32Value) RT_NOEXCEPT;
3687VBOXSTRICTRC iemMemStackPushU64(PVMCPUCC pVCpu, uint64_t u64Value) RT_NOEXCEPT;
3688VBOXSTRICTRC iemMemStackPushU16Ex(PVMCPUCC pVCpu, uint16_t u16Value, PRTUINT64U pTmpRsp) RT_NOEXCEPT;
3689VBOXSTRICTRC iemMemStackPushU32Ex(PVMCPUCC pVCpu, uint32_t u32Value, PRTUINT64U pTmpRsp) RT_NOEXCEPT;
3690VBOXSTRICTRC iemMemStackPushU64Ex(PVMCPUCC pVCpu, uint64_t u64Value, PRTUINT64U pTmpRsp) RT_NOEXCEPT;
3691VBOXSTRICTRC iemMemStackPushU32SReg(PVMCPUCC pVCpu, uint32_t u32Value) RT_NOEXCEPT;
3692VBOXSTRICTRC iemMemStackPopBeginSpecial(PVMCPUCC pVCpu, size_t cbMem, uint32_t cbAlign,
3693 void const **ppvMem, uint64_t *puNewRsp) RT_NOEXCEPT;
3694VBOXSTRICTRC iemMemStackPopContinueSpecial(PVMCPUCC pVCpu, size_t off, size_t cbMem,
3695 void const **ppvMem, uint64_t uCurNewRsp) RT_NOEXCEPT;
3696VBOXSTRICTRC iemMemStackPopDoneSpecial(PVMCPUCC pVCpu, void const *pvMem) RT_NOEXCEPT;
3697VBOXSTRICTRC iemMemStackPopU16(PVMCPUCC pVCpu, uint16_t *pu16Value) RT_NOEXCEPT;
3698VBOXSTRICTRC iemMemStackPopU32(PVMCPUCC pVCpu, uint32_t *pu32Value) RT_NOEXCEPT;
3699VBOXSTRICTRC iemMemStackPopU64(PVMCPUCC pVCpu, uint64_t *pu64Value) RT_NOEXCEPT;
3700VBOXSTRICTRC iemMemStackPopU16Ex(PVMCPUCC pVCpu, uint16_t *pu16Value, PRTUINT64U pTmpRsp) RT_NOEXCEPT;
3701VBOXSTRICTRC iemMemStackPopU32Ex(PVMCPUCC pVCpu, uint32_t *pu32Value, PRTUINT64U pTmpRsp) RT_NOEXCEPT;
3702VBOXSTRICTRC iemMemStackPopU64Ex(PVMCPUCC pVCpu, uint64_t *pu64Value, PRTUINT64U pTmpRsp) RT_NOEXCEPT;
3703/** @} */
3704
3705/** @name IEMAllCImpl.cpp
3706 * @note sed -e '/IEM_CIMPL_DEF_/!d' -e 's/IEM_CIMPL_DEF_/IEM_CIMPL_PROTO_/' -e 's/$/;/'
3707 * @{ */
3708IEM_CIMPL_PROTO_0(iemCImpl_popa_16);
3709IEM_CIMPL_PROTO_0(iemCImpl_popa_32);
3710IEM_CIMPL_PROTO_0(iemCImpl_pusha_16);
3711IEM_CIMPL_PROTO_0(iemCImpl_pusha_32);
3712IEM_CIMPL_PROTO_1(iemCImpl_pushf, IEMMODE, enmEffOpSize);
3713IEM_CIMPL_PROTO_1(iemCImpl_popf, IEMMODE, enmEffOpSize);
3714IEM_CIMPL_PROTO_1(iemCImpl_call_16, uint16_t, uNewPC);
3715IEM_CIMPL_PROTO_1(iemCImpl_call_rel_16, int16_t, offDisp);
3716IEM_CIMPL_PROTO_1(iemCImpl_call_32, uint32_t, uNewPC);
3717IEM_CIMPL_PROTO_1(iemCImpl_call_rel_32, int32_t, offDisp);
3718IEM_CIMPL_PROTO_1(iemCImpl_call_64, uint64_t, uNewPC);
3719IEM_CIMPL_PROTO_1(iemCImpl_call_rel_64, int64_t, offDisp);
3720IEM_CIMPL_PROTO_4(iemCImpl_BranchTaskSegment, uint16_t, uSel, IEMBRANCH, enmBranch, IEMMODE, enmEffOpSize, PIEMSELDESC, pDesc);
3721IEM_CIMPL_PROTO_4(iemCImpl_BranchTaskGate, uint16_t, uSel, IEMBRANCH, enmBranch, IEMMODE, enmEffOpSize, PIEMSELDESC, pDesc);
3722IEM_CIMPL_PROTO_4(iemCImpl_BranchCallGate, uint16_t, uSel, IEMBRANCH, enmBranch, IEMMODE, enmEffOpSize, PIEMSELDESC, pDesc);
3723IEM_CIMPL_PROTO_4(iemCImpl_BranchSysSel, uint16_t, uSel, IEMBRANCH, enmBranch, IEMMODE, enmEffOpSize, PIEMSELDESC, pDesc);
3724IEM_CIMPL_PROTO_3(iemCImpl_FarJmp, uint16_t, uSel, uint64_t, offSeg, IEMMODE, enmEffOpSize);
3725IEM_CIMPL_PROTO_3(iemCImpl_callf, uint16_t, uSel, uint64_t, offSeg, IEMMODE, enmEffOpSize);
3726IEM_CIMPL_PROTO_2(iemCImpl_retf, IEMMODE, enmEffOpSize, uint16_t, cbPop);
3727IEM_CIMPL_PROTO_2(iemCImpl_retn, IEMMODE, enmEffOpSize, uint16_t, cbPop);
3728IEM_CIMPL_PROTO_3(iemCImpl_enter, IEMMODE, enmEffOpSize, uint16_t, cbFrame, uint8_t, cParameters);
3729IEM_CIMPL_PROTO_1(iemCImpl_leave, IEMMODE, enmEffOpSize);
3730IEM_CIMPL_PROTO_2(iemCImpl_int, uint8_t, u8Int, IEMINT, enmInt);
3731IEM_CIMPL_PROTO_1(iemCImpl_iret_real_v8086, IEMMODE, enmEffOpSize);
3732IEM_CIMPL_PROTO_4(iemCImpl_iret_prot_v8086, uint32_t, uNewEip, uint16_t, uNewCs, uint32_t, uNewFlags, uint64_t, uNewRsp);
3733IEM_CIMPL_PROTO_1(iemCImpl_iret_prot_NestedTask, IEMMODE, enmEffOpSize);
3734IEM_CIMPL_PROTO_1(iemCImpl_iret_prot, IEMMODE, enmEffOpSize);
3735IEM_CIMPL_PROTO_1(iemCImpl_iret_64bit, IEMMODE, enmEffOpSize);
3736IEM_CIMPL_PROTO_1(iemCImpl_iret, IEMMODE, enmEffOpSize);
3737IEM_CIMPL_PROTO_0(iemCImpl_loadall286);
3738IEM_CIMPL_PROTO_0(iemCImpl_syscall);
3739IEM_CIMPL_PROTO_0(iemCImpl_sysret);
3740IEM_CIMPL_PROTO_0(iemCImpl_sysenter);
3741IEM_CIMPL_PROTO_1(iemCImpl_sysexit, IEMMODE, enmEffOpSize);
3742IEM_CIMPL_PROTO_2(iemCImpl_LoadSReg, uint8_t, iSegReg, uint16_t, uSel);
3743IEM_CIMPL_PROTO_2(iemCImpl_load_SReg, uint8_t, iSegReg, uint16_t, uSel);
3744IEM_CIMPL_PROTO_2(iemCImpl_pop_Sreg, uint8_t, iSegReg, IEMMODE, enmEffOpSize);
3745IEM_CIMPL_PROTO_5(iemCImpl_load_SReg_Greg, uint16_t, uSel, uint64_t, offSeg, uint8_t, iSegReg, uint8_t, iGReg, IEMMODE, enmEffOpSize);
3746IEM_CIMPL_PROTO_2(iemCImpl_VerX, uint16_t, uSel, bool, fWrite);
3747IEM_CIMPL_PROTO_3(iemCImpl_LarLsl_u64, uint64_t *, pu64Dst, uint16_t, uSel, bool, fIsLar);
3748IEM_CIMPL_PROTO_3(iemCImpl_LarLsl_u16, uint16_t *, pu16Dst, uint16_t, uSel, bool, fIsLar);
3749IEM_CIMPL_PROTO_3(iemCImpl_lgdt, uint8_t, iEffSeg, RTGCPTR, GCPtrEffSrc, IEMMODE, enmEffOpSize);
3750IEM_CIMPL_PROTO_2(iemCImpl_sgdt, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst);
3751IEM_CIMPL_PROTO_3(iemCImpl_lidt, uint8_t, iEffSeg, RTGCPTR, GCPtrEffSrc, IEMMODE, enmEffOpSize);
3752IEM_CIMPL_PROTO_2(iemCImpl_sidt, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst);
3753IEM_CIMPL_PROTO_1(iemCImpl_lldt, uint16_t, uNewLdt);
3754IEM_CIMPL_PROTO_2(iemCImpl_sldt_reg, uint8_t, iGReg, uint8_t, enmEffOpSize);
3755IEM_CIMPL_PROTO_2(iemCImpl_sldt_mem, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst);
3756IEM_CIMPL_PROTO_1(iemCImpl_ltr, uint16_t, uNewTr);
3757IEM_CIMPL_PROTO_2(iemCImpl_str_reg, uint8_t, iGReg, uint8_t, enmEffOpSize);
3758IEM_CIMPL_PROTO_2(iemCImpl_str_mem, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst);
3759IEM_CIMPL_PROTO_2(iemCImpl_mov_Rd_Cd, uint8_t, iGReg, uint8_t, iCrReg);
3760IEM_CIMPL_PROTO_2(iemCImpl_smsw_reg, uint8_t, iGReg, uint8_t, enmEffOpSize);
3761IEM_CIMPL_PROTO_2(iemCImpl_smsw_mem, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst);
3762IEM_CIMPL_PROTO_4(iemCImpl_load_CrX, uint8_t, iCrReg, uint64_t, uNewCrX, IEMACCESSCRX, enmAccessCrX, uint8_t, iGReg);
3763IEM_CIMPL_PROTO_2(iemCImpl_mov_Cd_Rd, uint8_t, iCrReg, uint8_t, iGReg);
3764IEM_CIMPL_PROTO_2(iemCImpl_lmsw, uint16_t, u16NewMsw, RTGCPTR, GCPtrEffDst);
3765IEM_CIMPL_PROTO_0(iemCImpl_clts);
3766IEM_CIMPL_PROTO_2(iemCImpl_mov_Rd_Dd, uint8_t, iGReg, uint8_t, iDrReg);
3767IEM_CIMPL_PROTO_2(iemCImpl_mov_Dd_Rd, uint8_t, iDrReg, uint8_t, iGReg);
3768IEM_CIMPL_PROTO_2(iemCImpl_mov_Rd_Td, uint8_t, iGReg, uint8_t, iTrReg);
3769IEM_CIMPL_PROTO_2(iemCImpl_mov_Td_Rd, uint8_t, iTrReg, uint8_t, iGReg);
3770IEM_CIMPL_PROTO_1(iemCImpl_invlpg, RTGCPTR, GCPtrPage);
3771IEM_CIMPL_PROTO_3(iemCImpl_invpcid, uint8_t, iEffSeg, RTGCPTR, GCPtrInvpcidDesc, uint64_t, uInvpcidType);
3772IEM_CIMPL_PROTO_0(iemCImpl_invd);
3773IEM_CIMPL_PROTO_0(iemCImpl_wbinvd);
3774IEM_CIMPL_PROTO_0(iemCImpl_rsm);
3775IEM_CIMPL_PROTO_0(iemCImpl_rdtsc);
3776IEM_CIMPL_PROTO_0(iemCImpl_rdtscp);
3777IEM_CIMPL_PROTO_0(iemCImpl_rdpmc);
3778IEM_CIMPL_PROTO_0(iemCImpl_rdmsr);
3779IEM_CIMPL_PROTO_0(iemCImpl_wrmsr);
3780IEM_CIMPL_PROTO_3(iemCImpl_in, uint16_t, u16Port, bool, fImm, uint8_t, cbReg);
3781IEM_CIMPL_PROTO_1(iemCImpl_in_eAX_DX, uint8_t, cbReg);
3782IEM_CIMPL_PROTO_3(iemCImpl_out, uint16_t, u16Port, bool, fImm, uint8_t, cbReg);
3783IEM_CIMPL_PROTO_1(iemCImpl_out_DX_eAX, uint8_t, cbReg);
3784IEM_CIMPL_PROTO_0(iemCImpl_cli);
3785IEM_CIMPL_PROTO_0(iemCImpl_sti);
3786IEM_CIMPL_PROTO_0(iemCImpl_hlt);
3787IEM_CIMPL_PROTO_1(iemCImpl_monitor, uint8_t, iEffSeg);
3788IEM_CIMPL_PROTO_0(iemCImpl_mwait);
3789IEM_CIMPL_PROTO_0(iemCImpl_swapgs);
3790IEM_CIMPL_PROTO_0(iemCImpl_cpuid);
3791IEM_CIMPL_PROTO_1(iemCImpl_aad, uint8_t, bImm);
3792IEM_CIMPL_PROTO_1(iemCImpl_aam, uint8_t, bImm);
3793IEM_CIMPL_PROTO_0(iemCImpl_daa);
3794IEM_CIMPL_PROTO_0(iemCImpl_das);
3795IEM_CIMPL_PROTO_0(iemCImpl_aaa);
3796IEM_CIMPL_PROTO_0(iemCImpl_aas);
3797IEM_CIMPL_PROTO_3(iemCImpl_bound_16, int16_t, idxArray, int16_t, idxLowerBound, int16_t, idxUpperBound);
3798IEM_CIMPL_PROTO_3(iemCImpl_bound_32, int32_t, idxArray, int32_t, idxLowerBound, int32_t, idxUpperBound);
3799IEM_CIMPL_PROTO_0(iemCImpl_xgetbv);
3800IEM_CIMPL_PROTO_0(iemCImpl_xsetbv);
3801IEM_CIMPL_PROTO_4(iemCImpl_cmpxchg16b_fallback_rendezvous, PRTUINT128U, pu128Dst, PRTUINT128U, pu128RaxRdx,
3802 PRTUINT128U, pu128RbxRcx, uint32_t *, pEFlags);
3803IEM_CIMPL_PROTO_2(iemCImpl_clflush_clflushopt, uint8_t, iEffSeg, RTGCPTR, GCPtrEff);
3804IEM_CIMPL_PROTO_1(iemCImpl_finit, bool, fCheckXcpts);
3805IEM_CIMPL_PROTO_3(iemCImpl_fxsave, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE, enmEffOpSize);
3806IEM_CIMPL_PROTO_3(iemCImpl_fxrstor, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE, enmEffOpSize);
3807IEM_CIMPL_PROTO_3(iemCImpl_xsave, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE, enmEffOpSize);
3808IEM_CIMPL_PROTO_3(iemCImpl_xrstor, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE, enmEffOpSize);
3809IEM_CIMPL_PROTO_2(iemCImpl_stmxcsr, uint8_t, iEffSeg, RTGCPTR, GCPtrEff);
3810IEM_CIMPL_PROTO_2(iemCImpl_vstmxcsr, uint8_t, iEffSeg, RTGCPTR, GCPtrEff);
3811IEM_CIMPL_PROTO_2(iemCImpl_ldmxcsr, uint8_t, iEffSeg, RTGCPTR, GCPtrEff);
3812IEM_CIMPL_PROTO_3(iemCImpl_fnstenv, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst);
3813IEM_CIMPL_PROTO_3(iemCImpl_fnsave, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst);
3814IEM_CIMPL_PROTO_3(iemCImpl_fldenv, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPTR, GCPtrEffSrc);
3815IEM_CIMPL_PROTO_3(iemCImpl_frstor, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPTR, GCPtrEffSrc);
3816IEM_CIMPL_PROTO_1(iemCImpl_fldcw, uint16_t, u16Fcw);
3817IEM_CIMPL_PROTO_1(iemCImpl_fxch_underflow, uint8_t, iStReg);
3818IEM_CIMPL_PROTO_3(iemCImpl_fcomi_fucomi, uint8_t, iStReg, PFNIEMAIMPLFPUR80EFL, pfnAImpl, bool, fPop);
3819/** @} */
3820
3821/** @name IEMAllCImplStrInstr.cpp.h
3822 * @note sed -e '/IEM_CIMPL_DEF_/!d' -e 's/IEM_CIMPL_DEF_/IEM_CIMPL_PROTO_/' -e 's/$/;/' -e 's/RT_CONCAT4(//' \
3823 * -e 's/,ADDR_SIZE)/64/g' -e 's/,OP_SIZE,/64/g' -e 's/,OP_rAX,/rax/g' IEMAllCImplStrInstr.cpp.h
3824 * @{ */
3825IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op8_addr16, uint8_t, iEffSeg);
3826IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op8_addr16, uint8_t, iEffSeg);
3827IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_al_m16);
3828IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_al_m16);
3829IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op8_addr16, uint8_t, iEffSeg);
3830IEM_CIMPL_PROTO_0(iemCImpl_stos_al_m16);
3831IEM_CIMPL_PROTO_1(iemCImpl_lods_al_m16, int8_t, iEffSeg);
3832IEM_CIMPL_PROTO_1(iemCImpl_ins_op8_addr16, bool, fIoChecked);
3833IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op8_addr16, bool, fIoChecked);
3834IEM_CIMPL_PROTO_2(iemCImpl_outs_op8_addr16, uint8_t, iEffSeg, bool, fIoChecked);
3835IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op8_addr16, uint8_t, iEffSeg, bool, fIoChecked);
3836
3837IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op16_addr16, uint8_t, iEffSeg);
3838IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op16_addr16, uint8_t, iEffSeg);
3839IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_ax_m16);
3840IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_ax_m16);
3841IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op16_addr16, uint8_t, iEffSeg);
3842IEM_CIMPL_PROTO_0(iemCImpl_stos_ax_m16);
3843IEM_CIMPL_PROTO_1(iemCImpl_lods_ax_m16, int8_t, iEffSeg);
3844IEM_CIMPL_PROTO_1(iemCImpl_ins_op16_addr16, bool, fIoChecked);
3845IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op16_addr16, bool, fIoChecked);
3846IEM_CIMPL_PROTO_2(iemCImpl_outs_op16_addr16, uint8_t, iEffSeg, bool, fIoChecked);
3847IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op16_addr16, uint8_t, iEffSeg, bool, fIoChecked);
3848
3849IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op32_addr16, uint8_t, iEffSeg);
3850IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op32_addr16, uint8_t, iEffSeg);
3851IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_eax_m16);
3852IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_eax_m16);
3853IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op32_addr16, uint8_t, iEffSeg);
3854IEM_CIMPL_PROTO_0(iemCImpl_stos_eax_m16);
3855IEM_CIMPL_PROTO_1(iemCImpl_lods_eax_m16, int8_t, iEffSeg);
3856IEM_CIMPL_PROTO_1(iemCImpl_ins_op32_addr16, bool, fIoChecked);
3857IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op32_addr16, bool, fIoChecked);
3858IEM_CIMPL_PROTO_2(iemCImpl_outs_op32_addr16, uint8_t, iEffSeg, bool, fIoChecked);
3859IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op32_addr16, uint8_t, iEffSeg, bool, fIoChecked);
3860
3861
3862IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op8_addr32, uint8_t, iEffSeg);
3863IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op8_addr32, uint8_t, iEffSeg);
3864IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_al_m32);
3865IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_al_m32);
3866IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op8_addr32, uint8_t, iEffSeg);
3867IEM_CIMPL_PROTO_0(iemCImpl_stos_al_m32);
3868IEM_CIMPL_PROTO_1(iemCImpl_lods_al_m32, int8_t, iEffSeg);
3869IEM_CIMPL_PROTO_1(iemCImpl_ins_op8_addr32, bool, fIoChecked);
3870IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op8_addr32, bool, fIoChecked);
3871IEM_CIMPL_PROTO_2(iemCImpl_outs_op8_addr32, uint8_t, iEffSeg, bool, fIoChecked);
3872IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op8_addr32, uint8_t, iEffSeg, bool, fIoChecked);
3873
3874IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op16_addr32, uint8_t, iEffSeg);
3875IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op16_addr32, uint8_t, iEffSeg);
3876IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_ax_m32);
3877IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_ax_m32);
3878IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op16_addr32, uint8_t, iEffSeg);
3879IEM_CIMPL_PROTO_0(iemCImpl_stos_ax_m32);
3880IEM_CIMPL_PROTO_1(iemCImpl_lods_ax_m32, int8_t, iEffSeg);
3881IEM_CIMPL_PROTO_1(iemCImpl_ins_op16_addr32, bool, fIoChecked);
3882IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op16_addr32, bool, fIoChecked);
3883IEM_CIMPL_PROTO_2(iemCImpl_outs_op16_addr32, uint8_t, iEffSeg, bool, fIoChecked);
3884IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op16_addr32, uint8_t, iEffSeg, bool, fIoChecked);
3885
3886IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op32_addr32, uint8_t, iEffSeg);
3887IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op32_addr32, uint8_t, iEffSeg);
3888IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_eax_m32);
3889IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_eax_m32);
3890IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op32_addr32, uint8_t, iEffSeg);
3891IEM_CIMPL_PROTO_0(iemCImpl_stos_eax_m32);
3892IEM_CIMPL_PROTO_1(iemCImpl_lods_eax_m32, int8_t, iEffSeg);
3893IEM_CIMPL_PROTO_1(iemCImpl_ins_op32_addr32, bool, fIoChecked);
3894IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op32_addr32, bool, fIoChecked);
3895IEM_CIMPL_PROTO_2(iemCImpl_outs_op32_addr32, uint8_t, iEffSeg, bool, fIoChecked);
3896IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op32_addr32, uint8_t, iEffSeg, bool, fIoChecked);
3897
3898IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op64_addr32, uint8_t, iEffSeg);
3899IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op64_addr32, uint8_t, iEffSeg);
3900IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_rax_m32);
3901IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_rax_m32);
3902IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op64_addr32, uint8_t, iEffSeg);
3903IEM_CIMPL_PROTO_0(iemCImpl_stos_rax_m32);
3904IEM_CIMPL_PROTO_1(iemCImpl_lods_rax_m32, int8_t, iEffSeg);
3905IEM_CIMPL_PROTO_1(iemCImpl_ins_op64_addr32, bool, fIoChecked);
3906IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op64_addr32, bool, fIoChecked);
3907IEM_CIMPL_PROTO_2(iemCImpl_outs_op64_addr32, uint8_t, iEffSeg, bool, fIoChecked);
3908IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op64_addr32, uint8_t, iEffSeg, bool, fIoChecked);
3909
3910
3911IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op8_addr64, uint8_t, iEffSeg);
3912IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op8_addr64, uint8_t, iEffSeg);
3913IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_al_m64);
3914IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_al_m64);
3915IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op8_addr64, uint8_t, iEffSeg);
3916IEM_CIMPL_PROTO_0(iemCImpl_stos_al_m64);
3917IEM_CIMPL_PROTO_1(iemCImpl_lods_al_m64, int8_t, iEffSeg);
3918IEM_CIMPL_PROTO_1(iemCImpl_ins_op8_addr64, bool, fIoChecked);
3919IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op8_addr64, bool, fIoChecked);
3920IEM_CIMPL_PROTO_2(iemCImpl_outs_op8_addr64, uint8_t, iEffSeg, bool, fIoChecked);
3921IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op8_addr64, uint8_t, iEffSeg, bool, fIoChecked);
3922
3923IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op16_addr64, uint8_t, iEffSeg);
3924IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op16_addr64, uint8_t, iEffSeg);
3925IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_ax_m64);
3926IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_ax_m64);
3927IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op16_addr64, uint8_t, iEffSeg);
3928IEM_CIMPL_PROTO_0(iemCImpl_stos_ax_m64);
3929IEM_CIMPL_PROTO_1(iemCImpl_lods_ax_m64, int8_t, iEffSeg);
3930IEM_CIMPL_PROTO_1(iemCImpl_ins_op16_addr64, bool, fIoChecked);
3931IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op16_addr64, bool, fIoChecked);
3932IEM_CIMPL_PROTO_2(iemCImpl_outs_op16_addr64, uint8_t, iEffSeg, bool, fIoChecked);
3933IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op16_addr64, uint8_t, iEffSeg, bool, fIoChecked);
3934
3935IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op32_addr64, uint8_t, iEffSeg);
3936IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op32_addr64, uint8_t, iEffSeg);
3937IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_eax_m64);
3938IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_eax_m64);
3939IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op32_addr64, uint8_t, iEffSeg);
3940IEM_CIMPL_PROTO_0(iemCImpl_stos_eax_m64);
3941IEM_CIMPL_PROTO_1(iemCImpl_lods_eax_m64, int8_t, iEffSeg);
3942IEM_CIMPL_PROTO_1(iemCImpl_ins_op32_addr64, bool, fIoChecked);
3943IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op32_addr64, bool, fIoChecked);
3944IEM_CIMPL_PROTO_2(iemCImpl_outs_op32_addr64, uint8_t, iEffSeg, bool, fIoChecked);
3945IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op32_addr64, uint8_t, iEffSeg, bool, fIoChecked);
3946
3947IEM_CIMPL_PROTO_1(iemCImpl_repe_cmps_op64_addr64, uint8_t, iEffSeg);
3948IEM_CIMPL_PROTO_1(iemCImpl_repne_cmps_op64_addr64, uint8_t, iEffSeg);
3949IEM_CIMPL_PROTO_0(iemCImpl_repe_scas_rax_m64);
3950IEM_CIMPL_PROTO_0(iemCImpl_repne_scas_rax_m64);
3951IEM_CIMPL_PROTO_1(iemCImpl_rep_movs_op64_addr64, uint8_t, iEffSeg);
3952IEM_CIMPL_PROTO_0(iemCImpl_stos_rax_m64);
3953IEM_CIMPL_PROTO_1(iemCImpl_lods_rax_m64, int8_t, iEffSeg);
3954IEM_CIMPL_PROTO_1(iemCImpl_ins_op64_addr64, bool, fIoChecked);
3955IEM_CIMPL_PROTO_1(iemCImpl_rep_ins_op64_addr64, bool, fIoChecked);
3956IEM_CIMPL_PROTO_2(iemCImpl_outs_op64_addr64, uint8_t, iEffSeg, bool, fIoChecked);
3957IEM_CIMPL_PROTO_2(iemCImpl_rep_outs_op64_addr64, uint8_t, iEffSeg, bool, fIoChecked);
3958/** @} */
3959
3960#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
3961VBOXSTRICTRC iemVmxVmexit(PVMCPUCC pVCpu, uint32_t uExitReason, uint64_t u64ExitQual) RT_NOEXCEPT;
3962VBOXSTRICTRC iemVmxVmexitInstr(PVMCPUCC pVCpu, uint32_t uExitReason, uint8_t cbInstr) RT_NOEXCEPT;
3963VBOXSTRICTRC iemVmxVmexitInstrNeedsInfo(PVMCPUCC pVCpu, uint32_t uExitReason, VMXINSTRID uInstrId, uint8_t cbInstr) RT_NOEXCEPT;
3964VBOXSTRICTRC iemVmxVmexitTaskSwitch(PVMCPUCC pVCpu, IEMTASKSWITCH enmTaskSwitch, RTSEL SelNewTss, uint8_t cbInstr) RT_NOEXCEPT;
3965VBOXSTRICTRC iemVmxVmexitEvent(PVMCPUCC pVCpu, uint8_t uVector, uint32_t fFlags, uint32_t uErrCode, uint64_t uCr2, uint8_t cbInstr) RT_NOEXCEPT;
3966VBOXSTRICTRC iemVmxVmexitEventDoubleFault(PVMCPUCC pVCpu) RT_NOEXCEPT;
3967VBOXSTRICTRC iemVmxVmexitEpt(PVMCPUCC pVCpu, PPGMPTWALK pWalk, uint32_t fAccess, uint32_t fSlatFail, uint8_t cbInstr) RT_NOEXCEPT;
3968VBOXSTRICTRC iemVmxVmexitPreemptTimer(PVMCPUCC pVCpu) RT_NOEXCEPT;
3969VBOXSTRICTRC iemVmxVmexitInstrMwait(PVMCPUCC pVCpu, bool fMonitorHwArmed, uint8_t cbInstr) RT_NOEXCEPT;
3970VBOXSTRICTRC iemVmxVmexitInstrIo(PVMCPUCC pVCpu, VMXINSTRID uInstrId, uint16_t u16Port,
3971 bool fImm, uint8_t cbAccess, uint8_t cbInstr) RT_NOEXCEPT;
3972VBOXSTRICTRC iemVmxVmexitInstrStrIo(PVMCPUCC pVCpu, VMXINSTRID uInstrId, uint16_t u16Port, uint8_t cbAccess,
3973 bool fRep, VMXEXITINSTRINFO ExitInstrInfo, uint8_t cbInstr) RT_NOEXCEPT;
3974VBOXSTRICTRC iemVmxVmexitInstrMovDrX(PVMCPUCC pVCpu, VMXINSTRID uInstrId, uint8_t iDrReg, uint8_t iGReg, uint8_t cbInstr) RT_NOEXCEPT;
3975VBOXSTRICTRC iemVmxVmexitInstrMovToCr8(PVMCPUCC pVCpu, uint8_t iGReg, uint8_t cbInstr) RT_NOEXCEPT;
3976VBOXSTRICTRC iemVmxVmexitInstrMovFromCr8(PVMCPUCC pVCpu, uint8_t iGReg, uint8_t cbInstr) RT_NOEXCEPT;
3977VBOXSTRICTRC iemVmxVmexitInstrMovToCr3(PVMCPUCC pVCpu, uint64_t uNewCr3, uint8_t iGReg, uint8_t cbInstr) RT_NOEXCEPT;
3978VBOXSTRICTRC iemVmxVmexitInstrMovFromCr3(PVMCPUCC pVCpu, uint8_t iGReg, uint8_t cbInstr) RT_NOEXCEPT;
3979VBOXSTRICTRC iemVmxVmexitInstrMovToCr0Cr4(PVMCPUCC pVCpu, uint8_t iCrReg, uint64_t *puNewCrX, uint8_t iGReg, uint8_t cbInstr) RT_NOEXCEPT;
3980VBOXSTRICTRC iemVmxVmexitInstrClts(PVMCPUCC pVCpu, uint8_t cbInstr) RT_NOEXCEPT;
3981VBOXSTRICTRC iemVmxVmexitInstrLmsw(PVMCPUCC pVCpu, uint32_t uGuestCr0, uint16_t *pu16NewMsw,
3982 RTGCPTR GCPtrEffDst, uint8_t cbInstr) RT_NOEXCEPT;
3983VBOXSTRICTRC iemVmxVmexitInstrInvlpg(PVMCPUCC pVCpu, RTGCPTR GCPtrPage, uint8_t cbInstr) RT_NOEXCEPT;
3984VBOXSTRICTRC iemVmxApicWriteEmulation(PVMCPUCC pVCpu) RT_NOEXCEPT;
3985VBOXSTRICTRC iemVmxVirtApicAccessUnused(PVMCPUCC pVCpu, PRTGCPHYS pGCPhysAccess, size_t cbAccess, uint32_t fAccess) RT_NOEXCEPT;
3986uint32_t iemVmxVirtApicReadRaw32(PVMCPUCC pVCpu, uint16_t offReg) RT_NOEXCEPT;
3987void iemVmxVirtApicWriteRaw32(PVMCPUCC pVCpu, uint16_t offReg, uint32_t uReg) RT_NOEXCEPT;
3988VBOXSTRICTRC iemVmxInvvpid(PVMCPUCC pVCpu, uint8_t cbInstr, uint8_t iEffSeg, RTGCPTR GCPtrInvvpidDesc,
3989 uint64_t u64InvvpidType, PCVMXVEXITINFO pExitInfo) RT_NOEXCEPT;
3990bool iemVmxIsRdmsrWrmsrInterceptSet(PCVMCPU pVCpu, uint32_t uExitReason, uint32_t idMsr) RT_NOEXCEPT;
3991IEM_CIMPL_PROTO_0(iemCImpl_vmxoff);
3992IEM_CIMPL_PROTO_2(iemCImpl_vmxon, uint8_t, iEffSeg, RTGCPTR, GCPtrVmxon);
3993IEM_CIMPL_PROTO_0(iemCImpl_vmlaunch);
3994IEM_CIMPL_PROTO_0(iemCImpl_vmresume);
3995IEM_CIMPL_PROTO_2(iemCImpl_vmptrld, uint8_t, iEffSeg, RTGCPTR, GCPtrVmcs);
3996IEM_CIMPL_PROTO_2(iemCImpl_vmptrst, uint8_t, iEffSeg, RTGCPTR, GCPtrVmcs);
3997IEM_CIMPL_PROTO_2(iemCImpl_vmclear, uint8_t, iEffSeg, RTGCPTR, GCPtrVmcs);
3998IEM_CIMPL_PROTO_2(iemCImpl_vmwrite_reg, uint64_t, u64Val, uint64_t, u64VmcsField);
3999IEM_CIMPL_PROTO_3(iemCImpl_vmwrite_mem, uint8_t, iEffSeg, RTGCPTR, GCPtrVal, uint32_t, u64VmcsField);
4000IEM_CIMPL_PROTO_2(iemCImpl_vmread_reg64, uint64_t *, pu64Dst, uint64_t, u64VmcsField);
4001IEM_CIMPL_PROTO_2(iemCImpl_vmread_reg32, uint32_t *, pu32Dst, uint32_t, u32VmcsField);
4002IEM_CIMPL_PROTO_3(iemCImpl_vmread_mem_reg64, uint8_t, iEffSeg, RTGCPTR, GCPtrDst, uint32_t, u64VmcsField);
4003IEM_CIMPL_PROTO_3(iemCImpl_vmread_mem_reg32, uint8_t, iEffSeg, RTGCPTR, GCPtrDst, uint32_t, u32VmcsField);
4004IEM_CIMPL_PROTO_3(iemCImpl_invvpid, uint8_t, iEffSeg, RTGCPTR, GCPtrInvvpidDesc, uint64_t, uInvvpidType);
4005IEM_CIMPL_PROTO_3(iemCImpl_invept, uint8_t, iEffSeg, RTGCPTR, GCPtrInveptDesc, uint64_t, uInveptType);
4006IEM_CIMPL_PROTO_0(iemCImpl_vmx_pause);
4007#endif
4008
4009#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
4010VBOXSTRICTRC iemSvmVmexit(PVMCPUCC pVCpu, uint64_t uExitCode, uint64_t uExitInfo1, uint64_t uExitInfo2) RT_NOEXCEPT;
4011VBOXSTRICTRC iemHandleSvmEventIntercept(PVMCPUCC pVCpu, uint8_t u8Vector, uint32_t fFlags, uint32_t uErr, uint64_t uCr2) RT_NOEXCEPT;
4012VBOXSTRICTRC iemSvmHandleIOIntercept(PVMCPUCC pVCpu, uint16_t u16Port, SVMIOIOTYPE enmIoType, uint8_t cbReg,
4013 uint8_t cAddrSizeBits, uint8_t iEffSeg, bool fRep, bool fStrIo, uint8_t cbInstr) RT_NOEXCEPT;
4014VBOXSTRICTRC iemSvmHandleMsrIntercept(PVMCPUCC pVCpu, uint32_t idMsr, bool fWrite) RT_NOEXCEPT;
4015IEM_CIMPL_PROTO_0(iemCImpl_vmrun);
4016IEM_CIMPL_PROTO_0(iemCImpl_vmload);
4017IEM_CIMPL_PROTO_0(iemCImpl_vmsave);
4018IEM_CIMPL_PROTO_0(iemCImpl_clgi);
4019IEM_CIMPL_PROTO_0(iemCImpl_stgi);
4020IEM_CIMPL_PROTO_0(iemCImpl_invlpga);
4021IEM_CIMPL_PROTO_0(iemCImpl_skinit);
4022IEM_CIMPL_PROTO_0(iemCImpl_svm_pause);
4023#endif
4024
4025IEM_CIMPL_PROTO_0(iemCImpl_vmcall); /* vmx */
4026IEM_CIMPL_PROTO_0(iemCImpl_vmmcall); /* svm */
4027IEM_CIMPL_PROTO_1(iemCImpl_Hypercall, uint16_t, uDisOpcode); /* both */
4028
4029
4030extern const PFNIEMOP g_apfnOneByteMap[256];
4031
4032/** @} */
4033
4034RT_C_DECLS_END
4035
4036#endif /* !VMM_INCLUDED_SRC_include_IEMInternal_h */
4037
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