Changeset 99351 in vbox for trunk/src/VBox/VMM/include/IEMMc.h
- Timestamp:
- Apr 8, 2023 12:03:42 AM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/IEMMc.h
r99343 r99351 76 76 #define IEM_MC_MAYBE_RAISE_DEVICE_NOT_AVAILABLE() \ 77 77 do { \ 78 if (!(pVCpu->cpum.GstCtx.cr0 & (X86_CR0_EM | X86_CR0_TS))) { /* probable */ } \ 79 else return iemRaiseDeviceNotAvailable(pVCpu); \ 80 } while (0) 81 #define IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE() \ 82 do { \ 83 if (!((pVCpu->cpum.GstCtx.cr0 & (X86_CR0_MP | X86_CR0_TS)) == (X86_CR0_MP | X86_CR0_TS))) { /* probable */ } \ 84 else return iemRaiseDeviceNotAvailable(pVCpu); \ 85 } while (0) 86 #define IEM_MC_MAYBE_RAISE_FPU_XCPT() \ 87 do { \ 88 if (!(pVCpu->cpum.GstCtx.XState.x87.FSW & X86_FSW_ES)) { /* probable */ } \ 89 else return iemRaiseMathFault(pVCpu); \ 90 } while (0) 91 #define IEM_MC_MAYBE_RAISE_AVX_RELATED_XCPT() \ 92 do { \ 93 if ( (pVCpu->cpum.GstCtx.aXcr[0] & (XSAVE_C_YMM | XSAVE_C_SSE)) == (XSAVE_C_YMM | XSAVE_C_SSE) \ 94 && (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXSAVE)) { /* probable */ } \ 95 else return iemRaiseUndefinedOpcode(pVCpu); \ 96 \ 97 if (!(pVCpu->cpum.GstCtx.cr0 & X86_CR0_TS)) { /* probable */ } \ 98 else return iemRaiseDeviceNotAvailable(pVCpu); \ 99 } while (0) 100 #define IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT() \ 101 do { \ 102 if ( !(pVCpu->cpum.GstCtx.cr0 & X86_CR0_EM) \ 103 && (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSFXSR)) { /* probable */ } \ 104 else return iemRaiseUndefinedOpcode(pVCpu); \ 105 \ 106 if (!(pVCpu->cpum.GstCtx.cr0 & X86_CR0_TS)) { /* probable */ } \ 107 else return iemRaiseDeviceNotAvailable(pVCpu); \ 108 } while (0) 109 #define IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT() \ 110 do { \ 78 111 if (!(pVCpu->cpum.GstCtx.cr0 & (X86_CR0_EM | X86_CR0_TS))) \ 79 { } else return iemRaiseDeviceNotAvailable(pVCpu); \ 80 } while (0) 81 #define IEM_MC_MAYBE_RAISE_WAIT_DEVICE_NOT_AVAILABLE() \ 82 do { \ 83 if (!((pVCpu->cpum.GstCtx.cr0 & (X86_CR0_MP | X86_CR0_TS)) == (X86_CR0_MP | X86_CR0_TS))) \ 84 { } else return iemRaiseDeviceNotAvailable(pVCpu); \ 85 } while (0) 86 #define IEM_MC_MAYBE_RAISE_FPU_XCPT() \ 87 do { \ 88 if (!(pVCpu->cpum.GstCtx.XState.x87.FSW & X86_FSW_ES)) \ 89 { } else return iemRaiseMathFault(pVCpu); \ 90 } while (0) 91 #define IEM_MC_MAYBE_RAISE_AVX_RELATED_XCPT() \ 92 do { \ 93 if ( (pVCpu->cpum.GstCtx.aXcr[0] & (XSAVE_C_YMM | XSAVE_C_SSE)) != (XSAVE_C_YMM | XSAVE_C_SSE) \ 94 || !(pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXSAVE)) \ 112 { /* probable */ } \ 113 else if (pVCpu->cpum.GstCtx.cr0 & X86_CR0_EM) \ 95 114 return iemRaiseUndefinedOpcode(pVCpu); \ 96 if (pVCpu->cpum.GstCtx.cr0 & X86_CR0_TS)\115 else \ 97 116 return iemRaiseDeviceNotAvailable(pVCpu); \ 98 } while (0) 99 #define IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT() \ 100 do { \ 101 if ( (pVCpu->cpum.GstCtx.cr0 & X86_CR0_EM) \ 102 || !(pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSFXSR)) \ 103 return iemRaiseUndefinedOpcode(pVCpu); \ 104 if (pVCpu->cpum.GstCtx.cr0 & X86_CR0_TS) \ 105 return iemRaiseDeviceNotAvailable(pVCpu); \ 106 } while (0) 107 #define IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT() \ 108 do { \ 109 if (pVCpu->cpum.GstCtx.cr0 & X86_CR0_EM) \ 110 return iemRaiseUndefinedOpcode(pVCpu); \ 111 if (pVCpu->cpum.GstCtx.cr0 & X86_CR0_TS) \ 112 return iemRaiseDeviceNotAvailable(pVCpu); \ 113 if (pVCpu->cpum.GstCtx.XState.x87.FSW & X86_FSW_ES) \ 114 return iemRaiseMathFault(pVCpu); \ 117 \ 118 if (!(pVCpu->cpum.GstCtx.XState.x87.FSW & X86_FSW_ES)) { /* probable */ } \ 119 else return iemRaiseMathFault(pVCpu); \ 115 120 } while (0) 116 121 #define IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO() \ 117 122 do { \ 118 if (pVCpu->iem.s.uCpl != 0)\119 123 if (pVCpu->iem.s.uCpl == 0) { /* probable */ } \ 124 else return iemRaiseGeneralProtectionFault0(pVCpu); \ 120 125 } while (0) 121 126 #define IEM_MC_RAISE_GP0_IF_EFF_ADDR_UNALIGNED(a_EffAddr, a_cbAlign) \ … … 126 131 #define IEM_MC_MAYBE_RAISE_FSGSBASE_XCPT() \ 127 132 do { \ 128 if ( pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT \129 || !(pVCpu->cpum.GstCtx.cr4 & X86_CR4_FSGSBASE))\130 133 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT \ 134 && (pVCpu->cpum.GstCtx.cr4 & X86_CR4_FSGSBASE)) { /* probable */ } \ 135 else return iemRaiseUndefinedOpcode(pVCpu); \ 131 136 } while (0) 132 137 #define IEM_MC_MAYBE_RAISE_NON_CANONICAL_ADDR_GP0(a_u64Addr) \ 133 138 do { \ 134 if ( !IEM_IS_CANONICAL(a_u64Addr))\135 139 if (RT_LIKELY(IEM_IS_CANONICAL(a_u64Addr))) { /* likely */ } \ 140 else return iemRaiseGeneralProtectionFault0(pVCpu); \ 136 141 } while (0) 137 142 #define IEM_MC_MAYBE_RAISE_SSE_AVX_SIMD_FP_OR_UD_XCPT() \ 138 143 do { \ 139 144 if (( ~((pVCpu->cpum.GstCtx.XState.x87.MXCSR & X86_MXCSR_XCPT_MASK) >> X86_MXCSR_XCPT_MASK_SHIFT) \ 140 & (pVCpu->cpum.GstCtx.XState.x87.MXCSR & X86_MXCSR_XCPT_FLAGS)) != 0) \ 145 & (pVCpu->cpum.GstCtx.XState.x87.MXCSR & X86_MXCSR_XCPT_FLAGS)) == 0) \ 146 { /* probable */ } \ 147 else \ 141 148 { \ 142 if (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXMMEEXCPT) \149 if (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXMMEEXCPT) \ 143 150 return iemRaiseSimdFpException(pVCpu); \ 144 151 return iemRaiseUndefinedOpcode(pVCpu); \
Note:
See TracChangeset
for help on using the changeset viewer.