Changeset 105271 in vbox
- Timestamp:
- Jul 11, 2024 10:30:56 AM (5 months ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompBltIn.cpp
r105261 r105271 254 254 ~(VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC), true /*fSetFlags*/); 255 255 /* Return VINF_IEM_REEXEC_BREAK if other FFs are set. */ 256 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNative ExitReason_ReturnBreakFF);256 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeLabelType_ReturnBreakFF); 257 257 258 258 /* So, it's only interrupt releated FFs and we need to see if IRQs are being … … 260 260 off = iemNativeEmitTestBitInGprAndJmpToLabelIfNotSet(pReNative, off, idxEflReg, X86_EFL_IF_BIT, idxLabelVmCheck); 261 261 off = iemNativeEmitTestAnyBitsInGprAndTbExitIfNoneSet(pReNative, off, idxEflReg, CPUMCTX_INHIBIT_SHADOW, 262 kIemNative ExitReason_ReturnBreakFF);262 kIemNativeLabelType_ReturnBreakFF); 263 263 264 264 /* We've got shadow flags set, so we must check that the PC they are valid … … 268 268 off = iemNativeEmitLoadGprFromVCpuU64(pReNative, off, idxTmpReg, RT_UOFFSETOF(VMCPUCC, cpum.GstCtx.uRipInhibitInt)); 269 269 off = iemNativeEmitTestIfGprNotEqualGprAndTbExit(pReNative, off, idxTmpReg, idxPcReg, 270 kIemNative ExitReason_ReturnBreakFF);270 kIemNativeLabelType_ReturnBreakFF); 271 271 272 272 /* … … 278 278 off = iemNativeEmitLoadGprByGprU32(pReNative, off, idxTmpReg, idxTmpReg, RT_UOFFSETOF(VMCC, fGlobalForcedActions)); 279 279 off = iemNativeEmitAndGpr32ByImm(pReNative, off, idxTmpReg, VM_FF_ALL_MASK, true /*fSetFlags*/); 280 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNative ExitReason_ReturnBreakFF);280 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeLabelType_ReturnBreakFF); 281 281 282 282 /** @todo STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatCheckIrqBreaks); */ … … 321 321 off = iemNativeEmitAndGpr32ByImm(pReNative, off, idxTmpReg, IEMTB_F_KEY_MASK); 322 322 off = iemNativeEmitTestIfGpr32NotEqualImmAndTbExit(pReNative, off, idxTmpReg, fExpectedExec & IEMTB_F_KEY_MASK, 323 kIemNative ExitReason_ReturnBreak);323 kIemNativeLabelType_ReturnBreak); 324 324 iemNativeRegFreeTmp(pReNative, idxTmpReg); 325 325 … … 450 450 451 451 /* 3. Jump if greater. */ 452 off = iemNativeEmitJaTbExit(pReNative, off, kIemNative ExitReason_RaiseGp0);452 off = iemNativeEmitJaTbExit(pReNative, off, kIemNativeLabelType_RaiseGp0); 453 453 454 454 iemNativeRegFreeTmp(pReNative, idxRegCsLim); … … 538 538 /* Compare the two and jump out if we're too close to the limit. */ 539 539 off = iemNativeEmitCmpGprWithGpr(pReNative, off, idxRegLeft, idxRegRight); 540 off = iemNativeEmitJlTbExit(pReNative, off, kIemNative ExitReason_NeedCsLimChecking);540 off = iemNativeEmitJlTbExit(pReNative, off, kIemNativeLabelType_NeedCsLimChecking); 541 541 542 542 iemNativeRegFreeTmp(pReNative, idxRegRight); … … 618 618 offConsolidatedJump = off; \ 619 619 if (BP_ON_OBSOLETION) pbCodeBuf[off++] = 0xcc; \ 620 off = iemNativeEmitTbExitEx(pReNative, pbCodeBuf, off, kIemNative ExitReason_ObsoleteTb); \620 off = iemNativeEmitTbExitEx(pReNative, pbCodeBuf, off, kIemNativeLabelType_ObsoleteTb); \ 621 621 } \ 622 622 } while (0) … … 862 862 if (fPendingJmp) 863 863 { 864 off = iemNativeEmitJccTbExitEx(pReNative, pu32CodeBuf, off, kIemNative ExitReason_ObsoleteTb,864 off = iemNativeEmitJccTbExitEx(pReNative, pu32CodeBuf, off, kIemNativeLabelType_ObsoleteTb, 865 865 kArmv8InstrCond_Ne); 866 866 fPendingJmp = false; … … 899 899 ARMA64_NZCV_F_N0_Z0_C0_V0, kArmv8InstrCond_Eq); 900 900 901 off = iemNativeEmitJccTbExitEx(pReNative, pu32CodeBuf, off, kIemNative ExitReason_ObsoleteTb,901 off = iemNativeEmitJccTbExitEx(pReNative, pu32CodeBuf, off, kIemNativeLabelType_ObsoleteTb, 902 902 kArmv8InstrCond_Ne); 903 903 … … 1033 1033 */ 1034 1034 if (fPendingJmp) 1035 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNative ExitReason_ObsoleteTb);1035 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeLabelType_ObsoleteTb); 1036 1036 1037 1037 RT_NOREF(pu32CodeBuf, cbLeft, offPage, pbOpcodes, offConsolidatedJump); … … 1194 1194 /* 3. Check that off is less than X86_PAGE_SIZE/cbInstrBufTotal. */ 1195 1195 off = iemNativeEmitCmpGprWithImm(pReNative, off, idxRegTmp, X86_PAGE_SIZE - 1); 1196 off = iemNativeEmitJaTbExit(pReNative, off, kIemNative ExitReason_CheckBranchMiss);1196 off = iemNativeEmitJaTbExit(pReNative, off, kIemNativeLabelType_CheckBranchMiss); 1197 1197 1198 1198 /* 4. Add iem.s.GCPhysInstrBuf and compare with GCPhysRangePageWithOffset. */ … … 1226 1226 + offRange; 1227 1227 off = iemNativeEmitTestIfGprNotEqualImmAndTbExit(pReNative, off, idxRegTmp, GCPhysRangePageWithOffset, 1228 kIemNative ExitReason_CheckBranchMiss);1228 kIemNativeLabelType_CheckBranchMiss); 1229 1229 1230 1230 iemNativeRegFreeTmp(pReNative, idxRegTmp); … … 1336 1336 RTGCPHYS const GCPhysNewPage = iemTbGetRangePhysPageAddr(pTb, idxRange); 1337 1337 off = iemNativeEmitTestIfGprNotEqualImmAndTbExit(pReNative, off, idxRegGCPhys, GCPhysNewPage, 1338 kIemNative ExitReason_ObsoleteTb);1338 kIemNativeLabelType_ObsoleteTb); 1339 1339 1340 1340 iemNativeRegFreeTmp(pReNative, idxRegGCPhys); … … 1547 1547 off = iemNativeEmitLoadGprImm64(pReNative, off, idxRegTmp2, GCPhysRangePageWithOffset); 1548 1548 off = iemNativeEmitCmpGprWithGpr(pReNative, off, idxRegTmp, idxRegTmp2); 1549 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNative ExitReason_CheckBranchMiss);1549 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeLabelType_CheckBranchMiss); 1550 1550 uint32_t const offFixedJumpToEnd = off; 1551 1551 off = iemNativeEmitJmpToFixed(pReNative, off, off + 512 /* force rel32 */); … … 1560 1560 /* Check that we haven't been here before. */ 1561 1561 off = iemNativeEmitTestIfGprIsNotZeroAndTbExit(pReNative, off, idxRegTmp2, false /*f64Bit*/, 1562 kIemNative ExitReason_CheckBranchMiss);1562 kIemNativeLabelType_CheckBranchMiss); 1563 1563 1564 1564 /* Jump to the TLB lookup code. */ -
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h
r105251 r105271 247 247 pReNative->fMc = 0; \ 248 248 pReNative->fCImpl = (a_fFlags); \ 249 return iemNativeEmitCImplCall0(pReNative, off, pCallEntry->idxInstr, a_fGstShwFlush, (uintptr_t)a_pfnCImpl, a_cbInstr) /** @todo not used ... */ 249 return iemNativeEmitCImplCall0(pReNative, off, pCallEntry->idxInstr, a_fGstShwFlush, (uintptr_t)a_pfnCImpl, \ 250 a_cbInstr) /** @todo not used ... */ 250 251 251 252 … … 319 320 #ifdef IEMNATIVE_WITH_LIVENESS_ANALYSIS 320 321 AssertMsg( pReNative->idxCurCall == 0 321 || IEMLIVENESS_STATE_IS_INPUT_EXPECTED(iemNativeLivenessGetStateByGstRegEx(&pReNative->paLivenessEntries[pReNative->idxCurCall - 1], IEMLIVENESSBIT_IDX_EFL_OTHER)), 322 ("Efl_Other - %u\n", iemNativeLivenessGetStateByGstRegEx(&pReNative->paLivenessEntries[pReNative->idxCurCall - 1], IEMLIVENESSBIT_IDX_EFL_OTHER))); 322 || IEMLIVENESS_STATE_IS_INPUT_EXPECTED(iemNativeLivenessGetStateByGstRegEx(&pReNative->paLivenessEntries[pReNative->idxCurCall - 1], 323 IEMLIVENESSBIT_IDX_EFL_OTHER)), 324 ("Efl_Other - %u\n", iemNativeLivenessGetStateByGstRegEx(&pReNative->paLivenessEntries[pReNative->idxCurCall - 1], 325 IEMLIVENESSBIT_IDX_EFL_OTHER))); 323 326 #endif 324 327 … … 334 337 off = iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(pReNative, off, idxEflReg, 335 338 X86_EFL_TF | CPUMCTX_DBG_HIT_DRX_MASK | CPUMCTX_DBG_DBGF_MASK, 336 kIemNative ExitReason_ReturnWithFlags);339 kIemNativeLabelType_ReturnWithFlags); 337 340 off = iemNativeEmitAndGpr32ByImm(pReNative, off, idxEflReg, ~(uint32_t)(X86_EFL_RF | CPUMCTX_INHIBIT_SHADOW)); 338 341 off = iemNativeEmitStoreGprToVCpuU32(pReNative, off, idxEflReg, RT_UOFFSETOF(VMCPU, cpum.GstCtx.eflags)); … … 394 397 RT_UOFFSETOF(VMCPU, iem.s.ppTbLookupEntryR3)); 395 398 396 return iemNativeEmitTbExit(pReNative, off, kIemNative ExitReason_ReturnBreak);399 return iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_ReturnBreak); 397 400 398 401 #else … … 440 443 441 444 if (pReNative->idxLastCheckIrqCallNo != UINT32_MAX) 442 return iemNativeEmitTbExit(pReNative, off, kIemNative ExitReason_ReturnBreakViaLookup);443 return iemNativeEmitTbExit(pReNative, off, kIemNative ExitReason_ReturnBreakViaLookupWithIrq);445 return iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_ReturnBreakViaLookup); 446 return iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_ReturnBreakViaLookupWithIrq); 444 447 } 445 448 } 446 449 if (pReNative->idxLastCheckIrqCallNo != UINT32_MAX) 447 return iemNativeEmitTbExit(pReNative, off, kIemNative ExitReason_ReturnBreakViaLookupWithTlb);448 return iemNativeEmitTbExit(pReNative, off, kIemNative ExitReason_ReturnBreakViaLookupWithTlbAndIrq);450 return iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_ReturnBreakViaLookupWithTlb); 451 return iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_ReturnBreakViaLookupWithTlbAndIrq); 449 452 #endif 450 453 } … … 1594 1597 1595 1598 /********************************************************************************************************************************* 1596 * Emitters for changing PC/RIP/EIP/IP with a RETN (Iw) instruction (IEM_MC_RETN_AND_FINISH) (requires stack emmiters). *1599 * Emitters for changing PC/RIP/EIP/IP with a RETN (Iw) instruction (IEM_MC_RETN_AND_FINISH) (requires stack emmiters). * 1597 1600 *********************************************************************************************************************************/ 1598 1601 … … 1719 1722 : (uintptr_t)iemNativeHlpStackFetchU16; 1720 1723 uint8_t const idxRegRsp = iemNativeRegAllocTmpForGuestReg(pReNative, &off, IEMNATIVEGSTREG_GPR(X86_GREG_xSP), 1721 fFlat ? kIemNativeGstRegUse_ForUpdate : kIemNativeGstRegUse_Calculation, 1724 fFlat ? kIemNativeGstRegUse_ForUpdate 1725 : kIemNativeGstRegUse_Calculation, 1722 1726 true /*fNoVolatileRegs*/); 1723 1727 uint8_t const idxRegEffSp = fFlat ? idxRegRsp : iemNativeRegAllocTmp(pReNative, &off); 1724 1728 /** @todo can do a better job picking the register here. For cbMem >= 4 this 1725 1729 * will be the resulting register value. */ 1726 uint8_t const idxRegMemResult = iemNativeRegAllocTmp(pReNative, &off); /* pointer then value; arm64 SP += 2/4 helper too. 1730 uint8_t const idxRegMemResult = iemNativeRegAllocTmp(pReNative, &off); /* pointer then value; arm64 SP += 2/4 helper too. */ 1727 1731 1728 1732 uint32_t offFixupJumpToUseOtherBitSp = UINT32_MAX; … … 1956 1960 1957 1961 /* Allocate a temporary CR0 register. */ 1958 uint8_t const idxCr0Reg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr0, kIemNativeGstRegUse_ReadOnly); 1962 uint8_t const idxCr0Reg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr0, 1963 kIemNativeGstRegUse_ReadOnly); 1959 1964 1960 1965 /* … … 1963 1968 */ 1964 1969 /* Test and jump. */ 1965 off = iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(pReNative, off, idxCr0Reg, X86_CR0_EM | X86_CR0_TS, kIemNativeExitReason_RaiseNm); 1970 off = iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(pReNative, off, idxCr0Reg, X86_CR0_EM | X86_CR0_TS, 1971 kIemNativeLabelType_RaiseNm); 1966 1972 1967 1973 /* Free but don't flush the CR0 register. */ … … 2013 2019 2014 2020 /* Allocate a temporary CR0 register. */ 2015 uint8_t const idxCr0Reg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr0, kIemNativeGstRegUse_Calculation); 2021 uint8_t const idxCr0Reg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr0, 2022 kIemNativeGstRegUse_Calculation); 2016 2023 2017 2024 /* … … 2021 2028 off = iemNativeEmitAndGpr32ByImm(pReNative, off, idxCr0Reg, X86_CR0_MP | X86_CR0_TS); 2022 2029 /* Test and jump. */ 2023 off = iemNativeEmitTestIfGpr32EqualsImmAndTbExit(pReNative, off, idxCr0Reg, X86_CR0_MP | X86_CR0_TS, kIemNativeExitReason_RaiseNm); 2030 off = iemNativeEmitTestIfGpr32EqualsImmAndTbExit(pReNative, off, idxCr0Reg, X86_CR0_MP | X86_CR0_TS, 2031 kIemNativeLabelType_RaiseNm); 2024 2032 2025 2033 /* Free the CR0 register. */ … … 2065 2073 2066 2074 /* Allocate a temporary FSW register. */ 2067 uint8_t const idxFpuFswReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_FpuFsw, kIemNativeGstRegUse_ReadOnly); 2075 uint8_t const idxFpuFswReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_FpuFsw, 2076 kIemNativeGstRegUse_ReadOnly); 2068 2077 2069 2078 /* … … 2072 2081 */ 2073 2082 /* Test and jump. */ 2074 off = iemNativeEmitTestBitInGprAndTbExitIfSet(pReNative, off, idxFpuFswReg, X86_FSW_ES_BIT, kIemNative ExitReason_RaiseMf);2083 off = iemNativeEmitTestBitInGprAndTbExitIfSet(pReNative, off, idxFpuFswReg, X86_FSW_ES_BIT, kIemNativeLabelType_RaiseMf); 2075 2084 2076 2085 /* Free but don't flush the FSW register. */ … … 2136 2145 off = iemNativeEmitAndGpr32ByImmEx(pCodeBuf, off, idxTmpReg, X86_CR0_EM | X86_CR0_TS | X86_CR4_OSFXSR); 2137 2146 off = iemNativeEmitXorGpr32ByImmEx(pCodeBuf, off, idxTmpReg, X86_CR4_OSFXSR); 2138 off = iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, kIemNative ExitReason_RaiseSseRelated, kIemNativeInstrCond_ne);2147 off = iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, kIemNativeLabelType_RaiseSseRelated, kIemNativeInstrCond_ne); 2139 2148 2140 2149 #elif defined(RT_ARCH_ARM64) … … 2154 2163 /* -> idxTmpReg[0]=~OSFXSR; idxTmpReg[2]=EM; idxTmpReg[3]=TS; (the rest is zero) */ 2155 2164 off = iemNativeEmitTestIfGprIsNotZeroAndTbExitEx(pReNative, pCodeBuf, off, idxTmpReg, false /*f64Bit*/, 2156 kIemNative ExitReason_RaiseSseRelated);2165 kIemNativeLabelType_RaiseSseRelated); 2157 2166 2158 2167 #else … … 2242 2251 off = iemNativeEmitXorGpr32ByImmEx(pCodeBuf, off, idxTmpReg, ((XSAVE_C_YMM | XSAVE_C_SSE) << 2) | 2); 2243 2252 /* -> idxTmpReg[0]=CR0.TS idxTmpReg[1]=~CR4.OSXSAVE; idxTmpReg[2]=0; idxTmpReg[3]=~SSE; idxTmpReg[4]=~YMM; */ 2244 off = iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, kIemNative ExitReason_RaiseAvxRelated, kIemNativeInstrCond_ne);2253 off = iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, kIemNativeLabelType_RaiseAvxRelated, kIemNativeInstrCond_ne); 2245 2254 2246 2255 #elif defined(RT_ARCH_ARM64) … … 2261 2270 /* -> idxTmpReg[0]=CR0.TS; idxTmpReg[1]=~CR4.OSXSAVE; idxTmpReg[2]=~SSE; idxTmpReg[3]=~YMM; (the rest is zero) */ 2262 2271 off = iemNativeEmitTestIfGprIsNotZeroAndTbExitEx(pReNative, pCodeBuf, off, idxTmpReg, false /*f64Bit*/, 2263 kIemNative ExitReason_RaiseAvxRelated);2272 kIemNativeLabelType_RaiseAvxRelated); 2264 2273 2265 2274 #else … … 2302 2311 #endif 2303 2312 2304 uint8_t const idxRegMxCsr = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_MxCsr, kIemNativeGstRegUse_ReadOnly); 2313 uint8_t const idxRegMxCsr = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_MxCsr, 2314 kIemNativeGstRegUse_ReadOnly); 2305 2315 uint8_t const idxRegTmp = iemNativeRegAllocTmp(pReNative, &off); 2306 2316 … … 2316 2326 off = iemNativeEmitAndGpr32ByGpr32(pReNative, off, idxRegTmp, idxRegMxCsr); 2317 2327 off = iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(pReNative, off, idxRegTmp, X86_MXCSR_XCPT_FLAGS, 2318 kIemNative ExitReason_RaiseSseAvxFpRelated);2328 kIemNativeLabelType_RaiseSseAvxFpRelated); 2319 2329 2320 2330 /* Free but don't flush the MXCSR register. */ … … 2353 2363 2354 2364 /* raise \#DE exception unconditionally. */ 2355 return iemNativeEmitTbExit(pReNative, off, kIemNative ExitReason_RaiseDe);2365 return iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_RaiseDe); 2356 2366 } 2357 2367 … … 2371 2381 */ 2372 2382 DECL_INLINE_THROW(uint32_t) 2373 iemNativeEmitRaiseGp0IfEffAddrUnaligned(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxInstr, uint8_t idxVarEffAddr, uint8_t cbAlign) 2383 iemNativeEmitRaiseGp0IfEffAddrUnaligned(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxInstr, 2384 uint8_t idxVarEffAddr, uint8_t cbAlign) 2374 2385 { 2375 2386 IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxVarEffAddr); … … 2390 2401 2391 2402 off = iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(pReNative, off, idxVarReg, cbAlign - 1, 2392 kIemNative ExitReason_RaiseGp0);2403 kIemNativeLabelType_RaiseGp0); 2393 2404 2394 2405 iemNativeVarRegisterRelease(pReNative, idxVarEffAddr); … … 3430 3441 #endif 3431 3442 fGstShwFlush = iemNativeCImplFlagsToGuestShadowFlushMask(pReNative->fCImpl, fGstShwFlush | RT_BIT_64(kIemNativeGstReg_Pc)); 3432 if (!(pReNative->fMc & IEM_MC_F_WITHOUT_FLAGS)) /** @todo We don't emit with-flags/without-flags variations for CIMPL calls. 3443 if (!(pReNative->fMc & IEM_MC_F_WITHOUT_FLAGS)) /** @todo We don't emit with-flags/without-flags variations for CIMPL calls. */ 3433 3444 fGstShwFlush |= RT_BIT_64(kIemNativeGstReg_EFlags); 3434 3445 iemNativeRegFlushGuestShadows(pReNative, fGstShwFlush); … … 5210 5221 5211 5222 /** Handles IEM_MC_SET_EFL_BIT/IEM_MC_CLEAR_EFL_BIT/IEM_MC_FLIP_EFL_BIT. */ 5212 DECL_INLINE_THROW(uint32_t) iemNativeEmitModifyEFlagsBit(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t fEflBit, IEMNATIVEMITEFLOP enmOp) 5223 DECL_INLINE_THROW(uint32_t) 5224 iemNativeEmitModifyEFlagsBit(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t fEflBit, IEMNATIVEMITEFLOP enmOp) 5213 5225 { 5214 5226 uint8_t const idxEflReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_EFlags, … … 6679 6691 */ 6680 6692 /* Allocate a temporary PC register. */ 6681 uint8_t const idxPcReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Pc, kIemNativeGstRegUse_ForUpdate); 6693 uint8_t const idxPcReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Pc, 6694 kIemNativeGstRegUse_ForUpdate); 6682 6695 6683 6696 /* Restore the original value. */ … … 8010 8023 AssertMsg( pReNative->idxCurCall == 0 8011 8024 || IEMLIVENESS_STATE_IS_CLOBBER_EXPECTED(iemNativeLivenessGetPrevStateByGstReg(pReNative, IEMNATIVEGSTREG_GPR(idxGReg))), 8012 ("%s - %u\n", g_aGstShadowInfo[idxGReg].pszName, iemNativeLivenessGetPrevStateByGstReg(pReNative, IEMNATIVEGSTREG_GPR(idxGReg)))); 8025 ("%s - %u\n", g_aGstShadowInfo[idxGReg].pszName, 8026 iemNativeLivenessGetPrevStateByGstReg(pReNative, IEMNATIVEGSTREG_GPR(idxGReg)))); 8013 8027 #endif 8014 8028 iemNativeRegClearAndMarkAsGstRegShadow(pReNative, idxRegMemResult, IEMNATIVEGSTREG_GPR(idxGReg), off); … … 8866 8880 /* Allocate destination and source register. */ 8867 8881 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXRegDst), 8868 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForFullWrite); 8882 kIemNativeGstSimdRegLdStSz_Low128, 8883 kIemNativeGstRegUse_ForFullWrite); 8869 8884 uint8_t const idxSimdRegSrc = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXRegSrc), 8870 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ReadOnly); 8885 kIemNativeGstSimdRegLdStSz_Low128, 8886 kIemNativeGstRegUse_ReadOnly); 8871 8887 8872 8888 off = iemNativeEmitSimdLoadVecRegFromVecRegU128(pReNative, off, idxSimdRegDst, idxSimdRegSrc); … … 8920 8936 8921 8937 uint8_t const idxSimdRegSrc = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 8922 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ReadOnly); 8938 kIemNativeGstSimdRegLdStSz_Low128, 8939 kIemNativeGstRegUse_ReadOnly); 8923 8940 8924 8941 iemNativeVarSetKindToStack(pReNative, idxDstVar); … … 8949 8966 8950 8967 uint8_t const idxSimdRegSrc = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 8951 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ReadOnly); 8968 kIemNativeGstSimdRegLdStSz_Low128, 8969 kIemNativeGstRegUse_ReadOnly); 8952 8970 8953 8971 iemNativeVarSetKindToStack(pReNative, idxDstVar); … … 8975 8993 8976 8994 uint8_t const idxSimdRegSrc = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 8977 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ReadOnly); 8995 kIemNativeGstSimdRegLdStSz_Low128, 8996 kIemNativeGstRegUse_ReadOnly); 8978 8997 8979 8998 iemNativeVarSetKindToStack(pReNative, idxDstVar); … … 9001 9020 9002 9021 uint8_t const idxSimdRegSrc = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9003 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ReadOnly); 9022 kIemNativeGstSimdRegLdStSz_Low128, 9023 kIemNativeGstRegUse_ReadOnly); 9004 9024 9005 9025 iemNativeVarSetKindToStack(pReNative, idxDstVar); … … 9032 9052 9033 9053 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9034 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForFullWrite); 9054 kIemNativeGstSimdRegLdStSz_Low128, 9055 kIemNativeGstRegUse_ForFullWrite); 9035 9056 uint8_t const idxVarReg = iemNativeVarSimdRegisterAcquire(pReNative, idxSrcVar, &off, true /*fInitialized*/); 9036 9057 … … 9083 9104 9084 9105 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9085 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForUpdate); 9106 kIemNativeGstSimdRegLdStSz_Low128, 9107 kIemNativeGstRegUse_ForUpdate); 9086 9108 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off, true /*fInitialized*/); 9087 9109 … … 9114 9136 9115 9137 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9116 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForUpdate); 9138 kIemNativeGstSimdRegLdStSz_Low128, 9139 kIemNativeGstRegUse_ForUpdate); 9117 9140 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off, true /*fInitialized*/); 9118 9141 … … 9140 9163 9141 9164 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9142 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForUpdate); 9165 kIemNativeGstSimdRegLdStSz_Low128, 9166 kIemNativeGstRegUse_ForUpdate); 9143 9167 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off, true /*fInitialized*/); 9144 9168 … … 9167 9191 9168 9192 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9169 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForUpdate); 9193 kIemNativeGstSimdRegLdStSz_Low128, 9194 kIemNativeGstRegUse_ForUpdate); 9170 9195 uint8_t const idxVarReg = iemNativeVarSimdRegisterAcquire(pReNative, idxSrcVar, &off, true /*fInitialized*/); 9171 9196 … … 9189 9214 { 9190 9215 /* 9191 * The iYRegSrc == iYRegDst case needs to be treated differently here, because if iYRegDst gets allocated first for the full write 9192 * it won't load the actual value from CPUMCTX. When allocating iYRegSrc afterwards it will get duplicated from the already 9193 * allocated host register for iYRegDst containing garbage. This will be catched by the guest register value checking in debug builds. 9216 * The iYRegSrc == iYRegDst case needs to be treated differently here, because 9217 * if iYRegDst gets allocated first for the full write it won't load the 9218 * actual value from CPUMCTX. When allocating iYRegSrc afterwards it will get 9219 * duplicated from the already allocated host register for iYRegDst containing 9220 * garbage. This will be catched by the guest register value checking in debug 9221 * builds. 9194 9222 */ 9195 9223 if (iYRegDst != iYRegSrc) … … 9214 9242 /* This effectively only clears the upper 128-bits of the register. */ 9215 9243 uint8_t const idxSimdReg = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYRegDst), 9216 kIemNativeGstSimdRegLdStSz_High128, kIemNativeGstRegUse_ForFullWrite); 9244 kIemNativeGstSimdRegLdStSz_High128, 9245 kIemNativeGstRegUse_ForFullWrite); 9217 9246 9218 9247 off = iemNativeEmitSimdZeroVecRegHighU128(pReNative, off, idxSimdReg); … … 9234 9263 { 9235 9264 /* 9236 * The iYRegSrc == iYRegDst case needs to be treated differently here, because if iYRegDst gets allocated first for the full write 9237 * it won't load the actual value from CPUMCTX. When allocating iYRegSrc afterwards it will get duplicated from the already 9238 * allocated host register for iYRegDst containing garbage. This will be catched by the guest register value checking in debug builds. 9239 * iYRegSrc == iYRegDst would effectively only clear any upper 256-bits for a zmm register we don't support yet, so this is just a nop. 9265 * The iYRegSrc == iYRegDst case needs to be treated differently here, because 9266 * if iYRegDst gets allocated first for the full write it won't load the 9267 * actual value from CPUMCTX. When allocating iYRegSrc afterwards it will get 9268 * duplicated from the already allocated host register for iYRegDst containing 9269 * garbage. This will be catched by the guest register value checking in debug 9270 * builds. iYRegSrc == iYRegDst would effectively only clear any upper 256-bits 9271 * for a zmm register we don't support yet, so this is just a nop. 9240 9272 */ 9241 9273 if (iYRegDst != iYRegSrc) … … 9243 9275 /* Allocate destination and source register. */ 9244 9276 uint8_t const idxSimdRegSrc = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYRegSrc), 9245 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ReadOnly); 9277 kIemNativeGstSimdRegLdStSz_256, 9278 kIemNativeGstRegUse_ReadOnly); 9246 9279 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYRegDst), 9247 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9280 kIemNativeGstSimdRegLdStSz_256, 9281 kIemNativeGstRegUse_ForFullWrite); 9248 9282 9249 9283 off = iemNativeEmitSimdLoadVecRegFromVecRegU256(pReNative, off, idxSimdRegDst, idxSimdRegSrc); … … 9357 9391 { 9358 9392 uint8_t const idxSimdReg = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYReg), 9359 kIemNativeGstSimdRegLdStSz_High128, kIemNativeGstRegUse_ForFullWrite); 9393 kIemNativeGstSimdRegLdStSz_High128, 9394 kIemNativeGstRegUse_ForFullWrite); 9360 9395 9361 9396 off = iemNativeEmitSimdZeroVecRegHighU128(pReNative, off, idxSimdReg); … … 9411 9446 9412 9447 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYReg), 9413 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9448 kIemNativeGstSimdRegLdStSz_256, 9449 kIemNativeGstRegUse_ForFullWrite); 9414 9450 9415 9451 uint8_t const idxVarReg = iemNativeVarSimdRegisterAcquire(pReNative, idxSrcVar, &off); … … 9437 9473 9438 9474 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9439 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9475 kIemNativeGstSimdRegLdStSz_256, 9476 kIemNativeGstRegUse_ForFullWrite); 9440 9477 9441 9478 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); … … 9462 9499 9463 9500 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9464 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9501 kIemNativeGstSimdRegLdStSz_256, 9502 kIemNativeGstRegUse_ForFullWrite); 9465 9503 9466 9504 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); … … 9488 9526 9489 9527 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9490 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9528 kIemNativeGstSimdRegLdStSz_256, 9529 kIemNativeGstRegUse_ForFullWrite); 9491 9530 9492 9531 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); … … 9514 9553 9515 9554 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9516 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9555 kIemNativeGstSimdRegLdStSz_256, 9556 kIemNativeGstRegUse_ForFullWrite); 9517 9557 9518 9558 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); … … 9540 9580 9541 9581 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYReg), 9542 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9582 kIemNativeGstSimdRegLdStSz_256, 9583 kIemNativeGstRegUse_ForFullWrite); 9543 9584 9544 9585 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); … … 9564 9605 9565 9606 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYReg), 9566 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9607 kIemNativeGstSimdRegLdStSz_256, 9608 kIemNativeGstRegUse_ForFullWrite); 9567 9609 9568 9610 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); … … 9588 9630 9589 9631 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYReg), 9590 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9632 kIemNativeGstSimdRegLdStSz_256, 9633 kIemNativeGstRegUse_ForFullWrite); 9591 9634 9592 9635 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); … … 9613 9656 9614 9657 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYReg), 9615 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9658 kIemNativeGstSimdRegLdStSz_256, 9659 kIemNativeGstRegUse_ForFullWrite); 9616 9660 9617 9661 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); … … 9638 9682 9639 9683 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYReg), 9640 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9684 kIemNativeGstSimdRegLdStSz_256, 9685 kIemNativeGstRegUse_ForFullWrite); 9641 9686 9642 9687 uint8_t const idxVarReg = iemNativeVarSimdRegisterAcquire(pReNative, idxSrcVar, &off); … … 9663 9708 9664 9709 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYReg), 9665 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9710 kIemNativeGstSimdRegLdStSz_256, 9711 kIemNativeGstRegUse_ForFullWrite); 9666 9712 9667 9713 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); … … 9689 9735 9690 9736 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYReg), 9691 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9737 kIemNativeGstSimdRegLdStSz_256, 9738 kIemNativeGstRegUse_ForFullWrite); 9692 9739 9693 9740 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); … … 9715 9762 9716 9763 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYRegDst), 9717 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9764 kIemNativeGstSimdRegLdStSz_256, 9765 kIemNativeGstRegUse_ForFullWrite); 9718 9766 uint8_t const idxSimdRegSrcHx = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYRegSrcHx), 9719 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ReadOnly); 9767 kIemNativeGstSimdRegLdStSz_Low128, 9768 kIemNativeGstRegUse_ReadOnly); 9720 9769 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); 9721 9770 … … 9744 9793 9745 9794 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYRegDst), 9746 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9795 kIemNativeGstSimdRegLdStSz_256, 9796 kIemNativeGstRegUse_ForFullWrite); 9747 9797 uint8_t const idxSimdRegSrcHx = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYRegSrcHx), 9748 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ReadOnly); 9798 kIemNativeGstSimdRegLdStSz_Low128, 9799 kIemNativeGstRegUse_ReadOnly); 9749 9800 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxSrcVar, &off); 9750 9801 … … 9771 9822 { 9772 9823 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iXReg), 9773 kIemNativeGstSimdRegLdStSz_Low128, kIemNativeGstRegUse_ForUpdate); 9824 kIemNativeGstSimdRegLdStSz_Low128, 9825 kIemNativeGstRegUse_ForUpdate); 9774 9826 9775 9827 /** @todo r=aeichner For certain bit combinations we could reduce the number of emitted instructions. */ … … 9804 9856 9805 9857 uint8_t const idxSimdRegSrc = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYRegSrc), 9806 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ReadOnly); 9858 kIemNativeGstSimdRegLdStSz_256, 9859 kIemNativeGstRegUse_ReadOnly); 9807 9860 uint8_t const idxVarReg = iemNativeVarSimdRegisterAcquire(pReNative, idxDstVar, &off); 9808 9861 … … 9831 9884 9832 9885 uint8_t const idxSimdRegDst = iemNativeSimdRegAllocTmpForGuestSimdReg(pReNative, &off, IEMNATIVEGSTSIMDREG_SIMD(iYRegDst), 9833 kIemNativeGstSimdRegLdStSz_256, kIemNativeGstRegUse_ForFullWrite); 9886 kIemNativeGstSimdRegLdStSz_256, 9887 kIemNativeGstRegUse_ForFullWrite); 9834 9888 uint8_t const idxVarRegSrc = iemNativeVarSimdRegisterAcquire(pReNative, idxSrcVar, &off, true /*fInitalized*/); 9835 9889 … … 9974 10028 * Do all the call setup and cleanup. 9975 10029 */ 9976 off = iemNativeEmitCallCommon(pReNative, off, cArgs + IEM_SSE_AIMPL_HIDDEN_ARGS, IEM_SSE_AIMPL_HIDDEN_ARGS, false /*fFlushPendingWrites*/); 10030 off = iemNativeEmitCallCommon(pReNative, off, cArgs + IEM_SSE_AIMPL_HIDDEN_ARGS, IEM_SSE_AIMPL_HIDDEN_ARGS, 10031 false /*fFlushPendingWrites*/); 9977 10032 9978 10033 /* … … 10020 10075 /** Emits code for IEM_MC_CALL_SSE_AIMPL_3. */ 10021 10076 DECL_INLINE_THROW(uint32_t) 10022 iemNativeEmitCallSseAImpl3(PIEMRECOMPILERSTATE pReNative, uint32_t off, uintptr_t pfnAImpl, uint8_t idxArg0, uint8_t idxArg1, uint8_t idxArg2) 10077 iemNativeEmitCallSseAImpl3(PIEMRECOMPILERSTATE pReNative, uint32_t off, uintptr_t pfnAImpl, 10078 uint8_t idxArg0, uint8_t idxArg1, uint8_t idxArg2) 10023 10079 { 10024 10080 IEMNATIVE_ASSERT_ARG_VAR_IDX(pReNative, idxArg0, 0 + IEM_SSE_AIMPL_HIDDEN_ARGS); … … 10051 10107 /** Emits code for IEM_MC_CALL_AVX_AIMPL_3. */ 10052 10108 DECL_INLINE_THROW(uint32_t) 10053 iemNativeEmitCallAvxAImpl3(PIEMRECOMPILERSTATE pReNative, uint32_t off, uintptr_t pfnAImpl, uint8_t idxArg0, uint8_t idxArg1, uint8_t idxArg2) 10109 iemNativeEmitCallAvxAImpl3(PIEMRECOMPILERSTATE pReNative, uint32_t off, uintptr_t pfnAImpl, 10110 uint8_t idxArg0, uint8_t idxArg1, uint8_t idxArg2) 10054 10111 { 10055 10112 IEMNATIVE_ASSERT_ARG_VAR_IDX(pReNative, idxArg0, 0 + IEM_AVX_AIMPL_HIDDEN_ARGS); … … 10058 10115 return iemNativeEmitCallSseAvxAImplCommon(pReNative, off, pfnAImpl, 3); 10059 10116 } 10117 10118 10060 10119 #endif /* IEMNATIVE_WITH_SIMD_REG_ALLOCATOR */ 10061 10120 -
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
r105261 r105271 2514 2514 */ 2515 2515 DECL_HIDDEN_THROW(void) 2516 iemNativeAddTbExitFixup(PIEMRECOMPILERSTATE pReNative, uint32_t offWhere, IEMNATIVEEXITREASON enmExitReason) 2517 { 2516 iemNativeAddTbExitFixup(PIEMRECOMPILERSTATE pReNative, uint32_t offWhere, IEMNATIVELABELTYPE enmExitReason) 2517 { 2518 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 2519 2518 2520 /* 2519 2521 * Make sure we've room. … … 2540 2542 */ 2541 2543 paTbExitFixups[cTbExitFixups].off = offWhere; 2542 paTbExitFixups[cTbExitFixups].enmExitReason = (uint32_t)enmExitReason;2544 paTbExitFixups[cTbExitFixups].enmExitReason = enmExitReason; 2543 2545 pReNative->cTbExitFixups = cTbExitFixups + 1; 2544 2546 } … … 6236 6238 6237 6239 /* Jump to non-zero status return path. */ 6238 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNative ExitReason_NonZeroRetOrPassUp);6240 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeLabelType_NonZeroRetOrPassUp); 6239 6241 6240 6242 /* done. */ … … 6254 6256 6255 6257 off = iemNativeEmitTestIfGprIsNotZeroAndTbExitEx(pReNative, pu32CodeBuf, off, ARMV8_A64_REG_X4, true /*f64Bit*/, 6256 kIemNative ExitReason_NonZeroRetOrPassUp);6258 kIemNativeLabelType_NonZeroRetOrPassUp); 6257 6259 6258 6260 #else … … 6302 6304 off = iemNativeEmitAddGpr32Imm(pReNative, off, iTmpReg, (int32_t)0x8000); 6303 6305 off = iemNativeEmitShiftGprRight(pReNative, off, iTmpReg, 16); 6304 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNative ExitReason_RaiseGp0);6306 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeLabelType_RaiseGp0); 6305 6307 6306 6308 iemNativeRegFreeTmp(pReNative, iTmpReg); … … 6321 6323 off = iemNativeEmitAddTwoGprs(pReNative, off, iTmpReg, idxAddrReg); 6322 6324 off = iemNativeEmitCmpArm64(pReNative, off, ARMV8_A64_REG_XZR, iTmpReg, true /*f64Bit*/, 48 /*cShift*/, kArmv8A64InstrShift_Lsr); 6323 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNative ExitReason_RaiseGp0);6325 off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeLabelType_RaiseGp0); 6324 6326 6325 6327 iemNativeRegFreeTmp(pReNative, iTmpReg); … … 6364 6366 6365 6367 off = iemNativeEmitCmpGpr32WithGpr(pReNative, off, idxAddrReg, idxRegCsLim); 6366 off = iemNativeEmitJaTbExit(pReNative, off, kIemNative ExitReason_RaiseGp0);6368 off = iemNativeEmitJaTbExit(pReNative, off, kIemNativeLabelType_RaiseGp0); 6367 6369 6368 6370 iemNativeRegFreeTmp(pReNative, idxRegCsLim); … … 9660 9662 # error "port me" 9661 9663 # endif 9662 uint32_t aoffLabels[kIemNative ExitReason_Max] = {0};9664 uint32_t aoffLabels[kIemNativeLabelType_LastTbExit + 1] = {0}; 9663 9665 int rc = VINF_SUCCESS; 9664 9666 uint32_t off = 0; … … 9669 9671 * Emit the epilog code. 9670 9672 */ 9671 aoffLabels[kIemNative ExitReason_Return] = off;9673 aoffLabels[kIemNativeLabelType_Return] = off; 9672 9674 off = iemNativeEmitCoreEpilog(pReNative, off); 9673 9675 … … 9677 9679 static struct 9678 9680 { 9679 IEMNATIVE EXITREASONenmExitReason;9680 uint32_t (*pfnEmitCore)(PIEMRECOMPILERSTATE pReNative, uint32_t off);9681 IEMNATIVELABELTYPE enmExitReason; 9682 uint32_t (*pfnEmitCore)(PIEMRECOMPILERSTATE pReNative, uint32_t off); 9681 9683 } const s_aSpecialWithEpilogs[] = 9682 9684 { 9683 { kIemNative ExitReason_NonZeroRetOrPassUp,iemNativeEmitCoreRcFiddling },9684 { kIemNative ExitReason_ReturnBreak,iemNativeEmitCoreReturnBreak },9685 { kIemNative ExitReason_ReturnBreakFF,iemNativeEmitCoreReturnBreakFF },9686 { kIemNative ExitReason_ReturnWithFlags,iemNativeEmitCoreReturnWithFlags },9685 { kIemNativeLabelType_NonZeroRetOrPassUp, iemNativeEmitCoreRcFiddling }, 9686 { kIemNativeLabelType_ReturnBreak, iemNativeEmitCoreReturnBreak }, 9687 { kIemNativeLabelType_ReturnBreakFF, iemNativeEmitCoreReturnBreakFF }, 9688 { kIemNativeLabelType_ReturnWithFlags, iemNativeEmitCoreReturnWithFlags }, 9687 9689 }; 9688 9690 for (uint32_t i = 0; i < RT_ELEMENTS(s_aSpecialWithEpilogs); i++) … … 9700 9702 static struct 9701 9703 { 9702 IEMNATIVE EXITREASONenmExitReason;9704 IEMNATIVELABELTYPE enmExitReason; 9703 9705 uintptr_t pfnHelper; 9704 9706 } const s_aViaLookup[] = 9705 9707 { 9706 { kIemNative ExitReason_ReturnBreakViaLookup,9708 { kIemNativeLabelType_ReturnBreakViaLookup, 9707 9709 (uintptr_t)iemNativeHlpReturnBreakViaLookup<false /*a_fWithIrqCheck*/> }, 9708 { kIemNative ExitReason_ReturnBreakViaLookupWithIrq,9710 { kIemNativeLabelType_ReturnBreakViaLookupWithIrq, 9709 9711 (uintptr_t)iemNativeHlpReturnBreakViaLookup<true /*a_fWithIrqCheck*/> }, 9710 { kIemNative ExitReason_ReturnBreakViaLookupWithTlb,9712 { kIemNativeLabelType_ReturnBreakViaLookupWithTlb, 9711 9713 (uintptr_t)iemNativeHlpReturnBreakViaLookupWithTlb<false /*a_fWithIrqCheck*/> }, 9712 { kIemNative ExitReason_ReturnBreakViaLookupWithTlbAndIrq,9714 { kIemNativeLabelType_ReturnBreakViaLookupWithTlbAndIrq, 9713 9715 (uintptr_t)iemNativeHlpReturnBreakViaLookupWithTlb<true /*a_fWithIrqCheck*/> }, 9714 9716 }; 9715 uint32_t const offReturnBreak = aoffLabels[kIemNative ExitReason_ReturnBreak]; Assert(offReturnBreak != 0);9717 uint32_t const offReturnBreak = aoffLabels[kIemNativeLabelType_ReturnBreak]; Assert(offReturnBreak != 0); 9716 9718 for (uint32_t i = 0; i < RT_ELEMENTS(s_aViaLookup); i++) 9717 9719 { … … 9729 9731 static struct 9730 9732 { 9731 IEMNATIVE EXITREASONenmExitReason;9733 IEMNATIVELABELTYPE enmExitReason; 9732 9734 bool fWithEpilog; 9733 9735 PFNIEMNATIVESIMPLETAILLABELCALL pfnCallback; 9734 9736 } const s_aSimpleTailLabels[] = 9735 9737 { 9736 { kIemNative ExitReason_RaiseDe,false, iemNativeHlpExecRaiseDe },9737 { kIemNative ExitReason_RaiseUd,false, iemNativeHlpExecRaiseUd },9738 { kIemNative ExitReason_RaiseSseRelated,false, iemNativeHlpExecRaiseSseRelated },9739 { kIemNative ExitReason_RaiseAvxRelated,false, iemNativeHlpExecRaiseAvxRelated },9740 { kIemNative ExitReason_RaiseSseAvxFpRelated,false, iemNativeHlpExecRaiseSseAvxFpRelated },9741 { kIemNative ExitReason_RaiseNm,false, iemNativeHlpExecRaiseNm },9742 { kIemNative ExitReason_RaiseGp0,false, iemNativeHlpExecRaiseGp0 },9743 { kIemNative ExitReason_RaiseMf,false, iemNativeHlpExecRaiseMf },9744 { kIemNative ExitReason_RaiseXf,false, iemNativeHlpExecRaiseXf },9745 { kIemNative ExitReason_ObsoleteTb,true, iemNativeHlpObsoleteTb },9746 { kIemNative ExitReason_NeedCsLimChecking,true, iemNativeHlpNeedCsLimChecking },9747 { kIemNative ExitReason_CheckBranchMiss,true, iemNativeHlpCheckBranchMiss },9738 { kIemNativeLabelType_RaiseDe, false, iemNativeHlpExecRaiseDe }, 9739 { kIemNativeLabelType_RaiseUd, false, iemNativeHlpExecRaiseUd }, 9740 { kIemNativeLabelType_RaiseSseRelated, false, iemNativeHlpExecRaiseSseRelated }, 9741 { kIemNativeLabelType_RaiseAvxRelated, false, iemNativeHlpExecRaiseAvxRelated }, 9742 { kIemNativeLabelType_RaiseSseAvxFpRelated, false, iemNativeHlpExecRaiseSseAvxFpRelated }, 9743 { kIemNativeLabelType_RaiseNm, false, iemNativeHlpExecRaiseNm }, 9744 { kIemNativeLabelType_RaiseGp0, false, iemNativeHlpExecRaiseGp0 }, 9745 { kIemNativeLabelType_RaiseMf, false, iemNativeHlpExecRaiseMf }, 9746 { kIemNativeLabelType_RaiseXf, false, iemNativeHlpExecRaiseXf }, 9747 { kIemNativeLabelType_ObsoleteTb, true, iemNativeHlpObsoleteTb }, 9748 { kIemNativeLabelType_NeedCsLimChecking, true, iemNativeHlpNeedCsLimChecking }, 9749 { kIemNativeLabelType_CheckBranchMiss, true, iemNativeHlpCheckBranchMiss }, 9748 9750 }; 9749 9751 for (uint32_t i = 0; i < RT_ELEMENTS(s_aSimpleTailLabels); i++) … … 9759 9761 /* jump back to the return sequence / generate a return sequence. */ 9760 9762 if (!s_aSimpleTailLabels[i].fWithEpilog) 9761 off = iemNativeEmitJmpToFixed(pReNative, off, aoffLabels[kIemNative ExitReason_Return]);9763 off = iemNativeEmitJmpToFixed(pReNative, off, aoffLabels[kIemNativeLabelType_Return]); 9762 9764 else 9763 9765 off = iemNativeEmitCoreEpilog(pReNative, off); … … 9767 9769 # ifdef VBOX_STRICT 9768 9770 /* Make sure we've generate code for all labels. */ 9769 for (uint32_t i = kIemNative ExitReason_Invalid + 1; i < RT_ELEMENTS(aoffLabels); i++)9770 Assert(aoffLabels[i] != 0 || i == kIemNative ExitReason_Return);9771 for (uint32_t i = kIemNativeLabelType_Invalid + 1; i < RT_ELEMENTS(aoffLabels); i++) 9772 Assert(aoffLabels[i] != 0 || i == kIemNativeLabelType_Return); 9771 9773 #endif 9772 9774 } … … 9802 9804 * Initialize the context. 9803 9805 */ 9804 AssertCompile(kIemNative ExitReason_Invalid == 0);9806 AssertCompile(kIemNativeLabelType_Invalid == 0); 9805 9807 AssertCompile(RT_ELEMENTS(pCtx->apExitLabels) == RT_ELEMENTS(aoffLabels)); 9806 pCtx->apExitLabels[kIemNative ExitReason_Invalid] = 0;9807 for (uint32_t i = kIemNative ExitReason_Invalid + 1; i < RT_ELEMENTS(pCtx->apExitLabels); i++)9808 { 9809 Assert(aoffLabels[i] != 0 || i == kIemNative ExitReason_Return);9808 pCtx->apExitLabels[kIemNativeLabelType_Invalid] = 0; 9809 for (uint32_t i = kIemNativeLabelType_Invalid + 1; i < RT_ELEMENTS(pCtx->apExitLabels); i++) 9810 { 9811 Assert(aoffLabels[i] != 0 || i == kIemNativeLabelType_Return); 9810 9812 pCtx->apExitLabels[i] = &paFinalCommonCodeRx[aoffLabels[i]]; 9811 9813 Log10((" apExitLabels[%u]=%p %s\n", i, pCtx->apExitLabels[i], iemNativeGetLabelName((IEMNATIVELABELTYPE)i, true))); … … 10068 10070 */ 10069 10071 //off = iemNativeEmitBrk(pReNative, off, 0x1227); 10070 off = iemNativeEmitTbExit(pReNative, off, kIemNative ExitReason_Return);10072 off = iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_Return); 10071 10073 #endif 10072 10074 … … 10172 10174 AssertContinue(idxLabel != UINT32_MAX); 10173 10175 iemNativeLabelDefine(pReNative, idxLabel, off); 10174 off = iemNativeEmitTbExit(pReNative, off, (IEMNATIVEEXITREASON)enmLabel);10176 off = iemNativeEmitTbExit(pReNative, off, enmLabel); 10175 10177 } while (fTailLabels); 10176 10178 } … … 10292 10294 { 10293 10295 Assert(paTbExitFixups[i].off < off); 10294 Assert( paTbExitFixups[i].enmExitReason < kIemNativeExitReason_Max 10295 && paTbExitFixups[i].enmExitReason > kIemNativeExitReason_Invalid); 10296 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(paTbExitFixups[i].enmExitReason)); 10296 10297 RTPTRUNION const Ptr = { &paFinalInstrBuf[paTbExitFixups[i].off] }; 10297 10298 -
trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
r105261 r105271 450 450 451 451 452 /** TB exit reasons. */453 typedef enum454 {455 kIemNativeExitReason_Invalid = 0,456 kIemNativeExitReason_RaiseDe, /**< Raise (throw) X86_XCPT_DE (00h). */457 kIemNativeExitReason_RaiseUd, /**< Raise (throw) X86_XCPT_UD (06h). */458 kIemNativeExitReason_RaiseSseRelated, /**< Raise (throw) X86_XCPT_UD or X86_XCPT_NM according to cr0 & cr4. */459 kIemNativeExitReason_RaiseAvxRelated, /**< Raise (throw) X86_XCPT_UD or X86_XCPT_NM according to xcr0, cr0 & cr4. */460 kIemNativeExitReason_RaiseSseAvxFpRelated, /**< Raise (throw) X86_XCPT_UD or X86_XCPT_XF according to c4. */461 kIemNativeExitReason_RaiseNm, /**< Raise (throw) X86_XCPT_NM (07h). */462 kIemNativeExitReason_RaiseGp0, /**< Raise (throw) X86_XCPT_GP (0dh) w/ errcd=0. */463 kIemNativeExitReason_RaiseMf, /**< Raise (throw) X86_XCPT_MF (10h). */464 kIemNativeExitReason_RaiseXf, /**< Raise (throw) X86_XCPT_XF (13h). */465 kIemNativeExitReason_ObsoleteTb,466 kIemNativeExitReason_NeedCsLimChecking,467 kIemNativeExitReason_CheckBranchMiss,468 kIemNativeExitReason_ReturnBreak,469 kIemNativeExitReason_ReturnBreakFF,470 kIemNativeExitReason_ReturnBreakViaLookup,471 kIemNativeExitReason_ReturnBreakViaLookupWithIrq,472 kIemNativeExitReason_ReturnBreakViaLookupWithTlb,473 kIemNativeExitReason_ReturnBreakViaLookupWithTlbAndIrq,474 kIemNativeExitReason_ReturnWithFlags,475 kIemNativeExitReason_NonZeroRetOrPassUp,476 kIemNativeExitReason_Return, /**< This is a little bit special, but needs to be included here. */477 kIemNativeExitReason_Max478 } IEMNATIVEEXITREASON;479 480 481 452 /** Native code generator label types. */ 482 453 typedef enum … … 484 455 kIemNativeLabelType_Invalid = 0, 485 456 /* 486 * Labels w/o data, only once instance per TB .457 * Labels w/o data, only once instance per TB - aka exit reasons. 487 458 * 488 459 * Note! Jumps to these requires instructions that are capable of spanning … … 536 507 } IEMNATIVELABELTYPE; 537 508 538 /** Temporary kludge until all jumps to TB exit labels are converted to the new TB exiting style, 539 * see @bugref{10677}. 540 * @note update bird: This won't happen, unfortunately, since we'll keep using 541 * the local labels on arm64 so we can avoid inverting branch conditions 542 * and inserting extra of unconditional branches in order to reach the 543 * common code. Instead we'll have everyone jump to the same tail lable 544 * which then jumps to the common (per chunk) code. */ 545 #define IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(a_Reason) \ 546 ((int)kIemNativeLabelType_ ## a_Reason == (int)kIemNativeExitReason_ ## a_Reason) 547 AssertCompile( IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseDe) 548 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseUd) 549 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseSseRelated) 550 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseAvxRelated) 551 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseSseAvxFpRelated) 552 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseNm) 553 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseGp0) 554 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseMf) 555 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseXf) 556 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ObsoleteTb) 557 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(NeedCsLimChecking) 558 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(CheckBranchMiss) 559 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreak) 560 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreakFF) 561 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreakViaLookup) 562 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreakViaLookupWithIrq) 563 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreakViaLookupWithTlb) 564 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreakViaLookupWithTlbAndIrq) 565 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnWithFlags) 566 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(NonZeroRetOrPassUp) 567 && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(Return)); 568 AssertCompile((int)kIemNativeExitReason_Max == (int)kIemNativeLabelType_LastTbExit + 1); 509 #define IEMNATIVELABELTYPE_IS_EXIT_REASON(a_enmLabel) \ 510 ((a_enmLabel) <= kIemNativeLabelType_LastTbExit && (a_enmLabel) > kIemNativeLabelType_Invalid) 569 511 570 512 … … 623 565 { 624 566 /** Code offset of the fixup location. */ 625 uint32_t off;626 /** The exit reason (IEMNATIVEEXITREASON). */627 uint32_tenmExitReason;567 uint32_t off; 568 /** The exit reason. */ 569 IEMNATIVELABELTYPE enmExitReason; 628 570 } IEMNATIVEEXITFIXUP; 629 571 /** Pointer to a native code generator TB exit fixup. */ … … 636 578 { 637 579 /** Pointers to the exit labels */ 638 PIEMNATIVEINSTR apExitLabels[kIemNative ExitReason_Max];580 PIEMNATIVEINSTR apExitLabels[kIemNativeLabelType_LastTbExit + 1]; 639 581 } IEMNATIVEPERCHUNKCTX; 640 582 /** Pointer to per-chunk recompiler context. */ … … 1687 1629 IEMNATIVEFIXUPTYPE enmType, int8_t offAddend = 0); 1688 1630 #ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE 1689 DECL_HIDDEN_THROW(void) iemNativeAddTbExitFixup(PIEMRECOMPILERSTATE pReNative, uint32_t offWhere, IEMNATIVE EXITREASONenmExitReason);1631 DECL_HIDDEN_THROW(void) iemNativeAddTbExitFixup(PIEMRECOMPILERSTATE pReNative, uint32_t offWhere, IEMNATIVELABELTYPE enmExitReason); 1690 1632 #endif 1691 1633 DECL_HIDDEN_THROW(PIEMNATIVEINSTR) iemNativeInstrBufEnsureSlow(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t cInstrReq); -
trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h
r105261 r105271 8010 8010 DECL_FORCE_INLINE_THROW(uint32_t) 8011 8011 iemNativeEmitJccTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off, 8012 IEMNATIVEEXITREASON enmExitReason, IEMNATIVEINSTRCOND enmCond) 8013 { 8012 IEMNATIVELABELTYPE enmExitReason, IEMNATIVEINSTRCOND enmCond) 8013 { 8014 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8014 8015 #if defined(IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE) && defined(RT_ARCH_AMD64) 8015 8016 /* jcc rel32 */ … … 8025 8026 /* ARM64 doesn't have the necessary jump range, so we jump via local label 8026 8027 just like when we keep everything local. */ 8027 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, (IEMNATIVELABELTYPE)enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/);8028 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8028 8029 off = iemNativeEmitJccToLabelEx(pReNative, pCodeBuf, off, idxLabel, enmCond); 8029 8030 #endif … … 8036 8037 */ 8037 8038 DECL_INLINE_THROW(uint32_t) 8038 iemNativeEmitJccTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8039 IEMNATIVEEXITREASON enmExitReason, IEMNATIVEINSTRCOND enmCond) 8040 { 8039 iemNativeEmitJccTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, IEMNATIVELABELTYPE enmExitReason, IEMNATIVEINSTRCOND enmCond) 8040 { 8041 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8041 8042 #ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE 8042 8043 # ifdef RT_ARCH_AMD64 8043 PIEMNATIVEINSTR pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 6);8044 off = iemNativeEmitJccTbExitEx(pReNative, iemNativeInstrBufEnsure(pReNative, off, 6), off, enmExitReason, enmCond); 8044 8045 # elif defined(RT_ARCH_ARM64) 8045 PIEMNATIVEINSTR pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 2);8046 off = iemNativeEmitJccTbExitEx(pReNative, iemNativeInstrBufEnsure(pReNative, off, 2), off, enmExitReason, enmCond); 8046 8047 # else 8047 8048 # error "Port me!" 8048 8049 # endif 8049 return iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, enmExitReason, enmCond); 8050 #else 8051 return iemNativeEmitJccToNewLabel(pReNative, off, (IEMNATIVELABELTYPE)enmExitReason, 0 /*uData*/, enmCond); 8050 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 8051 return off; 8052 #else 8053 return iemNativeEmitJccToNewLabel(pReNative, off, enmExitReason, 0 /*uData*/, enmCond); 8052 8054 #endif 8053 8055 } … … 8057 8059 * Emits a JNZ/JNE rel32 / B.NE imm19 to the TB exit routine with the given reason. 8058 8060 */ 8059 DECL_INLINE_THROW(uint32_t) iemNativeEmitJnzTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8060 IEMNATIVEEXITREASON enmExitReason) 8061 DECL_INLINE_THROW(uint32_t) iemNativeEmitJnzTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, IEMNATIVELABELTYPE enmExitReason) 8061 8062 { 8062 8063 #ifdef RT_ARCH_AMD64 … … 8073 8074 * Emits a JZ/JE rel32 / B.EQ imm19 to the TB exit routine with the given reason. 8074 8075 */ 8075 DECL_INLINE_THROW(uint32_t) iemNativeEmitJzTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8076 IEMNATIVEEXITREASON enmExitReason) 8076 DECL_INLINE_THROW(uint32_t) iemNativeEmitJzTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, IEMNATIVELABELTYPE enmExitReason) 8077 8077 { 8078 8078 #ifdef RT_ARCH_AMD64 … … 8089 8089 * Emits a JA/JNBE rel32 / B.HI imm19 to the TB exit. 8090 8090 */ 8091 DECL_INLINE_THROW(uint32_t) iemNativeEmitJaTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8092 IEMNATIVEEXITREASON enmExitReason) 8091 DECL_INLINE_THROW(uint32_t) iemNativeEmitJaTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, IEMNATIVELABELTYPE enmExitReason) 8093 8092 { 8094 8093 #ifdef RT_ARCH_AMD64 … … 8105 8104 * Emits a JL/JNGE rel32 / B.LT imm19 to the TB exit with the given reason. 8106 8105 */ 8107 DECL_INLINE_THROW(uint32_t) iemNativeEmitJlTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8108 IEMNATIVEEXITREASON enmExitReason) 8106 DECL_INLINE_THROW(uint32_t) iemNativeEmitJlTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, IEMNATIVELABELTYPE enmExitReason) 8109 8107 { 8110 8108 #ifdef RT_ARCH_AMD64 … … 8119 8117 8120 8118 DECL_INLINE_THROW(uint32_t) 8121 iemNativeEmitTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off, IEMNATIVEEXITREASON enmExitReason) 8122 { 8119 iemNativeEmitTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off, IEMNATIVELABELTYPE enmExitReason) 8120 { 8121 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8123 8122 #ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE 8124 8123 # ifdef RT_ARCH_AMD64 … … 8141 8140 8142 8141 #else 8143 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, (IEMNATIVELABELTYPE)enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/);8142 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8144 8143 return iemNativeEmitJmpToLabelEx(pReNative, pCodeBuf, off, idxLabel); 8145 8144 #endif … … 8147 8146 8148 8147 8149 DECL_INLINE_THROW(uint32_t) 8150 iemNativeEmitTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, IEMNATIVEEXITREASON enmExitReason) 8151 { 8148 DECL_INLINE_THROW(uint32_t) iemNativeEmitTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, IEMNATIVELABELTYPE enmExitReason) 8149 { 8150 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8152 8151 #ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE 8153 8152 # ifdef RT_ARCH_AMD64 … … 8174 8173 8175 8174 #else 8176 return iemNativeEmitJmpToNewLabel(pReNative, off, (IEMNATIVELABELTYPE)enmExitReason);8175 return iemNativeEmitJmpToNewLabel(pReNative, off, enmExitReason); 8177 8176 #endif 8178 8177 } … … 8185 8184 DECL_INLINE_THROW(uint32_t) 8186 8185 iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8187 uint8_t iGprSrc, uint64_t fBits, IEMNATIVE EXITREASONenmExitReason)8186 uint8_t iGprSrc, uint64_t fBits, IEMNATIVELABELTYPE enmExitReason) 8188 8187 { 8189 8188 Assert(fBits); Assert(!RT_IS_POWER_OF_TWO(fBits)); … … 8200 8199 DECL_INLINE_THROW(uint32_t) 8201 8200 iemNativeEmitTestAnyBitsInGprAndTbExitIfNoneSet(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8202 uint8_t iGprSrc, uint64_t fBits, IEMNATIVE EXITREASONenmExitReason)8201 uint8_t iGprSrc, uint64_t fBits, IEMNATIVELABELTYPE enmExitReason) 8203 8202 { 8204 8203 Assert(fBits); Assert(!RT_IS_POWER_OF_TWO(fBits)); … … 8215 8214 DECL_INLINE_THROW(uint32_t) 8216 8215 iemNativeEmitTestIfGprNotEqualGprAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8217 uint8_t iGprLeft, uint8_t iGprRight, IEMNATIVE EXITREASONenmExitReason)8216 uint8_t iGprLeft, uint8_t iGprRight, IEMNATIVELABELTYPE enmExitReason) 8218 8217 { 8219 8218 off = iemNativeEmitCmpGprWithGpr(pReNative, off, iGprLeft, iGprRight); … … 8227 8226 * @a uImm. 8228 8227 */ 8229 DECL_INLINE_THROW(uint32_t) iemNativeEmitTestIfGpr32NotEqualImmAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8230 uint8_t iGprSrc, uint32_t uImm, IEMNATIVEEXITREASON enmExitReason) 8228 DECL_INLINE_THROW(uint32_t) 8229 iemNativeEmitTestIfGpr32NotEqualImmAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8230 uint8_t iGprSrc, uint32_t uImm, IEMNATIVELABELTYPE enmExitReason) 8231 8231 { 8232 8232 off = iemNativeEmitCmpGpr32WithImm(pReNative, off, iGprSrc, uImm); … … 8241 8241 DECL_INLINE_THROW(uint32_t) 8242 8242 iemNativeEmitTestIfGprNotEqualImmAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8243 uint8_t iGprSrc, uint64_t uImm, IEMNATIVE EXITREASONenmExitReason)8243 uint8_t iGprSrc, uint64_t uImm, IEMNATIVELABELTYPE enmExitReason) 8244 8244 { 8245 8245 off = iemNativeEmitCmpGprWithImm(pReNative, off, iGprSrc, uImm); … … 8254 8254 DECL_INLINE_THROW(uint32_t) 8255 8255 iemNativeEmitTestIfGpr32EqualsImmAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8256 uint8_t iGprSrc, uint32_t uImm, IEMNATIVE EXITREASONenmExitReason)8256 uint8_t iGprSrc, uint32_t uImm, IEMNATIVELABELTYPE enmExitReason) 8257 8257 { 8258 8258 off = iemNativeEmitCmpGpr32WithImm(pReNative, off, iGprSrc, uImm); … … 8270 8270 DECL_INLINE_THROW(uint32_t) 8271 8271 iemNativeEmitTestBitInGprAndTbExitIfSet(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8272 uint8_t iGprSrc, uint8_t iBitNo, IEMNATIVEEXITREASON enmExitReason) 8273 { 8272 uint8_t iGprSrc, uint8_t iBitNo, IEMNATIVELABELTYPE enmExitReason) 8273 { 8274 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8274 8275 #if defined(IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE) && defined(RT_ARCH_AMD64) 8275 8276 Assert(iBitNo < 64); … … 8304 8305 /* ARM64 doesn't have the necessary jump range, so we jump via local label 8305 8306 just like when we keep everything local. */ 8306 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, (IEMNATIVELABELTYPE)enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/);8307 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8307 8308 return iemNativeEmitTestBitInGprAndJmpToLabelIfCc(pReNative, off, iGprSrc, iBitNo, idxLabel, true /*fJmpIfSet*/); 8308 8309 #endif … … 8317 8318 DECL_FORCE_INLINE_THROW(uint32_t) 8318 8319 iemNativeEmitTestIfGprIsNotZeroAndTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off, 8319 uint8_t iGprSrc, bool f64Bit, IEMNATIVEEXITREASON enmExitReason) 8320 { 8320 uint8_t iGprSrc, bool f64Bit, IEMNATIVELABELTYPE enmExitReason) 8321 { 8322 Assert(IEMNATIVELABELTYPE_IS_EXIT_REASON(enmExitReason)); 8321 8323 #if defined(IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE) && defined(RT_ARCH_AMD64) 8322 8324 /* test reg32,reg32 / test reg64,reg64 */ … … 8334 8336 /* ARM64 doesn't have the necessary jump range, so we jump via local label 8335 8337 just like when we keep everything local. */ 8336 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, (IEMNATIVELABELTYPE)enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/);8338 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8337 8339 return iemNativeEmitTestIfGprIsZeroOrNotZeroAndJmpToLabelEx(pReNative, pCodeBuf, off, iGprSrc, 8338 8340 f64Bit, true /*fJmpIfNotZero*/, idxLabel); … … 8346 8348 * The operand size is given by @a f64Bit. 8347 8349 */ 8348 DECL_INLINE_THROW(uint32_t) iemNativeEmitTestIfGprIsNotZeroAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8349 uint8_t iGprSrc, bool f64Bit, IEMNATIVEEXITREASON enmExitReason) 8350 DECL_INLINE_THROW(uint32_t) 8351 iemNativeEmitTestIfGprIsNotZeroAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, 8352 uint8_t iGprSrc, bool f64Bit, IEMNATIVELABELTYPE enmExitReason) 8350 8353 { 8351 8354 #if defined(IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE) && defined(RT_ARCH_AMD64) … … 8355 8358 return off; 8356 8359 #else 8357 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, (IEMNATIVELABELTYPE)enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/);8360 uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/); 8358 8361 return iemNativeEmitTestIfGprIsZeroOrNotZeroAndJmpToLabel(pReNative, off, iGprSrc, f64Bit, true /*fJmpIfNotZero*/, idxLabel); 8359 8362 #endif
Note:
See TracChangeset
for help on using the changeset viewer.