VirtualBox

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

Last change on this file since 100020 was 99988, checked in by vboxsync, 19 months ago

VMM/IEM: Externalized prefetch queue flushing from IEMAllCImpl.cpp so that the file can be compiled w/o access to the decoder IEMCPU members. Prevents writing non-recompiler friendly code. bugref:10369

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