Changeset 100052 in vbox for trunk/src/VBox/VMM/include
- Timestamp:
- Jun 2, 2023 2:49:14 PM (20 months ago)
- Location:
- trunk/src/VBox/VMM/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/IEMInline.h
r100020 r100052 165 165 166 166 /** 167 * Calculates the CPU mode. 168 * 169 * This is mainly for updating IEMCPU::enmCpuMode. 170 * 171 * @returns CPU mode. 167 * Calculates the IEM_F_MODE_X86_32BIT_FLAT flag. 168 * 169 * Checks if CS, SS, DS and SS are all wide open flat 32-bit segments. This will 170 * reject expand down data segments and conforming code segments. 171 * 172 * ASSUMES that the CPU is in 32-bit mode. 173 * 174 * @returns IEM_F_MODE_X86_32BIT_FLAT or zero. 172 175 * @param pVCpu The cross context virtual CPU structure of the 173 176 * calling thread. 174 */ 175 DECLINLINE(IEMMODE) iemCalcCpuMode(PVMCPUCC pVCpu) RT_NOEXCEPT 176 { 177 if (CPUMIsGuestIn64BitCodeEx(&pVCpu->cpum.GstCtx)) 178 return IEMMODE_64BIT; 179 if (pVCpu->cpum.GstCtx.cs.Attr.n.u1DefBig) /** @todo check if this is correct... */ 180 return IEMMODE_32BIT; 181 return IEMMODE_16BIT; 182 } 183 184 185 /** 186 * Checks if CS, SS, DS and SS are all wide open flat 32-bit segments. 187 * 188 * This will reject expand down data segments and conforming code segments. 189 * 190 * @returns The indicator. 191 * @param pVCpu The cross context virtual CPU structure of the 192 * calling thread. 193 */ 194 DECLINLINE(uint8_t) iemCalc32BitFlatIndicator(PVMCPUCC pVCpu) RT_NOEXCEPT 177 * @sa iemCalc32BitFlatIndicatorEsDs 178 */ 179 DECL_FORCE_INLINE(uint32_t) iemCalc32BitFlatIndicator(PVMCPUCC pVCpu) RT_NOEXCEPT 195 180 { 196 181 AssertCompile(X86_SEL_TYPE_DOWN == X86_SEL_TYPE_CONF); 197 return pVCpu->iem.s.enmCpuMode == IEMMODE_32BIT 198 && ( ( pVCpu->cpum.GstCtx.es.Attr.u 182 return ( ( pVCpu->cpum.GstCtx.es.Attr.u 199 183 | pVCpu->cpum.GstCtx.cs.Attr.u 200 184 | pVCpu->cpum.GstCtx.ss.Attr.u … … 212 196 | pVCpu->cpum.GstCtx.ds.u64Base) 213 197 == 0 214 ? 1 : 0; /** @todo define a constant/flag for this. */ 215 } 216 217 #ifndef IEM_WITH_OPAQUE_DECODER_STATE 218 219 # if defined(VBOX_INCLUDED_vmm_dbgf_h) || defined(DOXYGEN_RUNNING) /* dbgf.ro.cEnabledHwBreakpoints */ 220 /** 221 * Initializes the execution state. 222 * 198 && !(pVCpu->cpum.GstCtx.fExtrn & (CPUMCTX_EXTRN_ES | CPUMCTX_EXTRN_CS | CPUMCTX_EXTRN_SS | CPUMCTX_EXTRN_ES)) 199 ? IEM_F_MODE_X86_32BIT_FLAT : 0; 200 } 201 202 203 /** 204 * Calculates the IEM_F_MODE_X86_32BIT_FLAT flag, ASSUMING the CS and SS are 205 * flat already. 206 * 207 * This is used by sysenter. 208 * 209 * @returns IEM_F_MODE_X86_32BIT_FLAT or zero. 223 210 * @param pVCpu The cross context virtual CPU structure of the 224 211 * calling thread. 225 * @param fBypassHandlers Whether to bypass access handlers. 212 * @sa iemCalc32BitFlatIndicator 213 */ 214 DECL_FORCE_INLINE(uint32_t) iemCalc32BitFlatIndicatorEsDs(PVMCPUCC pVCpu) RT_NOEXCEPT 215 { 216 AssertCompile(X86_SEL_TYPE_DOWN == X86_SEL_TYPE_CONF); 217 return ( ( pVCpu->cpum.GstCtx.es.Attr.u 218 | pVCpu->cpum.GstCtx.ds.Attr.u) 219 & (X86_SEL_TYPE_ACCESSED | X86_SEL_TYPE_DOWN | X86DESCATTR_UNUSABLE | X86DESCATTR_G | X86DESCATTR_D | X86DESCATTR_P)) 220 == (X86_SEL_TYPE_ACCESSED | X86_SEL_TYPE_DOWN | X86DESCATTR_UNUSABLE | X86DESCATTR_G | X86DESCATTR_D | X86DESCATTR_P) 221 && ( (pVCpu->cpum.GstCtx.es.u32Limit + 1) 222 | (pVCpu->cpum.GstCtx.ds.u32Limit + 1)) 223 == 0 224 && ( pVCpu->cpum.GstCtx.es.u64Base 225 | pVCpu->cpum.GstCtx.ds.u64Base) 226 == 0 227 && !(pVCpu->cpum.GstCtx.fExtrn & (CPUMCTX_EXTRN_ES | CPUMCTX_EXTRN_CS | CPUMCTX_EXTRN_SS | CPUMCTX_EXTRN_ES)) 228 ? IEM_F_MODE_X86_32BIT_FLAT : 0; 229 } 230 231 232 /** 233 * Calculates the IEM_F_MODE_XXX and CPL flags. 234 * 235 * @returns IEM_F_MODE_XXX 236 * @param pVCpu The cross context virtual CPU structure of the 237 * calling thread. 238 */ 239 DECL_FORCE_INLINE(uint32_t) iemCalcExecModeAndCplFlags(PVMCPUCC pVCpu) RT_NOEXCEPT 240 { 241 /* 242 * We're duplicates code from CPUMGetGuestCPL and CPUMIsGuestIn64BitCodeEx 243 * here to try get this done as efficiently as possible. 244 */ 245 IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_EFER | CPUMCTX_EXTRN_RFLAGS | CPUMCTX_EXTRN_SS | CPUMCTX_EXTRN_CS); 246 247 if (pVCpu->cpum.GstCtx.cr0 & X86_CR0_PE) 248 { 249 if (!pVCpu->cpum.GstCtx.eflags.Bits.u1VM) 250 { 251 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->cpum.GstCtx.ss)); 252 uint32_t fExec = ((uint32_t)pVCpu->cpum.GstCtx.ss.Attr.n.u2Dpl << IEM_F_X86_CPL_SHIFT); 253 if (pVCpu->cpum.GstCtx.cs.Attr.n.u1DefBig) 254 { 255 Assert(!pVCpu->cpum.GstCtx.cs.Attr.n.u1Long || !(pVCpu->cpum.GstCtx.msrEFER & MSR_K6_EFER_LMA)); 256 fExec |= IEM_F_MODE_X86_32BIT_PROT | iemCalc32BitFlatIndicator(pVCpu); 257 } 258 else if ( pVCpu->cpum.GstCtx.cs.Attr.n.u1Long 259 && (pVCpu->cpum.GstCtx.msrEFER & MSR_K6_EFER_LMA)) 260 fExec |= IEM_F_MODE_X86_64BIT; 261 else if (IEM_GET_TARGET_CPU(pVCpu) >= IEMTARGETCPU_386) 262 fExec |= IEM_F_MODE_X86_16BIT_PROT; 263 else 264 fExec |= IEM_F_MODE_X86_16BIT_PROT_PRE_386; 265 return fExec; 266 } 267 return IEM_F_MODE_X86_16BIT_PROT_V86 | (UINT32_C(3) << IEM_F_X86_CPL_SHIFT); 268 } 269 270 /* Real mode is zero; CPL set to 3 for VT-x real-mode emulation. */ 271 if (RT_LIKELY(!pVCpu->cpum.GstCtx.cs.Attr.n.u1DefBig)) 272 { 273 if (IEM_GET_TARGET_CPU(pVCpu) >= IEMTARGETCPU_386) 274 return IEM_F_MODE_X86_16BIT; 275 return IEM_F_MODE_X86_16BIT_PRE_386; 276 } 277 278 /* 32-bit unreal mode. */ 279 return IEM_F_MODE_X86_32BIT | iemCalc32BitFlatIndicator(pVCpu); 280 } 281 282 283 /** 284 * Calculates the AMD-V and VT-x related context flags. 285 * 286 * @returns 0 or a combination of IEM_F_X86_CTX_IN_GUEST, IEM_F_X86_CTX_SVM and 287 * IEM_F_X86_CTX_VMX. 288 * @param pVCpu The cross context virtual CPU structure of the 289 * calling thread. 290 */ 291 DECL_FORCE_INLINE(uint32_t) iemCalcExecHwVirtFlags(PVMCPUCC pVCpu) RT_NOEXCEPT 292 { 293 /* 294 * This duplicates code from CPUMIsGuestVmxEnabled, CPUMIsGuestSvmEnabled 295 * and CPUMIsGuestInNestedHwvirtMode to some extent. 296 */ 297 IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CR4 | CPUMCTX_EXTRN_EFER); 298 299 AssertCompile(X86_CR4_VMXE != MSR_K6_EFER_SVME); 300 uint64_t const fTmp = (pVCpu->cpum.GstCtx.cr4 & X86_CR4_VMXE) 301 | (pVCpu->cpum.GstCtx.msrEFER & MSR_K6_EFER_SVME); 302 if (RT_LIKELY(!fTmp)) 303 return 0; /* likely */ 304 305 if (fTmp & X86_CR4_VMXE) 306 { 307 Assert(pVCpu->cpum.GstCtx.hwvirt.enmHwvirt == CPUMHWVIRT_VMX); 308 if (pVCpu->cpum.GstCtx.hwvirt.vmx.fInVmxNonRootMode) 309 return IEM_F_X86_CTX_VMX | IEM_F_X86_CTX_IN_GUEST; 310 return IEM_F_X86_CTX_VMX; 311 } 312 313 Assert(pVCpu->cpum.GstCtx.hwvirt.enmHwvirt == CPUMHWVIRT_SVM); 314 if (pVCpu->cpum.GstCtx.hwvirt.svm.Vmcb.ctrl.u64InterceptCtrl & SVM_CTRL_INTERCEPT_VMRUN) 315 return IEM_F_X86_CTX_SVM | IEM_F_X86_CTX_IN_GUEST; 316 return IEM_F_X86_CTX_SVM; 317 } 318 319 320 /** 321 * Calculates IEM_F_BRK_PENDING_XXX (IEM_F_PENDING_BRK_MASK) flags. 322 * 323 * @returns IEM_F_BRK_PENDING_XXX or zero. 324 * @param pVCpu The cross context virtual CPU structure of the 325 * calling thread. 326 */ 327 DECL_FORCE_INLINE(uint32_t) iemCalcExecDbgFlags(PVMCPUCC pVCpu) RT_NOEXCEPT 328 { 329 IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_DR7); 330 331 if (RT_LIKELY( !(pVCpu->cpum.GstCtx.dr[7] & X86_DR7_ENABLED_MASK) 332 && pVCpu->CTX_SUFF(pVM)->dbgf.ro.cEnabledHwBreakpoints == 0)) 333 return 0; 334 return iemCalcExecDbgFlagsSlow(pVCpu); 335 } 336 337 /** 338 * Calculates the the IEM_F_XXX flags. 339 * 340 * @returns IEM_F_XXX combination match the current CPU state. 341 * @param pVCpu The cross context virtual CPU structure of the 342 * calling thread. 343 */ 344 DECL_FORCE_INLINE(uint32_t) iemCalcExecFlags(PVMCPUCC pVCpu) RT_NOEXCEPT 345 { 346 return iemCalcExecModeAndCplFlags(pVCpu) 347 | iemCalcExecHwVirtFlags(pVCpu) 348 /* SMM is not yet implemented */ 349 | iemCalcExecDbgFlags(pVCpu) 350 ; 351 } 352 353 354 /** 355 * Re-calculates the MODE and CPL parts of IEMCPU::fExec. 356 * 357 * @param pVCpu The cross context virtual CPU structure of the 358 * calling thread. 359 */ 360 DECL_FORCE_INLINE(void) iemRecalcExecModeAndCplFlags(PVMCPUCC pVCpu) 361 { 362 pVCpu->iem.s.fExec = (pVCpu->iem.s.fExec & ~(IEM_F_MODE_MASK | IEM_F_X86_CPL_MASK)) 363 | iemCalcExecModeAndCplFlags(pVCpu); 364 } 365 366 367 /** 368 * Re-calculates the IEM_F_PENDING_BRK_MASK part of IEMCPU::fExec. 369 * 370 * @param pVCpu The cross context virtual CPU structure of the 371 * calling thread. 372 */ 373 DECL_FORCE_INLINE(void) iemRecalcExecDbgFlags(PVMCPUCC pVCpu) 374 { 375 pVCpu->iem.s.fExec = (pVCpu->iem.s.fExec & ~IEM_F_PENDING_BRK_MASK) 376 | iemCalcExecDbgFlags(pVCpu); 377 } 378 379 380 #ifndef IEM_WITH_OPAQUE_DECODER_STATE 381 382 # if defined(VBOX_INCLUDED_vmm_dbgf_h) || defined(DOXYGEN_RUNNING) /* dbgf.ro.cEnabledHwBreakpoints */ 383 /** 384 * Initializes the execution state. 385 * 386 * @param pVCpu The cross context virtual CPU structure of the 387 * calling thread. 388 * @param fExecOpts Optional execution flags: 389 * - IEM_F_BYPASS_HANDLERS 390 * - IEM_F_X86_DISREGARD_LOCK 226 391 * 227 392 * @remarks Callers of this must call iemUninitExec() to undo potentially fatal 228 393 * side-effects in strict builds. 229 394 */ 230 DECLINLINE(void) iemInitExec(PVMCPUCC pVCpu, bool fBypassHandlers) RT_NOEXCEPT395 DECLINLINE(void) iemInitExec(PVMCPUCC pVCpu, uint32_t fExecOpts) RT_NOEXCEPT 231 396 { 232 397 IEM_CTX_ASSERT(pVCpu, IEM_CPUMCTX_EXTRN_EXEC_DECODED_NO_MEM_MASK); … … 241 406 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->cpum.GstCtx.tr)); 242 407 243 pVCpu->iem.s.uCpl = CPUMGetGuestCPL(pVCpu); 244 pVCpu->iem.s.enmCpuMode = iemCalcCpuMode(pVCpu); 408 pVCpu->iem.s.fExec = iemCalcExecFlags(pVCpu) | fExecOpts; 245 409 # ifdef VBOX_STRICT 246 410 pVCpu->iem.s.enmDefAddrMode = (IEMMODE)0xfe; … … 275 439 pVCpu->iem.s.iNextMapping = 0; 276 440 pVCpu->iem.s.rcPassUp = VINF_SUCCESS; 277 pVCpu->iem.s.fBypassHandlers = fBypassHandlers;278 pVCpu->iem.s.fDisregardLock = false;279 pVCpu->iem.s.fPendingInstructionBreakpoints = false;280 pVCpu->iem.s.fPendingDataBreakpoints = false;281 pVCpu->iem.s.fPendingIoBreakpoints = false;282 if (RT_LIKELY( !(pVCpu->cpum.GstCtx.dr[7] & X86_DR7_ENABLED_MASK)283 && pVCpu->CTX_SUFF(pVM)->dbgf.ro.cEnabledHwBreakpoints == 0))284 { /* likely */ }285 else286 iemInitPendingBreakpointsSlow(pVCpu);287 441 } 288 442 # endif /* VBOX_INCLUDED_vmm_dbgf_h */ … … 302 456 DECLINLINE(void) iemReInitExec(PVMCPUCC pVCpu, uint8_t cbInstr) RT_NOEXCEPT 303 457 { 304 pVCpu->iem.s.uCpl = CPUMGetGuestCPL(pVCpu); 305 pVCpu->iem.s.enmCpuMode = iemCalcCpuMode(pVCpu); 458 pVCpu->iem.s.fExec = iemCalcExecFlags(pVCpu) | (pVCpu->iem.s.fExec & IEM_F_USER_OPTS); 306 459 iemOpcodeFlushHeavy(pVCpu, cbInstr); 307 460 } … … 374 527 * Check for hardware instruction breakpoints. 375 528 */ 376 if (RT_LIKELY(! pVCpu->iem.s.fPendingInstructionBreakpoints))529 if (RT_LIKELY(!(pVCpu->iem.s.fExec & IEM_F_PENDING_BRK_INSTR))) 377 530 { /* likely */ } 378 531 else … … 414 567 * Check for hardware instruction breakpoints. 415 568 */ 416 if (RT_LIKELY(! pVCpu->iem.s.fPendingInstructionBreakpoints))569 if (RT_LIKELY(!(pVCpu->iem.s.fExec & IEM_F_PENDING_BRK_INSTR))) 417 570 { /* likely */ } 418 571 else … … 1339 1492 { 1340 1493 /* VT-x (Intel 3960x) observed doing something like this. */ 1341 pSReg->Attr.u = X86DESCATTR_UNUSABLE | X86DESCATTR_G | X86DESCATTR_D | ( pVCpu->iem.s.uCpl<< X86DESCATTR_DPL_SHIFT);1494 pSReg->Attr.u = X86DESCATTR_UNUSABLE | X86DESCATTR_G | X86DESCATTR_D | (IEM_GET_CPL(pVCpu) << X86DESCATTR_DPL_SHIFT); 1342 1495 pSReg->u32Limit = UINT32_MAX; 1343 1496 pSReg->u64Base = 0; … … 1371 1524 DECLINLINE(void) iemRecalEffOpSize(PVMCPUCC pVCpu) RT_NOEXCEPT 1372 1525 { 1373 switch ( pVCpu->iem.s.enmCpuMode)1526 switch (IEM_GET_CPU_MODE(pVCpu)) 1374 1527 { 1375 1528 case IEMMODE_16BIT: … … 1408 1561 DECLINLINE(void) iemRecalEffOpSize64Default(PVMCPUCC pVCpu) RT_NOEXCEPT 1409 1562 { 1410 Assert( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT);1563 Assert(IEM_IS_64BIT_CODE(pVCpu)); 1411 1564 pVCpu->iem.s.enmDefOpSize = IEMMODE_64BIT; 1412 1565 if ((pVCpu->iem.s.fPrefixes & (IEM_OP_PRF_SIZE_REX_W | IEM_OP_PRF_SIZE_OP)) != IEM_OP_PRF_SIZE_OP) … … 1427 1580 DECLINLINE(void) iemRecalEffOpSize64DefaultAndIntelIgnoresOpSizePrefix(PVMCPUCC pVCpu) RT_NOEXCEPT 1428 1581 { 1429 Assert( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT);1582 Assert(IEM_IS_64BIT_CODE(pVCpu)); 1430 1583 pVCpu->iem.s.enmDefOpSize = IEMMODE_64BIT; 1431 1584 if ( (pVCpu->iem.s.fPrefixes & (IEM_OP_PRF_SIZE_REX_W | IEM_OP_PRF_SIZE_OP)) != IEM_OP_PRF_SIZE_OP … … 1745 1898 DECLINLINE(RTGCPTR) iemRegGetEffRsp(PCVMCPU pVCpu) RT_NOEXCEPT 1746 1899 { 1747 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)1900 if (IEM_IS_64BIT_CODE(pVCpu)) 1748 1901 return pVCpu->cpum.GstCtx.rsp; 1749 1902 if (pVCpu->cpum.GstCtx.ss.Attr.n.u1DefBig) … … 1774 1927 uint64_t const uRipNext = uRipPrev + cbInstr; 1775 1928 if (RT_LIKELY( !((uRipNext ^ uRipPrev) & (RT_BIT_64(32) | RT_BIT_64(16))) 1776 || pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT))1929 || IEM_IS_64BIT_CODE(pVCpu))) 1777 1930 pVCpu->cpum.GstCtx.rip = uRipNext; 1778 1931 else if (IEM_GET_TARGET_CPU(pVCpu) >= IEMTARGETCPU_386) … … 2008 2161 DECLINLINE(void) iemRegAddToRsp(PVMCPUCC pVCpu, uint8_t cbToAdd) RT_NOEXCEPT 2009 2162 { 2010 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2163 if (IEM_IS_64BIT_CODE(pVCpu)) 2011 2164 pVCpu->cpum.GstCtx.rsp += cbToAdd; 2012 2165 else if (pVCpu->cpum.GstCtx.ss.Attr.n.u1DefBig) … … 2025 2178 DECLINLINE(void) iemRegSubFromRsp(PVMCPUCC pVCpu, uint8_t cbToSub) RT_NOEXCEPT 2026 2179 { 2027 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2180 if (IEM_IS_64BIT_CODE(pVCpu)) 2028 2181 pVCpu->cpum.GstCtx.rsp -= cbToSub; 2029 2182 else if (pVCpu->cpum.GstCtx.ss.Attr.n.u1DefBig) … … 2043 2196 DECLINLINE(void) iemRegAddToRspEx(PCVMCPU pVCpu, PRTUINT64U pTmpRsp, uint16_t cbToAdd) RT_NOEXCEPT 2044 2197 { 2045 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2198 if (IEM_IS_64BIT_CODE(pVCpu)) 2046 2199 pTmpRsp->u += cbToAdd; 2047 2200 else if (pVCpu->cpum.GstCtx.ss.Attr.n.u1DefBig) … … 2063 2216 DECLINLINE(void) iemRegSubFromRspEx(PCVMCPU pVCpu, PRTUINT64U pTmpRsp, uint16_t cbToSub) RT_NOEXCEPT 2064 2217 { 2065 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2218 if (IEM_IS_64BIT_CODE(pVCpu)) 2066 2219 pTmpRsp->u -= cbToSub; 2067 2220 else if (pVCpu->cpum.GstCtx.ss.Attr.n.u1DefBig) … … 2087 2240 uTmpRsp.u = pVCpu->cpum.GstCtx.rsp; 2088 2241 2089 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2242 if (IEM_IS_64BIT_CODE(pVCpu)) 2090 2243 GCPtrTop = uTmpRsp.u -= cbItem; 2091 2244 else if (pVCpu->cpum.GstCtx.ss.Attr.n.u1DefBig) … … 2113 2266 uTmpRsp.u = pVCpu->cpum.GstCtx.rsp; 2114 2267 2115 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2268 if (IEM_IS_64BIT_CODE(pVCpu)) 2116 2269 { 2117 2270 GCPtrTop = uTmpRsp.u; … … 2146 2299 RTGCPTR GCPtrTop; 2147 2300 2148 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2301 if (IEM_IS_64BIT_CODE(pVCpu)) 2149 2302 GCPtrTop = pTmpRsp->u -= cbItem; 2150 2303 else if (pVCpu->cpum.GstCtx.ss.Attr.n.u1DefBig) … … 2168 2321 { 2169 2322 RTGCPTR GCPtrTop; 2170 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2323 if (IEM_IS_64BIT_CODE(pVCpu)) 2171 2324 { 2172 2325 GCPtrTop = pTmpRsp->u; … … 2654 2807 { 2655 2808 AssertCompile(X86_CR0_AM == X86_EFL_AC); 2656 return pVCpu->iem.s.uCpl== 32809 return IEM_GET_CPL(pVCpu) == 3 2657 2810 && (((uint32_t)pVCpu->cpum.GstCtx.cr0 & pVCpu->cpum.GstCtx.eflags.u) & X86_CR0_AM); 2658 2811 } … … 2676 2829 IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(iSegReg)); 2677 2830 2678 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2831 if (IEM_IS_64BIT_CODE(pVCpu)) 2679 2832 *pu64BaseAddr = iSegReg < X86_SREG_FS ? 0 : pHid->u64Base; 2680 2833 else … … 2690 2843 if ( ( (pHid->Attr.n.u4Type & X86_SEL_TYPE_CODE) 2691 2844 || !(pHid->Attr.n.u4Type & X86_SEL_TYPE_WRITE) ) 2692 && pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT)2845 && !IEM_IS_64BIT_CODE(pVCpu) ) 2693 2846 return iemRaiseSelectorInvalidAccess(pVCpu, iSegReg, IEM_ACCESS_DATA_W); 2694 2847 *pu64BaseAddr = pHid->u64Base; … … 2716 2869 IEM_CTX_ASSERT(pVCpu, CPUMCTX_EXTRN_SREG_FROM_IDX(iSegReg)); 2717 2870 2718 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2871 if (IEM_IS_64BIT_CODE(pVCpu)) 2719 2872 *pu64BaseAddr = iSegReg < X86_SREG_FS ? 0 : pHid->u64Base; 2720 2873 else … … 2761 2914 GCPhysMem, 2762 2915 RT_BOOL(fAccess & IEM_ACCESS_TYPE_WRITE), 2763 pVCpu->iem.s.fBypassHandlers,2916 RT_BOOL(pVCpu->iem.s.fExec & IEM_F_BYPASS_HANDLERS), 2764 2917 ppvMem, 2765 2918 pLock); … … 2802 2955 * 64-bit mode is simpler. 2803 2956 */ 2804 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)2957 if (IEM_IS_64BIT_CODE(pVCpu)) 2805 2958 { 2806 2959 if (iSegReg >= X86_SREG_FS && iSegReg != UINT8_MAX) … … 2880 3033 * 64-bit mode is simpler. 2881 3034 */ 2882 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)3035 if (IEM_IS_64BIT_CODE(pVCpu)) 2883 3036 { 2884 3037 if (iSegReg >= X86_SREG_FS) -
trunk/src/VBox/VMM/include/IEMInternal.h
r99988 r100052 539 539 typedef struct IEMTB *PIEMTB; 540 540 541 /** @name IEM_F_XXX - Execution mode flags (IEMCPU::fExec, IEMTB::fFlags). 542 * 543 * These flags are set when entering IEM and adjusted as code is executed, such 544 * that they will always contain the current values as instructions are 545 * finished. 546 * 547 * In recompiled execution mode, (most of) these flags are included in the 548 * translation block selection key and stored in IEMTB::fFlags alongside the 549 * IEMTB_F_XXX flags. The latter flags uses bits 31 thru 24, which are all zero 550 * in IEMCPU::fExec. 551 * 552 * @{ */ 553 /** Mode: The block target mode mask. */ 554 #define IEM_F_MODE_MASK UINT32_C(0x0000001f) 555 /** Mode: The IEMMODE part of the IEMTB_F_MODE_MASK value. */ 556 #define IEM_F_MODE_CPUMODE_MASK UINT32_C(0x00000003) 557 /** X86 Mode: Bit used to indicating pre-386 CPU in 16-bit mode (for eliminating 558 * conditional in EIP/IP updating), and flat wide open CS, SS DS, and ES in 559 * 32-bit mode (for simplifying most memory accesses). */ 560 #define IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK UINT32_C(0x00000004) 561 /** X86 Mode: Bit indicating protected mode. */ 562 #define IEM_F_MODE_X86_PROT_MASK UINT32_C(0x00000008) 563 /** X86 Mode: Bit used to indicate virtual 8086 mode (only 16-bit). */ 564 #define IEM_F_MODE_X86_V86_MASK UINT32_C(0x00000010) 565 566 /** X86 Mode: 16-bit on 386 or later. */ 567 #define IEM_F_MODE_X86_16BIT UINT32_C(0x00000000) 568 /** X86 Mode: 80286, 80186 and 8086/88 targetting blocks (EIP update opt). */ 569 #define IEM_F_MODE_X86_16BIT_PRE_386 UINT32_C(0x00000004) 570 /** X86 Mode: 16-bit protected mode on 386 or later. */ 571 #define IEM_F_MODE_X86_16BIT_PROT UINT32_C(0x00000008) 572 /** X86 Mode: 16-bit protected mode on 386 or later. */ 573 #define IEM_F_MODE_X86_16BIT_PROT_PRE_386 UINT32_C(0x0000000c) 574 /** X86 Mode: 16-bit virtual 8086 protected mode (on 386 or later). */ 575 #define IEM_F_MODE_X86_16BIT_PROT_V86 UINT32_C(0x00000018) 576 577 /** X86 Mode: 32-bit on 386 or later. */ 578 #define IEM_F_MODE_X86_32BIT UINT32_C(0x00000001) 579 /** X86 Mode: 32-bit mode with wide open flat CS, SS, DS and ES. */ 580 #define IEM_F_MODE_X86_32BIT_FLAT UINT32_C(0x00000005) 581 /** X86 Mode: 32-bit protected mode. */ 582 #define IEM_F_MODE_X86_32BIT_PROT UINT32_C(0x00000009) 583 /** X86 Mode: 32-bit protected mode with wide open flat CS, SS, DS and ES. */ 584 #define IEM_F_MODE_X86_32BIT_PROT_FLAT UINT32_C(0x0000000d) 585 586 /** X86 Mode: 64-bit (includes protected, but not the flat bit). */ 587 #define IEM_F_MODE_X86_64BIT UINT32_C(0x0000000a) 588 589 590 /** Bypass access handlers when set. */ 591 #define IEM_F_BYPASS_HANDLERS UINT32_C(0x00010000) 592 /** Have pending hardware instruction breakpoints. */ 593 #define IEM_F_PENDING_BRK_INSTR UINT32_C(0x00020000) 594 /** Have pending hardware data breakpoints. */ 595 #define IEM_F_PENDING_BRK_DATA UINT32_C(0x00040000) 596 597 /** X86: Have pending hardware I/O breakpoints. */ 598 #define IEM_F_PENDING_BRK_X86_IO UINT32_C(0x00000400) 599 /** X86: Disregard the lock prefix (implied or not) when set. */ 600 #define IEM_F_X86_DISREGARD_LOCK UINT32_C(0x00000800) 601 602 /** Pending breakpoint mask (what iemCalcExecDbgFlags works out). */ 603 #define IEM_F_PENDING_BRK_MASK (IEM_F_PENDING_BRK_INSTR | IEM_F_PENDING_BRK_DATA | IEM_F_PENDING_BRK_X86_IO) 604 605 /** Caller configurable options. */ 606 #define IEM_F_USER_OPTS (IEM_F_BYPASS_HANDLERS | IEM_F_X86_DISREGARD_LOCK) 607 608 /** X86: The current protection level (CPL) shift factor. */ 609 #define IEM_F_X86_CPL_SHIFT 8 610 /** X86: The current protection level (CPL) mask. */ 611 #define IEM_F_X86_CPL_MASK UINT32_C(0x00000300) 612 /** X86: The current protection level (CPL) shifted mask. */ 613 #define IEM_F_X86_CPL_SMASK UINT32_C(0x00000003) 614 615 /** X86 execution context. 616 * The IEM_F_X86_CTX_XXX values are individual flags that can be combined (with 617 * the exception of IEM_F_X86_CTX_NORMAL). This allows running VMs from SMM 618 * mode. */ 619 #define IEM_F_X86_CTX_MASK UINT32_C(0x0000f000) 620 /** X86 context: Plain regular execution context. */ 621 #define IEM_F_X86_CTX_NORMAL UINT32_C(0x00000000) 622 /** X86 context: VT-x enabled. */ 623 #define IEM_F_X86_CTX_VMX UINT32_C(0x00001000) 624 /** X86 context: AMD-V enabled. */ 625 #define IEM_F_X86_CTX_SVM UINT32_C(0x00002000) 626 /** X86 context: In AMD-V or VT-x guest mode. */ 627 #define IEM_F_X86_CTX_IN_GUEST UINT32_C(0x00004000) 628 /** X86 context: System management mode (SMM). */ 629 #define IEM_F_X86_CTX_SMM UINT32_C(0x00008000) 630 631 /** @todo Add TF+RF+INHIBIT indicator(s), so we can eliminate the conditional in 632 * iemRegFinishClearingRF() most for most situations (CPUMCTX_DBG_HIT_DRX_MASK 633 * and CPUMCTX_DBG_DBGF_MASK are covered by the IEM_F_PENDING_BRK_XXX bits 634 * alread). */ 635 636 /** @todo Add TF+RF+INHIBIT indicator(s), so we can eliminate the conditional in 637 * iemRegFinishClearingRF() most for most situations 638 * (CPUMCTX_DBG_HIT_DRX_MASK and CPUMCTX_DBG_DBGF_MASK are covered by 639 * the IEM_F_PENDING_BRK_XXX bits alread). */ 640 641 /** @} */ 642 643 644 /** @name IEMTB_F_XXX - Translation block flags (IEMTB::fFlags). 645 * 646 * Extends the IEM_F_XXX flags (subject to IEMTB_F_IEM_F_MASK) to make up the 647 * translation block flags. The combined flag mask (subject to 648 * IEMTB_F_KEY_MASK) is used as part of the lookup key for translation blocks. 649 * 650 * @{ */ 651 /** Mask of IEM_F_XXX flags included in IEMTB_F_XXX. */ 652 #define IEMTB_F_IEM_F_MASK UINT32_C(0x00ffffff) 653 654 /** Type: The block type mask. */ 655 #define IEMTB_F_TYPE_MASK UINT32_C(0x03000000) 656 /** Type: Purly threaded recompiler (via tables). */ 657 #define IEMTB_F_TYPE_THREADED UINT32_C(0x01000000) 658 /** Type: Native recompilation. */ 659 #define IEMTB_F_TYPE_NATIVE UINT32_C(0x02000000) 660 661 /** State mask. */ 662 #define IEMTB_F_STATE_MASK UINT32_C(0x0c000000) 663 /** State: Compiling. */ 664 #define IEMTB_F_STATE_COMPILING UINT32_C(0x04000000) 665 /** State: Ready. */ 666 #define IEMTB_F_STATE_READY UINT32_C(0x08000000) 667 /** State: Obsolete, can be deleted when we're sure it's not used any longer. */ 668 #define IEMTB_F_STATE_OBSOLETE UINT32_C(0x0c000000) 669 670 /** Mask of the IEMTB_F_XXX flags that are part of the TB lookup key. 671 * @note We don't */ 672 #define IEMTB_F_KEY_MASK ((UINT32_C(0xffffffff) & ~IEM_F_X86_CTX_MASK) | IEM_F_X86_CTX_SMM) 673 /** @} */ 674 675 AssertCompile( (IEM_F_MODE_X86_16BIT & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_16BIT); 676 AssertCompile(!(IEM_F_MODE_X86_16BIT & IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK)); 677 AssertCompile(!(IEM_F_MODE_X86_16BIT & IEM_F_MODE_X86_PROT_MASK)); 678 AssertCompile(!(IEM_F_MODE_X86_16BIT & IEM_F_MODE_X86_V86_MASK)); 679 AssertCompile( (IEM_F_MODE_X86_16BIT_PRE_386 & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_16BIT); 680 AssertCompile( IEM_F_MODE_X86_16BIT_PRE_386 & IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK); 681 AssertCompile(!(IEM_F_MODE_X86_16BIT_PRE_386 & IEM_F_MODE_X86_PROT_MASK)); 682 AssertCompile(!(IEM_F_MODE_X86_16BIT_PRE_386 & IEM_F_MODE_X86_V86_MASK)); 683 AssertCompile( (IEM_F_MODE_X86_16BIT_PROT & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_16BIT); 684 AssertCompile(!(IEM_F_MODE_X86_16BIT_PROT & IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK)); 685 AssertCompile( IEM_F_MODE_X86_16BIT_PROT & IEM_F_MODE_X86_PROT_MASK); 686 AssertCompile(!(IEM_F_MODE_X86_16BIT_PROT & IEM_F_MODE_X86_V86_MASK)); 687 AssertCompile( (IEM_F_MODE_X86_16BIT_PROT_PRE_386 & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_16BIT); 688 AssertCompile( IEM_F_MODE_X86_16BIT_PROT_PRE_386 & IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK); 689 AssertCompile( IEM_F_MODE_X86_16BIT_PROT_PRE_386 & IEM_F_MODE_X86_PROT_MASK); 690 AssertCompile(!(IEM_F_MODE_X86_16BIT_PROT_PRE_386 & IEM_F_MODE_X86_V86_MASK)); 691 AssertCompile( IEM_F_MODE_X86_16BIT_PROT_V86 & IEM_F_MODE_X86_PROT_MASK); 692 AssertCompile(!(IEM_F_MODE_X86_16BIT_PROT_V86 & IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK)); 693 AssertCompile( IEM_F_MODE_X86_16BIT_PROT_V86 & IEM_F_MODE_X86_V86_MASK); 694 695 AssertCompile( (IEM_F_MODE_X86_32BIT & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_32BIT); 696 AssertCompile(!(IEM_F_MODE_X86_32BIT & IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK)); 697 AssertCompile(!(IEM_F_MODE_X86_32BIT & IEM_F_MODE_X86_PROT_MASK)); 698 AssertCompile( (IEM_F_MODE_X86_32BIT_FLAT & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_32BIT); 699 AssertCompile( IEM_F_MODE_X86_32BIT_FLAT & IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK); 700 AssertCompile(!(IEM_F_MODE_X86_32BIT_FLAT & IEM_F_MODE_X86_PROT_MASK)); 701 AssertCompile( (IEM_F_MODE_X86_32BIT_PROT & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_32BIT); 702 AssertCompile(!(IEM_F_MODE_X86_32BIT_PROT & IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK)); 703 AssertCompile( IEM_F_MODE_X86_32BIT_PROT & IEM_F_MODE_X86_PROT_MASK); 704 AssertCompile( (IEM_F_MODE_X86_32BIT_PROT_FLAT & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_32BIT); 705 AssertCompile( IEM_F_MODE_X86_32BIT_PROT_FLAT & IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK); 706 AssertCompile( IEM_F_MODE_X86_32BIT_PROT_FLAT & IEM_F_MODE_X86_PROT_MASK); 707 708 AssertCompile( (IEM_F_MODE_X86_64BIT & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_64BIT); 709 AssertCompile( IEM_F_MODE_X86_64BIT & IEM_F_MODE_X86_PROT_MASK); 710 AssertCompile(!(IEM_F_MODE_X86_64BIT & IEM_F_MODE_X86_FLAT_OR_PRE_386_MASK)); 711 541 712 542 713 /** … … 551 722 * source of these codes will perform appropriate sanity checks. */ 552 723 int32_t rcPassUp; /* 0x00 */ 553 554 /** The current CPU execution mode (CS). */ 555 IEMMODE enmCpuMode; /* 0x04 */ 556 /** The CPL. */ 557 uint8_t uCpl; /* 0x05 */ 558 559 /** Whether to bypass access handlers or not. */ 560 bool fBypassHandlers : 1; /* 0x06.0 */ 561 /** Whether to disregard the lock prefix (implied or not). */ 562 bool fDisregardLock : 1; /* 0x06.1 */ 563 /** Whether there are pending hardware instruction breakpoints. */ 564 bool fPendingInstructionBreakpoints : 1; /* 0x06.2 */ 565 /** Whether there are pending hardware data breakpoints. */ 566 bool fPendingDataBreakpoints : 1; /* 0x06.3 */ 567 /** Whether there are pending hardware I/O breakpoints. */ 568 bool fPendingIoBreakpoints : 1; /* 0x06.4 */ 569 570 /* Unused/padding */ 571 bool fUnused; /* 0x07 */ 724 /** Execution flag, IEM_F_XXX. */ 725 uint32_t fExec; /* 0x04 */ 572 726 573 727 /** @name Decoder state. … … 3515 3669 3516 3670 /** 3671 * Gets the CPU mode (from fExec) as a IEMMODE value. 3672 * 3673 * @returns IEMMODE 3674 * @param a_pVCpu The cross context virtual CPU structure of the calling thread. 3675 */ 3676 #define IEM_GET_CPU_MODE(a_pVCpu) ((a_pVCpu)->iem.s.fExec & IEM_F_MODE_CPUMODE_MASK) 3677 3678 /** 3517 3679 * Check if we're currently executing in real or virtual 8086 mode. 3518 *3519 * @returns @c true if it is, @c false if not.3520 * @param a_pVCpu The IEM state of the current CPU.3521 */3522 #define IEM_IS_REAL_OR_V86_MODE(a_pVCpu) (CPUMIsGuestInRealOrV86ModeEx(IEM_GET_CTX(a_pVCpu)))3523 3524 /**3525 * Check if we're currently executing in virtual 8086 mode.3526 3680 * 3527 3681 * @returns @c true if it is, @c false if not. 3528 3682 * @param a_pVCpu The cross context virtual CPU structure of the calling thread. 3529 3683 */ 3530 #define IEM_IS_ V86_MODE(a_pVCpu) (CPUMIsGuestInV86ModeEx(IEM_GET_CTX(a_pVCpu)))3531 3532 /** 3533 * Check if we're currently executing in longmode.3684 #define IEM_IS_REAL_OR_V86_MODE(a_pVCpu) (CPUMIsGuestInRealOrV86ModeEx(IEM_GET_CTX(a_pVCpu))) 3685 3686 /** 3687 * Check if we're currently executing in virtual 8086 mode. 3534 3688 * 3535 3689 * @returns @c true if it is, @c false if not. 3536 3690 * @param a_pVCpu The cross context virtual CPU structure of the calling thread. 3537 3691 */ 3538 #define IEM_IS_ LONG_MODE(a_pVCpu) (CPUMIsGuestInLongModeEx(IEM_GET_CTX(a_pVCpu)))3539 3540 /** 3541 * Check if we're currently executing in a 64-bit code segment.3692 #define IEM_IS_V86_MODE(a_pVCpu) (CPUMIsGuestInV86ModeEx(IEM_GET_CTX(a_pVCpu))) 3693 3694 /** 3695 * Check if we're currently executing in long mode. 3542 3696 * 3543 3697 * @returns @c true if it is, @c false if not. 3544 3698 * @param a_pVCpu The cross context virtual CPU structure of the calling thread. 3545 3699 */ 3546 #define IEM_IS_ 64BIT_CODE(a_pVCpu) (CPUMIsGuestIn64BitCodeEx(IEM_GET_CTX(a_pVCpu)))3547 3548 /** 3549 * Check if we're currently executing in real mode.3700 #define IEM_IS_LONG_MODE(a_pVCpu) (CPUMIsGuestInLongModeEx(IEM_GET_CTX(a_pVCpu))) 3701 3702 /** 3703 * Check if we're currently executing in a 16-bit code segment. 3550 3704 * 3551 3705 * @returns @c true if it is, @c false if not. 3552 3706 * @param a_pVCpu The cross context virtual CPU structure of the calling thread. 3553 3707 */ 3708 #define IEM_IS_16BIT_CODE(a_pVCpu) (IEM_GET_CPU_MODE(a_pVCpu) == IEMMODE_16BIT) 3709 3710 /** 3711 * Check if we're currently executing in a 32-bit code segment. 3712 * 3713 * @returns @c true if it is, @c false if not. 3714 * @param a_pVCpu The cross context virtual CPU structure of the calling thread. 3715 */ 3716 #define IEM_IS_32BIT_CODE(a_pVCpu) (IEM_GET_CPU_MODE(a_pVCpu) == IEMMODE_32BIT) 3717 3718 /** 3719 * Check if we're currently executing in a 64-bit code segment. 3720 * 3721 * @returns @c true if it is, @c false if not. 3722 * @param a_pVCpu The cross context virtual CPU structure of the calling thread. 3723 */ 3724 #define IEM_IS_64BIT_CODE(a_pVCpu) (IEM_GET_CPU_MODE(a_pVCpu) == IEMMODE_64BIT) 3725 3726 /** 3727 * Check if we're currently executing in real mode. 3728 * 3729 * @returns @c true if it is, @c false if not. 3730 * @param a_pVCpu The cross context virtual CPU structure of the calling thread. 3731 */ 3554 3732 #define IEM_IS_REAL_MODE(a_pVCpu) (CPUMIsGuestInRealModeEx(IEM_GET_CTX(a_pVCpu))) 3733 3734 /** 3735 * Gets the current protection level (CPL). 3736 * 3737 * @returns 0..3 3738 * @param a_pVCpu The cross context virtual CPU structure of the calling thread. 3739 */ 3740 #define IEM_GET_CPL(a_pVCpu) (((a_pVCpu)->iem.s.fExec >> IEM_F_X86_CPL_SHIFT) & IEM_F_X86_CPL_SMASK) 3741 3742 /** 3743 * Sets the current protection level (CPL). 3744 * 3745 * @param a_pVCpu The cross context virtual CPU structure of the calling thread. 3746 */ 3747 #define IEM_SET_CPL(a_pVCpu, a_uCpl) \ 3748 do { (a_pVCpu)->iem.s.fExec = ((a_pVCpu)->iem.s.fExec & ~IEM_F_X86_CPL_MASK) | ((a_uCpl) << IEM_F_X86_CPL_SHIFT); } while (0) 3555 3749 3556 3750 /** … … 3638 3832 */ 3639 3833 #define IEM_GET_EFFECTIVE_VVVV(a_pVCpu) \ 3640 ( (a_pVCpu)->iem.s.enmCpuMode == IEMMODE_64BIT? (a_pVCpu)->iem.s.uVex3rdReg : (a_pVCpu)->iem.s.uVex3rdReg & 7)3834 (IEM_IS_64BIT_CODE(a_pVCpu) ? (a_pVCpu)->iem.s.uVex3rdReg : (a_pVCpu)->iem.s.uVex3rdReg & 7) 3641 3835 3642 3836 … … 3866 4060 /** @} */ 3867 4061 3868 void iemInitPendingBreakpointsSlow(PVMCPUCC pVCpu);4062 uint32_t iemCalcExecDbgFlagsSlow(PVMCPUCC pVCpu); 3869 4063 3870 4064 -
trunk/src/VBox/VMM/include/IEMMc.h
r99992 r100052 142 142 #define IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO() \ 143 143 do { \ 144 if (RT_LIKELY( pVCpu->iem.s.uCpl== 0)) { /* probable */ } \144 if (RT_LIKELY(IEM_GET_CPL(pVCpu) == 0)) { /* probable */ } \ 145 145 else return iemRaiseGeneralProtectionFault0(pVCpu); \ 146 146 } while (0) … … 152 152 #define IEM_MC_MAYBE_RAISE_FSGSBASE_XCPT() \ 153 153 do { \ 154 if (RT_LIKELY( ((pVCpu->cpum.GstCtx.cr4 & X86_CR4_FSGSBASE) | pVCpu->iem.s.enmCpuMode) \154 if (RT_LIKELY( ((pVCpu->cpum.GstCtx.cr4 & X86_CR4_FSGSBASE) | IEM_GET_CPU_MODE(pVCpu)) \ 155 155 == (X86_CR4_FSGSBASE | IEMMODE_64BIT))) \ 156 156 { /* probable */ } \ -
trunk/src/VBox/VMM/include/IEMOpHlp.h
r99958 r100052 346 346 do \ 347 347 { \ 348 if (pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT) \ 348 if (!IEM_IS_64BIT_CODE(pVCpu)) \ 349 { /* likely */ } \ 350 else \ 349 351 return IEMOP_RAISE_INVALID_OPCODE(); \ 350 352 } while (0) … … 355 357 do \ 356 358 { \ 357 if (pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT) \ 359 if (IEM_IS_64BIT_CODE(pVCpu)) \ 360 { /* likely */ } \ 361 else \ 358 362 return IEMOP_RAISE_INVALID_OPCODE(); \ 359 363 } while (0) … … 363 367 do \ 364 368 { \ 365 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT) \369 if (IEM_IS_64BIT_CODE(pVCpu)) \ 366 370 iemRecalEffOpSize64Default(pVCpu); \ 367 371 } while (0) … … 372 376 do \ 373 377 { \ 374 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT) \378 if (IEM_IS_64BIT_CODE(pVCpu)) \ 375 379 iemRecalEffOpSize64DefaultAndIntelIgnoresOpSizePrefix(pVCpu); \ 376 380 } while (0) … … 380 384 do \ 381 385 { \ 382 if ( pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT) \386 if (IEM_IS_64BIT_CODE(pVCpu)) \ 383 387 pVCpu->iem.s.enmEffOpSize = pVCpu->iem.s.enmDefOpSize = IEMMODE_64BIT; \ 384 388 } while (0)
Note:
See TracChangeset
for help on using the changeset viewer.