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