1 | /* $Id: IEMMc.h 106037 2024-09-12 15:17:06Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IEM - Interpreted Execution Manager - IEM_MC_XXX.
|
---|
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_IEMMc_h
|
---|
29 | #define VMM_INCLUDED_SRC_include_IEMMc_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 |
|
---|
35 | /** @name "Microcode" macros.
|
---|
36 | *
|
---|
37 | * The idea is that we should be able to use the same code to interpret
|
---|
38 | * instructions as well as recompiler instructions. Thus this obfuscation.
|
---|
39 | *
|
---|
40 | * @{
|
---|
41 | */
|
---|
42 |
|
---|
43 | #define IEM_MC_BEGIN(a_fMcFlags, a_fCImplFlags) {
|
---|
44 | #define IEM_MC_END() }
|
---|
45 |
|
---|
46 | /** Internal macro. */
|
---|
47 | #define IEM_MC_RETURN_ON_FAILURE(a_Expr) \
|
---|
48 | do \
|
---|
49 | { \
|
---|
50 | VBOXSTRICTRC rcStrict2 = a_Expr; \
|
---|
51 | if (rcStrict2 == VINF_SUCCESS) \
|
---|
52 | { /* likely */ } \
|
---|
53 | else \
|
---|
54 | return rcStrict2; \
|
---|
55 | } while (0)
|
---|
56 |
|
---|
57 |
|
---|
58 | /** Dummy MC that prevents native recompilation. */
|
---|
59 | #define IEM_MC_NO_NATIVE_RECOMPILE() ((void)0)
|
---|
60 |
|
---|
61 | /** Advances RIP, finishes the instruction and returns.
|
---|
62 | * This may include raising debug exceptions and such. */
|
---|
63 | #define IEM_MC_ADVANCE_RIP_AND_FINISH() return iemRegAddToRipAndFinishingClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu))
|
---|
64 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
|
---|
65 | #define IEM_MC_REL_JMP_S8_AND_FINISH(a_i8) \
|
---|
66 | return iemRegRipRelativeJumpS8AndFinishClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu), (a_i8), pVCpu->iem.s.enmEffOpSize)
|
---|
67 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns.
|
---|
68 | * @note only usable in 16-bit op size mode. */
|
---|
69 | #define IEM_MC_REL_JMP_S16_AND_FINISH(a_i16) \
|
---|
70 | return iemRegRipRelativeJumpS16AndFinishClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu), (a_i16))
|
---|
71 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
|
---|
72 | #define IEM_MC_REL_JMP_S32_AND_FINISH(a_i32) \
|
---|
73 | return iemRegRipRelativeJumpS32AndFinishClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu), (a_i32), pVCpu->iem.s.enmEffOpSize)
|
---|
74 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
|
---|
75 | #define IEM_MC_SET_RIP_U16_AND_FINISH(a_u16NewIP) \
|
---|
76 | return iemRegRipJumpU16AndFinishClearingRF((pVCpu), (a_u16NewIP), IEM_GET_INSTR_LEN(pVCpu))
|
---|
77 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
|
---|
78 | #define IEM_MC_SET_RIP_U32_AND_FINISH(a_u32NewIP) \
|
---|
79 | return iemRegRipJumpU32AndFinishClearingRF((pVCpu), (a_u32NewIP), IEM_GET_INSTR_LEN(pVCpu))
|
---|
80 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
|
---|
81 | #define IEM_MC_SET_RIP_U64_AND_FINISH(a_u64NewIP) \
|
---|
82 | return iemRegRipJumpU64AndFinishClearingRF((pVCpu), (a_u64NewIP), IEM_GET_INSTR_LEN(pVCpu))
|
---|
83 |
|
---|
84 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns.
|
---|
85 | * @note only usable in 16-bit op size mode. */
|
---|
86 | #define IEM_MC_REL_CALL_S16_AND_FINISH(a_i16) \
|
---|
87 | return iemRegRipRelativeCallS16AndFinishClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu), (a_i16))
|
---|
88 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
|
---|
89 | #define IEM_MC_REL_CALL_S32_AND_FINISH(a_i32) \
|
---|
90 | return iemRegEip32RelativeCallS32AndFinishClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu), (a_i32))
|
---|
91 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
|
---|
92 | #define IEM_MC_REL_CALL_S64_AND_FINISH(a_i64) \
|
---|
93 | return iemRegRip64RelativeCallS64AndFinishClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu), (a_i64))
|
---|
94 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
|
---|
95 | #define IEM_MC_IND_CALL_U16_AND_FINISH(a_u16NewIP) \
|
---|
96 | return iemRegIp16IndirectCallU16AndFinishClearingRF((pVCpu), IEM_GET_INSTR_LEN(pVCpu), (a_u16NewIP))
|
---|
97 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
|
---|
98 | #define IEM_MC_IND_CALL_U32_AND_FINISH(a_u32NewIP) \
|
---|
99 | return iemRegEip32IndirectCallU32AndFinishClearingRF((pVCpu), IEM_GET_INSTR_LEN(pVCpu), (a_u32NewIP))
|
---|
100 | /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */
|
---|
101 | #define IEM_MC_IND_CALL_U64_AND_FINISH(a_u64NewIP) \
|
---|
102 | return iemRegRip64IndirectCallU64AndFinishClearingRF((pVCpu), IEM_GET_INSTR_LEN(pVCpu), (a_u64NewIP))
|
---|
103 |
|
---|
104 |
|
---|
105 | /** Fetches the near return address from the stack, sets RIP and RSP (may trigger
|
---|
106 | * \#GP or \#SS), finishes the instruction and returns. */
|
---|
107 | #define IEM_MC_RETN_AND_FINISH(a_u16Pop) \
|
---|
108 | return iemRegRipNearReturnAndFinishClearingRF((pVCpu), IEM_GET_INSTR_LEN(pVCpu), (a_u16Pop), pVCpu->iem.s.enmEffOpSize)
|
---|
109 |
|
---|
110 |
|
---|
111 | #define IEM_MC_RAISE_DIVIDE_ERROR() return iemRaiseDivideError(pVCpu)
|
---|
112 | #define IEM_MC_MAYBE_RAISE_DEVICE_NOT_AVAILABLE() \
|
---|
113 | do { \
|
---|
114 | if (RT_LIKELY(!(pVCpu->cpum.GstCtx.cr0 & (X86_CR0_EM | X86_CR0_TS)))) \
|
---|
115 | { /* probable */ } \
|
---|
116 | else return iemRaiseDeviceNotAvailable(pVCpu); \
|
---|
117 | } while (0)
|
---|
118 | #define IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE() \
|
---|
119 | do { \
|
---|
120 | if (RT_LIKELY(!((pVCpu->cpum.GstCtx.cr0 & (X86_CR0_MP | X86_CR0_TS)) == (X86_CR0_MP | X86_CR0_TS)))) \
|
---|
121 | { /* probable */ } \
|
---|
122 | else return iemRaiseDeviceNotAvailable(pVCpu); \
|
---|
123 | } while (0)
|
---|
124 | #define IEM_MC_MAYBE_RAISE_FPU_XCPT() \
|
---|
125 | do { \
|
---|
126 | if (RT_LIKELY(!(pVCpu->cpum.GstCtx.XState.x87.FSW & X86_FSW_ES))) \
|
---|
127 | { /* probable */ } \
|
---|
128 | else return iemRaiseMathFault(pVCpu); \
|
---|
129 | } while (0)
|
---|
130 | #define IEM_MC_MAYBE_RAISE_AVX_RELATED_XCPT() \
|
---|
131 | do { \
|
---|
132 | /* Since none of the bits we compare from XCR0, CR4 and CR0 overlap, it can \
|
---|
133 | be reduced to a single compare branch in the more probably code path. */ \
|
---|
134 | if (RT_LIKELY( ( (pVCpu->cpum.GstCtx.aXcr[0] & (XSAVE_C_YMM | XSAVE_C_SSE)) \
|
---|
135 | | (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXSAVE) \
|
---|
136 | | (pVCpu->cpum.GstCtx.cr0 & X86_CR0_TS)) \
|
---|
137 | == (XSAVE_C_YMM | XSAVE_C_SSE | X86_CR4_OSXSAVE))) \
|
---|
138 | { /* probable */ } \
|
---|
139 | else if ( (pVCpu->cpum.GstCtx.aXcr[0] & (XSAVE_C_YMM | XSAVE_C_SSE)) != (XSAVE_C_YMM | XSAVE_C_SSE) \
|
---|
140 | || !(pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXSAVE)) \
|
---|
141 | return iemRaiseUndefinedOpcode(pVCpu); \
|
---|
142 | else \
|
---|
143 | return iemRaiseDeviceNotAvailable(pVCpu); \
|
---|
144 | } while (0)
|
---|
145 | AssertCompile(!((XSAVE_C_YMM | XSAVE_C_SSE) & X86_CR4_OSXSAVE));
|
---|
146 | AssertCompile(!((XSAVE_C_YMM | XSAVE_C_SSE) & X86_CR0_TS));
|
---|
147 | AssertCompile(!(X86_CR4_OSXSAVE & X86_CR0_TS));
|
---|
148 | #define IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT() \
|
---|
149 | do { \
|
---|
150 | /* Since the CR4 and CR0 bits doesn't overlap, it can be reduced to a
|
---|
151 | single compare branch in the more probable code path. */ \
|
---|
152 | if (RT_LIKELY( ( (pVCpu->cpum.GstCtx.cr0 & (X86_CR0_EM | X86_CR0_TS)) \
|
---|
153 | | (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSFXSR)) \
|
---|
154 | == X86_CR4_OSFXSR)) \
|
---|
155 | { /* likely */ } \
|
---|
156 | else if ( (pVCpu->cpum.GstCtx.cr0 & X86_CR0_EM) \
|
---|
157 | || !(pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSFXSR)) \
|
---|
158 | return iemRaiseUndefinedOpcode(pVCpu); \
|
---|
159 | else \
|
---|
160 | return iemRaiseDeviceNotAvailable(pVCpu); \
|
---|
161 | } while (0)
|
---|
162 | AssertCompile(!((X86_CR0_EM | X86_CR0_TS) & X86_CR4_OSFXSR));
|
---|
163 | #define IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT() \
|
---|
164 | do { \
|
---|
165 | /* Since the two CR0 bits doesn't overlap with FSW.ES, this can be reduced to a
|
---|
166 | single compare branch in the more probable code path. */ \
|
---|
167 | if (RT_LIKELY(!( (pVCpu->cpum.GstCtx.cr0 & (X86_CR0_EM | X86_CR0_TS)) \
|
---|
168 | | (pVCpu->cpum.GstCtx.XState.x87.FSW & X86_FSW_ES)))) \
|
---|
169 | { /* probable */ } \
|
---|
170 | else if (pVCpu->cpum.GstCtx.cr0 & X86_CR0_EM) \
|
---|
171 | return iemRaiseUndefinedOpcode(pVCpu); \
|
---|
172 | else if (pVCpu->cpum.GstCtx.cr0 & X86_CR0_TS) \
|
---|
173 | return iemRaiseDeviceNotAvailable(pVCpu); \
|
---|
174 | else \
|
---|
175 | return iemRaiseMathFault(pVCpu); \
|
---|
176 | } while (0)
|
---|
177 | AssertCompile(!((X86_CR0_EM | X86_CR0_TS) & X86_FSW_ES));
|
---|
178 | /** @todo recomp: this one is slightly problematic as the recompiler doesn't
|
---|
179 | * count the CPL into the TB key. However it is safe enough for now, as
|
---|
180 | * it calls iemRaiseGeneralProtectionFault0 directly so no calls will be
|
---|
181 | * emitted for it. */
|
---|
182 | #define IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO() \
|
---|
183 | do { \
|
---|
184 | if (RT_LIKELY(IEM_GET_CPL(pVCpu) == 0)) { /* probable */ } \
|
---|
185 | else return iemRaiseGeneralProtectionFault0(pVCpu); \
|
---|
186 | } while (0)
|
---|
187 | #define IEM_MC_RAISE_GP0_IF_EFF_ADDR_UNALIGNED(a_EffAddr, a_cbAlign) \
|
---|
188 | do { \
|
---|
189 | if (!((a_EffAddr) & ((a_cbAlign) - 1))) { /* likely */ } \
|
---|
190 | else return iemRaiseGeneralProtectionFault0(pVCpu); \
|
---|
191 | } while (0)
|
---|
192 | #define IEM_MC_MAYBE_RAISE_FSGSBASE_XCPT() \
|
---|
193 | do { \
|
---|
194 | if (RT_LIKELY( ((pVCpu->cpum.GstCtx.cr4 & X86_CR4_FSGSBASE) | IEM_GET_CPU_MODE(pVCpu)) \
|
---|
195 | == (X86_CR4_FSGSBASE | IEMMODE_64BIT))) \
|
---|
196 | { /* probable */ } \
|
---|
197 | else return iemRaiseUndefinedOpcode(pVCpu); \
|
---|
198 | } while (0)
|
---|
199 | AssertCompile(X86_CR4_FSGSBASE > UINT8_MAX);
|
---|
200 | #define IEM_MC_MAYBE_RAISE_NON_CANONICAL_ADDR_GP0(a_u64Addr) \
|
---|
201 | do { \
|
---|
202 | if (RT_LIKELY(IEM_IS_CANONICAL(a_u64Addr))) { /* likely */ } \
|
---|
203 | else return iemRaiseGeneralProtectionFault0(pVCpu); \
|
---|
204 | } while (0)
|
---|
205 |
|
---|
206 |
|
---|
207 | #define IEM_MC_LOCAL(a_Type, a_Name) a_Type a_Name
|
---|
208 | #define IEM_MC_LOCAL_ASSIGN(a_Type, a_Name, a_Value) a_Type a_Name = (a_Value)
|
---|
209 | #define IEM_MC_LOCAL_CONST(a_Type, a_Name, a_Value) a_Type const a_Name = (a_Value)
|
---|
210 | #define IEM_MC_NOREF(a_Name) RT_NOREF_PV(a_Name) /* NOP/liveness hack */
|
---|
211 | #define IEM_MC_ARG(a_Type, a_Name, a_iArg) a_Type a_Name
|
---|
212 | #define IEM_MC_ARG_CONST(a_Type, a_Name, a_Value, a_iArg) a_Type const a_Name = (a_Value)
|
---|
213 | #define IEM_MC_ARG_LOCAL_REF(a_Type, a_Name, a_Local, a_iArg) a_Type const a_Name = &(a_Local)
|
---|
214 | /** @note IEMAllInstPython.py duplicates the expansion. */
|
---|
215 | #define IEM_MC_ARG_EFLAGS(a_Name, a_iArg) uint32_t const a_Name = pVCpu->cpum.GstCtx.eflags.u
|
---|
216 | /** @note IEMAllInstPython.py duplicates the expansion. */
|
---|
217 | #define IEM_MC_ARG_LOCAL_EFLAGS(a_pName, a_Name, a_iArg) \
|
---|
218 | uint32_t a_Name = pVCpu->cpum.GstCtx.eflags.u; \
|
---|
219 | uint32_t *a_pName = &a_Name
|
---|
220 | /** @note IEMAllInstPython.py duplicates the expansion. */
|
---|
221 | #define IEM_MC_LOCAL_EFLAGS(a_Name) uint32_t a_Name = pVCpu->cpum.GstCtx.eflags.u
|
---|
222 | #define IEM_MC_COMMIT_EFLAGS(a_EFlags) \
|
---|
223 | do { pVCpu->cpum.GstCtx.eflags.u = (a_EFlags); Assert(pVCpu->cpum.GstCtx.eflags.u & X86_EFL_1); } while (0)
|
---|
224 | #define IEM_MC_COMMIT_EFLAGS_EX(a_EFlags, a_fEflInput, a_fEflOutput) do { \
|
---|
225 | AssertMsg((pVCpu->cpum.GstCtx.eflags.u & ~(a_fEflOutput)) == ((a_EFlags) & ~(a_fEflOutput)), \
|
---|
226 | ("eflags.u=%#x (%#x) vs %s=%#x (%#x) - diff %#x (a_fEflOutput=%#x)\n", \
|
---|
227 | pVCpu->cpum.GstCtx.eflags.u & ~(a_fEflOutput), pVCpu->cpum.GstCtx.eflags.u, #a_EFlags, \
|
---|
228 | (a_EFlags) & ~(a_fEflOutput), (a_EFlags), \
|
---|
229 | (pVCpu->cpum.GstCtx.eflags.u & ~(a_fEflOutput)) ^ ((a_EFlags) & ~(a_fEflOutput)), a_fEflOutput)); \
|
---|
230 | pVCpu->cpum.GstCtx.eflags.u = (a_EFlags); \
|
---|
231 | Assert(pVCpu->cpum.GstCtx.eflags.u & X86_EFL_1); \
|
---|
232 | } while (0)
|
---|
233 | #define IEM_MC_COMMIT_EFLAGS_OPT(a_EFlags) IEM_MC_COMMIT_EFLAGS(a_EFlags)
|
---|
234 | #define IEM_MC_COMMIT_EFLAGS_OPT_EX(a_EFlags, a_fEflInput, a_fEflOutput) IEM_MC_COMMIT_EFLAGS_EX(a_EFlags, a_fEflInput, a_fEflOutput)
|
---|
235 |
|
---|
236 | /** ASSUMES the source variable not used after this statement. */
|
---|
237 | #define IEM_MC_ASSIGN_TO_SMALLER(a_VarDst, a_VarSrcEol) (a_VarDst) = (a_VarSrcEol)
|
---|
238 |
|
---|
239 | #define IEM_MC_FETCH_GREG_U8(a_u8Dst, a_iGReg) (a_u8Dst) = iemGRegFetchU8(pVCpu, (a_iGReg))
|
---|
240 | #define IEM_MC_FETCH_GREG_U8_ZX_U16(a_u16Dst, a_iGReg) (a_u16Dst) = iemGRegFetchU8(pVCpu, (a_iGReg))
|
---|
241 | #define IEM_MC_FETCH_GREG_U8_ZX_U32(a_u32Dst, a_iGReg) (a_u32Dst) = iemGRegFetchU8(pVCpu, (a_iGReg))
|
---|
242 | #define IEM_MC_FETCH_GREG_U8_ZX_U64(a_u64Dst, a_iGReg) (a_u64Dst) = iemGRegFetchU8(pVCpu, (a_iGReg))
|
---|
243 | #define IEM_MC_FETCH_GREG_U8_SX_U16(a_u16Dst, a_iGReg) (a_u16Dst) = (int8_t)iemGRegFetchU8(pVCpu, (a_iGReg))
|
---|
244 | #define IEM_MC_FETCH_GREG_U8_SX_U32(a_u32Dst, a_iGReg) (a_u32Dst) = (int8_t)iemGRegFetchU8(pVCpu, (a_iGReg))
|
---|
245 | #define IEM_MC_FETCH_GREG_U8_SX_U64(a_u64Dst, a_iGReg) (a_u64Dst) = (int8_t)iemGRegFetchU8(pVCpu, (a_iGReg))
|
---|
246 | #define IEM_MC_FETCH_GREG_I16(a_i16Dst, a_iGReg) (a_i16Dst) = (int16_t)iemGRegFetchU16(pVCpu, (a_iGReg))
|
---|
247 | #define IEM_MC_FETCH_GREG_U16(a_u16Dst, a_iGReg) (a_u16Dst) = iemGRegFetchU16(pVCpu, (a_iGReg))
|
---|
248 | #define IEM_MC_FETCH_GREG_U16_ZX_U32(a_u32Dst, a_iGReg) (a_u32Dst) = iemGRegFetchU16(pVCpu, (a_iGReg))
|
---|
249 | #define IEM_MC_FETCH_GREG_U16_ZX_U64(a_u64Dst, a_iGReg) (a_u64Dst) = iemGRegFetchU16(pVCpu, (a_iGReg))
|
---|
250 | #define IEM_MC_FETCH_GREG_U16_SX_U32(a_u32Dst, a_iGReg) (a_u32Dst) = (int16_t)iemGRegFetchU16(pVCpu, (a_iGReg))
|
---|
251 | #define IEM_MC_FETCH_GREG_U16_SX_U64(a_u64Dst, a_iGReg) (a_u64Dst) = (int16_t)iemGRegFetchU16(pVCpu, (a_iGReg))
|
---|
252 | #define IEM_MC_FETCH_GREG_I32(a_i32Dst, a_iGReg) (a_i32Dst) = (int32_t)iemGRegFetchU32(pVCpu, (a_iGReg))
|
---|
253 | #define IEM_MC_FETCH_GREG_U32(a_u32Dst, a_iGReg) (a_u32Dst) = iemGRegFetchU32(pVCpu, (a_iGReg))
|
---|
254 | #define IEM_MC_FETCH_GREG_U32_ZX_U64(a_u64Dst, a_iGReg) (a_u64Dst) = iemGRegFetchU32(pVCpu, (a_iGReg))
|
---|
255 | #define IEM_MC_FETCH_GREG_U32_SX_U64(a_u64Dst, a_iGReg) (a_u64Dst) = (int32_t)iemGRegFetchU32(pVCpu, (a_iGReg))
|
---|
256 | #define IEM_MC_FETCH_GREG_U64(a_u64Dst, a_iGReg) (a_u64Dst) = iemGRegFetchU64(pVCpu, (a_iGReg))
|
---|
257 | #define IEM_MC_FETCH_GREG_U64_ZX_U64 IEM_MC_FETCH_GREG_U64
|
---|
258 | #define IEM_MC_FETCH_GREG_PAIR_U32(a_u64Dst, a_iGRegLo, a_iGRegHi) do { \
|
---|
259 | (a_u64Dst).s.Lo = iemGRegFetchU32(pVCpu, (a_iGRegLo)); \
|
---|
260 | (a_u64Dst).s.Hi = iemGRegFetchU32(pVCpu, (a_iGRegHi)); \
|
---|
261 | } while(0)
|
---|
262 | #define IEM_MC_FETCH_GREG_PAIR_U64(a_u128Dst, a_iGRegLo, a_iGRegHi) do { \
|
---|
263 | (a_u128Dst).s.Lo = iemGRegFetchU64(pVCpu, (a_iGRegLo)); \
|
---|
264 | (a_u128Dst).s.Hi = iemGRegFetchU64(pVCpu, (a_iGRegHi)); \
|
---|
265 | } while(0)
|
---|
266 | #define IEM_MC_FETCH_SREG_U16(a_u16Dst, a_iSReg) do { \
|
---|
267 | IEM_CTX_IMPORT_NORET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(a_iSReg)); \
|
---|
268 | (a_u16Dst) = iemSRegFetchU16(pVCpu, (a_iSReg)); \
|
---|
269 | } while (0)
|
---|
270 | #define IEM_MC_FETCH_SREG_ZX_U32(a_u32Dst, a_iSReg) do { \
|
---|
271 | IEM_CTX_IMPORT_NORET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(a_iSReg)); \
|
---|
272 | (a_u32Dst) = iemSRegFetchU16(pVCpu, (a_iSReg)); \
|
---|
273 | } while (0)
|
---|
274 | #define IEM_MC_FETCH_SREG_ZX_U64(a_u64Dst, a_iSReg) do { \
|
---|
275 | IEM_CTX_IMPORT_NORET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(a_iSReg)); \
|
---|
276 | (a_u64Dst) = iemSRegFetchU16(pVCpu, (a_iSReg)); \
|
---|
277 | } while (0)
|
---|
278 | /** @todo IEM_MC_FETCH_SREG_BASE_U64 & IEM_MC_FETCH_SREG_BASE_U32 probably aren't worth it... */
|
---|
279 | #define IEM_MC_FETCH_SREG_BASE_U64(a_u64Dst, a_iSReg) do { \
|
---|
280 | IEM_CTX_IMPORT_NORET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(a_iSReg)); \
|
---|
281 | (a_u64Dst) = iemSRegBaseFetchU64(pVCpu, (a_iSReg)); \
|
---|
282 | } while (0)
|
---|
283 | #define IEM_MC_FETCH_SREG_BASE_U32(a_u32Dst, a_iSReg) do { \
|
---|
284 | IEM_CTX_IMPORT_NORET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(a_iSReg)); \
|
---|
285 | (a_u32Dst) = iemSRegBaseFetchU64(pVCpu, (a_iSReg)); \
|
---|
286 | } while (0)
|
---|
287 | /** @note Not for IOPL or IF testing or modification. */
|
---|
288 | #define IEM_MC_FETCH_EFLAGS(a_EFlags) (a_EFlags) = pVCpu->cpum.GstCtx.eflags.u
|
---|
289 | #define IEM_MC_FETCH_EFLAGS_EX(a_EFlags, a_fEflInput, a_fEflOutput) IEM_MC_FETCH_EFLAGS(a_EFlags)
|
---|
290 | #define IEM_MC_FETCH_EFLAGS_U8(a_EFlags) (a_EFlags) = (uint8_t)pVCpu->cpum.GstCtx.eflags.u /* (only LAHF) */
|
---|
291 | #define IEM_MC_FETCH_FSW(a_u16Fsw) (a_u16Fsw) = pVCpu->cpum.GstCtx.XState.x87.FSW
|
---|
292 | #define IEM_MC_FETCH_FCW(a_u16Fcw) (a_u16Fcw) = pVCpu->cpum.GstCtx.XState.x87.FCW
|
---|
293 |
|
---|
294 | #define IEM_MC_STORE_GREG_U8(a_iGReg, a_u8Value) *iemGRegRefU8( pVCpu, (a_iGReg)) = (a_u8Value)
|
---|
295 | #define IEM_MC_STORE_GREG_U16(a_iGReg, a_u16Value) *iemGRegRefU16(pVCpu, (a_iGReg)) = (a_u16Value)
|
---|
296 | #define IEM_MC_STORE_GREG_U32(a_iGReg, a_u32Value) *iemGRegRefU64(pVCpu, (a_iGReg)) = (uint32_t)(a_u32Value) /* clear high bits. */
|
---|
297 | #define IEM_MC_STORE_GREG_I32(a_iGReg, a_i32Value) *iemGRegRefU64(pVCpu, (a_iGReg)) = (uint32_t)(a_i32Value) /* clear high bits. */
|
---|
298 | #define IEM_MC_STORE_GREG_U64(a_iGReg, a_u64Value) *iemGRegRefU64(pVCpu, (a_iGReg)) = (a_u64Value)
|
---|
299 | #define IEM_MC_STORE_GREG_I64(a_iGReg, a_i64Value) *iemGRegRefI64(pVCpu, (a_iGReg)) = (a_i64Value)
|
---|
300 | #define IEM_MC_STORE_GREG_U8_CONST IEM_MC_STORE_GREG_U8
|
---|
301 | #define IEM_MC_STORE_GREG_U16_CONST IEM_MC_STORE_GREG_U16
|
---|
302 | #define IEM_MC_STORE_GREG_U32_CONST IEM_MC_STORE_GREG_U32
|
---|
303 | #define IEM_MC_STORE_GREG_U64_CONST IEM_MC_STORE_GREG_U64
|
---|
304 | #define IEM_MC_STORE_GREG_PAIR_U32(a_iGRegLo, a_iGRegHi, a_u64Value) do { \
|
---|
305 | *iemGRegRefU64(pVCpu, (a_iGRegLo)) = (uint32_t)(a_u64Value).s.Lo; \
|
---|
306 | *iemGRegRefU64(pVCpu, (a_iGRegHi)) = (uint32_t)(a_u64Value).s.Hi; \
|
---|
307 | } while(0)
|
---|
308 | #define IEM_MC_STORE_GREG_PAIR_U64(a_iGRegLo, a_iGRegHi, a_u128Value) do { \
|
---|
309 | *iemGRegRefU64(pVCpu, (a_iGRegLo)) = (uint64_t)(a_u128Value).s.Lo; \
|
---|
310 | *iemGRegRefU64(pVCpu, (a_iGRegHi)) = (uint64_t)(a_u128Value).s.Hi; \
|
---|
311 | } while(0)
|
---|
312 | #define IEM_MC_CLEAR_HIGH_GREG_U64(a_iGReg) *iemGRegRefU64(pVCpu, (a_iGReg)) &= UINT32_MAX
|
---|
313 |
|
---|
314 | /** @todo IEM_MC_STORE_SREG_BASE_U64 & IEM_MC_STORE_SREG_BASE_U32 aren't worth it... */
|
---|
315 | #define IEM_MC_STORE_SREG_BASE_U64(a_iSReg, a_u64Value) do { \
|
---|
316 | IEM_CTX_IMPORT_NORET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(a_iSReg)); \
|
---|
317 | *iemSRegBaseRefU64(pVCpu, (a_iSReg)) = (a_u64Value); \
|
---|
318 | } while (0)
|
---|
319 | #define IEM_MC_STORE_SREG_BASE_U32(a_iSReg, a_u32Value) do { \
|
---|
320 | IEM_CTX_IMPORT_NORET(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(a_iSReg)); \
|
---|
321 | *iemSRegBaseRefU64(pVCpu, (a_iSReg)) = (uint32_t)(a_u32Value); /* clear high bits. */ \
|
---|
322 | } while (0)
|
---|
323 | #define IEM_MC_STORE_FPUREG_R80_SRC_REF(a_iSt, a_pr80Src) \
|
---|
324 | do { pVCpu->cpum.GstCtx.XState.x87.aRegs[a_iSt].r80 = *(a_pr80Src); } while (0)
|
---|
325 |
|
---|
326 |
|
---|
327 | #define IEM_MC_REF_GREG_U8(a_pu8Dst, a_iGReg) (a_pu8Dst) = iemGRegRefU8( pVCpu, (a_iGReg))
|
---|
328 | #define IEM_MC_REF_GREG_U8_CONST(a_pu8Dst, a_iGReg) (a_pu8Dst) = (uint8_t const *)iemGRegRefU8( pVCpu, (a_iGReg))
|
---|
329 | #define IEM_MC_REF_GREG_U16(a_pu16Dst, a_iGReg) (a_pu16Dst) = iemGRegRefU16(pVCpu, (a_iGReg))
|
---|
330 | #define IEM_MC_REF_GREG_U16_CONST(a_pu16Dst, a_iGReg) (a_pu16Dst) = (uint16_t const *)iemGRegRefU16(pVCpu, (a_iGReg))
|
---|
331 | /** @todo User of IEM_MC_REF_GREG_U32 needs to clear the high bits on commit.
|
---|
332 | * Use IEM_MC_CLEAR_HIGH_GREG_U64! */
|
---|
333 | #define IEM_MC_REF_GREG_U32(a_pu32Dst, a_iGReg) (a_pu32Dst) = iemGRegRefU32(pVCpu, (a_iGReg))
|
---|
334 | #define IEM_MC_REF_GREG_U32_CONST(a_pu32Dst, a_iGReg) (a_pu32Dst) = (uint32_t const *)iemGRegRefU32(pVCpu, (a_iGReg))
|
---|
335 | #define IEM_MC_REF_GREG_I32(a_pi32Dst, a_iGReg) (a_pi32Dst) = (int32_t *)iemGRegRefU32(pVCpu, (a_iGReg))
|
---|
336 | #define IEM_MC_REF_GREG_I32_CONST(a_pi32Dst, a_iGReg) (a_pi32Dst) = (int32_t const *)iemGRegRefU32(pVCpu, (a_iGReg))
|
---|
337 | #define IEM_MC_REF_GREG_U64(a_pu64Dst, a_iGReg) (a_pu64Dst) = iemGRegRefU64(pVCpu, (a_iGReg))
|
---|
338 | #define IEM_MC_REF_GREG_U64_CONST(a_pu64Dst, a_iGReg) (a_pu64Dst) = (uint64_t const *)iemGRegRefU64(pVCpu, (a_iGReg))
|
---|
339 | #define IEM_MC_REF_GREG_I64(a_pi64Dst, a_iGReg) (a_pi64Dst) = (int64_t *)iemGRegRefU64(pVCpu, (a_iGReg))
|
---|
340 | #define IEM_MC_REF_GREG_I64_CONST(a_pi64Dst, a_iGReg) (a_pi64Dst) = (int64_t const *)iemGRegRefU64(pVCpu, (a_iGReg))
|
---|
341 | /** @note Not for IOPL or IF testing or modification.
|
---|
342 | * @note Must preserve any undefined bits, see CPUMX86EFLAGS! */
|
---|
343 | #define IEM_MC_REF_EFLAGS(a_pEFlags) (a_pEFlags) = &pVCpu->cpum.GstCtx.eflags.uBoth
|
---|
344 | #define IEM_MC_REF_EFLAGS_EX(a_pEFlags, a_fEflInput, a_fEflOutput) IEM_MC_REF_EFLAGS(a_pEFlags)
|
---|
345 |
|
---|
346 | #define IEM_MC_ADD_GREG_U16(a_iGReg, a_u16Value) *iemGRegRefU16(pVCpu, (a_iGReg)) += (a_u16Value)
|
---|
347 | #define IEM_MC_ADD_GREG_U32(a_iGReg, a_u32Value) \
|
---|
348 | do { \
|
---|
349 | uint32_t *pu32Reg = iemGRegRefU32(pVCpu, (a_iGReg)); \
|
---|
350 | *pu32Reg += (a_u32Value); \
|
---|
351 | pu32Reg[1] = 0; /* implicitly clear the high bit. */ \
|
---|
352 | } while (0)
|
---|
353 | #define IEM_MC_ADD_GREG_U64(a_iGReg, a_u64Value) *iemGRegRefU64(pVCpu, (a_iGReg)) += (a_u64Value)
|
---|
354 |
|
---|
355 | #define IEM_MC_SUB_GREG_U16(a_iGReg, a_u8Const) *iemGRegRefU16(pVCpu, (a_iGReg)) -= (a_u8Const)
|
---|
356 | #define IEM_MC_SUB_GREG_U32(a_iGReg, a_u8Const) \
|
---|
357 | do { \
|
---|
358 | uint32_t *pu32Reg = iemGRegRefU32(pVCpu, (a_iGReg)); \
|
---|
359 | *pu32Reg -= (a_u8Const); \
|
---|
360 | pu32Reg[1] = 0; /* implicitly clear the high bit. */ \
|
---|
361 | } while (0)
|
---|
362 | #define IEM_MC_SUB_GREG_U64(a_iGReg, a_u8Const) *iemGRegRefU64(pVCpu, (a_iGReg)) -= (a_u8Const)
|
---|
363 | #define IEM_MC_SUB_LOCAL_U16(a_u16Value, a_u16Const) do { (a_u16Value) -= a_u16Const; } while (0)
|
---|
364 |
|
---|
365 | #define IEM_MC_ADD_GREG_U8_TO_LOCAL(a_u8Value, a_iGReg) do { (a_u8Value) += iemGRegFetchU8( pVCpu, (a_iGReg)); } while (0)
|
---|
366 | #define IEM_MC_ADD_GREG_U16_TO_LOCAL(a_u16Value, a_iGReg) do { (a_u16Value) += iemGRegFetchU16(pVCpu, (a_iGReg)); } while (0)
|
---|
367 | #define IEM_MC_ADD_GREG_U32_TO_LOCAL(a_u32Value, a_iGReg) do { (a_u32Value) += iemGRegFetchU32(pVCpu, (a_iGReg)); } while (0)
|
---|
368 | #define IEM_MC_ADD_GREG_U64_TO_LOCAL(a_u64Value, a_iGReg) do { (a_u64Value) += iemGRegFetchU64(pVCpu, (a_iGReg)); } while (0)
|
---|
369 | #define IEM_MC_ADD_LOCAL_S16_TO_EFF_ADDR(a_EffAddr, a_i16) do { (a_EffAddr) += (a_i16); } while (0)
|
---|
370 | #define IEM_MC_ADD_LOCAL_S32_TO_EFF_ADDR(a_EffAddr, a_i32) do { (a_EffAddr) += (a_i32); } while (0)
|
---|
371 | #define IEM_MC_ADD_LOCAL_S64_TO_EFF_ADDR(a_EffAddr, a_i64) do { (a_EffAddr) += (a_i64); } while (0)
|
---|
372 |
|
---|
373 | #define IEM_MC_AND_LOCAL_U8(a_u8Local, a_u8Mask) do { (a_u8Local) &= (a_u8Mask); } while (0)
|
---|
374 | #define IEM_MC_AND_LOCAL_U16(a_u16Local, a_u16Mask) do { (a_u16Local) &= (a_u16Mask); } while (0)
|
---|
375 | #define IEM_MC_AND_LOCAL_U32(a_u32Local, a_u32Mask) do { (a_u32Local) &= (a_u32Mask); } while (0)
|
---|
376 | #define IEM_MC_AND_LOCAL_U64(a_u64Local, a_u64Mask) do { (a_u64Local) &= (a_u64Mask); } while (0)
|
---|
377 |
|
---|
378 | #define IEM_MC_AND_ARG_U16(a_u16Arg, a_u16Mask) do { (a_u16Arg) &= (a_u16Mask); } while (0)
|
---|
379 | #define IEM_MC_AND_ARG_U32(a_u32Arg, a_u32Mask) do { (a_u32Arg) &= (a_u32Mask); } while (0)
|
---|
380 | #define IEM_MC_AND_ARG_U64(a_u64Arg, a_u64Mask) do { (a_u64Arg) &= (a_u64Mask); } while (0)
|
---|
381 |
|
---|
382 | #define IEM_MC_OR_LOCAL_U8(a_u8Local, a_u8Mask) do { (a_u8Local) |= (a_u8Mask); } while (0)
|
---|
383 | #define IEM_MC_OR_LOCAL_U16(a_u16Local, a_u16Mask) do { (a_u16Local) |= (a_u16Mask); } while (0)
|
---|
384 | #define IEM_MC_OR_LOCAL_U32(a_u32Local, a_u32Mask) do { (a_u32Local) |= (a_u32Mask); } while (0)
|
---|
385 |
|
---|
386 | #define IEM_MC_SAR_LOCAL_S16(a_i16Local, a_cShift) do { (a_i16Local) >>= (a_cShift); } while (0)
|
---|
387 | #define IEM_MC_SAR_LOCAL_S32(a_i32Local, a_cShift) do { (a_i32Local) >>= (a_cShift); } while (0)
|
---|
388 | #define IEM_MC_SAR_LOCAL_S64(a_i64Local, a_cShift) do { (a_i64Local) >>= (a_cShift); } while (0)
|
---|
389 |
|
---|
390 | #define IEM_MC_SHR_LOCAL_U8(a_u8Local, a_cShift) do { (a_u8Local) >>= (a_cShift); } while (0)
|
---|
391 |
|
---|
392 | #define IEM_MC_SHL_LOCAL_S16(a_i16Local, a_cShift) do { (a_i16Local) <<= (a_cShift); } while (0)
|
---|
393 | #define IEM_MC_SHL_LOCAL_S32(a_i32Local, a_cShift) do { (a_i32Local) <<= (a_cShift); } while (0)
|
---|
394 | #define IEM_MC_SHL_LOCAL_S64(a_i64Local, a_cShift) do { (a_i64Local) <<= (a_cShift); } while (0)
|
---|
395 |
|
---|
396 | #define IEM_MC_AND_2LOCS_U32(a_u32Local, a_u32Mask) do { (a_u32Local) &= (a_u32Mask); } while (0)
|
---|
397 |
|
---|
398 | #define IEM_MC_OR_2LOCS_U32(a_u32Local, a_u32Mask) do { (a_u32Local) |= (a_u32Mask); } while (0)
|
---|
399 |
|
---|
400 | #define IEM_MC_AND_GREG_U8(a_iGReg, a_u8Value) *iemGRegRefU8( pVCpu, (a_iGReg)) &= (a_u8Value)
|
---|
401 | #define IEM_MC_AND_GREG_U16(a_iGReg, a_u16Value) *iemGRegRefU16(pVCpu, (a_iGReg)) &= (a_u16Value)
|
---|
402 | #define IEM_MC_AND_GREG_U32(a_iGReg, a_u32Value) \
|
---|
403 | do { \
|
---|
404 | uint32_t *pu32Reg = iemGRegRefU32(pVCpu, (a_iGReg)); \
|
---|
405 | *pu32Reg &= (a_u32Value); \
|
---|
406 | pu32Reg[1] = 0; /* implicitly clear the high bit. */ \
|
---|
407 | } while (0)
|
---|
408 | #define IEM_MC_AND_GREG_U64(a_iGReg, a_u64Value) *iemGRegRefU64(pVCpu, (a_iGReg)) &= (a_u64Value)
|
---|
409 |
|
---|
410 | #define IEM_MC_OR_GREG_U8(a_iGReg, a_u8Value) *iemGRegRefU8( pVCpu, (a_iGReg)) |= (a_u8Value)
|
---|
411 | #define IEM_MC_OR_GREG_U16(a_iGReg, a_u16Value) *iemGRegRefU16(pVCpu, (a_iGReg)) |= (a_u16Value)
|
---|
412 | #define IEM_MC_OR_GREG_U32(a_iGReg, a_u32Value) \
|
---|
413 | do { \
|
---|
414 | uint32_t *pu32Reg = iemGRegRefU32(pVCpu, (a_iGReg)); \
|
---|
415 | *pu32Reg |= (a_u32Value); \
|
---|
416 | pu32Reg[1] = 0; /* implicitly clear the high bit. */ \
|
---|
417 | } while (0)
|
---|
418 | #define IEM_MC_OR_GREG_U64(a_iGReg, a_u64Value) *iemGRegRefU64(pVCpu, (a_iGReg)) |= (a_u64Value)
|
---|
419 |
|
---|
420 | #define IEM_MC_BSWAP_LOCAL_U16(a_u16Local) (a_u16Local) = RT_BSWAP_U16((a_u16Local));
|
---|
421 | #define IEM_MC_BSWAP_LOCAL_U32(a_u32Local) (a_u32Local) = RT_BSWAP_U32((a_u32Local));
|
---|
422 | #define IEM_MC_BSWAP_LOCAL_U64(a_u64Local) (a_u64Local) = RT_BSWAP_U64((a_u64Local));
|
---|
423 |
|
---|
424 | /** @note Not for IOPL or IF modification. */
|
---|
425 | #define IEM_MC_SET_EFL_BIT(a_fBit) do { pVCpu->cpum.GstCtx.eflags.u |= (a_fBit); } while (0)
|
---|
426 | /** @note Not for IOPL or IF modification. */
|
---|
427 | #define IEM_MC_CLEAR_EFL_BIT(a_fBit) do { pVCpu->cpum.GstCtx.eflags.u &= ~(a_fBit); } while (0)
|
---|
428 | /** @note Not for IOPL or IF modification. */
|
---|
429 | #define IEM_MC_FLIP_EFL_BIT(a_fBit) do { pVCpu->cpum.GstCtx.eflags.u ^= (a_fBit); } while (0)
|
---|
430 |
|
---|
431 | #define IEM_MC_CLEAR_FSW_EX() do { pVCpu->cpum.GstCtx.XState.x87.FSW &= X86_FSW_C_MASK | X86_FSW_TOP_MASK; } while (0)
|
---|
432 |
|
---|
433 | /** Switches the FPU state to MMX mode (FSW.TOS=0, FTW=0) if necessary. */
|
---|
434 | #define IEM_MC_FPU_TO_MMX_MODE() do { \
|
---|
435 | iemFpuRotateStackSetTop(&pVCpu->cpum.GstCtx.XState.x87, 0); \
|
---|
436 | pVCpu->cpum.GstCtx.XState.x87.FSW &= ~X86_FSW_TOP_MASK; \
|
---|
437 | pVCpu->cpum.GstCtx.XState.x87.FTW = 0xff; \
|
---|
438 | } while (0)
|
---|
439 |
|
---|
440 | /** Switches the FPU state from MMX mode (FSW.TOS=0, FTW=0xffff). */
|
---|
441 | #define IEM_MC_FPU_FROM_MMX_MODE() do { \
|
---|
442 | iemFpuRotateStackSetTop(&pVCpu->cpum.GstCtx.XState.x87, 0); \
|
---|
443 | pVCpu->cpum.GstCtx.XState.x87.FSW &= ~X86_FSW_TOP_MASK; \
|
---|
444 | pVCpu->cpum.GstCtx.XState.x87.FTW = 0; \
|
---|
445 | } while (0)
|
---|
446 |
|
---|
447 | #define IEM_MC_FETCH_MREG_U64(a_u64Value, a_iMReg) \
|
---|
448 | do { (a_u64Value) = pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].mmx; } while (0)
|
---|
449 | #define IEM_MC_FETCH_MREG_U32(a_u32Value, a_iMReg, a_iDWord) \
|
---|
450 | do { (a_u32Value) = pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au32[a_iDWord]; } while (0)
|
---|
451 | #define IEM_MC_FETCH_MREG_U16(a_u16Value, a_iMReg, a_iWord) \
|
---|
452 | do { (a_u16Value) = pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au16[a_iWord]; } while (0)
|
---|
453 | #define IEM_MC_FETCH_MREG_U8(a_u8Value, a_iMReg, a_iByte) \
|
---|
454 | do { (a_u8Value) = pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au8[a_iByte]; } while (0)
|
---|
455 | #define IEM_MC_STORE_MREG_U64(a_iMReg, a_u64Value) \
|
---|
456 | do { pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].mmx = (a_u64Value); \
|
---|
457 | pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au32[2] = 0xffff; \
|
---|
458 | } while (0)
|
---|
459 | #define IEM_MC_STORE_MREG_U32(a_iMReg, a_iDword, a_u32Value) \
|
---|
460 | do { pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au32[(a_iDword)] = (a_u32Value); \
|
---|
461 | pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au32[2] = 0xffff; \
|
---|
462 | } while (0)
|
---|
463 | #define IEM_MC_STORE_MREG_U16(a_iMReg, a_iWord, a_u16Value) \
|
---|
464 | do { pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au16[(a_iWord)] = (a_u16Value); \
|
---|
465 | pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au32[2] = 0xffff; \
|
---|
466 | } while (0)
|
---|
467 | #define IEM_MC_STORE_MREG_U8(a_iMReg, a_iByte, a_u8Value) \
|
---|
468 | do { pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au8[(a_iByte)] = (a_u8Value); \
|
---|
469 | pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au32[2] = 0xffff; \
|
---|
470 | } while (0)
|
---|
471 | #define IEM_MC_STORE_MREG_U32_ZX_U64(a_iMReg, a_u32Value) \
|
---|
472 | do { pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].mmx = (uint32_t)(a_u32Value); \
|
---|
473 | pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au32[2] = 0xffff; \
|
---|
474 | } while (0)
|
---|
475 | #define IEM_MC_REF_MREG_U64(a_pu64Dst, a_iMReg) /** @todo need to set high word to 0xffff on commit (see IEM_MC_STORE_MREG_U64) */ \
|
---|
476 | (a_pu64Dst) = (&pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].mmx)
|
---|
477 | #define IEM_MC_REF_MREG_U64_CONST(a_pu64Dst, a_iMReg) \
|
---|
478 | (a_pu64Dst) = ((uint64_t const *)&pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].mmx)
|
---|
479 | #define IEM_MC_REF_MREG_U32_CONST(a_pu32Dst, a_iMReg) \
|
---|
480 | (a_pu32Dst) = ((uint32_t const *)&pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].mmx)
|
---|
481 | #define IEM_MC_MODIFIED_MREG(a_iMReg) \
|
---|
482 | do { pVCpu->cpum.GstCtx.XState.x87.aRegs[(a_iMReg)].au32[2] = 0xffff; } while (0)
|
---|
483 | #define IEM_MC_MODIFIED_MREG_BY_REF(a_pu64Dst) \
|
---|
484 | do { ((uint32_t *)(a_pu64Dst))[2] = 0xffff; } while (0)
|
---|
485 |
|
---|
486 | #define IEM_MC_CLEAR_XREG_U32_MASK(a_iXReg, a_bMask) \
|
---|
487 | do { if ((a_bMask) & (1 << 0)) pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au32[0] = 0; \
|
---|
488 | if ((a_bMask) & (1 << 1)) pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au32[1] = 0; \
|
---|
489 | if ((a_bMask) & (1 << 2)) pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au32[2] = 0; \
|
---|
490 | if ((a_bMask) & (1 << 3)) pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au32[3] = 0; \
|
---|
491 | } while (0)
|
---|
492 | #define IEM_MC_FETCH_XREG_U128(a_u128Value, a_iXReg) \
|
---|
493 | do { (a_u128Value).au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[0]; \
|
---|
494 | (a_u128Value).au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[1]; \
|
---|
495 | } while (0)
|
---|
496 | #define IEM_MC_FETCH_XREG_XMM(a_XmmValue, a_iXReg) \
|
---|
497 | do { (a_XmmValue).au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[0]; \
|
---|
498 | (a_XmmValue).au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[1]; \
|
---|
499 | } while (0)
|
---|
500 | #define IEM_MC_FETCH_XREG_U64(a_u64Value, a_iXReg, a_iQWord) \
|
---|
501 | do { (a_u64Value) = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[(a_iQWord)]; } while (0)
|
---|
502 | #define IEM_MC_FETCH_XREG_R64(a_r64Value, a_iXReg, a_iQWord) \
|
---|
503 | do { (a_r64Value) = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].ar64[(a_iQWord)]; } while (0)
|
---|
504 | #define IEM_MC_FETCH_XREG_U32(a_u32Value, a_iXReg, a_iDWord) \
|
---|
505 | do { (a_u32Value) = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au32[(a_iDWord)]; } while (0)
|
---|
506 | #define IEM_MC_FETCH_XREG_R32(a_r32Value, a_iXReg, a_iDWord) \
|
---|
507 | do { (a_r32Value) = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].ar32[(a_iDWord)]; } while (0)
|
---|
508 | #define IEM_MC_FETCH_XREG_U16(a_u16Value, a_iXReg, a_iWord) \
|
---|
509 | do { (a_u16Value) = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au16[(a_iWord)]; } while (0)
|
---|
510 | #define IEM_MC_FETCH_XREG_U8( a_u8Value, a_iXReg, a_iByte) \
|
---|
511 | do { (a_u8Value) = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au8[(a_iByte)]; } while (0)
|
---|
512 | #define IEM_MC_FETCH_XREG_PAIR_U128(a_Dst, a_iXReg1, a_iXReg2) \
|
---|
513 | do { (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
514 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
515 | (a_Dst).uSrc2.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg2)].au64[0]; \
|
---|
516 | (a_Dst).uSrc2.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg2)].au64[1]; \
|
---|
517 | } while (0)
|
---|
518 | #define IEM_MC_FETCH_XREG_PAIR_XMM(a_Dst, a_iXReg1, a_iXReg2) \
|
---|
519 | do { (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
520 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
521 | (a_Dst).uSrc2.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg2)].au64[0]; \
|
---|
522 | (a_Dst).uSrc2.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg2)].au64[1]; \
|
---|
523 | } while (0)
|
---|
524 | #define IEM_MC_FETCH_XREG_PAIR_U128_AND_RAX_RDX_U64(a_Dst, a_iXReg1, a_iXReg2) \
|
---|
525 | do { (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
526 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
527 | (a_Dst).uSrc2.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg2)].au64[0]; \
|
---|
528 | (a_Dst).uSrc2.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg2)].au64[1]; \
|
---|
529 | (a_Dst).u64Rax = pVCpu->cpum.GstCtx.rax; \
|
---|
530 | (a_Dst).u64Rdx = pVCpu->cpum.GstCtx.rdx; \
|
---|
531 | } while (0)
|
---|
532 | #define IEM_MC_FETCH_XREG_PAIR_U128_AND_EAX_EDX_U32_SX_U64(a_Dst, a_iXReg1, a_iXReg2) \
|
---|
533 | do { (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
534 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
535 | (a_Dst).uSrc2.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg2)].au64[0]; \
|
---|
536 | (a_Dst).uSrc2.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg2)].au64[1]; \
|
---|
537 | (a_Dst).u64Rax = (int64_t)(int32_t)pVCpu->cpum.GstCtx.eax; \
|
---|
538 | (a_Dst).u64Rdx = (int64_t)(int32_t)pVCpu->cpum.GstCtx.edx; \
|
---|
539 | } while (0)
|
---|
540 | #define IEM_MC_STORE_XREG_U128(a_iXReg, a_u128Value) \
|
---|
541 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[0] = (a_u128Value).au64[0]; \
|
---|
542 | pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[1] = (a_u128Value).au64[1]; \
|
---|
543 | } while (0)
|
---|
544 | #define IEM_MC_STORE_XREG_XMM(a_iXReg, a_XmmValue) \
|
---|
545 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[0] = (a_XmmValue).au64[0]; \
|
---|
546 | pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[1] = (a_XmmValue).au64[1]; \
|
---|
547 | } while (0)
|
---|
548 | #define IEM_MC_STORE_XREG_XMM_U32(a_iXReg, a_iDword, a_XmmValue) \
|
---|
549 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au32[(a_iDword)] = (a_XmmValue).au32[(a_iDword)]; } while (0)
|
---|
550 | #define IEM_MC_STORE_XREG_XMM_U64(a_iXReg, a_iQword, a_XmmValue) \
|
---|
551 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[(a_iQword)] = (a_XmmValue).au64[(a_iQword)]; } while (0)
|
---|
552 | #define IEM_MC_STORE_XREG_U64(a_iXReg, a_iQword, a_u64Value) \
|
---|
553 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[(a_iQword)] = (a_u64Value); } while (0)
|
---|
554 | #define IEM_MC_STORE_XREG_U32(a_iXReg, a_iDword, a_u32Value) \
|
---|
555 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au32[(a_iDword)] = (a_u32Value); } while (0)
|
---|
556 | #define IEM_MC_STORE_XREG_U16(a_iXReg, a_iWord, a_u16Value) \
|
---|
557 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au16[(a_iWord)] = (a_u16Value); } while (0)
|
---|
558 | #define IEM_MC_STORE_XREG_U8(a_iXReg, a_iByte, a_u8Value) \
|
---|
559 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au8[(a_iByte)] = (a_u8Value); } while (0)
|
---|
560 |
|
---|
561 | #define IEM_MC_STORE_XREG_U64_ZX_U128(a_iXReg, a_u64Value) \
|
---|
562 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[0] = (a_u64Value); \
|
---|
563 | pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[1] = 0; \
|
---|
564 | } while (0)
|
---|
565 |
|
---|
566 | #define IEM_MC_STORE_XREG_U32_U128(a_iXReg, a_iDwDst, a_u128Value, a_iDwSrc) \
|
---|
567 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au32[(a_iDwDst)] = (a_u128Value).au32[(a_iDwSrc)]; } while (0)
|
---|
568 | #define IEM_MC_STORE_XREG_R32(a_iXReg, a_r32Value) \
|
---|
569 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].ar32[0] = (a_r32Value); } while (0)
|
---|
570 | #define IEM_MC_STORE_XREG_R64(a_iXReg, a_r64Value) \
|
---|
571 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].ar64[0] = (a_r64Value); } while (0)
|
---|
572 | #define IEM_MC_STORE_XREG_U32_ZX_U128(a_iXReg, a_u32Value) \
|
---|
573 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[0] = (uint32_t)(a_u32Value); \
|
---|
574 | pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[1] = 0; \
|
---|
575 | } while (0)
|
---|
576 |
|
---|
577 | #define IEM_MC_BROADCAST_XREG_U8_ZX_VLMAX(a_iXRegDst, a_u8Src) \
|
---|
578 | do { uintptr_t const iXRegDstTmp = (a_iXRegDst); \
|
---|
579 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[0] = (a_u8Src); \
|
---|
580 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[1] = (a_u8Src); \
|
---|
581 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[2] = (a_u8Src); \
|
---|
582 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[3] = (a_u8Src); \
|
---|
583 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[4] = (a_u8Src); \
|
---|
584 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[5] = (a_u8Src); \
|
---|
585 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[6] = (a_u8Src); \
|
---|
586 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[7] = (a_u8Src); \
|
---|
587 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[8] = (a_u8Src); \
|
---|
588 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[9] = (a_u8Src); \
|
---|
589 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[10] = (a_u8Src); \
|
---|
590 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[11] = (a_u8Src); \
|
---|
591 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[12] = (a_u8Src); \
|
---|
592 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[13] = (a_u8Src); \
|
---|
593 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[14] = (a_u8Src); \
|
---|
594 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au8[15] = (a_u8Src); \
|
---|
595 | IEM_MC_CLEAR_YREG_128_UP(iXRegDstTmp); \
|
---|
596 | } while (0)
|
---|
597 | #define IEM_MC_BROADCAST_XREG_U16_ZX_VLMAX(a_iXRegDst, a_u16Src) \
|
---|
598 | do { uintptr_t const iXRegDstTmp = (a_iXRegDst); \
|
---|
599 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au16[0] = (a_u16Src); \
|
---|
600 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au16[1] = (a_u16Src); \
|
---|
601 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au16[2] = (a_u16Src); \
|
---|
602 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au16[3] = (a_u16Src); \
|
---|
603 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au16[4] = (a_u16Src); \
|
---|
604 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au16[5] = (a_u16Src); \
|
---|
605 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au16[6] = (a_u16Src); \
|
---|
606 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au16[7] = (a_u16Src); \
|
---|
607 | IEM_MC_CLEAR_YREG_128_UP(iXRegDstTmp); \
|
---|
608 | } while (0)
|
---|
609 | #define IEM_MC_BROADCAST_XREG_U32_ZX_VLMAX(a_iXRegDst, a_u32Src) \
|
---|
610 | do { uintptr_t const iXRegDstTmp = (a_iXRegDst); \
|
---|
611 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au32[0] = (a_u32Src); \
|
---|
612 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au32[1] = (a_u32Src); \
|
---|
613 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au32[2] = (a_u32Src); \
|
---|
614 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au32[3] = (a_u32Src); \
|
---|
615 | IEM_MC_CLEAR_YREG_128_UP(iXRegDstTmp); \
|
---|
616 | } while (0)
|
---|
617 | #define IEM_MC_BROADCAST_XREG_U64_ZX_VLMAX(a_iXRegDst, a_u64Src) \
|
---|
618 | do { uintptr_t const iXRegDstTmp = (a_iXRegDst); \
|
---|
619 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au64[0] = (a_u64Src); \
|
---|
620 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iXRegDstTmp].au64[1] = (a_u64Src); \
|
---|
621 | IEM_MC_CLEAR_YREG_128_UP(iXRegDstTmp); \
|
---|
622 | } while (0)
|
---|
623 |
|
---|
624 | #define IEM_MC_REF_XREG_U128(a_pu128Dst, a_iXReg) \
|
---|
625 | (a_pu128Dst) = (&pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].uXmm)
|
---|
626 | #define IEM_MC_REF_XREG_XMM(a_pXmmDst, a_iXReg) \
|
---|
627 | (a_pXmmDst) = (&pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)])
|
---|
628 | #define IEM_MC_REF_XREG_U128_CONST(a_pu128Dst, a_iXReg) \
|
---|
629 | (a_pu128Dst) = ((PCRTUINT128U)&pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].uXmm)
|
---|
630 | #define IEM_MC_REF_XREG_XMM_CONST(a_pXmmDst, a_iXReg) \
|
---|
631 | (a_pXmmDst) = (&pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)])
|
---|
632 | #define IEM_MC_REF_XREG_U32_CONST(a_pu32Dst, a_iXReg) \
|
---|
633 | (a_pu32Dst) = ((uint32_t const *)&pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au32[0])
|
---|
634 | #define IEM_MC_REF_XREG_U64_CONST(a_pu64Dst, a_iXReg) \
|
---|
635 | (a_pu64Dst) = ((uint64_t const *)&pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].au64[0])
|
---|
636 | #define IEM_MC_REF_XREG_R32_CONST(a_pr32Dst, a_iXReg) \
|
---|
637 | (a_pr32Dst) = ((RTFLOAT32U const *)&pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].ar32[0])
|
---|
638 | #define IEM_MC_REF_XREG_R64_CONST(a_pr64Dst, a_iXReg) \
|
---|
639 | (a_pr64Dst) = ((RTFLOAT64U const *)&pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg)].ar64[0])
|
---|
640 | #define IEM_MC_COPY_XREG_U128(a_iXRegDst, a_iXRegSrc) \
|
---|
641 | do { pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXRegDst)].au64[0] \
|
---|
642 | = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXRegSrc)].au64[0]; \
|
---|
643 | pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXRegDst)].au64[1] \
|
---|
644 | = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXRegSrc)].au64[1]; \
|
---|
645 | } while (0)
|
---|
646 |
|
---|
647 | #define IEM_MC_FETCH_YREG_U32(a_u32Dst, a_iYRegSrc) \
|
---|
648 | do { uintptr_t const iYRegSrcTmp = (a_iYRegSrc); \
|
---|
649 | (a_u32Dst) = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au32[0]; \
|
---|
650 | } while (0)
|
---|
651 | #define IEM_MC_FETCH_YREG_U64(a_u64Dst, a_iYRegSrc, a_iQWord) \
|
---|
652 | do { uintptr_t const iYRegSrcTmp = (a_iYRegSrc); \
|
---|
653 | if ((a_iQWord) < 2) \
|
---|
654 | (a_u64Dst) = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au64[(a_iQWord)]; \
|
---|
655 | else \
|
---|
656 | (a_u64Dst) = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrcTmp].au64[(a_iQWord) - 2]; \
|
---|
657 | } while (0)
|
---|
658 | #define IEM_MC_FETCH_YREG_U128(a_u128Dst, a_iYRegSrc, a_iDQword) \
|
---|
659 | do { uintptr_t const iYRegSrcTmp = (a_iYRegSrc); \
|
---|
660 | if ((a_iDQword) == 0) \
|
---|
661 | { \
|
---|
662 | (a_u128Dst).au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(iYRegSrcTmp)].au64[0]; \
|
---|
663 | (a_u128Dst).au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(iYRegSrcTmp)].au64[1]; \
|
---|
664 | } \
|
---|
665 | else \
|
---|
666 | { \
|
---|
667 | (a_u128Dst).au64[0] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[(iYRegSrcTmp)].au64[0]; \
|
---|
668 | (a_u128Dst).au64[1] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[(iYRegSrcTmp)].au64[1]; \
|
---|
669 | } \
|
---|
670 | } while (0)
|
---|
671 | #define IEM_MC_FETCH_YREG_U256(a_u256Dst, a_iYRegSrc) \
|
---|
672 | do { uintptr_t const iYRegSrcTmp = (a_iYRegSrc); \
|
---|
673 | (a_u256Dst).au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au64[0]; \
|
---|
674 | (a_u256Dst).au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au64[1]; \
|
---|
675 | (a_u256Dst).au64[2] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrcTmp].au64[0]; \
|
---|
676 | (a_u256Dst).au64[3] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrcTmp].au64[1]; \
|
---|
677 | } while (0)
|
---|
678 | #define IEM_MC_FETCH_YREG_YMM(a_uYmmDst, a_iYRegSrc) \
|
---|
679 | do { uintptr_t const iYRegSrcTmp = (a_iYRegSrc); \
|
---|
680 | (a_uYmmDst).au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au64[0]; \
|
---|
681 | (a_uYmmDst).au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au64[1]; \
|
---|
682 | (a_uYmmDst).au64[2] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrcTmp].au64[0]; \
|
---|
683 | (a_uYmmDst).au64[3] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrcTmp].au64[1]; \
|
---|
684 | } while (0)
|
---|
685 | #define IEM_MC_FETCH_YREG_PAIR_YMM(a_uYmmDst, a_iYRegSrc1, a_iYRegSrc2) \
|
---|
686 | do { uintptr_t const iYRegSrc1Tmp = (a_iYRegSrc1); \
|
---|
687 | uintptr_t const iYRegSrc2Tmp = (a_iYRegSrc2); \
|
---|
688 | (a_uYmmDst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrc1Tmp].au64[0]; \
|
---|
689 | (a_uYmmDst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrc1Tmp].au64[1]; \
|
---|
690 | (a_uYmmDst).uSrc1.au64[2] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrc1Tmp].au64[0]; \
|
---|
691 | (a_uYmmDst).uSrc1.au64[3] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrc1Tmp].au64[1]; \
|
---|
692 | (a_uYmmDst).uSrc2.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrc2Tmp].au64[0]; \
|
---|
693 | (a_uYmmDst).uSrc2.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrc2Tmp].au64[1]; \
|
---|
694 | (a_uYmmDst).uSrc2.au64[2] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrc2Tmp].au64[0]; \
|
---|
695 | (a_uYmmDst).uSrc2.au64[3] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrc2Tmp].au64[1]; \
|
---|
696 | } while (0)
|
---|
697 |
|
---|
698 | #define IEM_MC_STORE_YREG_U128(a_iYRegDst, a_iDQword, a_u128Value) \
|
---|
699 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
700 | if ((a_iDQword) == 0) \
|
---|
701 | { \
|
---|
702 | pVCpu->cpum.GstCtx.XState.x87.aXMM[(iYRegDstTmp)].au64[0] = (a_u128Value).au64[0]; \
|
---|
703 | pVCpu->cpum.GstCtx.XState.x87.aXMM[(iYRegDstTmp)].au64[1] = (a_u128Value).au64[1]; \
|
---|
704 | } \
|
---|
705 | else \
|
---|
706 | { \
|
---|
707 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[(iYRegDstTmp)].au64[0] = (a_u128Value).au64[0]; \
|
---|
708 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[(iYRegDstTmp)].au64[1] = (a_u128Value).au64[1]; \
|
---|
709 | } \
|
---|
710 | } while (0)
|
---|
711 |
|
---|
712 | #define IEM_MC_INT_CLEAR_ZMM_256_UP(a_iXRegDst) do { /* For AVX512 and AVX1024 support. */ } while (0)
|
---|
713 | #define IEM_MC_STORE_YREG_U32_ZX_VLMAX(a_iYRegDst, a_u32Src) \
|
---|
714 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
715 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au32[0] = (a_u32Src); \
|
---|
716 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au32[1] = 0; \
|
---|
717 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = 0; \
|
---|
718 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
719 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
720 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
721 | } while (0)
|
---|
722 | #define IEM_MC_STORE_YREG_U64_ZX_VLMAX(a_iYRegDst, a_u64Src) \
|
---|
723 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
724 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = (a_u64Src); \
|
---|
725 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = 0; \
|
---|
726 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
727 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
728 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
729 | } while (0)
|
---|
730 | #define IEM_MC_STORE_YREG_U128_ZX_VLMAX(a_iYRegDst, a_u128Src) \
|
---|
731 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
732 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = (a_u128Src).au64[0]; \
|
---|
733 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = (a_u128Src).au64[1]; \
|
---|
734 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
735 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
736 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
737 | } while (0)
|
---|
738 | #define IEM_MC_STORE_YREG_U256_ZX_VLMAX(a_iYRegDst, a_u256Src) \
|
---|
739 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
740 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = (a_u256Src).au64[0]; \
|
---|
741 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = (a_u256Src).au64[1]; \
|
---|
742 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = (a_u256Src).au64[2]; \
|
---|
743 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = (a_u256Src).au64[3]; \
|
---|
744 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
745 | } while (0)
|
---|
746 | #define IEM_MC_STORE_YREG_YMM_ZX_VLMAX(a_iYRegDst, a_uYmmSrc) \
|
---|
747 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
748 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = (a_uYmmSrc).au64[0]; \
|
---|
749 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = (a_uYmmSrc).au64[1]; \
|
---|
750 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = (a_uYmmSrc).au64[2]; \
|
---|
751 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = (a_uYmmSrc).au64[3]; \
|
---|
752 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
753 | } while (0)
|
---|
754 | #define IEM_MC_STORE_YREG_U32_U256(a_iYRegDst, a_iDwDst, a_u256Value, a_iDwSrc) \
|
---|
755 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
756 | if ((a_iDwDst) < 4) \
|
---|
757 | pVCpu->cpum.GstCtx.XState.x87.aXMM[(iYRegDstTmp)].au32[(a_iDwDst)] = (a_u256Value).au32[(a_iDwSrc)]; \
|
---|
758 | else \
|
---|
759 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[(iYRegDstTmp)].au32[(a_iDwDst) - 4] = (a_u256Value).au32[(a_iDwSrc)]; \
|
---|
760 | } while (0)
|
---|
761 | #define IEM_MC_STORE_YREG_U64_U256(a_iYRegDst, a_iQwDst, a_u256Value, a_iQwSrc) \
|
---|
762 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
763 | if ((a_iQwDst) < 2) \
|
---|
764 | pVCpu->cpum.GstCtx.XState.x87.aXMM[(iYRegDstTmp)].au64[(a_iQwDst)] = (a_u256Value).au64[(a_iQwSrc)]; \
|
---|
765 | else \
|
---|
766 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[(iYRegDstTmp)].au64[(a_iQwDst) - 2] = (a_u256Value).au64[(a_iQwSrc)]; \
|
---|
767 | } while (0)
|
---|
768 | #define IEM_MC_STORE_YREG_U64(a_iYRegDst, a_iQword, a_u64Value) \
|
---|
769 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
770 | if ((a_iQword) < 2) \
|
---|
771 | pVCpu->cpum.GstCtx.XState.x87.aXMM[(iYRegDstTmp)].au64[(a_iQword)] = (a_u64Value); \
|
---|
772 | else \
|
---|
773 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[(iYRegDstTmp)].au64[(a_iQword) - 2] = (a_u64Value); \
|
---|
774 | } while (0)
|
---|
775 |
|
---|
776 | #define IEM_MC_BROADCAST_YREG_U8_ZX_VLMAX(a_iYRegDst, a_u8Src) \
|
---|
777 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
778 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[0] = (a_u8Src); \
|
---|
779 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[1] = (a_u8Src); \
|
---|
780 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[2] = (a_u8Src); \
|
---|
781 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[3] = (a_u8Src); \
|
---|
782 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[4] = (a_u8Src); \
|
---|
783 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[5] = (a_u8Src); \
|
---|
784 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[6] = (a_u8Src); \
|
---|
785 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[7] = (a_u8Src); \
|
---|
786 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[8] = (a_u8Src); \
|
---|
787 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[9] = (a_u8Src); \
|
---|
788 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[10] = (a_u8Src); \
|
---|
789 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[11] = (a_u8Src); \
|
---|
790 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[12] = (a_u8Src); \
|
---|
791 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[13] = (a_u8Src); \
|
---|
792 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[14] = (a_u8Src); \
|
---|
793 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au8[15] = (a_u8Src); \
|
---|
794 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[0] = (a_u8Src); \
|
---|
795 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[1] = (a_u8Src); \
|
---|
796 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[2] = (a_u8Src); \
|
---|
797 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[3] = (a_u8Src); \
|
---|
798 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[4] = (a_u8Src); \
|
---|
799 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[5] = (a_u8Src); \
|
---|
800 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[6] = (a_u8Src); \
|
---|
801 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[7] = (a_u8Src); \
|
---|
802 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[8] = (a_u8Src); \
|
---|
803 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[9] = (a_u8Src); \
|
---|
804 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[10] = (a_u8Src); \
|
---|
805 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[11] = (a_u8Src); \
|
---|
806 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[12] = (a_u8Src); \
|
---|
807 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[13] = (a_u8Src); \
|
---|
808 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[14] = (a_u8Src); \
|
---|
809 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au8[15] = (a_u8Src); \
|
---|
810 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
811 | } while (0)
|
---|
812 | #define IEM_MC_BROADCAST_YREG_U16_ZX_VLMAX(a_iYRegDst, a_u16Src) \
|
---|
813 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
814 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au16[0] = (a_u16Src); \
|
---|
815 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au16[1] = (a_u16Src); \
|
---|
816 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au16[2] = (a_u16Src); \
|
---|
817 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au16[3] = (a_u16Src); \
|
---|
818 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au16[4] = (a_u16Src); \
|
---|
819 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au16[5] = (a_u16Src); \
|
---|
820 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au16[6] = (a_u16Src); \
|
---|
821 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au16[7] = (a_u16Src); \
|
---|
822 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au16[0] = (a_u16Src); \
|
---|
823 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au16[1] = (a_u16Src); \
|
---|
824 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au16[2] = (a_u16Src); \
|
---|
825 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au16[3] = (a_u16Src); \
|
---|
826 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au16[4] = (a_u16Src); \
|
---|
827 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au16[5] = (a_u16Src); \
|
---|
828 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au16[6] = (a_u16Src); \
|
---|
829 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au16[7] = (a_u16Src); \
|
---|
830 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
831 | } while (0)
|
---|
832 | #define IEM_MC_BROADCAST_YREG_U32_ZX_VLMAX(a_iYRegDst, a_u32Src) \
|
---|
833 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
834 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au32[0] = (a_u32Src); \
|
---|
835 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au32[1] = (a_u32Src); \
|
---|
836 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au32[2] = (a_u32Src); \
|
---|
837 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au32[3] = (a_u32Src); \
|
---|
838 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au32[0] = (a_u32Src); \
|
---|
839 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au32[1] = (a_u32Src); \
|
---|
840 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au32[2] = (a_u32Src); \
|
---|
841 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au32[3] = (a_u32Src); \
|
---|
842 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
843 | } while (0)
|
---|
844 | #define IEM_MC_BROADCAST_YREG_U64_ZX_VLMAX(a_iYRegDst, a_u64Src) \
|
---|
845 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
846 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = (a_u64Src); \
|
---|
847 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = (a_u64Src); \
|
---|
848 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = (a_u64Src); \
|
---|
849 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = (a_u64Src); \
|
---|
850 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
851 | } while (0)
|
---|
852 | #define IEM_MC_BROADCAST_YREG_U128_ZX_VLMAX(a_iYRegDst, a_u128Src) \
|
---|
853 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
854 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = (a_u128Src).au64[0]; \
|
---|
855 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = (a_u128Src).au64[1]; \
|
---|
856 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = (a_u128Src).au64[0]; \
|
---|
857 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = (a_u128Src).au64[1]; \
|
---|
858 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
859 | } while (0)
|
---|
860 |
|
---|
861 | #define IEM_MC_REF_YREG_U128(a_pu128Dst, a_iYReg) \
|
---|
862 | (a_pu128Dst) = (&pVCpu->cpum.GstCtx.XState.x87.aYMM[(a_iYReg)].uXmm)
|
---|
863 | #define IEM_MC_REF_YREG_U128_CONST(a_pu128Dst, a_iYReg) \
|
---|
864 | (a_pu128Dst) = ((PCRTUINT128U)&pVCpu->cpum.GstCtx.XState.x87.aYMM[(a_iYReg)].uXmm)
|
---|
865 | #define IEM_MC_REF_YREG_U64_CONST(a_pu64Dst, a_iYReg) \
|
---|
866 | (a_pu64Dst) = ((uint64_t const *)&pVCpu->cpum.GstCtx.XState.x87.aYMM[(a_iYReg)].au64[0])
|
---|
867 | #define IEM_MC_CLEAR_YREG_128_UP(a_iYReg) \
|
---|
868 | do { uintptr_t const iYRegTmp = (a_iYReg); \
|
---|
869 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegTmp].au64[0] = 0; \
|
---|
870 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegTmp].au64[1] = 0; \
|
---|
871 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegTmp); \
|
---|
872 | } while (0)
|
---|
873 |
|
---|
874 | #define IEM_MC_COPY_YREG_U256_ZX_VLMAX(a_iYRegDst, a_iYRegSrc) \
|
---|
875 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
876 | uintptr_t const iYRegSrcTmp = (a_iYRegSrc); \
|
---|
877 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au64[0]; \
|
---|
878 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au64[1]; \
|
---|
879 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrcTmp].au64[0]; \
|
---|
880 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegSrcTmp].au64[1]; \
|
---|
881 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
882 | } while (0)
|
---|
883 | #define IEM_MC_COPY_YREG_U128_ZX_VLMAX(a_iYRegDst, a_iYRegSrc) \
|
---|
884 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
885 | uintptr_t const iYRegSrcTmp = (a_iYRegSrc); \
|
---|
886 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au64[0]; \
|
---|
887 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au64[1]; \
|
---|
888 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
889 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
890 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
891 | } while (0)
|
---|
892 | #define IEM_MC_COPY_YREG_U64_ZX_VLMAX(a_iYRegDst, a_iYRegSrc) \
|
---|
893 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
894 | uintptr_t const iYRegSrcTmp = (a_iYRegSrc); \
|
---|
895 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcTmp].au64[0]; \
|
---|
896 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = 0; \
|
---|
897 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
898 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
899 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
900 | } while (0)
|
---|
901 |
|
---|
902 | #define IEM_MC_MERGE_YREG_U32_U96_ZX_VLMAX(a_iYRegDst, a_iYRegSrc32, a_iYRegSrcHx) \
|
---|
903 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
904 | uintptr_t const iYRegSrc32Tmp = (a_iYRegSrc32); \
|
---|
905 | uintptr_t const iYRegSrcHxTmp = (a_iYRegSrcHx); \
|
---|
906 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au32[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrc32Tmp].au32[0]; \
|
---|
907 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au32[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcHxTmp].au32[1]; \
|
---|
908 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcHxTmp].au64[1]; \
|
---|
909 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
910 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
911 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
912 | } while (0)
|
---|
913 | #define IEM_MC_MERGE_YREG_U64_U64_ZX_VLMAX(a_iYRegDst, a_iYRegSrc64, a_iYRegSrcHx) \
|
---|
914 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
915 | uintptr_t const iYRegSrc64Tmp = (a_iYRegSrc64); \
|
---|
916 | uintptr_t const iYRegSrcHxTmp = (a_iYRegSrcHx); \
|
---|
917 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrc64Tmp].au64[0]; \
|
---|
918 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcHxTmp].au64[1]; \
|
---|
919 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
920 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
921 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
922 | } while (0)
|
---|
923 | #define IEM_MC_MERGE_YREG_U64LO_U64LO_ZX_VLMAX(a_iYRegDst, a_iYRegSrc64, a_iYRegSrcHx) /* for vmovhlps */ \
|
---|
924 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
925 | uintptr_t const iYRegSrc64Tmp = (a_iYRegSrc64); \
|
---|
926 | uintptr_t const iYRegSrcHxTmp = (a_iYRegSrcHx); \
|
---|
927 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrc64Tmp].au64[0]; \
|
---|
928 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcHxTmp].au64[0]; \
|
---|
929 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
930 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
931 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
932 | } while (0)
|
---|
933 | #define IEM_MC_MERGE_YREG_U64HI_U64HI_ZX_VLMAX(a_iYRegDst, a_iYRegSrc64, a_iYRegSrcHx) /* for vmovhlps */ \
|
---|
934 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
935 | uintptr_t const iYRegSrc64Tmp = (a_iYRegSrc64); \
|
---|
936 | uintptr_t const iYRegSrcHxTmp = (a_iYRegSrcHx); \
|
---|
937 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrc64Tmp].au64[1]; \
|
---|
938 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcHxTmp].au64[1]; \
|
---|
939 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
940 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
941 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
942 | } while (0)
|
---|
943 | #define IEM_MC_MERGE_YREG_U64LO_U64LOCAL_ZX_VLMAX(a_iYRegDst, a_iYRegSrcHx, a_u64Local) \
|
---|
944 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
945 | uintptr_t const iYRegSrcHxTmp = (a_iYRegSrcHx); \
|
---|
946 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcHxTmp].au64[0]; \
|
---|
947 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = (a_u64Local); \
|
---|
948 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
949 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
950 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
951 | } while (0)
|
---|
952 | #define IEM_MC_MERGE_YREG_U64LOCAL_U64HI_ZX_VLMAX(a_iYRegDst, a_u64Local, a_iYRegSrcHx) \
|
---|
953 | do { uintptr_t const iYRegDstTmp = (a_iYRegDst); \
|
---|
954 | uintptr_t const iYRegSrcHxTmp = (a_iYRegSrcHx); \
|
---|
955 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[0] = (a_u64Local); \
|
---|
956 | pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegDstTmp].au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[iYRegSrcHxTmp].au64[1]; \
|
---|
957 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[0] = 0; \
|
---|
958 | pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[iYRegDstTmp].au64[1] = 0; \
|
---|
959 | IEM_MC_INT_CLEAR_ZMM_256_UP(iYRegDstTmp); \
|
---|
960 | } while (0)
|
---|
961 |
|
---|
962 | #define IEM_MC_CLEAR_ZREG_256_UP(a_iYReg) \
|
---|
963 | do { IEM_MC_INT_CLEAR_ZMM_256_UP(a_iYReg); } while (0)
|
---|
964 |
|
---|
965 | #ifndef IEM_WITH_SETJMP
|
---|
966 | # define IEM_MC_FETCH_MEM_U8(a_u8Dst, a_iSeg, a_GCPtrMem) \
|
---|
967 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pVCpu, &(a_u8Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
968 | # define IEM_MC_FETCH_MEM16_U8(a_u8Dst, a_iSeg, a_GCPtrMem16) \
|
---|
969 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pVCpu, &(a_u8Dst), (a_iSeg), (a_GCPtrMem16)))
|
---|
970 | # define IEM_MC_FETCH_MEM32_U8(a_u8Dst, a_iSeg, a_GCPtrMem32) \
|
---|
971 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pVCpu, &(a_u8Dst), (a_iSeg), (a_GCPtrMem32)))
|
---|
972 | #else
|
---|
973 | # define IEM_MC_FETCH_MEM_U8(a_u8Dst, a_iSeg, a_GCPtrMem) \
|
---|
974 | ((a_u8Dst) = iemMemFetchDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
975 | # define IEM_MC_FETCH_MEM16_U8(a_u8Dst, a_iSeg, a_GCPtrMem16) \
|
---|
976 | ((a_u8Dst) = iemMemFetchDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem16)))
|
---|
977 | # define IEM_MC_FETCH_MEM32_U8(a_u8Dst, a_iSeg, a_GCPtrMem32) \
|
---|
978 | ((a_u8Dst) = iemMemFetchDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem32)))
|
---|
979 |
|
---|
980 | # define IEM_MC_FETCH_MEM_FLAT_U8(a_u8Dst, a_GCPtrMem) \
|
---|
981 | ((a_u8Dst) = iemMemFlatFetchDataU8Jmp(pVCpu, (a_GCPtrMem)))
|
---|
982 | # define IEM_MC_FETCH_MEM16_FLAT_U8(a_u8Dst, a_GCPtrMem16) \
|
---|
983 | ((a_u8Dst) = iemMemFlatFetchDataU8Jmp(pVCpu, (a_GCPtrMem16)))
|
---|
984 | # define IEM_MC_FETCH_MEM32_FLAT_U8(a_u8Dst, a_GCPtrMem32) \
|
---|
985 | ((a_u8Dst) = iemMemFlatFetchDataU8Jmp(pVCpu, (a_GCPtrMem32)))
|
---|
986 | #endif
|
---|
987 |
|
---|
988 | #ifndef IEM_WITH_SETJMP
|
---|
989 | # define IEM_MC_FETCH_MEM_U16(a_u16Dst, a_iSeg, a_GCPtrMem) \
|
---|
990 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU16(pVCpu, &(a_u16Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
991 | # define IEM_MC_FETCH_MEM_U16_DISP(a_u16Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
|
---|
992 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU16(pVCpu, &(a_u16Dst), (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
|
---|
993 | # define IEM_MC_FETCH_MEM_I16(a_i16Dst, a_iSeg, a_GCPtrMem) \
|
---|
994 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU16(pVCpu, (uint16_t *)&(a_i16Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
995 | # define IEM_MC_FETCH_MEM_I16_DISP(a_i16Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
|
---|
996 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU16(pVCpu, (uint16_t *)&(a_i16Dst), (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
|
---|
997 | #else
|
---|
998 | # define IEM_MC_FETCH_MEM_U16(a_u16Dst, a_iSeg, a_GCPtrMem) \
|
---|
999 | ((a_u16Dst) = iemMemFetchDataU16Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1000 | # define IEM_MC_FETCH_MEM_U16_DISP(a_u16Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
|
---|
1001 | ((a_u16Dst) = iemMemFetchDataU16Jmp(pVCpu, (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
|
---|
1002 | # define IEM_MC_FETCH_MEM_I16(a_i16Dst, a_iSeg, a_GCPtrMem) \
|
---|
1003 | ((a_i16Dst) = (int16_t)iemMemFetchDataU16Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1004 | # define IEM_MC_FETCH_MEM_I16_DISP(a_i16Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
|
---|
1005 | ((a_i16Dst) = (int16_t)iemMemFetchDataU16Jmp(pVCpu, (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
|
---|
1006 |
|
---|
1007 | # define IEM_MC_FETCH_MEM_FLAT_U16(a_u16Dst, a_GCPtrMem) \
|
---|
1008 | ((a_u16Dst) = iemMemFlatFetchDataU16Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1009 | # define IEM_MC_FETCH_MEM_FLAT_U16_DISP(a_u16Dst, a_GCPtrMem, a_offDisp) \
|
---|
1010 | ((a_u16Dst) = iemMemFlatFetchDataU16Jmp(pVCpu, (a_GCPtrMem) + (a_offDisp)))
|
---|
1011 | # define IEM_MC_FETCH_MEM_FLAT_I16(a_i16Dst, a_GCPtrMem) \
|
---|
1012 | ((a_i16Dst) = (int16_t)iemMemFlatFetchDataU16Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1013 | # define IEM_MC_FETCH_MEM_FLAT_I16_DISP(a_i16Dst, a_GCPtrMem, a_offDisp) \
|
---|
1014 | ((a_i16Dst) = (int16_t)iemMemFlatFetchDataU16Jmp(pVCpu, (a_GCPtrMem) + (a_offDisp)))
|
---|
1015 | #endif
|
---|
1016 |
|
---|
1017 | #ifndef IEM_WITH_SETJMP
|
---|
1018 | # define IEM_MC_FETCH_MEM_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1019 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU32(pVCpu, &(a_u32Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1020 | # define IEM_MC_FETCH_MEM_U32_DISP(a_u32Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
|
---|
1021 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU32(pVCpu, &(a_u32Dst), (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
|
---|
1022 | # define IEM_MC_FETCH_MEM_I32(a_i32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1023 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU32(pVCpu, (uint32_t *)&(a_i32Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1024 | # define IEM_MC_FETCH_MEM_I32_DISP(a_i32Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
|
---|
1025 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU32(pVCpu, (uint32_t *)&(a_i32Dst), (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
|
---|
1026 | #else
|
---|
1027 | # define IEM_MC_FETCH_MEM_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1028 | ((a_u32Dst) = iemMemFetchDataU32Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1029 | # define IEM_MC_FETCH_MEM_U32_DISP(a_u32Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
|
---|
1030 | ((a_u32Dst) = iemMemFetchDataU32Jmp(pVCpu, (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
|
---|
1031 | # define IEM_MC_FETCH_MEM_I32(a_i32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1032 | ((a_i32Dst) = (int32_t)iemMemFetchDataU32Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1033 | # define IEM_MC_FETCH_MEM_I32_DISP(a_i32Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
|
---|
1034 | ((a_i32Dst) = (int32_t)iemMemFetchDataU32Jmp(pVCpu, (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
|
---|
1035 |
|
---|
1036 | # define IEM_MC_FETCH_MEM_FLAT_U32(a_u32Dst, a_GCPtrMem) \
|
---|
1037 | ((a_u32Dst) = iemMemFlatFetchDataU32Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1038 | # define IEM_MC_FETCH_MEM_FLAT_U32_DISP(a_u32Dst, a_GCPtrMem, a_offDisp) \
|
---|
1039 | ((a_u32Dst) = iemMemFlatFetchDataU32Jmp(pVCpu, (a_GCPtrMem) + (a_offDisp)))
|
---|
1040 | # define IEM_MC_FETCH_MEM_FLAT_I32(a_i32Dst, a_GCPtrMem) \
|
---|
1041 | ((a_i32Dst) = (int32_t)iemMemFlatFetchDataU32Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1042 | # define IEM_MC_FETCH_MEM_FLAT_I32_DISP(a_i32Dst, a_GCPtrMem, a_offDisp) \
|
---|
1043 | ((a_i32Dst) = (int32_t)iemMemFlatFetchDataU32Jmp(pVCpu, (a_GCPtrMem) + (a_offDisp)))
|
---|
1044 | #endif
|
---|
1045 |
|
---|
1046 | #ifndef IEM_WITH_SETJMP
|
---|
1047 | # define IEM_MC_FETCH_MEM_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1048 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU64(pVCpu, &(a_u64Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1049 | # define IEM_MC_FETCH_MEM_U64_DISP(a_u64Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
|
---|
1050 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU64(pVCpu, &(a_u64Dst), (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
|
---|
1051 | # define IEM_MC_FETCH_MEM_U64_ALIGN_U128(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1052 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU64AlignedU128(pVCpu, &(a_u64Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1053 | # define IEM_MC_FETCH_MEM_I64(a_i64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1054 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU64(pVCpu, (uint64_t *)&(a_i64Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1055 | #else
|
---|
1056 | # define IEM_MC_FETCH_MEM_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1057 | ((a_u64Dst) = iemMemFetchDataU64Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1058 | # define IEM_MC_FETCH_MEM_U64_DISP(a_u64Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
|
---|
1059 | ((a_u64Dst) = iemMemFetchDataU64Jmp(pVCpu, (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
|
---|
1060 | # define IEM_MC_FETCH_MEM_U64_ALIGN_U128(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1061 | ((a_u64Dst) = iemMemFetchDataU64AlignedU128Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1062 | # define IEM_MC_FETCH_MEM_I64(a_i64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1063 | ((a_i64Dst) = (int64_t)iemMemFetchDataU64Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1064 |
|
---|
1065 | # define IEM_MC_FETCH_MEM_FLAT_U64(a_u64Dst, a_GCPtrMem) \
|
---|
1066 | ((a_u64Dst) = iemMemFlatFetchDataU64Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1067 | # define IEM_MC_FETCH_MEM_FLAT_U64_DISP(a_u64Dst, a_GCPtrMem, a_offDisp) \
|
---|
1068 | ((a_u64Dst) = iemMemFlatFetchDataU64Jmp(pVCpu, (a_GCPtrMem) + (a_offDisp)))
|
---|
1069 | # define IEM_MC_FETCH_MEM_FLAT_U64_ALIGN_U128(a_u64Dst, a_GCPtrMem) \
|
---|
1070 | ((a_u64Dst) = iemMemFlatFetchDataU64AlignedU128Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1071 | # define IEM_MC_FETCH_MEM_FLAT_I64(a_i64Dst, a_GCPtrMem) \
|
---|
1072 | ((a_i64Dst) = (int64_t)iemMemFlatFetchDataU64Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1073 | #endif
|
---|
1074 |
|
---|
1075 | #ifndef IEM_WITH_SETJMP
|
---|
1076 | # define IEM_MC_FETCH_MEM_R32(a_r32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1077 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU32(pVCpu, &(a_r32Dst).u, (a_iSeg), (a_GCPtrMem)))
|
---|
1078 | # define IEM_MC_FETCH_MEM_R64(a_r64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1079 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU64(pVCpu, &(a_r64Dst).u, (a_iSeg), (a_GCPtrMem)))
|
---|
1080 | # define IEM_MC_FETCH_MEM_R80(a_r80Dst, a_iSeg, a_GCPtrMem) \
|
---|
1081 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataR80(pVCpu, &(a_r80Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1082 | # define IEM_MC_FETCH_MEM_D80(a_d80Dst, a_iSeg, a_GCPtrMem) \
|
---|
1083 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataD80(pVCpu, &(a_d80Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1084 | #else
|
---|
1085 | # define IEM_MC_FETCH_MEM_R32(a_r32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1086 | ((a_r32Dst).u = iemMemFetchDataU32Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1087 | # define IEM_MC_FETCH_MEM_R64(a_r64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1088 | ((a_r64Dst).u = iemMemFetchDataU64Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1089 | # define IEM_MC_FETCH_MEM_R80(a_r80Dst, a_iSeg, a_GCPtrMem) \
|
---|
1090 | iemMemFetchDataR80Jmp(pVCpu, &(a_r80Dst), (a_iSeg), (a_GCPtrMem))
|
---|
1091 | # define IEM_MC_FETCH_MEM_D80(a_d80Dst, a_iSeg, a_GCPtrMem) \
|
---|
1092 | iemMemFetchDataD80Jmp(pVCpu, &(a_d80Dst), (a_iSeg), (a_GCPtrMem))
|
---|
1093 |
|
---|
1094 | # define IEM_MC_FETCH_MEM_FLAT_R32(a_r32Dst, a_GCPtrMem) \
|
---|
1095 | ((a_r32Dst).u = iemMemFlatFetchDataU32Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1096 | # define IEM_MC_FETCH_MEM_FLAT_R64(a_r64Dst, a_GCPtrMem) \
|
---|
1097 | ((a_r64Dst).u = iemMemFlatFetchDataU64Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1098 | # define IEM_MC_FETCH_MEM_FLAT_R80(a_r80Dst, a_GCPtrMem) \
|
---|
1099 | iemMemFlatFetchDataR80Jmp(pVCpu, &(a_r80Dst), (a_GCPtrMem))
|
---|
1100 | # define IEM_MC_FETCH_MEM_FLAT_D80(a_d80Dst, a_GCPtrMem) \
|
---|
1101 | iemMemFlatFetchDataD80Jmp(pVCpu, &(a_d80Dst), (a_GCPtrMem))
|
---|
1102 | #endif
|
---|
1103 |
|
---|
1104 | #ifndef IEM_WITH_SETJMP
|
---|
1105 | # define IEM_MC_FETCH_MEM_U128(a_u128Dst, a_iSeg, a_GCPtrMem) \
|
---|
1106 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU128(pVCpu, &(a_u128Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1107 | # define IEM_MC_FETCH_MEM_U128_NO_AC(a_u128Dst, a_iSeg, a_GCPtrMem) \
|
---|
1108 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU128NoAc(pVCpu, &(a_u128Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1109 | # define IEM_MC_FETCH_MEM_U128_ALIGN_SSE(a_u128Dst, a_iSeg, a_GCPtrMem) \
|
---|
1110 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU128AlignedSse(pVCpu, &(a_u128Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1111 |
|
---|
1112 | # define IEM_MC_FETCH_MEM_XMM_NO_AC(a_XmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1113 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU128NoAc(pVCpu, &(a_XmmDst).uXmm, (a_iSeg), (a_GCPtrMem)))
|
---|
1114 | # define IEM_MC_FETCH_MEM_XMM_ALIGN_SSE(a_XmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1115 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU128AlignedSse(pVCpu, &(a_XmmDst).uXmm, (a_iSeg), (a_GCPtrMem)))
|
---|
1116 |
|
---|
1117 | # define IEM_MC_FETCH_MEM_U128_NO_AC_AND_XREG_U128(a_u128Dst, a_iXReg1, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1118 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU128NoAc(pVCpu, &(a_Dst).uSrc2, (a_iSeg2), (a_GCPtrMem2))); \
|
---|
1119 | (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1120 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1121 | } while (0)
|
---|
1122 |
|
---|
1123 | # define IEM_MC_FETCH_MEM_XMM_ALIGN_SSE_AND_XREG_XMM(a_Dst, a_iXReg1, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1124 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU128AlignedSse(pVCpu, &(a_Dst).uSrc2.uXmm, (a_iSeg2), (a_GCPtrMem2))); \
|
---|
1125 | (a_Dst).uSrc1.uXmm.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1126 | (a_Dst).uSrc1.uXmm.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1127 | } while (0)
|
---|
1128 |
|
---|
1129 | # define IEM_MC_FETCH_MEM_XMM_U32_AND_XREG_XMM(a_Dst, a_iXReg1, a_iDWord2, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1130 | (a_Dst).uSrc2.uXmm.au64[0] = 0; \
|
---|
1131 | (a_Dst).uSrc2.uXmm.au64[1] = 0; \
|
---|
1132 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU32(pVCpu, &(a_Dst).uSrc2.uXmm.au32[(a_iDWord2)], (a_iSeg2), (a_GCPtrMem2))); \
|
---|
1133 | (a_Dst).uSrc1.uXmm.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1134 | (a_Dst).uSrc1.uXmm.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1135 | } while (0)
|
---|
1136 |
|
---|
1137 | # define IEM_MC_FETCH_MEM_XMM_U64_AND_XREG_XMM(a_Dst, a_iXReg1, a_iQWord2, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1138 | (a_Dst).uSrc2.uXmm.au64[1] = 0; \
|
---|
1139 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU64(pVCpu, &(a_Dst).uSrc2.uXmm.au64[(a_iQWord2)], (a_iSeg2), (a_GCPtrMem2))); \
|
---|
1140 | (a_Dst).uSrc1.uXmm.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1141 | (a_Dst).uSrc1.uXmm.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1142 | } while (0)
|
---|
1143 |
|
---|
1144 | # define IEM_MC_FETCH_MEM_U128_AND_XREG_U128_AND_RAX_RDX_U64(a_Dst, a_iXReg1, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1145 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU128(pVCpu, &(a_Dst).uSrc2, (a_iSeg2), (a_GCPtrMem2))); \
|
---|
1146 | (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1147 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1148 | (a_Dst).u64Rax = pVCpu->cpum.GstCtx.rax; \
|
---|
1149 | (a_Dst).u64Rdx = pVCpu->cpum.GstCtx.rdx; \
|
---|
1150 | } while (0)
|
---|
1151 | # define IEM_MC_FETCH_MEM_U128_AND_XREG_U128_AND_EAX_EDX_U32_SX_U64(a_Dst, a_iXReg1, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1152 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU128(pVCpu, &(a_Dst).uSrc2, (a_iSeg2), (a_GCPtrMem2))); \
|
---|
1153 | (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1154 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1155 | (a_Dst).u64Rax = (int64_t)(int32_t)pVCpu->cpum.GstCtx.eax; \
|
---|
1156 | (a_Dst).u64Rdx = (int64_t)(int32_t)pVCpu->cpum.GstCtx.edx; \
|
---|
1157 | } while (0)
|
---|
1158 |
|
---|
1159 | #else
|
---|
1160 | # define IEM_MC_FETCH_MEM_U128(a_u128Dst, a_iSeg, a_GCPtrMem) \
|
---|
1161 | iemMemFetchDataU128Jmp(pVCpu, &(a_u128Dst), (a_iSeg), (a_GCPtrMem))
|
---|
1162 | # define IEM_MC_FETCH_MEM_U128_NO_AC(a_u128Dst, a_iSeg, a_GCPtrMem) \
|
---|
1163 | iemMemFetchDataU128NoAcJmp(pVCpu, &(a_u128Dst), (a_iSeg), (a_GCPtrMem))
|
---|
1164 | # define IEM_MC_FETCH_MEM_U128_ALIGN_SSE(a_u128Dst, a_iSeg, a_GCPtrMem) \
|
---|
1165 | iemMemFetchDataU128AlignedSseJmp(pVCpu, &(a_u128Dst), (a_iSeg), (a_GCPtrMem))
|
---|
1166 |
|
---|
1167 | # define IEM_MC_FETCH_MEM_XMM(a_XmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1168 | iemMemFetchDataU128Jmp(pVCpu, &(a_XmmDst).uXmm, (a_iSeg), (a_GCPtrMem))
|
---|
1169 | # define IEM_MC_FETCH_MEM_XMM_NO_AC(a_XmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1170 | iemMemFetchDataU128NoAcJmp(pVCpu, &(a_XmmDst).uXmm, (a_iSeg), (a_GCPtrMem))
|
---|
1171 | # define IEM_MC_FETCH_MEM_XMM_ALIGN_SSE(a_XmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1172 | iemMemFetchDataU128AlignedSseJmp(pVCpu, &(a_XmmDst).uXmm, (a_iSeg), (a_GCPtrMem))
|
---|
1173 |
|
---|
1174 | # define IEM_MC_FETCH_MEM_FLAT_U128(a_u128Dst, a_GCPtrMem) \
|
---|
1175 | iemMemFlatFetchDataU128Jmp(pVCpu, &(a_u128Dst), (a_GCPtrMem))
|
---|
1176 | # define IEM_MC_FETCH_MEM_FLAT_U128_NO_AC(a_u128Dst, a_GCPtrMem) \
|
---|
1177 | iemMemFlatFetchDataU128NoAcJmp(pVCpu, &(a_u128Dst), (a_GCPtrMem))
|
---|
1178 | # define IEM_MC_FETCH_MEM_FLAT_U128_ALIGN_SSE(a_u128Dst, a_GCPtrMem) \
|
---|
1179 | iemMemFlatFetchDataU128AlignedSseJmp(pVCpu, &(a_u128Dst), (a_GCPtrMem))
|
---|
1180 |
|
---|
1181 | # define IEM_MC_FETCH_MEM_FLAT_XMM(a_XmmDst, a_GCPtrMem) \
|
---|
1182 | iemMemFlatFetchDataU128Jmp(pVCpu, &(a_XmmDst).uXmm, (a_GCPtrMem))
|
---|
1183 | # define IEM_MC_FETCH_MEM_FLAT_XMM_NO_AC(a_XmmDst, a_GCPtrMem) \
|
---|
1184 | iemMemFlatFetchDataU128NoAcJmp(pVCpu, &(a_XmmDst).uXmm, (a_GCPtrMem))
|
---|
1185 | # define IEM_MC_FETCH_MEM_FLAT_XMM_ALIGN_SSE(a_XmmDst, a_GCPtrMem) \
|
---|
1186 | iemMemFlatFetchDataU128AlignedSseJmp(pVCpu, &(a_XmmDst).uXmm, (a_GCPtrMem))
|
---|
1187 |
|
---|
1188 | # define IEM_MC_FETCH_MEM_U128_AND_XREG_U128(a_Dst, a_iXReg1, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1189 | iemMemFetchDataU128Jmp(pVCpu, &(a_Dst).uSrc2, (a_iSeg2), (a_GCPtrMem2)); \
|
---|
1190 | (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1191 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1192 | } while (0)
|
---|
1193 | # define IEM_MC_FETCH_MEM_FLAT_U128_AND_XREG_U128(a_Dst, a_iXReg1, a_GCPtrMem2) do { \
|
---|
1194 | iemMemFlatFetchDataU128Jmp(pVCpu, &(a_Dst).uSrc2, (a_GCPtrMem2)); \
|
---|
1195 | (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1196 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1197 | } while (0)
|
---|
1198 |
|
---|
1199 | # define IEM_MC_FETCH_MEM_XMM_ALIGN_SSE_AND_XREG_XMM(a_Dst, a_iXReg1, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1200 | iemMemFetchDataU128AlignedSseJmp(pVCpu, &(a_Dst).uSrc2.uXmm, (a_iSeg2), (a_GCPtrMem2)); \
|
---|
1201 | (a_Dst).uSrc1.uXmm.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1202 | (a_Dst).uSrc1.uXmm.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1203 | } while (0)
|
---|
1204 | # define IEM_MC_FETCH_MEM_FLAT_XMM_ALIGN_SSE_AND_XREG_XMM(a_Dst, a_iXReg1, a_GCPtrMem2) do { \
|
---|
1205 | iemMemFlatFetchDataU128AlignedSseJmp(pVCpu, &(a_Dst).uSrc2.uXmm, (a_GCPtrMem2)); \
|
---|
1206 | (a_Dst).uSrc1.uXmm.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1207 | (a_Dst).uSrc1.uXmm.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1208 | } while (0)
|
---|
1209 |
|
---|
1210 | # define IEM_MC_FETCH_MEM_XMM_U32_AND_XREG_XMM(a_Dst, a_iXReg1, a_iDWord2, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1211 | (a_Dst).uSrc2.uXmm.au64[0] = 0; \
|
---|
1212 | (a_Dst).uSrc2.uXmm.au64[1] = 0; \
|
---|
1213 | (a_Dst).uSrc2.uXmm.au32[(a_iDWord2)] = iemMemFetchDataU32Jmp(pVCpu, (a_iSeg2), (a_GCPtrMem2)); \
|
---|
1214 | (a_Dst).uSrc1.uXmm.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1215 | (a_Dst).uSrc1.uXmm.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1216 | } while (0)
|
---|
1217 | # define IEM_MC_FETCH_MEM_FLAT_XMM_U32_AND_XREG_XMM(a_Dst, a_iXReg1, a_iDWord2, a_GCPtrMem2) do { \
|
---|
1218 | (a_Dst).uSrc2.uXmm.au64[0] = 0; \
|
---|
1219 | (a_Dst).uSrc2.uXmm.au64[1] = 0; \
|
---|
1220 | (a_Dst).uSrc2.uXmm.au32[(a_iDWord2)] = iemMemFlatFetchDataU32Jmp(pVCpu, (a_GCPtrMem2)); \
|
---|
1221 | (a_Dst).uSrc1.uXmm.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1222 | (a_Dst).uSrc1.uXmm.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1223 | } while (0)
|
---|
1224 |
|
---|
1225 | # define IEM_MC_FETCH_MEM_XMM_U64_AND_XREG_XMM(a_Dst, a_iXReg1, a_iQWord2, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1226 | (a_Dst).uSrc2.uXmm.au64[!(a_iQWord2)] = 0; \
|
---|
1227 | (a_Dst).uSrc2.uXmm.au64[(a_iQWord2)] = iemMemFetchDataU64Jmp(pVCpu, (a_iSeg2), (a_GCPtrMem2)); \
|
---|
1228 | (a_Dst).uSrc1.uXmm.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1229 | (a_Dst).uSrc1.uXmm.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1230 | } while (0)
|
---|
1231 | # define IEM_MC_FETCH_MEM_FLAT_XMM_U64_AND_XREG_XMM(a_Dst, a_iXReg1, a_iQWord2, a_GCPtrMem2) do { \
|
---|
1232 | (a_Dst).uSrc2.uXmm.au64[1] = 0; \
|
---|
1233 | (a_Dst).uSrc2.uXmm.au64[(a_iQWord2)] = iemMemFlatFetchDataU64Jmp(pVCpu, (a_GCPtrMem2)); \
|
---|
1234 | (a_Dst).uSrc1.uXmm.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1235 | (a_Dst).uSrc1.uXmm.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1236 | } while (0)
|
---|
1237 |
|
---|
1238 |
|
---|
1239 | # define IEM_MC_FETCH_MEM_U128_AND_XREG_U128_AND_RAX_RDX_U64(a_Dst, a_iXReg1, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1240 | iemMemFetchDataU128Jmp(pVCpu, &(a_Dst).uSrc2, (a_iSeg2), (a_GCPtrMem2)); \
|
---|
1241 | (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1242 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1243 | (a_Dst).u64Rax = pVCpu->cpum.GstCtx.rax; \
|
---|
1244 | (a_Dst).u64Rdx = pVCpu->cpum.GstCtx.rdx; \
|
---|
1245 | } while (0)
|
---|
1246 | # define IEM_MC_FETCH_MEM_U128_AND_XREG_U128_AND_EAX_EDX_U32_SX_U64(a_Dst, a_iXReg1, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1247 | iemMemFetchDataU128Jmp(pVCpu, &(a_Dst).uSrc2, (a_iSeg2), (a_GCPtrMem2)); \
|
---|
1248 | (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1249 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1250 | (a_Dst).u64Rax = (int64_t)(int32_t)pVCpu->cpum.GstCtx.eax; \
|
---|
1251 | (a_Dst).u64Rdx = (int64_t)(int32_t)pVCpu->cpum.GstCtx.edx; \
|
---|
1252 | } while (0)
|
---|
1253 |
|
---|
1254 | # define IEM_MC_FETCH_MEM_FLAT_U128_AND_XREG_U128_AND_RAX_RDX_U64(a_Dst, a_iXReg1, a_GCPtrMem2) do { \
|
---|
1255 | iemMemFlatFetchDataU128Jmp(pVCpu, &(a_Dst).uSrc2, (a_GCPtrMem2)); \
|
---|
1256 | (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1257 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1258 | (a_Dst).u64Rax = pVCpu->cpum.GstCtx.rax; \
|
---|
1259 | (a_Dst).u64Rdx = pVCpu->cpum.GstCtx.rdx; \
|
---|
1260 | } while (0)
|
---|
1261 | # define IEM_MC_FETCH_MEM_FLAT_U128_AND_XREG_U128_AND_EAX_EDX_U32_SX_U64(a_Dst, a_iXReg1, a_GCPtrMem2) do { \
|
---|
1262 | iemMemFlatFetchDataU128Jmp(pVCpu, &(a_Dst).uSrc2, (a_GCPtrMem2)); \
|
---|
1263 | (a_Dst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[0]; \
|
---|
1264 | (a_Dst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[(a_iXReg1)].au64[1]; \
|
---|
1265 | (a_Dst).u64Rax = (int64_t)(int32_t)pVCpu->cpum.GstCtx.eax; \
|
---|
1266 | (a_Dst).u64Rdx = (int64_t)(int32_t)pVCpu->cpum.GstCtx.edx; \
|
---|
1267 | } while (0)
|
---|
1268 |
|
---|
1269 | #endif
|
---|
1270 |
|
---|
1271 | #ifndef IEM_WITH_SETJMP
|
---|
1272 | # define IEM_MC_FETCH_MEM_U256(a_u256Dst, a_iSeg, a_GCPtrMem) \
|
---|
1273 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU256NoAc(pVCpu, &(a_u256Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1274 | # define IEM_MC_FETCH_MEM_U256_NO_AC(a_u256Dst, a_iSeg, a_GCPtrMem) \
|
---|
1275 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU256NoAc(pVCpu, &(a_u256Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1276 | # define IEM_MC_FETCH_MEM_U256_ALIGN_AVX(a_u256Dst, a_iSeg, a_GCPtrMem) \
|
---|
1277 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU256AlignedAvx(pVCpu, &(a_u256Dst), (a_iSeg), (a_GCPtrMem)))
|
---|
1278 |
|
---|
1279 | # define IEM_MC_FETCH_MEM_YMM(a_YmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1280 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU256NoAc(pVCpu, &(a_YmmDst).ymm, (a_iSeg), (a_GCPtrMem)))
|
---|
1281 | # define IEM_MC_FETCH_MEM_YMM_NO_AC(a_YmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1282 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU256NoAc(pVCpu, &(a_YmmDst).ymm, (a_iSeg), (a_GCPtrMem)))
|
---|
1283 | # define IEM_MC_FETCH_MEM_YMM_ALIGN_AVX(a_YmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1284 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU256AlignedAvx(pVCpu, &(a_YmmDst).ymm, (a_iSeg), (a_GCPtrMem)))
|
---|
1285 |
|
---|
1286 | # define IEM_MC_FETCH_MEM_YMM_ALIGN_AVX_AND_YREG_YMM(a_uYmmDst, a_iYRegSrc1, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1287 | uintptr_t const a_iYRegSrc1Tmp = (a_iYRegSrc1); \
|
---|
1288 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU256AlignedAvx(pVCpu, &(a_uYmmDst).uSrc2.ymm, (a_iSeg2), (a_GCPtrMem2))); \
|
---|
1289 | (a_uYmmDst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[a_iYRegSrc1Tmp].au64[0]; \
|
---|
1290 | (a_uYmmDst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[a_iYRegSrc1Tmp].au64[1]; \
|
---|
1291 | (a_uYmmDst).uSrc1.au64[2] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[a_iYRegSrc1Tmp].au64[0]; \
|
---|
1292 | (a_uYmmDst).uSrc1.au64[3] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[a_iYRegSrc1Tmp].au64[1]; \
|
---|
1293 | } while (0)
|
---|
1294 |
|
---|
1295 | #else
|
---|
1296 | # define IEM_MC_FETCH_MEM_U256(a_u256Dst, a_iSeg, a_GCPtrMem) \
|
---|
1297 | iemMemFetchDataU256NoAcJmp(pVCpu, &(a_u256Dst), (a_iSeg), (a_GCPtrMem))
|
---|
1298 | # define IEM_MC_FETCH_MEM_U256_NO_AC(a_u256Dst, a_iSeg, a_GCPtrMem) \
|
---|
1299 | iemMemFetchDataU256NoAcJmp(pVCpu, &(a_u256Dst), (a_iSeg), (a_GCPtrMem))
|
---|
1300 | # define IEM_MC_FETCH_MEM_U256_ALIGN_AVX(a_u256Dst, a_iSeg, a_GCPtrMem) \
|
---|
1301 | iemMemFetchDataU256AlignedAvxJmp(pVCpu, &(a_u256Dst), (a_iSeg), (a_GCPtrMem))
|
---|
1302 |
|
---|
1303 | # define IEM_MC_FETCH_MEM_YMM(a_YmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1304 | iemMemFetchDataU256NoAcJmp(pVCpu, &(a_YmmDst).ymm, (a_iSeg), (a_GCPtrMem))
|
---|
1305 | # define IEM_MC_FETCH_MEM_YMM_NO_AC(a_YmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1306 | iemMemFetchDataU256NoAcJmp(pVCpu, &(a_YmmDst).ymm, (a_iSeg), (a_GCPtrMem))
|
---|
1307 | # define IEM_MC_FETCH_MEM_YMM_ALIGN_AVX(a_YmmDst, a_iSeg, a_GCPtrMem) \
|
---|
1308 | iemMemFetchDataU256AlignedAvxJmp(pVCpu, &(a_YmmDst).ymm, (a_iSeg), (a_GCPtrMem))
|
---|
1309 |
|
---|
1310 | # define IEM_MC_FETCH_MEM_YMM_ALIGN_AVX_AND_YREG_YMM(a_uYmmDst, a_iYRegSrc1, a_iSeg2, a_GCPtrMem2) do { \
|
---|
1311 | uintptr_t const a_iYRegSrc1Tmp = (a_iYRegSrc1); \
|
---|
1312 | iemMemFetchDataU256AlignedAvxJmp(pVCpu, &(a_uYmmDst).uSrc2.ymm, (a_iSeg2), (a_GCPtrMem2)); \
|
---|
1313 | (a_uYmmDst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[a_iYRegSrc1Tmp].au64[0]; \
|
---|
1314 | (a_uYmmDst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[a_iYRegSrc1Tmp].au64[1]; \
|
---|
1315 | (a_uYmmDst).uSrc1.au64[2] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[a_iYRegSrc1Tmp].au64[0]; \
|
---|
1316 | (a_uYmmDst).uSrc1.au64[3] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[a_iYRegSrc1Tmp].au64[1]; \
|
---|
1317 | } while (0)
|
---|
1318 |
|
---|
1319 | # define IEM_MC_FETCH_MEM_FLAT_U256(a_u256Dst, a_GCPtrMem) \
|
---|
1320 | iemMemFlatFetchDataU256NoAcJmp(pVCpu, &(a_u256Dst), (a_GCPtrMem))
|
---|
1321 | # define IEM_MC_FETCH_MEM_FLAT_U256_NO_AC(a_u256Dst, a_GCPtrMem) \
|
---|
1322 | iemMemFlatFetchDataU256NoAcJmp(pVCpu, &(a_u256Dst), (a_GCPtrMem))
|
---|
1323 | # define IEM_MC_FETCH_MEM_FLAT_U256_ALIGN_AVX(a_u256Dst, a_GCPtrMem) \
|
---|
1324 | iemMemFlatFetchDataU256AlignedAvxJmp(pVCpu, &(a_u256Dst), (a_GCPtrMem))
|
---|
1325 |
|
---|
1326 | # define IEM_MC_FETCH_MEM_FLAT_YMM(a_YmmDst, a_GCPtrMem) \
|
---|
1327 | iemMemFlatFetchDataU256NoAcJmp(pVCpu, &(a_YmmDst).ymm, (a_GCPtrMem))
|
---|
1328 | # define IEM_MC_FETCH_MEM_FLAT_YMM_NO_AC(a_YmmDst, a_GCPtrMem) \
|
---|
1329 | iemMemFlatFetchDataU256NoAcJmp(pVCpu, &(a_YmmDst).ymm, (a_GCPtrMem))
|
---|
1330 | # define IEM_MC_FETCH_MEM_FLAT_YMM_ALIGN_AVX(a_YmmDst, a_GCPtrMem) \
|
---|
1331 | iemMemFlatFetchDataU256AlignedAvxJmp(pVCpu, &(a_YmmDst).ymm, (a_GCPtrMem))
|
---|
1332 |
|
---|
1333 | # define IEM_MC_FETCH_MEM_FLAT_YMM_ALIGN_AVX_AND_YREG_YMM(a_uYmmDst, a_iYRegSrc1, a_GCPtrMem2) do { \
|
---|
1334 | uintptr_t const a_iYRegSrc1Tmp = (a_iYRegSrc1); \
|
---|
1335 | iemMemFlatFetchDataU256AlignedAvxJmp(pVCpu, &(a_uYmmDst).uSrc2.ymm, (a_GCPtrMem2)); \
|
---|
1336 | (a_uYmmDst).uSrc1.au64[0] = pVCpu->cpum.GstCtx.XState.x87.aXMM[a_iYRegSrc1Tmp].au64[0]; \
|
---|
1337 | (a_uYmmDst).uSrc1.au64[1] = pVCpu->cpum.GstCtx.XState.x87.aXMM[a_iYRegSrc1Tmp].au64[1]; \
|
---|
1338 | (a_uYmmDst).uSrc1.au64[2] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[a_iYRegSrc1Tmp].au64[0]; \
|
---|
1339 | (a_uYmmDst).uSrc1.au64[3] = pVCpu->cpum.GstCtx.XState.u.YmmHi.aYmmHi[a_iYRegSrc1Tmp].au64[1]; \
|
---|
1340 | } while (0)
|
---|
1341 |
|
---|
1342 | #endif
|
---|
1343 |
|
---|
1344 |
|
---|
1345 |
|
---|
1346 | #ifndef IEM_WITH_SETJMP
|
---|
1347 | # define IEM_MC_FETCH_MEM_U8_ZX_U16(a_u16Dst, a_iSeg, a_GCPtrMem) \
|
---|
1348 | do { \
|
---|
1349 | uint8_t u8Tmp; \
|
---|
1350 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pVCpu, &u8Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1351 | (a_u16Dst) = u8Tmp; \
|
---|
1352 | } while (0)
|
---|
1353 | # define IEM_MC_FETCH_MEM_U8_ZX_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1354 | do { \
|
---|
1355 | uint8_t u8Tmp; \
|
---|
1356 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pVCpu, &u8Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1357 | (a_u32Dst) = u8Tmp; \
|
---|
1358 | } while (0)
|
---|
1359 | # define IEM_MC_FETCH_MEM_U8_ZX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1360 | do { \
|
---|
1361 | uint8_t u8Tmp; \
|
---|
1362 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pVCpu, &u8Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1363 | (a_u64Dst) = u8Tmp; \
|
---|
1364 | } while (0)
|
---|
1365 | # define IEM_MC_FETCH_MEM_U16_ZX_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1366 | do { \
|
---|
1367 | uint16_t u16Tmp; \
|
---|
1368 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU16(pVCpu, &u16Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1369 | (a_u32Dst) = u16Tmp; \
|
---|
1370 | } while (0)
|
---|
1371 | # define IEM_MC_FETCH_MEM_U16_ZX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1372 | do { \
|
---|
1373 | uint16_t u16Tmp; \
|
---|
1374 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU16(pVCpu, &u16Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1375 | (a_u64Dst) = u16Tmp; \
|
---|
1376 | } while (0)
|
---|
1377 | # define IEM_MC_FETCH_MEM_U32_ZX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1378 | do { \
|
---|
1379 | uint32_t u32Tmp; \
|
---|
1380 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU32(pVCpu, &u32Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1381 | (a_u64Dst) = u32Tmp; \
|
---|
1382 | } while (0)
|
---|
1383 | #else /* IEM_WITH_SETJMP */
|
---|
1384 | # define IEM_MC_FETCH_MEM_U8_ZX_U16(a_u16Dst, a_iSeg, a_GCPtrMem) \
|
---|
1385 | ((a_u16Dst) = iemMemFetchDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1386 | # define IEM_MC_FETCH_MEM_U8_ZX_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1387 | ((a_u32Dst) = iemMemFetchDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1388 | # define IEM_MC_FETCH_MEM_U8_ZX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1389 | ((a_u64Dst) = iemMemFetchDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1390 | # define IEM_MC_FETCH_MEM_U16_ZX_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1391 | ((a_u32Dst) = iemMemFetchDataU16Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1392 | # define IEM_MC_FETCH_MEM_U16_ZX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1393 | ((a_u64Dst) = iemMemFetchDataU16Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1394 | # define IEM_MC_FETCH_MEM_U32_ZX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1395 | ((a_u64Dst) = iemMemFetchDataU32Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1396 |
|
---|
1397 | # define IEM_MC_FETCH_MEM_FLAT_U8_ZX_U16(a_u16Dst, a_GCPtrMem) \
|
---|
1398 | ((a_u16Dst) = iemMemFlatFetchDataU8Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1399 | # define IEM_MC_FETCH_MEM_FLAT_U8_ZX_U32(a_u32Dst, a_GCPtrMem) \
|
---|
1400 | ((a_u32Dst) = iemMemFlatFetchDataU8Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1401 | # define IEM_MC_FETCH_MEM_FLAT_U8_ZX_U64(a_u64Dst, a_GCPtrMem) \
|
---|
1402 | ((a_u64Dst) = iemMemFlatFetchDataU8Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1403 | # define IEM_MC_FETCH_MEM_FLAT_U16_ZX_U32(a_u32Dst, a_GCPtrMem) \
|
---|
1404 | ((a_u32Dst) = iemMemFlatFetchDataU16Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1405 | # define IEM_MC_FETCH_MEM_FLAT_U16_ZX_U64(a_u64Dst, a_GCPtrMem) \
|
---|
1406 | ((a_u64Dst) = iemMemFlatFetchDataU16Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1407 | # define IEM_MC_FETCH_MEM_FLAT_U32_ZX_U64(a_u64Dst, a_GCPtrMem) \
|
---|
1408 | ((a_u64Dst) = iemMemFlatFetchDataU32Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1409 | #endif /* IEM_WITH_SETJMP */
|
---|
1410 |
|
---|
1411 | #ifndef IEM_WITH_SETJMP
|
---|
1412 | # define IEM_MC_FETCH_MEM_U8_SX_U16(a_u16Dst, a_iSeg, a_GCPtrMem) \
|
---|
1413 | do { \
|
---|
1414 | uint8_t u8Tmp; \
|
---|
1415 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pVCpu, &u8Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1416 | (a_u16Dst) = (int8_t)u8Tmp; \
|
---|
1417 | } while (0)
|
---|
1418 | # define IEM_MC_FETCH_MEM_U8_SX_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1419 | do { \
|
---|
1420 | uint8_t u8Tmp; \
|
---|
1421 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pVCpu, &u8Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1422 | (a_u32Dst) = (int8_t)u8Tmp; \
|
---|
1423 | } while (0)
|
---|
1424 | # define IEM_MC_FETCH_MEM_U8_SX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1425 | do { \
|
---|
1426 | uint8_t u8Tmp; \
|
---|
1427 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pVCpu, &u8Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1428 | (a_u64Dst) = (int8_t)u8Tmp; \
|
---|
1429 | } while (0)
|
---|
1430 | # define IEM_MC_FETCH_MEM_U16_SX_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1431 | do { \
|
---|
1432 | uint16_t u16Tmp; \
|
---|
1433 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU16(pVCpu, &u16Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1434 | (a_u32Dst) = (int16_t)u16Tmp; \
|
---|
1435 | } while (0)
|
---|
1436 | # define IEM_MC_FETCH_MEM_U16_SX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1437 | do { \
|
---|
1438 | uint16_t u16Tmp; \
|
---|
1439 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU16(pVCpu, &u16Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1440 | (a_u64Dst) = (int16_t)u16Tmp; \
|
---|
1441 | } while (0)
|
---|
1442 | # define IEM_MC_FETCH_MEM_U32_SX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1443 | do { \
|
---|
1444 | uint32_t u32Tmp; \
|
---|
1445 | IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU32(pVCpu, &u32Tmp, (a_iSeg), (a_GCPtrMem))); \
|
---|
1446 | (a_u64Dst) = (int32_t)u32Tmp; \
|
---|
1447 | } while (0)
|
---|
1448 | #else /* IEM_WITH_SETJMP */
|
---|
1449 | # define IEM_MC_FETCH_MEM_U8_SX_U16(a_u16Dst, a_iSeg, a_GCPtrMem) \
|
---|
1450 | ((a_u16Dst) = (int8_t)iemMemFetchDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1451 | # define IEM_MC_FETCH_MEM_U8_SX_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1452 | ((a_u32Dst) = (int8_t)iemMemFetchDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1453 | # define IEM_MC_FETCH_MEM_U8_SX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1454 | ((a_u64Dst) = (int8_t)iemMemFetchDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1455 | # define IEM_MC_FETCH_MEM_U16_SX_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \
|
---|
1456 | ((a_u32Dst) = (int16_t)iemMemFetchDataU16Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1457 | # define IEM_MC_FETCH_MEM_U16_SX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1458 | ((a_u64Dst) = (int16_t)iemMemFetchDataU16Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1459 | # define IEM_MC_FETCH_MEM_U32_SX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \
|
---|
1460 | ((a_u64Dst) = (int32_t)iemMemFetchDataU32Jmp(pVCpu, (a_iSeg), (a_GCPtrMem)))
|
---|
1461 |
|
---|
1462 | # define IEM_MC_FETCH_MEM_FLAT_U8_SX_U16(a_u16Dst, a_GCPtrMem) \
|
---|
1463 | ((a_u16Dst) = (int8_t)iemMemFlatFetchDataU8Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1464 | # define IEM_MC_FETCH_MEM_FLAT_U8_SX_U32(a_u32Dst, a_GCPtrMem) \
|
---|
1465 | ((a_u32Dst) = (int8_t)iemMemFlatFetchDataU8Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1466 | # define IEM_MC_FETCH_MEM_FLAT_U8_SX_U64(a_u64Dst, a_GCPtrMem) \
|
---|
1467 | ((a_u64Dst) = (int8_t)iemMemFlatFetchDataU8Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1468 | # define IEM_MC_FETCH_MEM_FLAT_U16_SX_U32(a_u32Dst, a_GCPtrMem) \
|
---|
1469 | ((a_u32Dst) = (int16_t)iemMemFlatFetchDataU16Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1470 | # define IEM_MC_FETCH_MEM_FLAT_U16_SX_U64(a_u64Dst, a_GCPtrMem) \
|
---|
1471 | ((a_u64Dst) = (int16_t)iemMemFlatFetchDataU16Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1472 | # define IEM_MC_FETCH_MEM_FLAT_U32_SX_U64(a_u64Dst, a_GCPtrMem) \
|
---|
1473 | ((a_u64Dst) = (int32_t)iemMemFlatFetchDataU32Jmp(pVCpu, (a_GCPtrMem)))
|
---|
1474 | #endif /* IEM_WITH_SETJMP */
|
---|
1475 |
|
---|
1476 | #ifndef IEM_WITH_SETJMP
|
---|
1477 | # define IEM_MC_STORE_MEM_U8(a_iSeg, a_GCPtrMem, a_u8Value) \
|
---|
1478 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU8(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u8Value)))
|
---|
1479 | # define IEM_MC_STORE_MEM_U16(a_iSeg, a_GCPtrMem, a_u16Value) \
|
---|
1480 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU16(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u16Value)))
|
---|
1481 | # define IEM_MC_STORE_MEM_U32(a_iSeg, a_GCPtrMem, a_u32Value) \
|
---|
1482 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU32(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u32Value)))
|
---|
1483 | # define IEM_MC_STORE_MEM_U64(a_iSeg, a_GCPtrMem, a_u64Value) \
|
---|
1484 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU64(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u64Value)))
|
---|
1485 | #else
|
---|
1486 | # define IEM_MC_STORE_MEM_U8(a_iSeg, a_GCPtrMem, a_u8Value) \
|
---|
1487 | iemMemStoreDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u8Value))
|
---|
1488 | # define IEM_MC_STORE_MEM_U16(a_iSeg, a_GCPtrMem, a_u16Value) \
|
---|
1489 | iemMemStoreDataU16Jmp(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u16Value))
|
---|
1490 | # define IEM_MC_STORE_MEM_U32(a_iSeg, a_GCPtrMem, a_u32Value) \
|
---|
1491 | iemMemStoreDataU32Jmp(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u32Value))
|
---|
1492 | # define IEM_MC_STORE_MEM_U64(a_iSeg, a_GCPtrMem, a_u64Value) \
|
---|
1493 | iemMemStoreDataU64Jmp(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u64Value))
|
---|
1494 |
|
---|
1495 | # define IEM_MC_STORE_MEM_FLAT_U8(a_GCPtrMem, a_u8Value) \
|
---|
1496 | iemMemFlatStoreDataU8Jmp(pVCpu, (a_GCPtrMem), (a_u8Value))
|
---|
1497 | # define IEM_MC_STORE_MEM_FLAT_U16(a_GCPtrMem, a_u16Value) \
|
---|
1498 | iemMemFlatStoreDataU16Jmp(pVCpu, (a_GCPtrMem), (a_u16Value))
|
---|
1499 | # define IEM_MC_STORE_MEM_FLAT_U32(a_GCPtrMem, a_u32Value) \
|
---|
1500 | iemMemFlatStoreDataU32Jmp(pVCpu, (a_GCPtrMem), (a_u32Value))
|
---|
1501 | # define IEM_MC_STORE_MEM_FLAT_U64(a_GCPtrMem, a_u64Value) \
|
---|
1502 | iemMemFlatStoreDataU64Jmp(pVCpu, (a_GCPtrMem), (a_u64Value))
|
---|
1503 | #endif
|
---|
1504 |
|
---|
1505 | #ifndef IEM_WITH_SETJMP
|
---|
1506 | # define IEM_MC_STORE_MEM_U8_CONST(a_iSeg, a_GCPtrMem, a_u8C) \
|
---|
1507 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU8(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u8C)))
|
---|
1508 | # define IEM_MC_STORE_MEM_U16_CONST(a_iSeg, a_GCPtrMem, a_u16C) \
|
---|
1509 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU16(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u16C)))
|
---|
1510 | # define IEM_MC_STORE_MEM_U32_CONST(a_iSeg, a_GCPtrMem, a_u32C) \
|
---|
1511 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU32(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u32C)))
|
---|
1512 | # define IEM_MC_STORE_MEM_U64_CONST(a_iSeg, a_GCPtrMem, a_u64C) \
|
---|
1513 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU64(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u64C)))
|
---|
1514 | #else
|
---|
1515 | # define IEM_MC_STORE_MEM_U8_CONST(a_iSeg, a_GCPtrMem, a_u8C) \
|
---|
1516 | iemMemStoreDataU8Jmp(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u8C))
|
---|
1517 | # define IEM_MC_STORE_MEM_U16_CONST(a_iSeg, a_GCPtrMem, a_u16C) \
|
---|
1518 | iemMemStoreDataU16Jmp(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u16C))
|
---|
1519 | # define IEM_MC_STORE_MEM_U32_CONST(a_iSeg, a_GCPtrMem, a_u32C) \
|
---|
1520 | iemMemStoreDataU32Jmp(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u32C))
|
---|
1521 | # define IEM_MC_STORE_MEM_U64_CONST(a_iSeg, a_GCPtrMem, a_u64C) \
|
---|
1522 | iemMemStoreDataU64Jmp(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u64C))
|
---|
1523 |
|
---|
1524 | # define IEM_MC_STORE_MEM_FLAT_U8_CONST(a_GCPtrMem, a_u8C) \
|
---|
1525 | iemMemFlatStoreDataU8Jmp(pVCpu, (a_GCPtrMem), (a_u8C))
|
---|
1526 | # define IEM_MC_STORE_MEM_FLAT_U16_CONST(a_GCPtrMem, a_u16C) \
|
---|
1527 | iemMemFlatStoreDataU16Jmp(pVCpu, (a_GCPtrMem), (a_u16C))
|
---|
1528 | # define IEM_MC_STORE_MEM_FLAT_U32_CONST(a_GCPtrMem, a_u32C) \
|
---|
1529 | iemMemFlatStoreDataU32Jmp(pVCpu, (a_GCPtrMem), (a_u32C))
|
---|
1530 | # define IEM_MC_STORE_MEM_FLAT_U64_CONST(a_GCPtrMem, a_u64C) \
|
---|
1531 | iemMemFlatStoreDataU64Jmp(pVCpu, (a_GCPtrMem), (a_u64C))
|
---|
1532 | #endif
|
---|
1533 |
|
---|
1534 | #define IEM_MC_STORE_MEM_I8_CONST_BY_REF( a_pi8Dst, a_i8C) *(a_pi8Dst) = (a_i8C)
|
---|
1535 | #define IEM_MC_STORE_MEM_I16_CONST_BY_REF(a_pi16Dst, a_i16C) *(a_pi16Dst) = (a_i16C)
|
---|
1536 | #define IEM_MC_STORE_MEM_I32_CONST_BY_REF(a_pi32Dst, a_i32C) *(a_pi32Dst) = (a_i32C)
|
---|
1537 | #define IEM_MC_STORE_MEM_I64_CONST_BY_REF(a_pi64Dst, a_i64C) *(a_pi64Dst) = (a_i64C)
|
---|
1538 | #define IEM_MC_STORE_MEM_NEG_QNAN_R32_BY_REF(a_pr32Dst) (a_pr32Dst)->u = UINT32_C(0xffc00000)
|
---|
1539 | #define IEM_MC_STORE_MEM_NEG_QNAN_R64_BY_REF(a_pr64Dst) (a_pr64Dst)->u = UINT64_C(0xfff8000000000000)
|
---|
1540 | #define IEM_MC_STORE_MEM_NEG_QNAN_R80_BY_REF(a_pr80Dst) \
|
---|
1541 | do { \
|
---|
1542 | (a_pr80Dst)->au64[0] = UINT64_C(0xc000000000000000); \
|
---|
1543 | (a_pr80Dst)->au16[4] = UINT16_C(0xffff); \
|
---|
1544 | } while (0)
|
---|
1545 | #define IEM_MC_STORE_MEM_INDEF_D80_BY_REF(a_pd80Dst) \
|
---|
1546 | do { \
|
---|
1547 | (a_pd80Dst)->au64[0] = UINT64_C(0xc000000000000000); \
|
---|
1548 | (a_pd80Dst)->au16[4] = UINT16_C(0xffff); \
|
---|
1549 | } while (0)
|
---|
1550 |
|
---|
1551 | #ifndef IEM_WITH_SETJMP
|
---|
1552 | # define IEM_MC_STORE_MEM_U128(a_iSeg, a_GCPtrMem, a_u128Value) \
|
---|
1553 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU128(pVCpu, (a_iSeg), (a_GCPtrMem), &(a_u128Value)))
|
---|
1554 | # define IEM_MC_STORE_MEM_U128_NO_AC(a_iSeg, a_GCPtrMem, a_u128Value) \
|
---|
1555 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU128NoAc(pVCpu, (a_iSeg), (a_GCPtrMem), &(a_u128Value)))
|
---|
1556 | # define IEM_MC_STORE_MEM_U128_ALIGN_SSE(a_iSeg, a_GCPtrMem, a_u128Value) \
|
---|
1557 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU128AlignedSse(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u128Value)))
|
---|
1558 | #else
|
---|
1559 | # define IEM_MC_STORE_MEM_U128(a_iSeg, a_GCPtrMem, a_u128Value) \
|
---|
1560 | iemMemStoreDataU128Jmp(pVCpu, (a_iSeg), (a_GCPtrMem), &(a_u128Value))
|
---|
1561 | # define IEM_MC_STORE_MEM_U128_NO_AC(a_iSeg, a_GCPtrMem, a_u128Value) \
|
---|
1562 | iemMemStoreDataU128NoAcJmp(pVCpu, (a_iSeg), (a_GCPtrMem), &(a_u128Value))
|
---|
1563 | # define IEM_MC_STORE_MEM_U128_ALIGN_SSE(a_iSeg, a_GCPtrMem, a_u128Value) \
|
---|
1564 | iemMemStoreDataU128AlignedSseJmp(pVCpu, (a_iSeg), (a_GCPtrMem), (a_u128Value))
|
---|
1565 |
|
---|
1566 | # define IEM_MC_STORE_MEM_FLAT_U128(a_GCPtrMem, a_u128Value) \
|
---|
1567 | iemMemFlatStoreDataU128Jmp(pVCpu, (a_GCPtrMem), &(a_u128Value))
|
---|
1568 | # define IEM_MC_STORE_MEM_FLAT_U128_NO_AC(a_GCPtrMem, a_u128Value) \
|
---|
1569 | iemMemFlatStoreDataU128NoAcJmp(pVCpu, (a_GCPtrMem), &(a_u128Value))
|
---|
1570 | # define IEM_MC_STORE_MEM_FLAT_U128_ALIGN_SSE(a_GCPtrMem, a_u128Value) \
|
---|
1571 | iemMemStoreDataU128AlignedSseJmp(pVCpu, UINT8_MAX, (a_GCPtrMem), (a_u128Value))
|
---|
1572 | #endif
|
---|
1573 |
|
---|
1574 | #ifndef IEM_WITH_SETJMP
|
---|
1575 | # define IEM_MC_STORE_MEM_U256(a_iSeg, a_GCPtrMem, a_u256Value) \
|
---|
1576 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU256(pVCpu, (a_iSeg), (a_GCPtrMem), &(a_u256Value)))
|
---|
1577 | # define IEM_MC_STORE_MEM_U256_NO_AC(a_iSeg, a_GCPtrMem, a_u256Value) \
|
---|
1578 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU256NoAc(pVCpu, (a_iSeg), (a_GCPtrMem), &(a_u256Value)))
|
---|
1579 | # define IEM_MC_STORE_MEM_U256_ALIGN_AVX(a_iSeg, a_GCPtrMem, a_u256Value) \
|
---|
1580 | IEM_MC_RETURN_ON_FAILURE(iemMemStoreDataU256AlignedAvx(pVCpu, (a_iSeg), (a_GCPtrMem), &(a_u256Value)))
|
---|
1581 | #else
|
---|
1582 | # define IEM_MC_STORE_MEM_U256(a_iSeg, a_GCPtrMem, a_u256Value) \
|
---|
1583 | iemMemStoreDataU256Jmp(pVCpu, (a_iSeg), (a_GCPtrMem), &(a_u256Value))
|
---|
1584 | # define IEM_MC_STORE_MEM_U256_NO_AC(a_iSeg, a_GCPtrMem, a_u256Value) \
|
---|
1585 | iemMemStoreDataU256NoAcJmp(pVCpu, (a_iSeg), (a_GCPtrMem), &(a_u256Value))
|
---|
1586 | # define IEM_MC_STORE_MEM_U256_ALIGN_AVX(a_iSeg, a_GCPtrMem, a_u256Value) \
|
---|
1587 | iemMemStoreDataU256AlignedAvxJmp(pVCpu, (a_iSeg), (a_GCPtrMem), &(a_u256Value))
|
---|
1588 |
|
---|
1589 | # define IEM_MC_STORE_MEM_FLAT_U256(a_GCPtrMem, a_u256Value) \
|
---|
1590 | iemMemFlatStoreDataU256Jmp(pVCpu, (a_GCPtrMem), &(a_u256Value))
|
---|
1591 | # define IEM_MC_STORE_MEM_FLAT_U256_NO_AC(a_GCPtrMem, a_u256Value) \
|
---|
1592 | iemMemFlatStoreDataU256NoAcJmp(pVCpu, (a_GCPtrMem), &(a_u256Value))
|
---|
1593 | # define IEM_MC_STORE_MEM_FLAT_U256_ALIGN_AVX(a_GCPtrMem, a_u256Value) \
|
---|
1594 | iemMemFlatStoreDataU256AlignedAvxJmp(pVCpu, (a_GCPtrMem), &(a_u256Value))
|
---|
1595 | #endif
|
---|
1596 |
|
---|
1597 | /* Regular stack push and pop: */
|
---|
1598 | #ifndef IEM_WITH_SETJMP
|
---|
1599 | # define IEM_MC_PUSH_U16(a_u16Value) IEM_MC_RETURN_ON_FAILURE(iemMemStackPushU16(pVCpu, (a_u16Value)))
|
---|
1600 | # define IEM_MC_PUSH_U32(a_u32Value) IEM_MC_RETURN_ON_FAILURE(iemMemStackPushU32(pVCpu, (a_u32Value)))
|
---|
1601 | # define IEM_MC_PUSH_U32_SREG(a_uSegVal) IEM_MC_RETURN_ON_FAILURE(iemMemStackPushU32SReg(pVCpu, (a_uSegVal)))
|
---|
1602 | # define IEM_MC_PUSH_U64(a_u64Value) IEM_MC_RETURN_ON_FAILURE(iemMemStackPushU64(pVCpu, (a_u64Value)))
|
---|
1603 |
|
---|
1604 | # define IEM_MC_POP_GREG_U16(a_iGReg) IEM_MC_RETURN_ON_FAILURE(iemMemStackPopGRegU16(pVCpu, (a_iGReg)))
|
---|
1605 | # define IEM_MC_POP_GREG_U32(a_iGReg) IEM_MC_RETURN_ON_FAILURE(iemMemStackPopGRegU32(pVCpu, (a_iGReg)))
|
---|
1606 | # define IEM_MC_POP_GREG_U64(a_iGReg) IEM_MC_RETURN_ON_FAILURE(iemMemStackPopGRegU64(pVCpu, (a_iGReg)))
|
---|
1607 | #else
|
---|
1608 | # define IEM_MC_PUSH_U16(a_u16Value) iemMemStackPushU16Jmp(pVCpu, (a_u16Value))
|
---|
1609 | # define IEM_MC_PUSH_U32(a_u32Value) iemMemStackPushU32Jmp(pVCpu, (a_u32Value))
|
---|
1610 | # define IEM_MC_PUSH_U32_SREG(a_uSegVal) iemMemStackPushU32SRegJmp(pVCpu, (a_uSegVal))
|
---|
1611 | # define IEM_MC_PUSH_U64(a_u64Value) iemMemStackPushU64Jmp(pVCpu, (a_u64Value))
|
---|
1612 |
|
---|
1613 | # define IEM_MC_POP_GREG_U16(a_iGReg) iemMemStackPopGRegU16Jmp(pVCpu, (a_iGReg))
|
---|
1614 | # define IEM_MC_POP_GREG_U32(a_iGReg) iemMemStackPopGRegU32Jmp(pVCpu, (a_iGReg))
|
---|
1615 | # define IEM_MC_POP_GREG_U64(a_iGReg) iemMemStackPopGRegU64Jmp(pVCpu, (a_iGReg))
|
---|
1616 | #endif
|
---|
1617 |
|
---|
1618 | /* 32-bit flat stack push and pop: */
|
---|
1619 | #ifndef IEM_WITH_SETJMP
|
---|
1620 | # define IEM_MC_FLAT32_PUSH_U16(a_u16Value) IEM_MC_RETURN_ON_FAILURE(iemMemStackPushU16(pVCpu, (a_u16Value)))
|
---|
1621 | # define IEM_MC_FLAT32_PUSH_U32(a_u32Value) IEM_MC_RETURN_ON_FAILURE(iemMemStackPushU32(pVCpu, (a_u32Value)))
|
---|
1622 | # define IEM_MC_FLAT32_PUSH_U32_SREG(a_uSegVal) IEM_MC_RETURN_ON_FAILURE(iemMemStackPushU32SReg(pVCpu, (a_uSegVal)))
|
---|
1623 |
|
---|
1624 | # define IEM_MC_FLAT32_POP_GREG_U16(a_iGReg) IEM_MC_RETURN_ON_FAILURE(iemMemStackPopGRegU16(pVCpu, (a_iGReg)))
|
---|
1625 | # define IEM_MC_FLAT32_POP_GREG_U32(a_iGReg) IEM_MC_RETURN_ON_FAILURE(iemMemStackPopGRegU32(pVCpu, (a_iGReg)))
|
---|
1626 | #else
|
---|
1627 | # define IEM_MC_FLAT32_PUSH_U16(a_u16Value) iemMemFlat32StackPushU16Jmp(pVCpu, (a_u16Value))
|
---|
1628 | # define IEM_MC_FLAT32_PUSH_U32(a_u32Value) iemMemFlat32StackPushU32Jmp(pVCpu, (a_u32Value))
|
---|
1629 | # define IEM_MC_FLAT32_PUSH_U32_SREG(a_uSegVal) iemMemFlat32StackPushU32SRegJmp(pVCpu, (a_uSegVal))
|
---|
1630 |
|
---|
1631 | # define IEM_MC_FLAT32_POP_GREG_U16(a_iGReg) iemMemFlat32StackPopGRegU16Jmp(pVCpu, a_iGReg))
|
---|
1632 | # define IEM_MC_FLAT32_POP_GREG_U32(a_iGReg) iemMemFlat32StackPopGRegU32Jmp(pVCpu, a_iGReg))
|
---|
1633 | #endif
|
---|
1634 |
|
---|
1635 | /* 64-bit flat stack push and pop: */
|
---|
1636 | #ifndef IEM_WITH_SETJMP
|
---|
1637 | # define IEM_MC_FLAT64_PUSH_U16(a_u16Value) IEM_MC_RETURN_ON_FAILURE(iemMemStackPushU16(pVCpu, (a_u16Value)))
|
---|
1638 | # define IEM_MC_FLAT64_PUSH_U64(a_u64Value) IEM_MC_RETURN_ON_FAILURE(iemMemStackPushU64(pVCpu, (a_u64Value)))
|
---|
1639 |
|
---|
1640 | # define IEM_MC_FLAT64_POP_GREG_U16(a_iGReg) IEM_MC_RETURN_ON_FAILURE(iemMemStackPopGRegU16(pVCpu, (a_iGReg)))
|
---|
1641 | # define IEM_MC_FLAT64_POP_GREG_U64(a_iGReg) IEM_MC_RETURN_ON_FAILURE(iemMemStackPopGRegU64(pVCpu, (a_iGReg)))
|
---|
1642 | #else
|
---|
1643 | # define IEM_MC_FLAT64_PUSH_U16(a_u16Value) iemMemFlat64StackPushU16Jmp(pVCpu, (a_u16Value))
|
---|
1644 | # define IEM_MC_FLAT64_PUSH_U64(a_u64Value) iemMemFlat64StackPushU64Jmp(pVCpu, (a_u64Value))
|
---|
1645 |
|
---|
1646 | # define IEM_MC_FLAT64_POP_GREG_U16(a_iGReg) iemMemFlat64StackPopGRegU16Jmp(pVCpu, (a_iGReg))
|
---|
1647 | # define IEM_MC_FLAT64_POP_GREG_U64(a_iGReg) iemMemFlat64StackPopGRegU64Jmp(pVCpu, (a_iGReg))
|
---|
1648 | #endif
|
---|
1649 |
|
---|
1650 |
|
---|
1651 | /* 8-bit */
|
---|
1652 |
|
---|
1653 | /**
|
---|
1654 | * Maps guest memory for byte atomic read+write direct (or bounce) buffer
|
---|
1655 | * acccess, for atomic operations.
|
---|
1656 | *
|
---|
1657 | * @param[out] a_pu8Mem Where to return the pointer to the mapping.
|
---|
1658 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1659 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
1660 | * @param[in] a_GCPtrMem The memory address.
|
---|
1661 | * @remarks Will return/long jump on errors.
|
---|
1662 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC
|
---|
1663 | */
|
---|
1664 | #ifndef IEM_WITH_SETJMP
|
---|
1665 | # define IEM_MC_MEM_MAP_U8_ATOMIC(a_pu8Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1666 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu8Mem), &(a_bUnmapInfo), sizeof(uint8_t), (a_iSeg), \
|
---|
1667 | (a_GCPtrMem), IEM_ACCESS_DATA_ATOMIC, 0))
|
---|
1668 | #else
|
---|
1669 | # define IEM_MC_MEM_MAP_U8_ATOMIC(a_pu8Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1670 | (a_pu8Mem) = iemMemMapDataU8AtJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
1671 | #endif
|
---|
1672 |
|
---|
1673 | /**
|
---|
1674 | * Maps guest memory for byte read+write direct (or bounce) buffer acccess.
|
---|
1675 | *
|
---|
1676 | * @param[out] a_pu8Mem Where to return the pointer to the mapping.
|
---|
1677 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1678 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
1679 | * @param[in] a_GCPtrMem The memory address.
|
---|
1680 | * @remarks Will return/long jump on errors.
|
---|
1681 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RW
|
---|
1682 | */
|
---|
1683 | #ifndef IEM_WITH_SETJMP
|
---|
1684 | # define IEM_MC_MEM_MAP_U8_RW(a_pu8Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1685 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu8Mem), &(a_bUnmapInfo), sizeof(uint8_t), (a_iSeg), \
|
---|
1686 | (a_GCPtrMem), IEM_ACCESS_DATA_RW, 0))
|
---|
1687 | #else
|
---|
1688 | # define IEM_MC_MEM_MAP_U8_RW(a_pu8Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1689 | (a_pu8Mem) = iemMemMapDataU8RwJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
1690 | #endif
|
---|
1691 |
|
---|
1692 | /**
|
---|
1693 | * Maps guest memory for byte writeonly direct (or bounce) buffer acccess.
|
---|
1694 | *
|
---|
1695 | * @param[out] a_pu8Mem Where to return the pointer to the mapping.
|
---|
1696 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1697 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
1698 | * @param[in] a_GCPtrMem The memory address.
|
---|
1699 | * @remarks Will return/long jump on errors.
|
---|
1700 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
1701 | */
|
---|
1702 | #ifndef IEM_WITH_SETJMP
|
---|
1703 | # define IEM_MC_MEM_MAP_U8_WO(a_pu8Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1704 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu8Mem), &(a_bUnmapInfo), sizeof(uint8_t), (a_iSeg), \
|
---|
1705 | (a_GCPtrMem), IEM_ACCESS_DATA_W, 0))
|
---|
1706 | #else
|
---|
1707 | # define IEM_MC_MEM_MAP_U8_WO(a_pu8Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1708 | (a_pu8Mem) = iemMemMapDataU8WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
1709 | #endif
|
---|
1710 |
|
---|
1711 | /**
|
---|
1712 | * Maps guest memory for byte readonly direct (or bounce) buffer acccess.
|
---|
1713 | *
|
---|
1714 | * @param[out] a_pu8Mem Where to return the pointer to the mapping.
|
---|
1715 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1716 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
1717 | * @param[in] a_GCPtrMem The memory address.
|
---|
1718 | * @remarks Will return/long jump on errors.
|
---|
1719 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RO
|
---|
1720 | */
|
---|
1721 | #ifndef IEM_WITH_SETJMP
|
---|
1722 | # define IEM_MC_MEM_MAP_U8_RO(a_pu8Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1723 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu8Mem), &(a_bUnmapInfo), sizeof(uint8_t), (a_iSeg), \
|
---|
1724 | (a_GCPtrMem), IEM_ACCESS_DATA_R, 0))
|
---|
1725 | #else
|
---|
1726 | # define IEM_MC_MEM_MAP_U8_RO(a_pu8Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1727 | (a_pu8Mem) = iemMemMapDataU8RoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
1728 | #endif
|
---|
1729 |
|
---|
1730 | /**
|
---|
1731 | * Maps guest memory for byte atomic read+write direct (or bounce) buffer
|
---|
1732 | * acccess, flat address variant.
|
---|
1733 | *
|
---|
1734 | * @param[out] a_pu8Mem Where to return the pointer to the mapping.
|
---|
1735 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1736 | * @param[in] a_GCPtrMem The memory address.
|
---|
1737 | * @remarks Will return/long jump on errors.
|
---|
1738 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC
|
---|
1739 | */
|
---|
1740 | #ifndef IEM_WITH_SETJMP
|
---|
1741 | # define IEM_MC_MEM_FLAT_MAP_U8_ATOMIC(a_pu8Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1742 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu8Mem), &(a_bUnmapInfo), sizeof(uint8_t), UINT8_MAX, \
|
---|
1743 | (a_GCPtrMem), IEM_ACCESS_DATA_ATOMIC, 0))
|
---|
1744 | #else
|
---|
1745 | # define IEM_MC_MEM_FLAT_MAP_U8_ATOMIC(a_pu8Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1746 | (a_pu8Mem) = iemMemFlatMapDataU8AtJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
1747 | #endif
|
---|
1748 |
|
---|
1749 | /**
|
---|
1750 | * Maps guest memory for byte read+write direct (or bounce) buffer acccess, flat
|
---|
1751 | * address variant.
|
---|
1752 | *
|
---|
1753 | * @param[out] a_pu8Mem Where to return the pointer to the mapping.
|
---|
1754 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1755 | * @param[in] a_GCPtrMem The memory address.
|
---|
1756 | * @remarks Will return/long jump on errors.
|
---|
1757 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RW
|
---|
1758 | */
|
---|
1759 | #ifndef IEM_WITH_SETJMP
|
---|
1760 | # define IEM_MC_MEM_FLAT_MAP_U8_RW(a_pu8Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1761 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu8Mem), &(a_bUnmapInfo), sizeof(uint8_t), UINT8_MAX, \
|
---|
1762 | (a_GCPtrMem), IEM_ACCESS_DATA_RW, 0))
|
---|
1763 | #else
|
---|
1764 | # define IEM_MC_MEM_FLAT_MAP_U8_RW(a_pu8Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1765 | (a_pu8Mem) = iemMemFlatMapDataU8RwJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
1766 | #endif
|
---|
1767 |
|
---|
1768 | /**
|
---|
1769 | * Maps guest memory for byte writeonly direct (or bounce) buffer acccess, flat
|
---|
1770 | * address variant.
|
---|
1771 | *
|
---|
1772 | * @param[out] a_pu8Mem Where to return the pointer to the mapping.
|
---|
1773 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1774 | * @param[in] a_GCPtrMem The memory address.
|
---|
1775 | * @remarks Will return/long jump on errors.
|
---|
1776 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
1777 | */
|
---|
1778 | #ifndef IEM_WITH_SETJMP
|
---|
1779 | # define IEM_MC_MEM_FLAT_MAP_U8_WO(a_pu8Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1780 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu8Mem), &(a_bUnmapInfo), sizeof(uint8_t), UINT8_MAX, \
|
---|
1781 | (a_GCPtrMem), IEM_ACCESS_DATA_W, 0))
|
---|
1782 | #else
|
---|
1783 | # define IEM_MC_MEM_FLAT_MAP_U8_WO(a_pu8Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1784 | (a_pu8Mem) = iemMemFlatMapDataU8WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
1785 | #endif
|
---|
1786 |
|
---|
1787 | /**
|
---|
1788 | * Maps guest memory for byte readonly direct (or bounce) buffer acccess, flat
|
---|
1789 | * address variant.
|
---|
1790 | *
|
---|
1791 | * @param[out] a_pu8Mem Where to return the pointer to the mapping.
|
---|
1792 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1793 | * @param[in] a_GCPtrMem The memory address.
|
---|
1794 | * @remarks Will return/long jump on errors.
|
---|
1795 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RO
|
---|
1796 | */
|
---|
1797 | #ifndef IEM_WITH_SETJMP
|
---|
1798 | # define IEM_MC_MEM_FLAT_MAP_U8_RO(a_pu8Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1799 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu8Mem), &(a_bUnmapInfo), sizeof(uint8_t), UINT8_MAX, \
|
---|
1800 | (a_GCPtrMem), IEM_ACCESS_DATA_R, 0))
|
---|
1801 | #else
|
---|
1802 | # define IEM_MC_MEM_FLAT_MAP_U8_RO(a_pu8Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1803 | (a_pu8Mem) = iemMemFlatMapDataU8RoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
1804 | #endif
|
---|
1805 |
|
---|
1806 |
|
---|
1807 | /* 16-bit */
|
---|
1808 |
|
---|
1809 | /**
|
---|
1810 | * Maps guest memory for word atomic read+write direct (or bounce) buffer acccess.
|
---|
1811 | *
|
---|
1812 | * @param[out] a_pu16Mem Where to return the pointer to the mapping.
|
---|
1813 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1814 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
1815 | * @param[in] a_GCPtrMem The memory address.
|
---|
1816 | * @remarks Will return/long jump on errors.
|
---|
1817 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC
|
---|
1818 | */
|
---|
1819 | #ifndef IEM_WITH_SETJMP
|
---|
1820 | # define IEM_MC_MEM_MAP_U16_ATOMIC(a_pu16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1821 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu16Mem), &(a_bUnmapInfo), sizeof(uint16_t), (a_iSeg), \
|
---|
1822 | (a_GCPtrMem), IEM_ACCESS_DATA_ATOMIC, sizeof(uint16_t) - 1))
|
---|
1823 | #else
|
---|
1824 | # define IEM_MC_MEM_MAP_U16_ATOMIC(a_pu16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1825 | (a_pu16Mem) = iemMemMapDataU16AtJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
1826 | #endif
|
---|
1827 |
|
---|
1828 | /**
|
---|
1829 | * Maps guest memory for word read+write direct (or bounce) buffer acccess.
|
---|
1830 | *
|
---|
1831 | * @param[out] a_pu16Mem Where to return the pointer to the mapping.
|
---|
1832 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1833 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
1834 | * @param[in] a_GCPtrMem The memory address.
|
---|
1835 | * @remarks Will return/long jump on errors.
|
---|
1836 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RW
|
---|
1837 | */
|
---|
1838 | #ifndef IEM_WITH_SETJMP
|
---|
1839 | # define IEM_MC_MEM_MAP_U16_RW(a_pu16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1840 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu16Mem), &(a_bUnmapInfo), sizeof(uint16_t), (a_iSeg), \
|
---|
1841 | (a_GCPtrMem), IEM_ACCESS_DATA_RW, sizeof(uint16_t) - 1))
|
---|
1842 | #else
|
---|
1843 | # define IEM_MC_MEM_MAP_U16_RW(a_pu16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1844 | (a_pu16Mem) = iemMemMapDataU16RwJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
1845 | #endif
|
---|
1846 |
|
---|
1847 | /**
|
---|
1848 | * Maps guest memory for word writeonly direct (or bounce) buffer acccess.
|
---|
1849 | *
|
---|
1850 | * @param[out] a_pu16Mem Where to return the pointer to the mapping.
|
---|
1851 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1852 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
1853 | * @param[in] a_GCPtrMem The memory address.
|
---|
1854 | * @remarks Will return/long jump on errors.
|
---|
1855 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
1856 | */
|
---|
1857 | #ifndef IEM_WITH_SETJMP
|
---|
1858 | # define IEM_MC_MEM_MAP_U16_WO(a_pu16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1859 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu16Mem), &(a_bUnmapInfo), sizeof(uint16_t), (a_iSeg), \
|
---|
1860 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(uint16_t) - 1))
|
---|
1861 | #else
|
---|
1862 | # define IEM_MC_MEM_MAP_U16_WO(a_pu16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1863 | (a_pu16Mem) = iemMemMapDataU16WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
1864 | #endif
|
---|
1865 |
|
---|
1866 | /**
|
---|
1867 | * Maps guest memory for word readonly direct (or bounce) buffer acccess.
|
---|
1868 | *
|
---|
1869 | * @param[out] a_pu16Mem Where to return the pointer to the mapping.
|
---|
1870 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1871 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
1872 | * @param[in] a_GCPtrMem The memory address.
|
---|
1873 | * @remarks Will return/long jump on errors.
|
---|
1874 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RO
|
---|
1875 | */
|
---|
1876 | #ifndef IEM_WITH_SETJMP
|
---|
1877 | # define IEM_MC_MEM_MAP_U16_RO(a_pu16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1878 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu16Mem), &(a_bUnmapInfo), sizeof(uint16_t), (a_iSeg), \
|
---|
1879 | (a_GCPtrMem), IEM_ACCESS_DATA_R, sizeof(uint16_t) - 1))
|
---|
1880 | #else
|
---|
1881 | # define IEM_MC_MEM_MAP_U16_RO(a_pu16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1882 | (a_pu16Mem) = iemMemMapDataU16RoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
1883 | #endif
|
---|
1884 |
|
---|
1885 | /**
|
---|
1886 | * Maps guest memory for word atomic read+write direct (or bounce) buffer
|
---|
1887 | * acccess, flat address variant.
|
---|
1888 | *
|
---|
1889 | * @param[out] a_pu16Mem Where to return the pointer to the mapping.
|
---|
1890 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1891 | * @param[in] a_GCPtrMem The memory address.
|
---|
1892 | * @remarks Will return/long jump on errors.
|
---|
1893 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC
|
---|
1894 | */
|
---|
1895 | #ifndef IEM_WITH_SETJMP
|
---|
1896 | # define IEM_MC_MEM_FLAT_MAP_U16_ATOMIC(a_pu16Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1897 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu16Mem), &(a_bUnmapInfo), sizeof(uint16_t), UINT8_MAX, \
|
---|
1898 | (a_GCPtrMem), IEM_ACCESS_DATA_ATOMIC, sizeof(uint16_t) - 1))
|
---|
1899 | #else
|
---|
1900 | # define IEM_MC_MEM_FLAT_MAP_U16_ATOMIC(a_pu16Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1901 | (a_pu16Mem) = iemMemFlatMapDataU16AtJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
1902 | #endif
|
---|
1903 |
|
---|
1904 | /**
|
---|
1905 | * Maps guest memory for word read+write direct (or bounce) buffer acccess, flat
|
---|
1906 | * address variant.
|
---|
1907 | *
|
---|
1908 | * @param[out] a_pu16Mem Where to return the pointer to the mapping.
|
---|
1909 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1910 | * @param[in] a_GCPtrMem The memory address.
|
---|
1911 | * @remarks Will return/long jump on errors.
|
---|
1912 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RW
|
---|
1913 | */
|
---|
1914 | #ifndef IEM_WITH_SETJMP
|
---|
1915 | # define IEM_MC_MEM_FLAT_MAP_U16_RW(a_pu16Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1916 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu16Mem), &(a_bUnmapInfo), sizeof(uint16_t), UINT8_MAX, \
|
---|
1917 | (a_GCPtrMem), IEM_ACCESS_DATA_RW, sizeof(uint16_t) - 1))
|
---|
1918 | #else
|
---|
1919 | # define IEM_MC_MEM_FLAT_MAP_U16_RW(a_pu16Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1920 | (a_pu16Mem) = iemMemFlatMapDataU16RwJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
1921 | #endif
|
---|
1922 |
|
---|
1923 | /**
|
---|
1924 | * Maps guest memory for word writeonly direct (or bounce) buffer acccess, flat
|
---|
1925 | * address variant.
|
---|
1926 | *
|
---|
1927 | * @param[out] a_pu16Mem Where to return the pointer to the mapping.
|
---|
1928 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1929 | * @param[in] a_GCPtrMem The memory address.
|
---|
1930 | * @remarks Will return/long jump on errors.
|
---|
1931 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
1932 | */
|
---|
1933 | #ifndef IEM_WITH_SETJMP
|
---|
1934 | # define IEM_MC_MEM_FLAT_MAP_U16_WO(a_pu16Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1935 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu16Mem), &(a_bUnmapInfo), sizeof(uint16_t), UINT8_MAX, \
|
---|
1936 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(uint16_t) - 1))
|
---|
1937 | #else
|
---|
1938 | # define IEM_MC_MEM_FLAT_MAP_U16_WO(a_pu16Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1939 | (a_pu16Mem) = iemMemFlatMapDataU16WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
1940 | #endif
|
---|
1941 |
|
---|
1942 | /**
|
---|
1943 | * Maps guest memory for word readonly direct (or bounce) buffer acccess, flat
|
---|
1944 | * address variant.
|
---|
1945 | *
|
---|
1946 | * @param[out] a_pu16Mem Where to return the pointer to the mapping.
|
---|
1947 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1948 | * @param[in] a_GCPtrMem The memory address.
|
---|
1949 | * @remarks Will return/long jump on errors.
|
---|
1950 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RO
|
---|
1951 | */
|
---|
1952 | #ifndef IEM_WITH_SETJMP
|
---|
1953 | # define IEM_MC_MEM_FLAT_MAP_U16_RO(a_pu16Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1954 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu16Mem), &(a_bUnmapInfo), sizeof(uint16_t), UINT8_MAX, \
|
---|
1955 | (a_GCPtrMem), IEM_ACCESS_DATA_R, sizeof(uint16_t) - 1))
|
---|
1956 | #else
|
---|
1957 | # define IEM_MC_MEM_FLAT_MAP_U16_RO(a_pu16Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1958 | (a_pu16Mem) = iemMemFlatMapDataU16RoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
1959 | #endif
|
---|
1960 |
|
---|
1961 | /** int16_t alias. */
|
---|
1962 | #ifndef IEM_WITH_SETJMP
|
---|
1963 | # define IEM_MC_MEM_MAP_I16_WO(a_pi16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1964 | IEM_MC_MEM_MAP_U16_WO(a_pi16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem)
|
---|
1965 | #else
|
---|
1966 | # define IEM_MC_MEM_MAP_I16_WO(a_pi16Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1967 | (a_pi16Mem) = (int16_t *)iemMemMapDataU16WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
1968 | #endif
|
---|
1969 |
|
---|
1970 | /** Flat int16_t alias. */
|
---|
1971 | #ifndef IEM_WITH_SETJMP
|
---|
1972 | # define IEM_MC_MEM_FLAT_MAP_I16_WO(a_pi16Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1973 | IEM_MC_MEM_FLAT_MAP_U16_WO(a_pi16Mem, a_bUnmapInfo, a_GCPtrMem)
|
---|
1974 | #else
|
---|
1975 | # define IEM_MC_MEM_FLAT_MAP_I16_WO(a_pi16Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
1976 | (a_pi16Mem) = (int16_t *)iemMemFlatMapDataU16WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
1977 | #endif
|
---|
1978 |
|
---|
1979 |
|
---|
1980 | /* 32-bit */
|
---|
1981 |
|
---|
1982 | /**
|
---|
1983 | * Maps guest memory for dword atomic read+write direct (or bounce) buffer acccess.
|
---|
1984 | *
|
---|
1985 | * @param[out] a_pu32Mem Where to return the pointer to the mapping.
|
---|
1986 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
1987 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
1988 | * @param[in] a_GCPtrMem The memory address.
|
---|
1989 | * @remarks Will return/long jump on errors.
|
---|
1990 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC
|
---|
1991 | */
|
---|
1992 | #ifndef IEM_WITH_SETJMP
|
---|
1993 | # define IEM_MC_MEM_MAP_U32_ATOMIC(a_pu32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1994 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu32Mem), &(a_bUnmapInfo), sizeof(uint32_t), (a_iSeg), \
|
---|
1995 | (a_GCPtrMem), IEM_ACCESS_DATA_ATOMIC, sizeof(uint32_t) - 1))
|
---|
1996 | #else
|
---|
1997 | # define IEM_MC_MEM_MAP_U32_ATOMIC(a_pu32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
1998 | (a_pu32Mem) = iemMemMapDataU32AtJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
1999 | #endif
|
---|
2000 |
|
---|
2001 | /**
|
---|
2002 | * Maps guest memory for dword read+write direct (or bounce) buffer acccess.
|
---|
2003 | *
|
---|
2004 | * @param[out] a_pu32Mem Where to return the pointer to the mapping.
|
---|
2005 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2006 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2007 | * @param[in] a_GCPtrMem The memory address.
|
---|
2008 | * @remarks Will return/long jump on errors.
|
---|
2009 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RW
|
---|
2010 | */
|
---|
2011 | #ifndef IEM_WITH_SETJMP
|
---|
2012 | # define IEM_MC_MEM_MAP_U32_RW(a_pu32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2013 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu32Mem), &(a_bUnmapInfo), sizeof(uint32_t), (a_iSeg), \
|
---|
2014 | (a_GCPtrMem), IEM_ACCESS_DATA_RW, sizeof(uint32_t) - 1))
|
---|
2015 | #else
|
---|
2016 | # define IEM_MC_MEM_MAP_U32_RW(a_pu32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2017 | (a_pu32Mem) = iemMemMapDataU32RwJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2018 | #endif
|
---|
2019 |
|
---|
2020 | /**
|
---|
2021 | * Maps guest memory for dword writeonly direct (or bounce) buffer acccess.
|
---|
2022 | *
|
---|
2023 | * @param[out] a_pu32Mem Where to return the pointer to the mapping.
|
---|
2024 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2025 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2026 | * @param[in] a_GCPtrMem The memory address.
|
---|
2027 | * @remarks Will return/long jump on errors.
|
---|
2028 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
2029 | */
|
---|
2030 | #ifndef IEM_WITH_SETJMP
|
---|
2031 | # define IEM_MC_MEM_MAP_U32_WO(a_pu32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2032 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu32Mem), &(a_bUnmapInfo), sizeof(uint32_t), (a_iSeg), \
|
---|
2033 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(uint32_t) - 1))
|
---|
2034 | #else
|
---|
2035 | # define IEM_MC_MEM_MAP_U32_WO(a_pu32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2036 | (a_pu32Mem) = iemMemMapDataU32WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2037 | #endif
|
---|
2038 |
|
---|
2039 | /**
|
---|
2040 | * Maps guest memory for dword readonly direct (or bounce) buffer acccess.
|
---|
2041 | *
|
---|
2042 | * @param[out] a_pu32Mem Where to return the pointer to the mapping.
|
---|
2043 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2044 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2045 | * @param[in] a_GCPtrMem The memory address.
|
---|
2046 | * @remarks Will return/long jump on errors.
|
---|
2047 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RO
|
---|
2048 | */
|
---|
2049 | #ifndef IEM_WITH_SETJMP
|
---|
2050 | # define IEM_MC_MEM_MAP_U32_RO(a_pu32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2051 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu32Mem), &(a_bUnmapInfo), sizeof(uint32_t), (a_iSeg), \
|
---|
2052 | (a_GCPtrMem), IEM_ACCESS_DATA_R, sizeof(uint32_t) - 1))
|
---|
2053 | #else
|
---|
2054 | # define IEM_MC_MEM_MAP_U32_RO(a_pu32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2055 | (a_pu32Mem) = iemMemMapDataU32RoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2056 | #endif
|
---|
2057 |
|
---|
2058 | /**
|
---|
2059 | * Maps guest memory for dword atomic read+write direct (or bounce) buffer
|
---|
2060 | * acccess, flat address variant.
|
---|
2061 | *
|
---|
2062 | * @param[out] a_pu32Mem Where to return the pointer to the mapping.
|
---|
2063 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2064 | * @param[in] a_GCPtrMem The memory address.
|
---|
2065 | * @remarks Will return/long jump on errors.
|
---|
2066 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC
|
---|
2067 | */
|
---|
2068 | #ifndef IEM_WITH_SETJMP
|
---|
2069 | # define IEM_MC_MEM_FLAT_MAP_U32_ATOMIC(a_pu32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2070 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu32Mem), &(a_bUnmapInfo), sizeof(uint32_t), UINT8_MAX, \
|
---|
2071 | (a_GCPtrMem), IEM_ACCESS_DATA_ATOMIC, sizeof(uint32_t) - 1))
|
---|
2072 | #else
|
---|
2073 | # define IEM_MC_MEM_FLAT_MAP_U32_ATOMIC(a_pu32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2074 | (a_pu32Mem) = iemMemFlatMapDataU32AtJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2075 | #endif
|
---|
2076 |
|
---|
2077 | /**
|
---|
2078 | * Maps guest memory for dword read+write direct (or bounce) buffer acccess,
|
---|
2079 | * flat address variant.
|
---|
2080 | *
|
---|
2081 | * @param[out] a_pu32Mem Where to return the pointer to the mapping.
|
---|
2082 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2083 | * @param[in] a_GCPtrMem The memory address.
|
---|
2084 | * @remarks Will return/long jump on errors.
|
---|
2085 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RW
|
---|
2086 | */
|
---|
2087 | #ifndef IEM_WITH_SETJMP
|
---|
2088 | # define IEM_MC_MEM_FLAT_MAP_U32_RW(a_pu32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2089 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu32Mem), &(a_bUnmapInfo), sizeof(uint32_t), UINT8_MAX, \
|
---|
2090 | (a_GCPtrMem), IEM_ACCESS_DATA_RW, sizeof(uint32_t) - 1))
|
---|
2091 | #else
|
---|
2092 | # define IEM_MC_MEM_FLAT_MAP_U32_RW(a_pu32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2093 | (a_pu32Mem) = iemMemFlatMapDataU32RwJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2094 | #endif
|
---|
2095 |
|
---|
2096 | /**
|
---|
2097 | * Maps guest memory for dword writeonly direct (or bounce) buffer acccess, flat
|
---|
2098 | * address variant.
|
---|
2099 | *
|
---|
2100 | * @param[out] a_pu32Mem Where to return the pointer to the mapping.
|
---|
2101 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2102 | * @param[in] a_GCPtrMem The memory address.
|
---|
2103 | * @remarks Will return/long jump on errors.
|
---|
2104 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
2105 | */
|
---|
2106 | #ifndef IEM_WITH_SETJMP
|
---|
2107 | # define IEM_MC_MEM_FLAT_MAP_U32_WO(a_pu32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2108 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu32Mem), &(a_bUnmapInfo), sizeof(uint32_t), UINT8_MAX, \
|
---|
2109 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(uint32_t) - 1))
|
---|
2110 | #else
|
---|
2111 | # define IEM_MC_MEM_FLAT_MAP_U32_WO(a_pu32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2112 | (a_pu32Mem) = iemMemFlatMapDataU32WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2113 | #endif
|
---|
2114 |
|
---|
2115 | /**
|
---|
2116 | * Maps guest memory for dword readonly direct (or bounce) buffer acccess, flat
|
---|
2117 | * address variant.
|
---|
2118 | *
|
---|
2119 | * @param[out] a_pu32Mem Where to return the pointer to the mapping.
|
---|
2120 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2121 | * @param[in] a_GCPtrMem The memory address.
|
---|
2122 | * @remarks Will return/long jump on errors.
|
---|
2123 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RO
|
---|
2124 | */
|
---|
2125 | #ifndef IEM_WITH_SETJMP
|
---|
2126 | # define IEM_MC_MEM_FLAT_MAP_U32_RO(a_pu32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2127 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu32Mem), &(a_bUnmapInfo), sizeof(uint32_t), UINT8_MAX, \
|
---|
2128 | (a_GCPtrMem), IEM_ACCESS_DATA_R, sizeof(uint32_t) - 1))
|
---|
2129 | #else
|
---|
2130 | # define IEM_MC_MEM_FLAT_MAP_U32_RO(a_pu32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2131 | (a_pu32Mem) = iemMemFlatMapDataU32RoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2132 | #endif
|
---|
2133 |
|
---|
2134 | /** int32_t alias. */
|
---|
2135 | #ifndef IEM_WITH_SETJMP
|
---|
2136 | # define IEM_MC_MEM_MAP_I32_WO(a_pi32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2137 | IEM_MC_MEM_MAP_U32_WO(a_pi32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem)
|
---|
2138 | #else
|
---|
2139 | # define IEM_MC_MEM_MAP_I32_WO(a_pi32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2140 | (a_pi32Mem) = (int32_t *)iemMemMapDataU32WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2141 | #endif
|
---|
2142 |
|
---|
2143 | /** Flat int32_t alias. */
|
---|
2144 | #ifndef IEM_WITH_SETJMP
|
---|
2145 | # define IEM_MC_MEM_FLAT_MAP_I32_WO(a_pi32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2146 | IEM_MC_MEM_FLAT_MAP_U32_WO(a_pi32Mem, a_bUnmapInfo, a_GCPtrMem)
|
---|
2147 | #else
|
---|
2148 | # define IEM_MC_MEM_FLAT_MAP_I32_WO(a_pi32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2149 | (a_pi32Mem) = (int32_t *)iemMemFlatMapDataU32WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2150 | #endif
|
---|
2151 |
|
---|
2152 | /** RTFLOAT32U alias. */
|
---|
2153 | #ifndef IEM_WITH_SETJMP
|
---|
2154 | # define IEM_MC_MEM_MAP_R32_WO(a_pr32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2155 | IEM_MC_MEM_MAP_U32_WO(a_pr32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem)
|
---|
2156 | #else
|
---|
2157 | # define IEM_MC_MEM_MAP_R32_WO(a_pr32Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2158 | (a_pr32Mem) = (PRTFLOAT32U)iemMemMapDataU32WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2159 | #endif
|
---|
2160 |
|
---|
2161 | /** Flat RTFLOAT32U alias. */
|
---|
2162 | #ifndef IEM_WITH_SETJMP
|
---|
2163 | # define IEM_MC_MEM_FLAT_MAP_R32_WO(a_pr32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2164 | IEM_MC_MEM_FLAT_MAP_U32_WO(a_pr32Mem, a_bUnmapInfo, a_GCPtrMem)
|
---|
2165 | #else
|
---|
2166 | # define IEM_MC_MEM_FLAT_MAP_R32_WO(a_pr32Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2167 | (a_pr32Mem) = (PRTFLOAT32U)iemMemFlatMapDataU32WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2168 | #endif
|
---|
2169 |
|
---|
2170 |
|
---|
2171 | /* 64-bit */
|
---|
2172 |
|
---|
2173 | /**
|
---|
2174 | * Maps guest memory for qword atomic read+write direct (or bounce) buffer acccess.
|
---|
2175 | *
|
---|
2176 | * @param[out] a_pu64Mem Where to return the pointer to the mapping.
|
---|
2177 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2178 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2179 | * @param[in] a_GCPtrMem The memory address.
|
---|
2180 | * @remarks Will return/long jump on errors.
|
---|
2181 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC
|
---|
2182 | */
|
---|
2183 | #ifndef IEM_WITH_SETJMP
|
---|
2184 | # define IEM_MC_MEM_MAP_U64_ATOMIC(a_pu64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2185 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu64Mem), &(a_bUnmapInfo), sizeof(uint64_t), (a_iSeg), \
|
---|
2186 | (a_GCPtrMem), IEM_ACCESS_DATA_ATOMIC, sizeof(uint64_t) - 1))
|
---|
2187 | #else
|
---|
2188 | # define IEM_MC_MEM_MAP_U64_ATOMIC(a_pu64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2189 | (a_pu64Mem) = iemMemMapDataU64AtJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2190 | #endif
|
---|
2191 |
|
---|
2192 | /**
|
---|
2193 | * Maps guest memory for qword read+write direct (or bounce) buffer acccess.
|
---|
2194 | *
|
---|
2195 | * @param[out] a_pu64Mem Where to return the pointer to the mapping.
|
---|
2196 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2197 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2198 | * @param[in] a_GCPtrMem The memory address.
|
---|
2199 | * @remarks Will return/long jump on errors.
|
---|
2200 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RW
|
---|
2201 | */
|
---|
2202 | #ifndef IEM_WITH_SETJMP
|
---|
2203 | # define IEM_MC_MEM_MAP_U64_RW(a_pu64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2204 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu64Mem), &(a_bUnmapInfo), sizeof(uint64_t), (a_iSeg), \
|
---|
2205 | (a_GCPtrMem), IEM_ACCESS_DATA_RW, sizeof(uint64_t) - 1))
|
---|
2206 | #else
|
---|
2207 | # define IEM_MC_MEM_MAP_U64_RW(a_pu64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2208 | (a_pu64Mem) = iemMemMapDataU64RwJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2209 | #endif
|
---|
2210 |
|
---|
2211 | /**
|
---|
2212 | * Maps guest memory for qword writeonly direct (or bounce) buffer acccess.
|
---|
2213 | *
|
---|
2214 | * @param[out] a_pu64Mem Where to return the pointer to the mapping.
|
---|
2215 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2216 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2217 | * @param[in] a_GCPtrMem The memory address.
|
---|
2218 | * @remarks Will return/long jump on errors.
|
---|
2219 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
2220 | */
|
---|
2221 | #ifndef IEM_WITH_SETJMP
|
---|
2222 | # define IEM_MC_MEM_MAP_U64_WO(a_pu64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2223 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu64Mem), &(a_bUnmapInfo), sizeof(uint64_t), (a_iSeg), \
|
---|
2224 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(uint64_t) - 1))
|
---|
2225 | #else
|
---|
2226 | # define IEM_MC_MEM_MAP_U64_WO(a_pu64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2227 | (a_pu64Mem) = iemMemMapDataU64WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2228 | #endif
|
---|
2229 |
|
---|
2230 | /**
|
---|
2231 | * Maps guest memory for qword readonly direct (or bounce) buffer acccess.
|
---|
2232 | *
|
---|
2233 | * @param[out] a_pu64Mem Where to return the pointer to the mapping.
|
---|
2234 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2235 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2236 | * @param[in] a_GCPtrMem The memory address.
|
---|
2237 | * @remarks Will return/long jump on errors.
|
---|
2238 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RO
|
---|
2239 | */
|
---|
2240 | #ifndef IEM_WITH_SETJMP
|
---|
2241 | # define IEM_MC_MEM_MAP_U64_RO(a_pu64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2242 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu64Mem), &(a_bUnmapInfo), sizeof(uint64_t), (a_iSeg), \
|
---|
2243 | (a_GCPtrMem), IEM_ACCESS_DATA_R, sizeof(uint64_t) - 1))
|
---|
2244 | #else
|
---|
2245 | # define IEM_MC_MEM_MAP_U64_RO(a_pu64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2246 | (a_pu64Mem) = iemMemMapDataU64RoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2247 | #endif
|
---|
2248 |
|
---|
2249 | /**
|
---|
2250 | * Maps guest memory for qword atomic read+write direct (or bounce) buffer
|
---|
2251 | * acccess, flat address variant.
|
---|
2252 | *
|
---|
2253 | * @param[out] a_pu64Mem Where to return the pointer to the mapping.
|
---|
2254 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2255 | * @param[in] a_GCPtrMem The memory address.
|
---|
2256 | * @remarks Will return/long jump on errors.
|
---|
2257 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC
|
---|
2258 | */
|
---|
2259 | #ifndef IEM_WITH_SETJMP
|
---|
2260 | # define IEM_MC_MEM_FLAT_MAP_U64_ATOMIC(a_pu64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2261 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu64Mem), &(a_bUnmapInfo), sizeof(uint64_t), UINT8_MAX, \
|
---|
2262 | (a_GCPtrMem), IEM_ACCESS_DATA_ATOMIC, sizeof(uint64_t) - 1))
|
---|
2263 | #else
|
---|
2264 | # define IEM_MC_MEM_FLAT_MAP_U64_ATOMIC(a_pu64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2265 | (a_pu64Mem) = iemMemFlatMapDataU64AtJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2266 | #endif
|
---|
2267 |
|
---|
2268 | /**
|
---|
2269 | * Maps guest memory for qword read+write direct (or bounce) buffer acccess,
|
---|
2270 | * flat address variant.
|
---|
2271 | *
|
---|
2272 | * @param[out] a_pu64Mem Where to return the pointer to the mapping.
|
---|
2273 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2274 | * @param[in] a_GCPtrMem The memory address.
|
---|
2275 | * @remarks Will return/long jump on errors.
|
---|
2276 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RW
|
---|
2277 | */
|
---|
2278 | #ifndef IEM_WITH_SETJMP
|
---|
2279 | # define IEM_MC_MEM_FLAT_MAP_U64_RW(a_pu64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2280 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu64Mem), &(a_bUnmapInfo), sizeof(uint64_t), UINT8_MAX, \
|
---|
2281 | (a_GCPtrMem), IEM_ACCESS_DATA_RW, sizeof(uint64_t) - 1))
|
---|
2282 | #else
|
---|
2283 | # define IEM_MC_MEM_FLAT_MAP_U64_RW(a_pu64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2284 | (a_pu64Mem) = iemMemFlatMapDataU64RwJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2285 | #endif
|
---|
2286 |
|
---|
2287 | /**
|
---|
2288 | * Maps guest memory for qword writeonly direct (or bounce) buffer acccess, flat
|
---|
2289 | * address variant.
|
---|
2290 | *
|
---|
2291 | * @param[out] a_pu64Mem Where to return the pointer to the mapping.
|
---|
2292 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2293 | * @param[in] a_GCPtrMem The memory address.
|
---|
2294 | * @remarks Will return/long jump on errors.
|
---|
2295 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
2296 | */
|
---|
2297 | #ifndef IEM_WITH_SETJMP
|
---|
2298 | # define IEM_MC_MEM_FLAT_MAP_U64_WO(a_pu64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2299 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu64Mem), &(a_bUnmapInfo), sizeof(uint64_t), UINT8_MAX, \
|
---|
2300 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(uint64_t) - 1))
|
---|
2301 | #else
|
---|
2302 | # define IEM_MC_MEM_FLAT_MAP_U64_WO(a_pu64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2303 | (a_pu64Mem) = iemMemFlatMapDataU64WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2304 | #endif
|
---|
2305 |
|
---|
2306 | /**
|
---|
2307 | * Maps guest memory for qword readonly direct (or bounce) buffer acccess, flat
|
---|
2308 | * address variant.
|
---|
2309 | *
|
---|
2310 | * @param[out] a_pu64Mem Where to return the pointer to the mapping.
|
---|
2311 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2312 | * @param[in] a_GCPtrMem The memory address.
|
---|
2313 | * @remarks Will return/long jump on errors.
|
---|
2314 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RO
|
---|
2315 | */
|
---|
2316 | #ifndef IEM_WITH_SETJMP
|
---|
2317 | # define IEM_MC_MEM_FLAT_MAP_U64_RO(a_pu64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2318 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu64Mem), &(a_bUnmapInfo), sizeof(uint64_t), UINT8_MAX, \
|
---|
2319 | (a_GCPtrMem), IEM_ACCESS_DATA_R, sizeof(uint64_t) - 1))
|
---|
2320 | #else
|
---|
2321 | # define IEM_MC_MEM_FLAT_MAP_U64_RO(a_pu64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2322 | (a_pu64Mem) = iemMemFlatMapDataU64RoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2323 | #endif
|
---|
2324 |
|
---|
2325 | /** int64_t alias. */
|
---|
2326 | #ifndef IEM_WITH_SETJMP
|
---|
2327 | # define IEM_MC_MEM_MAP_I64_WO(a_pi64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2328 | IEM_MC_MEM_MAP_U64_WO(a_pi64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem)
|
---|
2329 | #else
|
---|
2330 | # define IEM_MC_MEM_MAP_I64_WO(a_pi64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2331 | (a_pi64Mem) = (int64_t *)iemMemMapDataU64WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2332 | #endif
|
---|
2333 |
|
---|
2334 | /** Flat int64_t alias. */
|
---|
2335 | #ifndef IEM_WITH_SETJMP
|
---|
2336 | # define IEM_MC_MEM_FLAT_MAP_I64_WO(a_pi64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2337 | IEM_MC_MEM_FLAT_MAP_U64_WO(a_pi64Mem, a_bUnmapInfo, a_GCPtrMem)
|
---|
2338 | #else
|
---|
2339 | # define IEM_MC_MEM_FLAT_MAP_I64_WO(a_pi64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2340 | (a_pi64Mem) = (int64_t *)iemMemFlatMapDataU64WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2341 | #endif
|
---|
2342 |
|
---|
2343 | /** RTFLOAT64U alias. */
|
---|
2344 | #ifndef IEM_WITH_SETJMP
|
---|
2345 | # define IEM_MC_MEM_MAP_R64_WO(a_pr64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2346 | IEM_MC_MEM_MAP_U64_WO(a_pr64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem)
|
---|
2347 | #else
|
---|
2348 | # define IEM_MC_MEM_MAP_R64_WO(a_pr64Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2349 | (a_pr64Mem) = (PRTFLOAT64U)iemMemMapDataU64WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2350 | #endif
|
---|
2351 |
|
---|
2352 | /** Flat RTFLOAT64U alias. */
|
---|
2353 | #ifndef IEM_WITH_SETJMP
|
---|
2354 | # define IEM_MC_MEM_FLAT_MAP_R64_WO(a_pr64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2355 | IEM_MC_MEM_FLAT_MAP_U64_WO(a_pr64Mem, a_bUnmapInfo, a_GCPtrMem)
|
---|
2356 | #else
|
---|
2357 | # define IEM_MC_MEM_FLAT_MAP_R64_WO(a_pr64Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2358 | (a_pr64Mem) = (PRTFLOAT64U)iemMemFlatMapDataU64WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2359 | #endif
|
---|
2360 |
|
---|
2361 |
|
---|
2362 | /* 128-bit */
|
---|
2363 |
|
---|
2364 | /**
|
---|
2365 | * Maps guest memory for dqword atomic read+write direct (or bounce) buffer acccess.
|
---|
2366 | *
|
---|
2367 | * @param[out] a_pu128Mem Where to return the pointer to the mapping.
|
---|
2368 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2369 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2370 | * @param[in] a_GCPtrMem The memory address.
|
---|
2371 | * @remarks Will return/long jump on errors.
|
---|
2372 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC
|
---|
2373 | */
|
---|
2374 | #ifndef IEM_WITH_SETJMP
|
---|
2375 | # define IEM_MC_MEM_MAP_U128_ATOMIC(a_pu128Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2376 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu128Mem), &(a_bUnmapInfo), sizeof(RTUINT128U), (a_iSeg), \
|
---|
2377 | (a_GCPtrMem), IEM_ACCESS_DATA_ATOMIC, sizeof(RTUINT128U) - 1))
|
---|
2378 | #else
|
---|
2379 | # define IEM_MC_MEM_MAP_U128_ATOMIC(a_pu128Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2380 | (a_pu128Mem) = iemMemMapDataU128AtJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2381 | #endif
|
---|
2382 |
|
---|
2383 | /**
|
---|
2384 | * Maps guest memory for dqword read+write direct (or bounce) buffer acccess.
|
---|
2385 | *
|
---|
2386 | * @param[out] a_pu128Mem Where to return the pointer to the mapping.
|
---|
2387 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2388 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2389 | * @param[in] a_GCPtrMem The memory address.
|
---|
2390 | * @remarks Will return/long jump on errors.
|
---|
2391 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RW
|
---|
2392 | */
|
---|
2393 | #ifndef IEM_WITH_SETJMP
|
---|
2394 | # define IEM_MC_MEM_MAP_U128_RW(a_pu128Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2395 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu128Mem), &(a_bUnmapInfo), sizeof(RTUINT128U), (a_iSeg), \
|
---|
2396 | (a_GCPtrMem), IEM_ACCESS_DATA_RW, sizeof(RTUINT128U) - 1))
|
---|
2397 | #else
|
---|
2398 | # define IEM_MC_MEM_MAP_U128_RW(a_pu128Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2399 | (a_pu128Mem) = iemMemMapDataU128RwJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2400 | #endif
|
---|
2401 |
|
---|
2402 | /**
|
---|
2403 | * Maps guest memory for dqword writeonly direct (or bounce) buffer acccess.
|
---|
2404 | *
|
---|
2405 | * @param[out] a_pu128Mem Where to return the pointer to the mapping.
|
---|
2406 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2407 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2408 | * @param[in] a_GCPtrMem The memory address.
|
---|
2409 | * @remarks Will return/long jump on errors.
|
---|
2410 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
2411 | */
|
---|
2412 | #ifndef IEM_WITH_SETJMP
|
---|
2413 | # define IEM_MC_MEM_MAP_U128_WO(a_pu128Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2414 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu128Mem), &(a_bUnmapInfo), sizeof(RTUINT128), (a_iSeg), \
|
---|
2415 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(RTUINT128) - 1))
|
---|
2416 | #else
|
---|
2417 | # define IEM_MC_MEM_MAP_U128_WO(a_pu128Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2418 | (a_pu128Mem) = iemMemMapDataU128WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2419 | #endif
|
---|
2420 |
|
---|
2421 | /**
|
---|
2422 | * Maps guest memory for dqword readonly direct (or bounce) buffer acccess.
|
---|
2423 | *
|
---|
2424 | * @param[out] a_pu128Mem Where to return the pointer to the mapping.
|
---|
2425 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2426 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2427 | * @param[in] a_GCPtrMem The memory address.
|
---|
2428 | * @remarks Will return/long jump on errors.
|
---|
2429 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RO
|
---|
2430 | */
|
---|
2431 | #ifndef IEM_WITH_SETJMP
|
---|
2432 | # define IEM_MC_MEM_MAP_U128_RO(a_pu128Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2433 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu128Mem), &(a_bUnmapInfo), sizeof(RTUINT128), (a_iSeg), \
|
---|
2434 | (a_GCPtrMem), IEM_ACCESS_DATA_R, sizeof(RTUINT128) - 1))
|
---|
2435 | #else
|
---|
2436 | # define IEM_MC_MEM_MAP_U128_RO(a_pu128Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2437 | (a_pu128Mem) = iemMemMapDataU128RoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2438 | #endif
|
---|
2439 |
|
---|
2440 | /**
|
---|
2441 | * Maps guest memory for dqword atomic read+write direct (or bounce) buffer
|
---|
2442 | * access, flat address variant.
|
---|
2443 | *
|
---|
2444 | * @param[out] a_pu128Mem Where to return the pointer to the mapping.
|
---|
2445 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2446 | * @param[in] a_GCPtrMem The memory address.
|
---|
2447 | * @remarks Will return/long jump on errors.
|
---|
2448 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC
|
---|
2449 | */
|
---|
2450 | #ifndef IEM_WITH_SETJMP
|
---|
2451 | # define IEM_MC_MEM_FLAT_MAP_U128_ATOMIC(a_pu128Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2452 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu128Mem), &(a_bUnmapInfo), sizeof(RTUINT128), UINT8_MAX, \
|
---|
2453 | (a_GCPtrMem), IEM_ACCESS_DATA_ATOMIC, sizeof(RTUINT128) - 1))
|
---|
2454 | #else
|
---|
2455 | # define IEM_MC_MEM_FLAT_MAP_U128_ATOMIC(a_pu128Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2456 | (a_pu128Mem) = iemMemFlatMapDataU128AtJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2457 | #endif
|
---|
2458 |
|
---|
2459 | /**
|
---|
2460 | * Maps guest memory for dqword read+write direct (or bounce) buffer acccess,
|
---|
2461 | * flat address variant.
|
---|
2462 | *
|
---|
2463 | * @param[out] a_pu128Mem Where to return the pointer to the mapping.
|
---|
2464 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2465 | * @param[in] a_GCPtrMem The memory address.
|
---|
2466 | * @remarks Will return/long jump on errors.
|
---|
2467 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RW
|
---|
2468 | */
|
---|
2469 | #ifndef IEM_WITH_SETJMP
|
---|
2470 | # define IEM_MC_MEM_FLAT_MAP_U128_RW(a_pu128Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2471 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu128Mem), &(a_bUnmapInfo), sizeof(RTUINT128), UINT8_MAX, \
|
---|
2472 | (a_GCPtrMem), IEM_ACCESS_DATA_RW, sizeof(RTUINT128) - 1))
|
---|
2473 | #else
|
---|
2474 | # define IEM_MC_MEM_FLAT_MAP_U128_RW(a_pu128Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2475 | (a_pu128Mem) = iemMemFlatMapDataU128RwJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2476 | #endif
|
---|
2477 |
|
---|
2478 | /**
|
---|
2479 | * Maps guest memory for dqword writeonly direct (or bounce) buffer acccess,
|
---|
2480 | * flat address variant.
|
---|
2481 | *
|
---|
2482 | * @param[out] a_pu128Mem Where to return the pointer to the mapping.
|
---|
2483 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2484 | * @param[in] a_GCPtrMem The memory address.
|
---|
2485 | * @remarks Will return/long jump on errors.
|
---|
2486 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
2487 | */
|
---|
2488 | #ifndef IEM_WITH_SETJMP
|
---|
2489 | # define IEM_MC_MEM_FLAT_MAP_U128_WO(a_pu128Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2490 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu128Mem), &(a_bUnmapInfo), sizeof(RTUINT128), UINT8_MAX, \
|
---|
2491 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(RTUINT128) - 1))
|
---|
2492 | #else
|
---|
2493 | # define IEM_MC_MEM_FLAT_MAP_U128_WO(a_pu128Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2494 | (a_pu128Mem) = iemMemFlatMapDataU128WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2495 | #endif
|
---|
2496 |
|
---|
2497 | /**
|
---|
2498 | * Maps guest memory for dqword readonly direct (or bounce) buffer acccess, flat
|
---|
2499 | * address variant.
|
---|
2500 | *
|
---|
2501 | * @param[out] a_pu128Mem Where to return the pointer to the mapping.
|
---|
2502 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2503 | * @param[in] a_GCPtrMem The memory address.
|
---|
2504 | * @remarks Will return/long jump on errors.
|
---|
2505 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_RO
|
---|
2506 | */
|
---|
2507 | #ifndef IEM_WITH_SETJMP
|
---|
2508 | # define IEM_MC_MEM_FLAT_MAP_U128_RO(a_pu128Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2509 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pu128Mem), &(a_bUnmapInfo), sizeof(RTUINT128), UINT8_MAX, \
|
---|
2510 | (a_GCPtrMem), IEM_ACCESS_DATA_R, sizeof(RTUINT128) - 1))
|
---|
2511 | #else
|
---|
2512 | # define IEM_MC_MEM_FLAT_MAP_U128_RO(a_pu128Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2513 | (a_pu128Mem) = iemMemFlatMapDataU128RoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2514 | #endif
|
---|
2515 |
|
---|
2516 |
|
---|
2517 | /* misc */
|
---|
2518 |
|
---|
2519 | /**
|
---|
2520 | * Maps guest memory for 80-bit float writeonly direct (or bounce) buffer acccess.
|
---|
2521 | *
|
---|
2522 | * @param[out] a_pr80Mem Where to return the pointer to the mapping.
|
---|
2523 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2524 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2525 | * @param[in] a_GCPtrMem The memory address.
|
---|
2526 | * @remarks Will return/long jump on errors.
|
---|
2527 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
2528 | */
|
---|
2529 | #ifndef IEM_WITH_SETJMP
|
---|
2530 | # define IEM_MC_MEM_MAP_R80_WO(a_pr80Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2531 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pr80Mem), &(a_bUnmapInfo), sizeof(RTFLOAT80U), (a_iSeg), \
|
---|
2532 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(uint64_t) - 1))
|
---|
2533 | #else
|
---|
2534 | # define IEM_MC_MEM_MAP_R80_WO(a_pr80Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2535 | (a_pr80Mem) = iemMemMapDataR80WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2536 | #endif
|
---|
2537 |
|
---|
2538 | /**
|
---|
2539 | * Maps guest memory for 80-bit float writeonly direct (or bounce) buffer acccess.
|
---|
2540 | *
|
---|
2541 | * @param[out] a_pr80Mem Where to return the pointer to the mapping.
|
---|
2542 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2543 | * @param[in] a_GCPtrMem The memory address.
|
---|
2544 | * @remarks Will return/long jump on errors.
|
---|
2545 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
2546 | */
|
---|
2547 | #ifndef IEM_WITH_SETJMP
|
---|
2548 | # define IEM_MC_MEM_FLAT_MAP_R80_WO(a_pr80Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2549 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pr80Mem), &(a_bUnmapInfo), sizeof(RTFLOAT80U), UINT8_MAX, \
|
---|
2550 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(uint64_t) - 1))
|
---|
2551 | #else
|
---|
2552 | # define IEM_MC_MEM_FLAT_MAP_R80_WO(a_pr80Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2553 | (a_pr80Mem) = iemMemFlatMapDataR80WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2554 | #endif
|
---|
2555 |
|
---|
2556 |
|
---|
2557 | /**
|
---|
2558 | * Maps guest memory for 80-bit BCD writeonly direct (or bounce) buffer acccess.
|
---|
2559 | *
|
---|
2560 | * @param[out] a_pd80Mem Where to return the pointer to the mapping.
|
---|
2561 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2562 | * @param[in] a_iSeg The segment register to access via. No UINT8_MAX!
|
---|
2563 | * @param[in] a_GCPtrMem The memory address.
|
---|
2564 | * @remarks Will return/long jump on errors.
|
---|
2565 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
2566 | */
|
---|
2567 | #ifndef IEM_WITH_SETJMP
|
---|
2568 | # define IEM_MC_MEM_MAP_D80_WO(a_pd80Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2569 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pd80Mem), &(a_bUnmapInfo), sizeof(RTFLOAT80U), (a_iSeg), \
|
---|
2570 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(uint64_t) - 1))
|
---|
2571 | #else
|
---|
2572 | # define IEM_MC_MEM_MAP_D80_WO(a_pd80Mem, a_bUnmapInfo, a_iSeg, a_GCPtrMem) \
|
---|
2573 | (a_pd80Mem) = iemMemMapDataD80WoJmp(pVCpu, &(a_bUnmapInfo), (a_iSeg), (a_GCPtrMem))
|
---|
2574 | #endif
|
---|
2575 |
|
---|
2576 | /**
|
---|
2577 | * Maps guest memory for 80-bit BCD writeonly direct (or bounce) buffer acccess.
|
---|
2578 | *
|
---|
2579 | * @param[out] a_pd80Mem Where to return the pointer to the mapping.
|
---|
2580 | * @param[out] a_bUnmapInfo Where to return umapping instructions. uint8_t.
|
---|
2581 | * @param[in] a_GCPtrMem The memory address.
|
---|
2582 | * @remarks Will return/long jump on errors.
|
---|
2583 | * @see IEM_MC_MEM_COMMIT_AND_UNMAP_WO
|
---|
2584 | */
|
---|
2585 | #ifndef IEM_WITH_SETJMP
|
---|
2586 | # define IEM_MC_MEM_FLAT_MAP_D80_WO(a_pd80Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2587 | IEM_MC_RETURN_ON_FAILURE(iemMemMap(pVCpu, (void **)&(a_pd80Mem), &(a_bUnmapInfo), sizeof(RTFLOAT80U), UINT8_MAX, \
|
---|
2588 | (a_GCPtrMem), IEM_ACCESS_DATA_W, sizeof(uint64_t) - 1))
|
---|
2589 | #else
|
---|
2590 | # define IEM_MC_MEM_FLAT_MAP_D80_WO(a_pd80Mem, a_bUnmapInfo, a_GCPtrMem) \
|
---|
2591 | (a_pd80Mem) = iemMemFlatMapDataD80WoJmp(pVCpu, &(a_bUnmapInfo), (a_GCPtrMem))
|
---|
2592 | #endif
|
---|
2593 |
|
---|
2594 |
|
---|
2595 |
|
---|
2596 | /* commit + unmap */
|
---|
2597 |
|
---|
2598 | /** Commits the memory and unmaps guest memory previously mapped RW.
|
---|
2599 | * @remarks May return.
|
---|
2600 | * @note Implictly frees the a_bMapInfo variable.
|
---|
2601 | */
|
---|
2602 | #ifndef IEM_WITH_SETJMP
|
---|
2603 | # define IEM_MC_MEM_COMMIT_AND_UNMAP_RW(a_bMapInfo) IEM_MC_RETURN_ON_FAILURE(iemMemCommitAndUnmap(pVCpu, a_bMapInfo))
|
---|
2604 | #else
|
---|
2605 | # define IEM_MC_MEM_COMMIT_AND_UNMAP_RW(a_bMapInfo) iemMemCommitAndUnmapRwJmp(pVCpu, (a_bMapInfo))
|
---|
2606 | #endif
|
---|
2607 |
|
---|
2608 | /** Commits the memory and unmaps guest memory previously mapped ATOMIC.
|
---|
2609 | * @remarks May return.
|
---|
2610 | * @note Implictly frees the a_bMapInfo variable.
|
---|
2611 | */
|
---|
2612 | #ifndef IEM_WITH_SETJMP
|
---|
2613 | # define IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC(a_bMapInfo) IEM_MC_RETURN_ON_FAILURE(iemMemCommitAndUnmap(pVCpu, a_bMapInfo))
|
---|
2614 | #else
|
---|
2615 | # define IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC(a_bMapInfo) iemMemCommitAndUnmapRwJmp(pVCpu, (a_bMapInfo))
|
---|
2616 | #endif
|
---|
2617 |
|
---|
2618 | /** Commits the memory and unmaps guest memory previously mapped W.
|
---|
2619 | * @remarks May return.
|
---|
2620 | * @note Implictly frees the a_bMapInfo variable.
|
---|
2621 | */
|
---|
2622 | #ifndef IEM_WITH_SETJMP
|
---|
2623 | # define IEM_MC_MEM_COMMIT_AND_UNMAP_WO(a_bMapInfo) IEM_MC_RETURN_ON_FAILURE(iemMemCommitAndUnmap(pVCpu, a_bMapInfo))
|
---|
2624 | #else
|
---|
2625 | # define IEM_MC_MEM_COMMIT_AND_UNMAP_WO(a_bMapInfo) iemMemCommitAndUnmapWoJmp(pVCpu, (a_bMapInfo))
|
---|
2626 | #endif
|
---|
2627 |
|
---|
2628 | /** Commits the memory and unmaps guest memory previously mapped R.
|
---|
2629 | * @remarks May return.
|
---|
2630 | * @note Implictly frees the a_bMapInfo variable.
|
---|
2631 | */
|
---|
2632 | #ifndef IEM_WITH_SETJMP
|
---|
2633 | # define IEM_MC_MEM_COMMIT_AND_UNMAP_RO(a_bMapInfo) IEM_MC_RETURN_ON_FAILURE(iemMemCommitAndUnmap(pVCpu, a_bMapInfo))
|
---|
2634 | #else
|
---|
2635 | # define IEM_MC_MEM_COMMIT_AND_UNMAP_RO(a_bMapInfo) iemMemCommitAndUnmapRoJmp(pVCpu, (a_bMapInfo))
|
---|
2636 | #endif
|
---|
2637 |
|
---|
2638 |
|
---|
2639 | /** Commits the memory and unmaps the guest memory unless the FPU status word
|
---|
2640 | * indicates (@a a_u16FSW) and FPU control word indicates a pending exception
|
---|
2641 | * that would cause FLD not to store.
|
---|
2642 | *
|
---|
2643 | * The current understanding is that \#O, \#U, \#IA and \#IS will prevent a
|
---|
2644 | * store, while \#P will not.
|
---|
2645 | *
|
---|
2646 | * @remarks May in theory return - for now.
|
---|
2647 | * @note Implictly frees both the a_bMapInfo and a_u16FSW variables.
|
---|
2648 | */
|
---|
2649 | #ifndef IEM_WITH_SETJMP
|
---|
2650 | # define IEM_MC_MEM_COMMIT_AND_UNMAP_FOR_FPU_STORE_WO(a_bMapInfo, a_u16FSW) do { \
|
---|
2651 | if ( !(a_u16FSW & X86_FSW_ES) \
|
---|
2652 | || !( (a_u16FSW & (X86_FSW_UE | X86_FSW_OE | X86_FSW_IE)) \
|
---|
2653 | & ~(pVCpu->cpum.GstCtx.XState.x87.FCW & X86_FCW_MASK_ALL) ) ) \
|
---|
2654 | IEM_MC_RETURN_ON_FAILURE(iemMemCommitAndUnmap(pVCpu, a_bMapInfo)); \
|
---|
2655 | else \
|
---|
2656 | iemMemRollbackAndUnmap(pVCpu, (a_pvMem), IEM_ACCESS_DATA_W); \
|
---|
2657 | } while (0)
|
---|
2658 | #else
|
---|
2659 | # define IEM_MC_MEM_COMMIT_AND_UNMAP_FOR_FPU_STORE_WO(a_bMapInfo, a_u16FSW) do { \
|
---|
2660 | if ( !(a_u16FSW & X86_FSW_ES) \
|
---|
2661 | || !( (a_u16FSW & (X86_FSW_UE | X86_FSW_OE | X86_FSW_IE)) \
|
---|
2662 | & ~(pVCpu->cpum.GstCtx.XState.x87.FCW & X86_FCW_MASK_ALL) ) ) \
|
---|
2663 | iemMemCommitAndUnmapWoJmp(pVCpu, a_bMapInfo); \
|
---|
2664 | else \
|
---|
2665 | iemMemRollbackAndUnmapWo(pVCpu, a_bMapInfo); \
|
---|
2666 | } while (0)
|
---|
2667 | #endif
|
---|
2668 |
|
---|
2669 | /** Rolls back (conceptually only, assumes no writes) and unmaps the guest memory.
|
---|
2670 | * @note Implictly frees the a_bMapInfo variable. */
|
---|
2671 | #ifndef IEM_WITH_SETJMP
|
---|
2672 | # define IEM_MC_MEM_ROLLBACK_AND_UNMAP_WO(a_bMapInfo) iemMemRollbackAndUnmap(pVCpu, a_bMapInfo)
|
---|
2673 | #else
|
---|
2674 | # define IEM_MC_MEM_ROLLBACK_AND_UNMAP_WO(a_bMapInfo) iemMemRollbackAndUnmapWo(pVCpu, a_bMapInfo)
|
---|
2675 | #endif
|
---|
2676 |
|
---|
2677 |
|
---|
2678 |
|
---|
2679 | /** Calculate efficient address from R/M. */
|
---|
2680 | #ifndef IEM_WITH_SETJMP
|
---|
2681 | # define IEM_MC_CALC_RM_EFF_ADDR(a_GCPtrEff, a_bRm, a_cbImmAndRspOffset) \
|
---|
2682 | IEM_MC_RETURN_ON_FAILURE(iemOpHlpCalcRmEffAddr(pVCpu, (a_bRm), (a_cbImmAndRspOffset), &(a_GCPtrEff)))
|
---|
2683 | #else
|
---|
2684 | # define IEM_MC_CALC_RM_EFF_ADDR(a_GCPtrEff, a_bRm, a_cbImmAndRspOffset) \
|
---|
2685 | ((a_GCPtrEff) = iemOpHlpCalcRmEffAddrJmp(pVCpu, (a_bRm), (a_cbImmAndRspOffset)))
|
---|
2686 | #endif
|
---|
2687 |
|
---|
2688 |
|
---|
2689 | /** The @a a_fSupportedHosts mask are ORed together RT_ARCH_VAL_XXX values. */
|
---|
2690 | #define IEM_MC_NATIVE_IF(a_fSupportedHosts) if (false) {
|
---|
2691 | #define IEM_MC_NATIVE_ELSE() } else {
|
---|
2692 | #define IEM_MC_NATIVE_ENDIF() } ((void)0)
|
---|
2693 |
|
---|
2694 | #define IEM_MC_NATIVE_EMIT_0(a_fnEmitter)
|
---|
2695 | #define IEM_MC_NATIVE_EMIT_1(a_fnEmitter, a0) (void)(a0)
|
---|
2696 | #define IEM_MC_NATIVE_EMIT_2(a_fnEmitter, a0, a1) (void)(a0), (void)(a1)
|
---|
2697 | #define IEM_MC_NATIVE_EMIT_2_EX(a_fnEmitter, a0, a1) (void)(a0), (void)(a1)
|
---|
2698 | #define IEM_MC_NATIVE_EMIT_3(a_fnEmitter, a0, a1, a2) (void)(a0), (void)(a1), (void)(a2)
|
---|
2699 | #define IEM_MC_NATIVE_EMIT_4(a_fnEmitter, a0, a1, a2, a3) (void)(a0), (void)(a1), (void)(a2), (void)(a3)
|
---|
2700 | #define IEM_MC_NATIVE_EMIT_5(a_fnEmitter, a0, a1, a2, a3, a4) (void)(a0), (void)(a1), (void)(a2), (void)(a3), (void)(a4)
|
---|
2701 | #define IEM_MC_NATIVE_EMIT_6(a_fnEmitter, a0, a1, a2, a3, a4, a5) (void)(a0), (void)(a1), (void)(a2), (void)(a3), (void)(a4), (void)(a5)
|
---|
2702 | #define IEM_MC_NATIVE_EMIT_7(a_fnEmitter, a0, a1, a2, a3, a4, a5, a6) (void)(a0), (void)(a1), (void)(a2), (void)(a3), (void)(a4), (void)(a5), (void)(a6)
|
---|
2703 | #define IEM_MC_NATIVE_EMIT_8(a_fnEmitter, a0, a1, a2, a3, a4, a5, a6, a7) (void)(a0), (void)(a1), (void)(a2), (void)(a3), (void)(a4), (void)(a5), (void)(a6), (void)(a7)
|
---|
2704 |
|
---|
2705 | /** This can be used to direct the register allocator when dealing with
|
---|
2706 | * x86/AMD64 instructions (like SHL reg,CL) that takes fixed registers. */
|
---|
2707 | #define IEM_MC_NATIVE_SET_AMD64_HOST_REG_FOR_LOCAL(a_VarNm, a_idxHostReg) ((void)0)
|
---|
2708 |
|
---|
2709 |
|
---|
2710 | #define IEM_MC_CALL_VOID_AIMPL_0(a_pfn) (a_pfn)()
|
---|
2711 | #define IEM_MC_CALL_VOID_AIMPL_1(a_pfn, a0) (a_pfn)((a0))
|
---|
2712 | #define IEM_MC_CALL_VOID_AIMPL_2(a_pfn, a0, a1) (a_pfn)((a0), (a1))
|
---|
2713 | #define IEM_MC_CALL_VOID_AIMPL_3(a_pfn, a0, a1, a2) (a_pfn)((a0), (a1), (a2))
|
---|
2714 | #define IEM_MC_CALL_VOID_AIMPL_4(a_pfn, a0, a1, a2, a3) (a_pfn)((a0), (a1), (a2), (a3))
|
---|
2715 | #define IEM_MC_CALL_AIMPL_3(a_rcType, a_rc, a_pfn, a0, a1, a2) a_rcType const a_rc = (a_pfn)((a0), (a1), (a2))
|
---|
2716 | #define IEM_MC_CALL_AIMPL_4(a_rcType, a_rc, a_pfn, a0, a1, a2, a3) a_rcType const a_rc = (a_pfn)((a0), (a1), (a2), (a3))
|
---|
2717 |
|
---|
2718 |
|
---|
2719 | /** @def IEM_MC_CALL_CIMPL_HLP_RET
|
---|
2720 | * Helper macro for check that all important IEM_CIMPL_F_XXX bits are set.
|
---|
2721 | */
|
---|
2722 | #ifdef VBOX_STRICT
|
---|
2723 | # define IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, a_CallExpr) \
|
---|
2724 | do { \
|
---|
2725 | uint8_t const cbInstr = IEM_GET_INSTR_LEN(pVCpu); /* may be flushed */ \
|
---|
2726 | uint16_t const uCsBefore = pVCpu->cpum.GstCtx.cs.Sel; \
|
---|
2727 | uint64_t const uRipBefore = pVCpu->cpum.GstCtx.rip; \
|
---|
2728 | uint32_t const fEflBefore = pVCpu->cpum.GstCtx.eflags.u; \
|
---|
2729 | uint32_t const fExecBefore = pVCpu->iem.s.fExec; \
|
---|
2730 | VBOXSTRICTRC const rcStrictHlp = a_CallExpr; \
|
---|
2731 | if (rcStrictHlp == VINF_SUCCESS) \
|
---|
2732 | { \
|
---|
2733 | uint64_t const fRipMask = (pVCpu->iem.s.fExec & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_64BIT ? UINT64_MAX : UINT32_MAX; \
|
---|
2734 | AssertMsg( ((a_fFlags) & IEM_CIMPL_F_BRANCH_ANY) \
|
---|
2735 | || ( ((uRipBefore + cbInstr) & fRipMask) == pVCpu->cpum.GstCtx.rip \
|
---|
2736 | && uCsBefore == pVCpu->cpum.GstCtx.cs.Sel) \
|
---|
2737 | || ( ((a_fFlags) & IEM_CIMPL_F_REP) \
|
---|
2738 | && uRipBefore == pVCpu->cpum.GstCtx.rip \
|
---|
2739 | && uCsBefore == pVCpu->cpum.GstCtx.cs.Sel), \
|
---|
2740 | ("CS:RIP=%04x:%08RX64 + %x -> %04x:%08RX64, expected %04x:%08RX64\n", uCsBefore, uRipBefore, cbInstr, \
|
---|
2741 | pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip, uCsBefore, (uRipBefore + cbInstr) & fRipMask)); \
|
---|
2742 | if ((a_fFlags) & IEM_CIMPL_F_RFLAGS) \
|
---|
2743 | { /* No need to check fEflBefore */ Assert(!((a_fFlags) & IEM_CIMPL_F_STATUS_FLAGS)); } \
|
---|
2744 | else if ((a_fFlags) & IEM_CIMPL_F_STATUS_FLAGS) \
|
---|
2745 | AssertMsg( (pVCpu->cpum.GstCtx.eflags.u & ~(X86_EFL_STATUS_BITS | X86_EFL_RF)) \
|
---|
2746 | == (fEflBefore & ~(X86_EFL_STATUS_BITS | X86_EFL_RF)), \
|
---|
2747 | ("EFL=%#RX32 -> %#RX32\n", fEflBefore, pVCpu->cpum.GstCtx.eflags.u)); \
|
---|
2748 | else \
|
---|
2749 | AssertMsg( (pVCpu->cpum.GstCtx.eflags.u & ~(X86_EFL_RF)) \
|
---|
2750 | == (fEflBefore & ~(X86_EFL_RF)), \
|
---|
2751 | ("EFL=%#RX32 -> %#RX32\n", fEflBefore, pVCpu->cpum.GstCtx.eflags.u)); \
|
---|
2752 | if (!((a_fFlags) & IEM_CIMPL_F_MODE)) \
|
---|
2753 | { \
|
---|
2754 | uint32_t fExecRecalc = iemCalcExecFlags(pVCpu) | (pVCpu->iem.s.fExec & IEM_F_USER_OPTS); \
|
---|
2755 | AssertMsg( fExecBefore == fExecRecalc \
|
---|
2756 | /* in case ES, DS or SS was external initially (happens alot with HM): */ \
|
---|
2757 | || ( fExecBefore == (fExecRecalc & ~IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK) \
|
---|
2758 | && (fExecRecalc & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_32BIT), \
|
---|
2759 | ("fExec=%#x -> %#x (diff %#x)\n", fExecBefore, fExecRecalc, fExecBefore ^ fExecRecalc)); \
|
---|
2760 | } \
|
---|
2761 | } \
|
---|
2762 | return rcStrictHlp; \
|
---|
2763 | } while (0)
|
---|
2764 | #else
|
---|
2765 | # define IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, a_CallExpr) return a_CallExpr
|
---|
2766 | #endif
|
---|
2767 |
|
---|
2768 | /**
|
---|
2769 | * Defers the rest of the instruction emulation to a C implementation routine
|
---|
2770 | * and returns, only taking the standard parameters.
|
---|
2771 | *
|
---|
2772 | * @param a_fFlags IEM_CIMPL_F_XXX.
|
---|
2773 | * @param a_fGstShwFlush Guest shadow register copies needing to be flushed
|
---|
2774 | * in the native recompiler.
|
---|
2775 | * @param a_pfnCImpl The pointer to the C routine.
|
---|
2776 | * @sa IEM_DECL_IMPL_C_TYPE_0 and IEM_CIMPL_DEF_0.
|
---|
2777 | */
|
---|
2778 | #define IEM_MC_CALL_CIMPL_0(a_fFlags, a_fGstShwFlush, a_pfnCImpl) \
|
---|
2779 | IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, (a_pfnCImpl)(pVCpu, IEM_GET_INSTR_LEN(pVCpu)))
|
---|
2780 |
|
---|
2781 | /**
|
---|
2782 | * Defers the rest of instruction emulation to a C implementation routine and
|
---|
2783 | * returns, taking one argument in addition to the standard ones.
|
---|
2784 | *
|
---|
2785 | * @param a_fFlags IEM_CIMPL_F_XXX.
|
---|
2786 | * @param a_fGstShwFlush Guest shadow register copies needing to be flushed
|
---|
2787 | * in the native recompiler.
|
---|
2788 | * @param a_pfnCImpl The pointer to the C routine.
|
---|
2789 | * @param a0 The argument.
|
---|
2790 | */
|
---|
2791 | #define IEM_MC_CALL_CIMPL_1(a_fFlags, a_fGstShwFlush, a_pfnCImpl, a0) \
|
---|
2792 | IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, (a_pfnCImpl)(pVCpu, IEM_GET_INSTR_LEN(pVCpu), a0))
|
---|
2793 |
|
---|
2794 | /**
|
---|
2795 | * Defers the rest of the instruction emulation to a C implementation routine
|
---|
2796 | * and returns, taking two arguments in addition to the standard ones.
|
---|
2797 | *
|
---|
2798 | * @param a_fFlags IEM_CIMPL_F_XXX.
|
---|
2799 | * @param a_fGstShwFlush Guest shadow register copies needing to be flushed
|
---|
2800 | * in the native recompiler.
|
---|
2801 | * @param a_pfnCImpl The pointer to the C routine.
|
---|
2802 | * @param a0 The first extra argument.
|
---|
2803 | * @param a1 The second extra argument.
|
---|
2804 | */
|
---|
2805 | #define IEM_MC_CALL_CIMPL_2(a_fFlags, a_fGstShwFlush, a_pfnCImpl, a0, a1) \
|
---|
2806 | IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, (a_pfnCImpl)(pVCpu, IEM_GET_INSTR_LEN(pVCpu), a0, a1))
|
---|
2807 |
|
---|
2808 | /**
|
---|
2809 | * Defers the rest of the instruction emulation to a C implementation routine
|
---|
2810 | * and returns, taking three arguments in addition to the standard ones.
|
---|
2811 | *
|
---|
2812 | * @param a_fFlags IEM_CIMPL_F_XXX.
|
---|
2813 | * @param a_fGstShwFlush Guest shadow register copies needing to be flushed
|
---|
2814 | * in the native recompiler.
|
---|
2815 | * @param a_pfnCImpl The pointer to the C routine.
|
---|
2816 | * @param a0 The first extra argument.
|
---|
2817 | * @param a1 The second extra argument.
|
---|
2818 | * @param a2 The third extra argument.
|
---|
2819 | */
|
---|
2820 | #define IEM_MC_CALL_CIMPL_3(a_fFlags, a_fGstShwFlush, a_pfnCImpl, a0, a1, a2) \
|
---|
2821 | IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, (a_pfnCImpl)(pVCpu, IEM_GET_INSTR_LEN(pVCpu), a0, a1, a2))
|
---|
2822 |
|
---|
2823 | /**
|
---|
2824 | * Defers the rest of the instruction emulation to a C implementation routine
|
---|
2825 | * and returns, taking four arguments in addition to the standard ones.
|
---|
2826 | *
|
---|
2827 | * @param a_fFlags IEM_CIMPL_F_XXX.
|
---|
2828 | * @param a_fGstShwFlush Guest shadow register copies needing to be flushed
|
---|
2829 | * in the native recompiler.
|
---|
2830 | * @param a_pfnCImpl The pointer to the C routine.
|
---|
2831 | * @param a0 The first extra argument.
|
---|
2832 | * @param a1 The second extra argument.
|
---|
2833 | * @param a2 The third extra argument.
|
---|
2834 | * @param a3 The fourth extra argument.
|
---|
2835 | */
|
---|
2836 | #define IEM_MC_CALL_CIMPL_4(a_fFlags, a_fGstShwFlush, a_pfnCImpl, a0, a1, a2, a3) \
|
---|
2837 | IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, (a_pfnCImpl)(pVCpu, IEM_GET_INSTR_LEN(pVCpu), a0, a1, a2, a3))
|
---|
2838 |
|
---|
2839 | /**
|
---|
2840 | * Defers the rest of the instruction emulation to a C implementation routine
|
---|
2841 | * and returns, taking five arguments in addition to the standard ones.
|
---|
2842 | *
|
---|
2843 | * @param a_fFlags IEM_CIMPL_F_XXX.
|
---|
2844 | * @param a_fGstShwFlush Guest shadow register copies needing to be flushed
|
---|
2845 | * in the native recompiler.
|
---|
2846 | * @param a_pfnCImpl The pointer to the C routine.
|
---|
2847 | * @param a0 The first extra argument.
|
---|
2848 | * @param a1 The second extra argument.
|
---|
2849 | * @param a2 The third extra argument.
|
---|
2850 | * @param a3 The fourth extra argument.
|
---|
2851 | * @param a4 The fifth extra argument.
|
---|
2852 | */
|
---|
2853 | #define IEM_MC_CALL_CIMPL_5(a_fFlags, a_fGstShwFlush, a_pfnCImpl, a0, a1, a2, a3, a4) \
|
---|
2854 | IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, (a_pfnCImpl)(pVCpu, IEM_GET_INSTR_LEN(pVCpu), a0, a1, a2, a3, a4))
|
---|
2855 |
|
---|
2856 | /**
|
---|
2857 | * Defers the entire instruction emulation to a C implementation routine and
|
---|
2858 | * returns, only taking the standard parameters.
|
---|
2859 | *
|
---|
2860 | * This shall be used without any IEM_MC_BEGIN or IEM_END macro surrounding it.
|
---|
2861 | *
|
---|
2862 | * @param a_fFlags IEM_CIMPL_F_XXX.
|
---|
2863 | * @param a_fGstShwFlush Guest shadow register copies needing to be flushed
|
---|
2864 | * in the native recompiler.
|
---|
2865 | * @param a_pfnCImpl The pointer to the C routine.
|
---|
2866 | * @sa IEM_DECL_IMPL_C_TYPE_0 and IEM_CIMPL_DEF_0.
|
---|
2867 | */
|
---|
2868 | #define IEM_MC_DEFER_TO_CIMPL_0_RET(a_fFlags, a_fGstShwFlush, a_pfnCImpl) \
|
---|
2869 | IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, (a_pfnCImpl)(pVCpu, IEM_GET_INSTR_LEN(pVCpu)))
|
---|
2870 |
|
---|
2871 | /**
|
---|
2872 | * Defers the entire instruction emulation to a C implementation routine and
|
---|
2873 | * returns, taking one argument in addition to the standard ones.
|
---|
2874 | *
|
---|
2875 | * This shall be used without any IEM_MC_BEGIN or IEM_END macro surrounding it.
|
---|
2876 | *
|
---|
2877 | * @param a_fFlags IEM_CIMPL_F_XXX.
|
---|
2878 | * @param a_fGstShwFlush Guest shadow register copies needing to be flushed
|
---|
2879 | * in the native recompiler.
|
---|
2880 | * @param a_pfnCImpl The pointer to the C routine.
|
---|
2881 | * @param a0 The argument.
|
---|
2882 | */
|
---|
2883 | #define IEM_MC_DEFER_TO_CIMPL_1_RET(a_fFlags, a_fGstShwFlush, a_pfnCImpl, a0) \
|
---|
2884 | IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, (a_pfnCImpl)(pVCpu, IEM_GET_INSTR_LEN(pVCpu), a0))
|
---|
2885 |
|
---|
2886 | /**
|
---|
2887 | * Defers the entire instruction emulation to a C implementation routine and
|
---|
2888 | * returns, taking two arguments in addition to the standard ones.
|
---|
2889 | *
|
---|
2890 | * This shall be used without any IEM_MC_BEGIN or IEM_END macro surrounding it.
|
---|
2891 | *
|
---|
2892 | * @param a_fFlags IEM_CIMPL_F_XXX.
|
---|
2893 | * @param a_fGstShwFlush Guest shadow register copies needing to be flushed
|
---|
2894 | * in the native recompiler.
|
---|
2895 | * @param a_pfnCImpl The pointer to the C routine.
|
---|
2896 | * @param a0 The first extra argument.
|
---|
2897 | * @param a1 The second extra argument.
|
---|
2898 | */
|
---|
2899 | #define IEM_MC_DEFER_TO_CIMPL_2_RET(a_fFlags, a_fGstShwFlush, a_pfnCImpl, a0, a1) \
|
---|
2900 | IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, (a_pfnCImpl)(pVCpu, IEM_GET_INSTR_LEN(pVCpu), a0, a1))
|
---|
2901 |
|
---|
2902 | /**
|
---|
2903 | * Defers the entire instruction emulation to a C implementation routine and
|
---|
2904 | * returns, taking three arguments in addition to the standard ones.
|
---|
2905 | *
|
---|
2906 | * This shall be used without any IEM_MC_BEGIN or IEM_END macro surrounding it.
|
---|
2907 | *
|
---|
2908 | * @param a_fFlags IEM_CIMPL_F_XXX.
|
---|
2909 | * @param a_fGstShwFlush Guest shadow register copies needing to be flushed
|
---|
2910 | * in the native recompiler.
|
---|
2911 | * @param a_pfnCImpl The pointer to the C routine.
|
---|
2912 | * @param a0 The first extra argument.
|
---|
2913 | * @param a1 The second extra argument.
|
---|
2914 | * @param a2 The third extra argument.
|
---|
2915 | */
|
---|
2916 | #define IEM_MC_DEFER_TO_CIMPL_3_RET(a_fFlags, a_fGstShwFlush, a_pfnCImpl, a0, a1, a2) \
|
---|
2917 | IEM_MC_CALL_CIMPL_HLP_RET(a_fFlags, (a_pfnCImpl)(pVCpu, IEM_GET_INSTR_LEN(pVCpu), a0, a1, a2))
|
---|
2918 |
|
---|
2919 |
|
---|
2920 | /**
|
---|
2921 | * Calls a FPU assembly implementation taking one visible argument.
|
---|
2922 | *
|
---|
2923 | * @param a_pfnAImpl Pointer to the assembly FPU routine.
|
---|
2924 | * @param a0 The first extra argument.
|
---|
2925 | */
|
---|
2926 | #define IEM_MC_CALL_FPU_AIMPL_1(a_pfnAImpl, a0) \
|
---|
2927 | do { \
|
---|
2928 | a_pfnAImpl(&pVCpu->cpum.GstCtx.XState.x87, (a0)); \
|
---|
2929 | } while (0)
|
---|
2930 |
|
---|
2931 | /**
|
---|
2932 | * Calls a FPU assembly implementation taking two visible arguments.
|
---|
2933 | *
|
---|
2934 | * @param a_pfnAImpl Pointer to the assembly FPU routine.
|
---|
2935 | * @param a0 The first extra argument.
|
---|
2936 | * @param a1 The second extra argument.
|
---|
2937 | */
|
---|
2938 | #define IEM_MC_CALL_FPU_AIMPL_2(a_pfnAImpl, a0, a1) \
|
---|
2939 | do { \
|
---|
2940 | a_pfnAImpl(&pVCpu->cpum.GstCtx.XState.x87, (a0), (a1)); \
|
---|
2941 | } while (0)
|
---|
2942 |
|
---|
2943 | /**
|
---|
2944 | * Calls a FPU assembly implementation taking three visible arguments.
|
---|
2945 | *
|
---|
2946 | * @param a_pfnAImpl Pointer to the assembly FPU routine.
|
---|
2947 | * @param a0 The first extra argument.
|
---|
2948 | * @param a1 The second extra argument.
|
---|
2949 | * @param a2 The third extra argument.
|
---|
2950 | */
|
---|
2951 | #define IEM_MC_CALL_FPU_AIMPL_3(a_pfnAImpl, a0, a1, a2) \
|
---|
2952 | do { \
|
---|
2953 | a_pfnAImpl(&pVCpu->cpum.GstCtx.XState.x87, (a0), (a1), (a2)); \
|
---|
2954 | } while (0)
|
---|
2955 |
|
---|
2956 | #define IEM_MC_SET_FPU_RESULT(a_FpuData, a_FSW, a_pr80Value) \
|
---|
2957 | do { \
|
---|
2958 | (a_FpuData).FSW = (a_FSW); \
|
---|
2959 | (a_FpuData).r80Result = *(a_pr80Value); \
|
---|
2960 | } while (0)
|
---|
2961 |
|
---|
2962 | /** Pushes FPU result onto the stack. */
|
---|
2963 | #define IEM_MC_PUSH_FPU_RESULT(a_FpuData, a_uFpuOpcode) \
|
---|
2964 | iemFpuPushResult(pVCpu, &a_FpuData, a_uFpuOpcode)
|
---|
2965 | /** Pushes FPU result onto the stack and sets the FPUDP. */
|
---|
2966 | #define IEM_MC_PUSH_FPU_RESULT_MEM_OP(a_FpuData, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode) \
|
---|
2967 | iemFpuPushResultWithMemOp(pVCpu, &a_FpuData, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode)
|
---|
2968 |
|
---|
2969 | /** Replaces ST0 with value one and pushes value 2 onto the FPU stack. */
|
---|
2970 | #define IEM_MC_PUSH_FPU_RESULT_TWO(a_FpuDataTwo, a_uFpuOpcode) \
|
---|
2971 | iemFpuPushResultTwo(pVCpu, &a_FpuDataTwo, a_uFpuOpcode)
|
---|
2972 |
|
---|
2973 | /** Stores FPU result in a stack register. */
|
---|
2974 | #define IEM_MC_STORE_FPU_RESULT(a_FpuData, a_iStReg, a_uFpuOpcode) \
|
---|
2975 | iemFpuStoreResult(pVCpu, &a_FpuData, a_iStReg, a_uFpuOpcode)
|
---|
2976 | /** Stores FPU result in a stack register and pops the stack. */
|
---|
2977 | #define IEM_MC_STORE_FPU_RESULT_THEN_POP(a_FpuData, a_iStReg, a_uFpuOpcode) \
|
---|
2978 | iemFpuStoreResultThenPop(pVCpu, &a_FpuData, a_iStReg, a_uFpuOpcode)
|
---|
2979 | /** Stores FPU result in a stack register and sets the FPUDP. */
|
---|
2980 | #define IEM_MC_STORE_FPU_RESULT_MEM_OP(a_FpuData, a_iStReg, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode) \
|
---|
2981 | iemFpuStoreResultWithMemOp(pVCpu, &a_FpuData, a_iStReg, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode)
|
---|
2982 | /** Stores FPU result in a stack register, sets the FPUDP, and pops the
|
---|
2983 | * stack. */
|
---|
2984 | #define IEM_MC_STORE_FPU_RESULT_WITH_MEM_OP_THEN_POP(a_FpuData, a_iStReg, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode) \
|
---|
2985 | iemFpuStoreResultWithMemOpThenPop(pVCpu, &a_FpuData, a_iStReg, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode)
|
---|
2986 |
|
---|
2987 | /** Only update the FOP, FPUIP, and FPUCS. (For FNOP.) */
|
---|
2988 | #define IEM_MC_UPDATE_FPU_OPCODE_IP(a_uFpuOpcode) \
|
---|
2989 | iemFpuUpdateOpcodeAndIp(pVCpu, a_uFpuOpcode)
|
---|
2990 | /** Free a stack register (for FFREE and FFREEP). */
|
---|
2991 | #define IEM_MC_FPU_STACK_FREE(a_iStReg) \
|
---|
2992 | iemFpuStackFree(pVCpu, a_iStReg)
|
---|
2993 | /** Increment the FPU stack pointer. */
|
---|
2994 | #define IEM_MC_FPU_STACK_INC_TOP() \
|
---|
2995 | iemFpuStackIncTop(pVCpu)
|
---|
2996 | /** Decrement the FPU stack pointer. */
|
---|
2997 | #define IEM_MC_FPU_STACK_DEC_TOP() \
|
---|
2998 | iemFpuStackDecTop(pVCpu)
|
---|
2999 |
|
---|
3000 | /** Updates the FSW, FOP, FPUIP, and FPUCS. */
|
---|
3001 | #define IEM_MC_UPDATE_FSW(a_u16FSW, a_uFpuOpcode) \
|
---|
3002 | iemFpuUpdateFSW(pVCpu, a_u16FSW, a_uFpuOpcode)
|
---|
3003 | /** Updates the FSW with a constant value as well as FOP, FPUIP, and FPUCS. */
|
---|
3004 | #define IEM_MC_UPDATE_FSW_CONST(a_u16FSW, a_uFpuOpcode) \
|
---|
3005 | iemFpuUpdateFSW(pVCpu, a_u16FSW, a_uFpuOpcode)
|
---|
3006 | /** Updates the FSW, FOP, FPUIP, FPUCS, FPUDP, and FPUDS. */
|
---|
3007 | #define IEM_MC_UPDATE_FSW_WITH_MEM_OP(a_u16FSW, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode) \
|
---|
3008 | iemFpuUpdateFSWWithMemOp(pVCpu, a_u16FSW, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode)
|
---|
3009 | /** Updates the FSW, FOP, FPUIP, and FPUCS, and then pops the stack. */
|
---|
3010 | #define IEM_MC_UPDATE_FSW_THEN_POP(a_u16FSW, a_uFpuOpcode) \
|
---|
3011 | iemFpuUpdateFSWThenPop(pVCpu, a_u16FSW, a_uFpuOpcode)
|
---|
3012 | /** Updates the FSW, FOP, FPUIP, FPUCS, FPUDP and FPUDS, and then pops the
|
---|
3013 | * stack. */
|
---|
3014 | #define IEM_MC_UPDATE_FSW_WITH_MEM_OP_THEN_POP(a_u16FSW, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode) \
|
---|
3015 | iemFpuUpdateFSWWithMemOpThenPop(pVCpu, a_u16FSW, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode)
|
---|
3016 | /** Updates the FSW, FOP, FPUIP, and FPUCS, and then pops the stack twice. */
|
---|
3017 | #define IEM_MC_UPDATE_FSW_THEN_POP_POP(a_u16FSW, a_uFpuOpcode) \
|
---|
3018 | iemFpuUpdateFSWThenPopPop(pVCpu, a_u16FSW, a_uFpuOpcode)
|
---|
3019 |
|
---|
3020 | /** Raises a FPU stack underflow exception. Sets FPUIP, FPUCS and FOP. */
|
---|
3021 | #define IEM_MC_FPU_STACK_UNDERFLOW(a_iStDst, a_uFpuOpcode) \
|
---|
3022 | iemFpuStackUnderflow(pVCpu, a_iStDst, a_uFpuOpcode)
|
---|
3023 | /** Raises a FPU stack underflow exception. Sets FPUIP, FPUCS and FOP. Pops
|
---|
3024 | * stack. */
|
---|
3025 | #define IEM_MC_FPU_STACK_UNDERFLOW_THEN_POP(a_iStDst, a_uFpuOpcode) \
|
---|
3026 | iemFpuStackUnderflowThenPop(pVCpu, a_iStDst, a_uFpuOpcode)
|
---|
3027 | /** Raises a FPU stack underflow exception. Sets FPUIP, FPUCS, FOP, FPUDP and
|
---|
3028 | * FPUDS. */
|
---|
3029 | #define IEM_MC_FPU_STACK_UNDERFLOW_MEM_OP(a_iStDst, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode) \
|
---|
3030 | iemFpuStackUnderflowWithMemOp(pVCpu, a_iStDst, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode)
|
---|
3031 | /** Raises a FPU stack underflow exception. Sets FPUIP, FPUCS, FOP, FPUDP and
|
---|
3032 | * FPUDS. Pops stack. */
|
---|
3033 | #define IEM_MC_FPU_STACK_UNDERFLOW_MEM_OP_THEN_POP(a_iStDst, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode) \
|
---|
3034 | iemFpuStackUnderflowWithMemOpThenPop(pVCpu, a_iStDst, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode)
|
---|
3035 | /** Raises a FPU stack underflow exception. Sets FPUIP, FPUCS and FOP. Pops
|
---|
3036 | * stack twice. */
|
---|
3037 | #define IEM_MC_FPU_STACK_UNDERFLOW_THEN_POP_POP(a_uFpuOpcode) \
|
---|
3038 | iemFpuStackUnderflowThenPopPop(pVCpu, a_uFpuOpcode)
|
---|
3039 | /** Raises a FPU stack underflow exception for an instruction pushing a result
|
---|
3040 | * value onto the stack. Sets FPUIP, FPUCS and FOP. */
|
---|
3041 | #define IEM_MC_FPU_STACK_PUSH_UNDERFLOW(a_uFpuOpcode) \
|
---|
3042 | iemFpuStackPushUnderflow(pVCpu, a_uFpuOpcode)
|
---|
3043 | /** Raises a FPU stack underflow exception for an instruction pushing a result
|
---|
3044 | * value onto the stack and replacing ST0. Sets FPUIP, FPUCS and FOP. */
|
---|
3045 | #define IEM_MC_FPU_STACK_PUSH_UNDERFLOW_TWO(a_uFpuOpcode) \
|
---|
3046 | iemFpuStackPushUnderflowTwo(pVCpu, a_uFpuOpcode)
|
---|
3047 |
|
---|
3048 | /** Raises a FPU stack overflow exception as part of a push attempt. Sets
|
---|
3049 | * FPUIP, FPUCS and FOP. */
|
---|
3050 | #define IEM_MC_FPU_STACK_PUSH_OVERFLOW(a_uFpuOpcode) \
|
---|
3051 | iemFpuStackPushOverflow(pVCpu, a_uFpuOpcode)
|
---|
3052 | /** Raises a FPU stack overflow exception as part of a push attempt. Sets
|
---|
3053 | * FPUIP, FPUCS, FOP, FPUDP and FPUDS. */
|
---|
3054 | #define IEM_MC_FPU_STACK_PUSH_OVERFLOW_MEM_OP(a_iEffSeg, a_GCPtrEff, a_uFpuOpcode) \
|
---|
3055 | iemFpuStackPushOverflowWithMemOp(pVCpu, a_iEffSeg, a_GCPtrEff, a_uFpuOpcode)
|
---|
3056 | /** Prepares for using the FPU state.
|
---|
3057 | * Ensures that we can use the host FPU in the current context (RC+R0.
|
---|
3058 | * Ensures the guest FPU state in the CPUMCTX is up to date. */
|
---|
3059 | #define IEM_MC_PREPARE_FPU_USAGE() iemFpuPrepareUsage(pVCpu)
|
---|
3060 | /** Actualizes the guest FPU state so it can be accessed read-only fashion. */
|
---|
3061 | #define IEM_MC_ACTUALIZE_FPU_STATE_FOR_READ() iemFpuActualizeStateForRead(pVCpu)
|
---|
3062 | /** Actualizes the guest FPU state so it can be accessed and modified. */
|
---|
3063 | #define IEM_MC_ACTUALIZE_FPU_STATE_FOR_CHANGE() iemFpuActualizeStateForChange(pVCpu)
|
---|
3064 |
|
---|
3065 | /** Prepares for using the SSE state.
|
---|
3066 | * Ensures that we can use the host SSE/FPU in the current context (RC+R0.
|
---|
3067 | * Ensures the guest SSE state in the CPUMCTX is up to date. */
|
---|
3068 | #define IEM_MC_PREPARE_SSE_USAGE() iemFpuPrepareUsageSse(pVCpu)
|
---|
3069 | /** Actualizes the guest XMM0..15 and MXCSR register state for read-only access. */
|
---|
3070 | #define IEM_MC_ACTUALIZE_SSE_STATE_FOR_READ() iemFpuActualizeSseStateForRead(pVCpu)
|
---|
3071 | /** Actualizes the guest XMM0..15 and MXCSR register state for read-write access. */
|
---|
3072 | #define IEM_MC_ACTUALIZE_SSE_STATE_FOR_CHANGE() iemFpuActualizeSseStateForChange(pVCpu)
|
---|
3073 |
|
---|
3074 | /** Prepares for using the AVX state.
|
---|
3075 | * Ensures that we can use the host AVX/FPU in the current context (RC+R0.
|
---|
3076 | * Ensures the guest AVX state in the CPUMCTX is up to date.
|
---|
3077 | * @note This will include the AVX512 state too when support for it is added
|
---|
3078 | * due to the zero extending feature of VEX instruction. */
|
---|
3079 | #define IEM_MC_PREPARE_AVX_USAGE() iemFpuPrepareUsageAvx(pVCpu)
|
---|
3080 | /** Actualizes the guest XMM0..15 and MXCSR register state for read-only access. */
|
---|
3081 | #define IEM_MC_ACTUALIZE_AVX_STATE_FOR_READ() iemFpuActualizeAvxStateForRead(pVCpu)
|
---|
3082 | /** Actualizes the guest YMM0..15 and MXCSR register state for read-write access. */
|
---|
3083 | #define IEM_MC_ACTUALIZE_AVX_STATE_FOR_CHANGE() iemFpuActualizeAvxStateForChange(pVCpu)
|
---|
3084 |
|
---|
3085 | /**
|
---|
3086 | * Calls a MMX assembly implementation taking two visible arguments.
|
---|
3087 | *
|
---|
3088 | * @param a_pfnAImpl Pointer to the assembly MMX routine.
|
---|
3089 | * @param a0 The first extra argument.
|
---|
3090 | * @param a1 The second extra argument.
|
---|
3091 | */
|
---|
3092 | #define IEM_MC_CALL_MMX_AIMPL_2(a_pfnAImpl, a0, a1) \
|
---|
3093 | do { \
|
---|
3094 | IEM_MC_PREPARE_FPU_USAGE(); \
|
---|
3095 | a_pfnAImpl(&pVCpu->cpum.GstCtx.XState.x87, (a0), (a1)); \
|
---|
3096 | } while (0)
|
---|
3097 |
|
---|
3098 | /**
|
---|
3099 | * Calls a MMX assembly implementation taking three visible arguments.
|
---|
3100 | *
|
---|
3101 | * @param a_pfnAImpl Pointer to the assembly MMX routine.
|
---|
3102 | * @param a0 The first extra argument.
|
---|
3103 | * @param a1 The second extra argument.
|
---|
3104 | * @param a2 The third extra argument.
|
---|
3105 | */
|
---|
3106 | #define IEM_MC_CALL_MMX_AIMPL_3(a_pfnAImpl, a0, a1, a2) \
|
---|
3107 | do { \
|
---|
3108 | IEM_MC_PREPARE_FPU_USAGE(); \
|
---|
3109 | a_pfnAImpl(&pVCpu->cpum.GstCtx.XState.x87, (a0), (a1), (a2)); \
|
---|
3110 | } while (0)
|
---|
3111 |
|
---|
3112 |
|
---|
3113 | /**
|
---|
3114 | * Calls a SSE assembly implementation taking two visible arguments.
|
---|
3115 | *
|
---|
3116 | * @param a_pfnAImpl Pointer to the assembly SSE routine.
|
---|
3117 | * @param a0 The first extra argument.
|
---|
3118 | * @param a1 The second extra argument.
|
---|
3119 | *
|
---|
3120 | * @note This throws an \#XF/\#UD exception if the helper indicates an exception
|
---|
3121 | * which is unmasked in the guest's MXCSR.
|
---|
3122 | */
|
---|
3123 | #define IEM_MC_CALL_SSE_AIMPL_2(a_pfnAImpl, a0, a1) \
|
---|
3124 | do { \
|
---|
3125 | IEM_MC_PREPARE_SSE_USAGE(); \
|
---|
3126 | const uint32_t fMxcsrOld = pVCpu->cpum.GstCtx.XState.x87.MXCSR; \
|
---|
3127 | const uint32_t fMxcsrNew = a_pfnAImpl(fMxcsrOld & ~X86_MXCSR_XCPT_FLAGS, \
|
---|
3128 | (a0), (a1)); \
|
---|
3129 | pVCpu->cpum.GstCtx.XState.x87.MXCSR |= fMxcsrNew; \
|
---|
3130 | if (RT_LIKELY(( ~((fMxcsrOld & X86_MXCSR_XCPT_MASK) >> X86_MXCSR_XCPT_MASK_SHIFT) \
|
---|
3131 | & (fMxcsrNew & X86_MXCSR_XCPT_FLAGS)) == 0)) \
|
---|
3132 | { /* probable */ } \
|
---|
3133 | else \
|
---|
3134 | { \
|
---|
3135 | if (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXMMEEXCPT) \
|
---|
3136 | return iemRaiseSimdFpException(pVCpu); \
|
---|
3137 | return iemRaiseUndefinedOpcode(pVCpu); \
|
---|
3138 | } \
|
---|
3139 | } while (0)
|
---|
3140 |
|
---|
3141 | /**
|
---|
3142 | * Calls a SSE assembly implementation taking three visible arguments.
|
---|
3143 | *
|
---|
3144 | * @param a_pfnAImpl Pointer to the assembly SSE routine.
|
---|
3145 | * @param a0 The first extra argument.
|
---|
3146 | * @param a1 The second extra argument.
|
---|
3147 | * @param a2 The third extra argument.
|
---|
3148 | *
|
---|
3149 | * @note This throws an \#XF/\#UD exception if the helper indicates an exception
|
---|
3150 | * which is unmasked in the guest's MXCSR.
|
---|
3151 | */
|
---|
3152 | #define IEM_MC_CALL_SSE_AIMPL_3(a_pfnAImpl, a0, a1, a2) \
|
---|
3153 | do { \
|
---|
3154 | IEM_MC_PREPARE_SSE_USAGE(); \
|
---|
3155 | const uint32_t fMxcsrOld = pVCpu->cpum.GstCtx.XState.x87.MXCSR; \
|
---|
3156 | const uint32_t fMxcsrNew = a_pfnAImpl(fMxcsrOld & ~X86_MXCSR_XCPT_FLAGS, \
|
---|
3157 | (a0), (a1), (a2)); \
|
---|
3158 | pVCpu->cpum.GstCtx.XState.x87.MXCSR |= fMxcsrNew; \
|
---|
3159 | if (RT_LIKELY(( ~((fMxcsrOld & X86_MXCSR_XCPT_MASK) >> X86_MXCSR_XCPT_MASK_SHIFT) \
|
---|
3160 | & (fMxcsrNew & X86_MXCSR_XCPT_FLAGS)) == 0)) \
|
---|
3161 | { /* probable */ } \
|
---|
3162 | else \
|
---|
3163 | { \
|
---|
3164 | if (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXMMEEXCPT) \
|
---|
3165 | return iemRaiseSimdFpException(pVCpu); \
|
---|
3166 | return iemRaiseUndefinedOpcode(pVCpu); \
|
---|
3167 | } \
|
---|
3168 | } while (0)
|
---|
3169 |
|
---|
3170 |
|
---|
3171 | /**
|
---|
3172 | * Calls a AVX assembly implementation taking two visible arguments.
|
---|
3173 | *
|
---|
3174 | * There is one implicit zero'th argument, a pointer to the extended state.
|
---|
3175 | *
|
---|
3176 | * @param a_pfnAImpl Pointer to the assembly AVX routine.
|
---|
3177 | * @param a0 The first extra argument.
|
---|
3178 | * @param a1 The second extra argument.
|
---|
3179 | *
|
---|
3180 | * @note This throws an \#XF/\#UD exception if the helper indicates an exception
|
---|
3181 | * which is unmasked in the guest's MXCSR.
|
---|
3182 | */
|
---|
3183 | #define IEM_MC_CALL_AVX_AIMPL_2(a_pfnAImpl, a0, a1) \
|
---|
3184 | do { \
|
---|
3185 | IEM_MC_PREPARE_AVX_USAGE(); \
|
---|
3186 | const uint32_t fMxcsrOld = pVCpu->cpum.GstCtx.XState.x87.MXCSR; \
|
---|
3187 | const uint32_t fMxcsrNew = a_pfnAImpl(fMxcsrOld & ~X86_MXCSR_XCPT_FLAGS, \
|
---|
3188 | (a0), (a1)); \
|
---|
3189 | pVCpu->cpum.GstCtx.XState.x87.MXCSR |= fMxcsrNew; \
|
---|
3190 | if (RT_LIKELY(( ~((fMxcsrOld & X86_MXCSR_XCPT_MASK) >> X86_MXCSR_XCPT_MASK_SHIFT) \
|
---|
3191 | & (fMxcsrNew & X86_MXCSR_XCPT_FLAGS)) == 0)) \
|
---|
3192 | { /* probable */ } \
|
---|
3193 | else \
|
---|
3194 | { \
|
---|
3195 | if (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXMMEEXCPT) \
|
---|
3196 | return iemRaiseSimdFpException(pVCpu); \
|
---|
3197 | return iemRaiseUndefinedOpcode(pVCpu); \
|
---|
3198 | } \
|
---|
3199 | } while (0)
|
---|
3200 |
|
---|
3201 | /**
|
---|
3202 | * Calls a AVX assembly implementation taking three visible arguments.
|
---|
3203 | *
|
---|
3204 | * There is one implicit zero'th argument, a pointer to the extended state.
|
---|
3205 | *
|
---|
3206 | * @param a_pfnAImpl Pointer to the assembly AVX routine.
|
---|
3207 | * @param a0 The first extra argument.
|
---|
3208 | * @param a1 The second extra argument.
|
---|
3209 | * @param a2 The third extra argument.
|
---|
3210 | *
|
---|
3211 | * @note This throws an \#XF/\#UD exception if the helper indicates an exception
|
---|
3212 | * which is unmasked in the guest's MXCSR.
|
---|
3213 | */
|
---|
3214 | #define IEM_MC_CALL_AVX_AIMPL_3(a_pfnAImpl, a0, a1, a2) \
|
---|
3215 | do { \
|
---|
3216 | IEM_MC_PREPARE_AVX_USAGE(); \
|
---|
3217 | const uint32_t fMxcsrOld = pVCpu->cpum.GstCtx.XState.x87.MXCSR; \
|
---|
3218 | const uint32_t fMxcsrNew = a_pfnAImpl(fMxcsrOld & ~X86_MXCSR_XCPT_FLAGS, \
|
---|
3219 | (a0), (a1), (a2)); \
|
---|
3220 | pVCpu->cpum.GstCtx.XState.x87.MXCSR |= fMxcsrNew; \
|
---|
3221 | if (RT_LIKELY(( ~((fMxcsrOld & X86_MXCSR_XCPT_MASK) >> X86_MXCSR_XCPT_MASK_SHIFT) \
|
---|
3222 | & (fMxcsrNew & X86_MXCSR_XCPT_FLAGS)) == 0)) \
|
---|
3223 | { /* probable */ } \
|
---|
3224 | else \
|
---|
3225 | { \
|
---|
3226 | if (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXMMEEXCPT) \
|
---|
3227 | return iemRaiseSimdFpException(pVCpu); \
|
---|
3228 | return iemRaiseUndefinedOpcode(pVCpu); \
|
---|
3229 | } \
|
---|
3230 | } while (0)
|
---|
3231 |
|
---|
3232 | /** @note Not for IOPL or IF testing. */
|
---|
3233 | #define IEM_MC_IF_EFL_BIT_SET(a_fBit) if (pVCpu->cpum.GstCtx.eflags.u & (a_fBit)) {
|
---|
3234 | /** @note Not for IOPL or IF testing. */
|
---|
3235 | #define IEM_MC_IF_EFL_BIT_NOT_SET(a_fBit) if (!(pVCpu->cpum.GstCtx.eflags.u & (a_fBit))) {
|
---|
3236 | /** @note Not for IOPL or IF testing. */
|
---|
3237 | #define IEM_MC_IF_EFL_ANY_BITS_SET(a_fBits) if (pVCpu->cpum.GstCtx.eflags.u & (a_fBits)) {
|
---|
3238 | /** @note Not for IOPL or IF testing. */
|
---|
3239 | #define IEM_MC_IF_EFL_NO_BITS_SET(a_fBits) if (!(pVCpu->cpum.GstCtx.eflags.u & (a_fBits))) {
|
---|
3240 | /** @note Not for IOPL or IF testing. */
|
---|
3241 | #define IEM_MC_IF_EFL_BITS_NE(a_fBit1, a_fBit2) \
|
---|
3242 | if ( !!(pVCpu->cpum.GstCtx.eflags.u & (a_fBit1)) \
|
---|
3243 | != !!(pVCpu->cpum.GstCtx.eflags.u & (a_fBit2)) ) {
|
---|
3244 | /** @note Not for IOPL or IF testing. */
|
---|
3245 | #define IEM_MC_IF_EFL_BITS_EQ(a_fBit1, a_fBit2) \
|
---|
3246 | if ( !!(pVCpu->cpum.GstCtx.eflags.u & (a_fBit1)) \
|
---|
3247 | == !!(pVCpu->cpum.GstCtx.eflags.u & (a_fBit2)) ) {
|
---|
3248 | /** @note Not for IOPL or IF testing. */
|
---|
3249 | #define IEM_MC_IF_EFL_BIT_SET_OR_BITS_NE(a_fBit, a_fBit1, a_fBit2) \
|
---|
3250 | if ( (pVCpu->cpum.GstCtx.eflags.u & (a_fBit)) \
|
---|
3251 | || !!(pVCpu->cpum.GstCtx.eflags.u & (a_fBit1)) \
|
---|
3252 | != !!(pVCpu->cpum.GstCtx.eflags.u & (a_fBit2)) ) {
|
---|
3253 | /** @note Not for IOPL or IF testing. */
|
---|
3254 | #define IEM_MC_IF_EFL_BIT_NOT_SET_AND_BITS_EQ(a_fBit, a_fBit1, a_fBit2) \
|
---|
3255 | if ( !(pVCpu->cpum.GstCtx.eflags.u & (a_fBit)) \
|
---|
3256 | && !!(pVCpu->cpum.GstCtx.eflags.u & (a_fBit1)) \
|
---|
3257 | == !!(pVCpu->cpum.GstCtx.eflags.u & (a_fBit2)) ) {
|
---|
3258 | #define IEM_MC_IF_CX_IS_NZ() if (pVCpu->cpum.GstCtx.cx != 0) {
|
---|
3259 | #define IEM_MC_IF_ECX_IS_NZ() if (pVCpu->cpum.GstCtx.ecx != 0) {
|
---|
3260 | #define IEM_MC_IF_RCX_IS_NZ() if (pVCpu->cpum.GstCtx.rcx != 0) {
|
---|
3261 | #define IEM_MC_IF_CX_IS_NOT_ONE() if (pVCpu->cpum.GstCtx.cx != 1) {
|
---|
3262 | #define IEM_MC_IF_ECX_IS_NOT_ONE() if (pVCpu->cpum.GstCtx.ecx != 1) {
|
---|
3263 | #define IEM_MC_IF_RCX_IS_NOT_ONE() if (pVCpu->cpum.GstCtx.rcx != 1) {
|
---|
3264 | /** @note Not for IOPL or IF testing. */
|
---|
3265 | #define IEM_MC_IF_CX_IS_NOT_ONE_AND_EFL_BIT_SET(a_fBit) \
|
---|
3266 | if ( pVCpu->cpum.GstCtx.cx != 1 \
|
---|
3267 | && (pVCpu->cpum.GstCtx.eflags.u & a_fBit)) {
|
---|
3268 | /** @note Not for IOPL or IF testing. */
|
---|
3269 | #define IEM_MC_IF_ECX_IS_NOT_ONE_AND_EFL_BIT_SET(a_fBit) \
|
---|
3270 | if ( pVCpu->cpum.GstCtx.ecx != 1 \
|
---|
3271 | && (pVCpu->cpum.GstCtx.eflags.u & a_fBit)) {
|
---|
3272 | /** @note Not for IOPL or IF testing. */
|
---|
3273 | #define IEM_MC_IF_RCX_IS_NOT_ONE_AND_EFL_BIT_SET(a_fBit) \
|
---|
3274 | if ( pVCpu->cpum.GstCtx.rcx != 1 \
|
---|
3275 | && (pVCpu->cpum.GstCtx.eflags.u & a_fBit)) {
|
---|
3276 | /** @note Not for IOPL or IF testing. */
|
---|
3277 | #define IEM_MC_IF_CX_IS_NOT_ONE_AND_EFL_BIT_NOT_SET(a_fBit) \
|
---|
3278 | if ( pVCpu->cpum.GstCtx.cx != 1 \
|
---|
3279 | && !(pVCpu->cpum.GstCtx.eflags.u & a_fBit)) {
|
---|
3280 | /** @note Not for IOPL or IF testing. */
|
---|
3281 | #define IEM_MC_IF_ECX_IS_NOT_ONE_AND_EFL_BIT_NOT_SET(a_fBit) \
|
---|
3282 | if ( pVCpu->cpum.GstCtx.ecx != 1 \
|
---|
3283 | && !(pVCpu->cpum.GstCtx.eflags.u & a_fBit)) {
|
---|
3284 | /** @note Not for IOPL or IF testing. */
|
---|
3285 | #define IEM_MC_IF_RCX_IS_NOT_ONE_AND_EFL_BIT_NOT_SET(a_fBit) \
|
---|
3286 | if ( pVCpu->cpum.GstCtx.rcx != 1 \
|
---|
3287 | && !(pVCpu->cpum.GstCtx.eflags.u & a_fBit)) {
|
---|
3288 | #define IEM_MC_IF_LOCAL_IS_Z(a_Local) if ((a_Local) == 0) {
|
---|
3289 | #define IEM_MC_IF_GREG_BIT_SET(a_iGReg, a_iBitNo) if (iemGRegFetchU64(pVCpu, (a_iGReg)) & RT_BIT_64(a_iBitNo)) {
|
---|
3290 |
|
---|
3291 | #define IEM_MC_REF_FPUREG(a_pr80Dst, a_iSt) \
|
---|
3292 | do { (a_pr80Dst) = &pVCpu->cpum.GstCtx.XState.x87.aRegs[a_iSt].r80; } while (0)
|
---|
3293 | #define IEM_MC_IF_FPUREG_IS_EMPTY(a_iSt) \
|
---|
3294 | if (iemFpuStRegNotEmpty(pVCpu, (a_iSt)) != VINF_SUCCESS) {
|
---|
3295 | #define IEM_MC_IF_FPUREG_NOT_EMPTY(a_iSt) \
|
---|
3296 | if (iemFpuStRegNotEmpty(pVCpu, (a_iSt)) == VINF_SUCCESS) {
|
---|
3297 | #define IEM_MC_IF_FPUREG_NOT_EMPTY_REF_R80(a_pr80Dst, a_iSt) \
|
---|
3298 | if (iemFpuStRegNotEmptyRef(pVCpu, (a_iSt), &(a_pr80Dst)) == VINF_SUCCESS) {
|
---|
3299 | #define IEM_MC_IF_TWO_FPUREGS_NOT_EMPTY_REF_R80(a_pr80Dst0, a_iSt0, a_pr80Dst1, a_iSt1) \
|
---|
3300 | if (iemFpu2StRegsNotEmptyRef(pVCpu, (a_iSt0), &(a_pr80Dst0), (a_iSt1), &(a_pr80Dst1)) == VINF_SUCCESS) {
|
---|
3301 | #define IEM_MC_IF_TWO_FPUREGS_NOT_EMPTY_REF_R80_FIRST(a_pr80Dst0, a_iSt0, a_iSt1) \
|
---|
3302 | if (iemFpu2StRegsNotEmptyRefFirst(pVCpu, (a_iSt0), &(a_pr80Dst0), (a_iSt1)) == VINF_SUCCESS) {
|
---|
3303 | #define IEM_MC_IF_FCW_IM() \
|
---|
3304 | if (pVCpu->cpum.GstCtx.XState.x87.FCW & X86_FCW_IM) {
|
---|
3305 |
|
---|
3306 | #define IEM_MC_ELSE() } else {
|
---|
3307 | #define IEM_MC_ENDIF() } do {} while (0)
|
---|
3308 |
|
---|
3309 |
|
---|
3310 | /** Recompiler debugging: Flush guest register shadow copies. */
|
---|
3311 | #define IEM_MC_HINT_FLUSH_GUEST_SHADOW(g_fGstShwFlush) ((void)0)
|
---|
3312 |
|
---|
3313 | /** Recompiler liveness info: input GPR */
|
---|
3314 | #define IEM_MC_LIVENESS_GREG_INPUT(a_iGReg) ((void)0)
|
---|
3315 | /** Recompiler liveness info: clobbered GPR */
|
---|
3316 | #define IEM_MC_LIVENESS_GREG_CLOBBER(a_iGReg) ((void)0)
|
---|
3317 | /** Recompiler liveness info: modified GPR register (i.e. input & output) */
|
---|
3318 | #define IEM_MC_LIVENESS_GREG_MODIFY(a_iGReg) ((void)0)
|
---|
3319 |
|
---|
3320 | /** Recompiler liveness info: input MM register */
|
---|
3321 | #define IEM_MC_LIVENESS_MREG_INPUT(a_iMReg) ((void)0)
|
---|
3322 | /** Recompiler liveness info: clobbered MM register */
|
---|
3323 | #define IEM_MC_LIVENESS_MREG_CLOBBER(a_iMReg) ((void)0)
|
---|
3324 | /** Recompiler liveness info: modified MM register (i.e. input & output) */
|
---|
3325 | #define IEM_MC_LIVENESS_MREG_MODIFY(a_iMReg) ((void)0)
|
---|
3326 |
|
---|
3327 | /** Recompiler liveness info: input SSE register */
|
---|
3328 | #define IEM_MC_LIVENESS_XREG_INPUT(a_iXReg) ((void)0)
|
---|
3329 | /** Recompiler liveness info: clobbered SSE register */
|
---|
3330 | #define IEM_MC_LIVENESS_XREG_CLOBBER(a_iXReg) ((void)0)
|
---|
3331 | /** Recompiler liveness info: modified SSE register (i.e. input & output) */
|
---|
3332 | #define IEM_MC_LIVENESS_XREG_MODIFY(a_iXReg) ((void)0)
|
---|
3333 |
|
---|
3334 | /** @todo add more as needed. */
|
---|
3335 |
|
---|
3336 | /** @} */
|
---|
3337 |
|
---|
3338 | #endif /* !VMM_INCLUDED_SRC_include_IEMMc_h */
|
---|
3339 |
|
---|