Changeset 103592 in vbox
- Timestamp:
- Feb 27, 2024 5:19:48 PM (9 months ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r103588 r103592 4216 4216 return iemRaiseXcptOrInt(pVCpu, 0, X86_XCPT_UD, IEM_XCPT_FLAGS_T_CPU_XCPT, 0, 0); 4217 4217 } 4218 4219 4220 #ifdef IEM_WITH_SETJMP 4221 /** \#UD - 06. */ 4222 DECL_NO_RETURN(void) iemRaiseUndefinedOpcodeJmp(PVMCPUCC pVCpu) IEM_NOEXCEPT_MAY_LONGJMP 4223 { 4224 iemRaiseXcptOrIntJmp(pVCpu, 0, X86_XCPT_UD, IEM_XCPT_FLAGS_T_CPU_XCPT, 0, 0); 4225 } 4226 #endif 4218 4227 4219 4228 -
trunk/src/VBox/VMM/VMMAll/IEMAllInstPython.py
r103590 r103592 3111 3111 'IEM_MC_MAYBE_RAISE_NON_CANONICAL_ADDR_GP0': (McBlock.parseMcGeneric, True, True, False, ), 3112 3112 'IEM_MC_MAYBE_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT': (McBlock.parseMcGeneric, True, True, False, ), 3113 'IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT': (McBlock.parseMcGeneric, True, True, False,),3113 'IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT': (McBlock.parseMcGeneric, True, True, True, ), 3114 3114 'IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE': (McBlock.parseMcGeneric, True, True, False, ), 3115 3115 'IEM_MC_MEM_COMMIT_AND_UNMAP_ATOMIC': (McBlock.parseMcGeneric, True, True, True, ), -
trunk/src/VBox/VMM/VMMAll/IEMAllInstTwoByte0f.cpp.h
r103590 r103592 3389 3389 iemCImpl_mov_Cd_Rd, iCrReg, IEM_GET_MODRM_RM(pVCpu, bRm)); 3390 3390 else 3391 IEM_MC_DEFER_TO_CIMPL_2_RET(IEM_CIMPL_F_MODE | IEM_CIMPL_F_VMEXIT, RT_BIT_64(kIemNativeGstReg_Cr0) ,3391 IEM_MC_DEFER_TO_CIMPL_2_RET(IEM_CIMPL_F_MODE | IEM_CIMPL_F_VMEXIT, RT_BIT_64(kIemNativeGstReg_Cr0) | RT_BIT_64(kIemNativeGstReg_Cr4), 3392 3392 iemCImpl_mov_Cd_Rd, iCrReg, IEM_GET_MODRM_RM(pVCpu, bRm)); 3393 3393 } -
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
r103591 r103592 1610 1610 1611 1611 /** 1612 * Used by TB code when it wants to raise a \#UD. 1613 */ 1614 IEM_DECL_NATIVE_HLP_DEF(int, iemNativeHlpExecRaiseUd,(PVMCPUCC pVCpu)) 1615 { 1616 iemRaiseUndefinedOpcodeJmp(pVCpu); 1617 #ifndef _MSC_VER 1618 return VINF_IEM_RAISED_XCPT; /* not reached */ 1619 #endif 1620 } 1621 1622 1623 /** 1612 1624 * Used by TB code when detecting opcode changes. 1613 1625 * @see iemThreadeFuncWorkerObsoleteTb … … 2918 2930 pReNative->Core.u64ArgVars = UINT64_MAX; 2919 2931 2920 AssertCompile(RT_ELEMENTS(pReNative->aidxUniqueLabels) == 1 0);2932 AssertCompile(RT_ELEMENTS(pReNative->aidxUniqueLabels) == 11); 2921 2933 pReNative->aidxUniqueLabels[0] = UINT32_MAX; 2922 2934 pReNative->aidxUniqueLabels[1] = UINT32_MAX; … … 2929 2941 pReNative->aidxUniqueLabels[8] = UINT32_MAX; 2930 2942 pReNative->aidxUniqueLabels[9] = UINT32_MAX; 2943 pReNative->aidxUniqueLabels[10] = UINT32_MAX; 2931 2944 2932 2945 /* Full host register reinit: */ … … 3525 3538 /* [kIemNativeGstReg_SegSelFirst + 4] = */ { CPUMCTX_OFF_AND_SIZE(aSRegs[4].Sel), "fs", }, 3526 3539 /* [kIemNativeGstReg_SegSelFirst + 5] = */ { CPUMCTX_OFF_AND_SIZE(aSRegs[5].Sel), "gs", }, 3540 /* [kIemNativeGstReg_Cr4] = */ { CPUMCTX_OFF_AND_SIZE(cr4), "cr4", }, 3527 3541 /* [kIemNativeGstReg_EFlags] = */ { CPUMCTX_OFF_AND_SIZE(eflags), "eflags", }, 3528 3542 #undef CPUMCTX_OFF_AND_SIZE … … 5802 5816 5803 5817 /** 5818 * Emits the code at the RaiseUd label. 5819 */ 5820 static uint32_t iemNativeEmitRaiseUd(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t idxReturnLabel) 5821 { 5822 uint32_t const idxLabel = iemNativeLabelFind(pReNative, kIemNativeLabelType_RaiseNm); 5823 if (idxLabel != UINT32_MAX) 5824 { 5825 iemNativeLabelDefine(pReNative, idxLabel, off); 5826 5827 /* iemNativeHlpExecRaiseUd(PVMCPUCC pVCpu) */ 5828 off = iemNativeEmitLoadGprFromGpr(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, IEMNATIVE_REG_FIXED_PVMCPU); 5829 off = iemNativeEmitCallImm(pReNative, off, (uintptr_t)iemNativeHlpExecRaiseUd); 5830 5831 /* jump back to the return sequence. */ 5832 off = iemNativeEmitJmpToLabel(pReNative, off, idxReturnLabel); 5833 } 5834 return off; 5835 } 5836 5837 5838 /** 5804 5839 * Emits the code at the ReturnWithFlags label (returns 5805 5840 * VINF_IEM_REEXEC_FINISH_WITH_FLAGS). … … 6663 6698 /* Free but don't flush the CR0 register. */ 6664 6699 iemNativeRegFreeTmp(pReNative, idxCr0Reg); 6700 6701 return off; 6702 } 6703 6704 6705 #define IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT() \ 6706 off = iemNativeEmitMaybeRaiseSseRelatedXcpt(pReNative, off, pCallEntry->idxInstr) 6707 6708 /** 6709 * Emits code to check if a SSE exception (either \#UD or \#NM) should be raised. 6710 * 6711 * @returns New code buffer offset, UINT32_MAX on failure. 6712 * @param pReNative The native recompile state. 6713 * @param off The code buffer offset. 6714 * @param idxInstr The current instruction. 6715 */ 6716 DECL_INLINE_THROW(uint32_t) 6717 iemNativeEmitMaybeRaiseSseRelatedXcpt(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t idxInstr) 6718 { 6719 /* 6720 * Make sure we don't have any outstanding guest register writes as we may 6721 * raise an \#UD or \#NM and all guest register must be up to date in CPUMCTX. 6722 * 6723 * @todo r=aeichner Can we postpone this to the RaiseNm/RaiseUd path? 6724 */ 6725 off = iemNativeRegFlushPendingWrites(pReNative, off); 6726 6727 #ifdef IEMNATIVE_WITH_INSTRUCTION_COUNTING 6728 off = iemNativeEmitStoreImmToVCpuU8(pReNative, off, idxInstr, RT_UOFFSETOF(VMCPUCC, iem.s.idxTbCurInstr)); 6729 #else 6730 RT_NOREF(idxInstr); 6731 #endif 6732 6733 /* Allocate a temporary CR0 and CR4 register. */ 6734 uint8_t const idxCr0Reg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr0, kIemNativeGstRegUse_ReadOnly); 6735 uint8_t const idxCr4Reg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr4, kIemNativeGstRegUse_ReadOnly); 6736 uint8_t const idxLabelRaiseNm = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseNm); 6737 uint8_t const idxLabelRaiseUd = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseUd); 6738 6739 /** @todo r=aeichner Optimize this more later to have less compares and branches, 6740 * (see IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT() in IEMMc.h but check that it has some 6741 * actual performance benefit first). */ 6742 /* 6743 * if (cr0 & X86_CR0_EM) 6744 * return raisexcpt(); 6745 */ 6746 off = iemNativeEmitTestAnyBitsInGprAndJmpToLabelIfAnySet(pReNative, off, idxCr0Reg, X86_CR0_EM, idxLabelRaiseUd); 6747 /* 6748 * if (!(cr4 & X86_CR4_OSFXSR)) 6749 * return raisexcpt(); 6750 */ 6751 off = iemNativeEmitTestAnyBitsInGprAndJmpToLabelIfNoneSet(pReNative, off, idxCr4Reg, X86_CR4_OSFXSR, idxLabelRaiseUd); 6752 /* 6753 * if (cr0 & X86_CR0_TS) 6754 * return raisexcpt(); 6755 */ 6756 off = iemNativeEmitTestAnyBitsInGprAndJmpToLabelIfAnySet(pReNative, off, idxCr0Reg, X86_CR0_TS, idxLabelRaiseNm); 6757 6758 /* Free but don't flush the CR0 and CR4 register. */ 6759 iemNativeRegFreeTmp(pReNative, idxCr0Reg); 6760 iemNativeRegFreeTmp(pReNative, idxCr4Reg); 6665 6761 6666 6762 return off; … … 13777 13873 pszName = "RaiseNm"; 13778 13874 break; 13875 case kIemNativeLabelType_RaiseUd: 13876 pszName = "RaiseUd"; 13877 break; 13779 13878 case kIemNativeLabelType_ObsoleteTb: 13780 13879 pszName = "ObsoleteTb"; … … 14326 14425 if (pReNative->bmLabelTypes & RT_BIT_64(kIemNativeLabelType_RaiseNm)) 14327 14426 off = iemNativeEmitRaiseNm(pReNative, off, idxReturnLabel); 14427 if (pReNative->bmLabelTypes & RT_BIT_64(kIemNativeLabelType_RaiseUd)) 14428 off = iemNativeEmitRaiseUd(pReNative, off, idxReturnLabel); 14328 14429 if (pReNative->bmLabelTypes & RT_BIT_64(kIemNativeLabelType_ObsoleteTb)) 14329 14430 off = iemNativeEmitObsoleteTb(pReNative, off, idxReturnLabel); -
trunk/src/VBox/VMM/include/IEMInternal.h
r103588 r103592 5147 5147 VBOXSTRICTRC iemRaiseBoundRangeExceeded(PVMCPUCC pVCpu) RT_NOEXCEPT; 5148 5148 VBOXSTRICTRC iemRaiseUndefinedOpcode(PVMCPUCC pVCpu) RT_NOEXCEPT; 5149 #ifdef IEM_WITH_SETJMP 5150 DECL_NO_RETURN(void) iemRaiseUndefinedOpcodeJmp(PVMCPUCC pVCpu) IEM_NOEXCEPT_MAY_LONGJMP; 5151 #endif 5149 5152 VBOXSTRICTRC iemRaiseDeviceNotAvailable(PVMCPUCC pVCpu) RT_NOEXCEPT; 5150 5153 #ifdef IEM_WITH_SETJMP -
trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
r103590 r103592 320 320 kIemNativeLabelType_RaiseGp0, 321 321 kIemNativeLabelType_RaiseNm, 322 kIemNativeLabelType_RaiseUd, 322 323 kIemNativeLabelType_ObsoleteTb, 323 324 kIemNativeLabelType_NeedCsLimChecking, … … 698 699 kIemNativeGstReg_SegSelFirst, 699 700 kIemNativeGstReg_SegSelLast = kIemNativeGstReg_SegSelFirst + 5, 701 kIemNativeGstReg_Cr4, 700 702 kIemNativeGstReg_EFlags, /**< 32-bit, includes internal flags - last! */ 701 703 kIemNativeGstReg_End
Note:
See TracChangeset
for help on using the changeset viewer.