- Timestamp:
- May 26, 2023 12:10:23 AM (16 months ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
-
VMMAll/IEMAll.cpp (modified) (7 diffs)
-
VMMAll/IEMAllCImpl.cpp (modified) (5 diffs)
-
include/IEMInline.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r99982 r99983 338 338 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->cpum.GstCtx.tr)); 339 339 340 pVCpu->iem.s.uCpl = CPUMGetGuestCPL(pVCpu); /** @todo this should be updated during execution!*/341 IEMMODE enmMode = iemCalcCpuMode(pVCpu);342 pVCpu->iem.s.enmCpuMode = enmMode; /** @todo this should be updated during execution!*/340 Assert(pVCpu->iem.s.uCpl == CPUMGetGuestCPL(pVCpu)); /* ASSUMES: Anyone changing CPL will adjust iem.s.uCpl. */ 341 IEMMODE const enmMode = pVCpu->iem.s.enmCpuMode; 342 Assert(enmMode == iemCalcCpuMode(pVCpu)); /* ASSUMES: Anyone changing the CPU mode will adjust iem.s.enmCpuMode. */ 343 343 pVCpu->iem.s.enmDefAddrMode = enmMode; /** @todo check if this is correct... */ 344 344 pVCpu->iem.s.enmEffAddrMode = enmMode; … … 2057 2057 iemRaiseXcptAdjustState(pVCpu, u8Vector); 2058 2058 2059 /* pVCpu->iem.s.enmCpuMode and pVCpu->iem.s.uCpl doesn't really change here, 2060 so best leave them alone in case we're in a weird kind of real mode... */ 2061 2059 2062 return fFlags & IEM_XCPT_FLAGS_T_CPU_XCPT ? VINF_IEM_RAISED_XCPT : VINF_SUCCESS; 2060 2063 } … … 2905 2908 } 2906 2909 2910 /* Make sure the CPU mode is correct. */ 2911 IEMMODE const enmNewCpuMode = iemCalcCpuMode(pVCpu); 2912 if (enmNewCpuMode != pVCpu->iem.s.enmCpuMode) 2913 Log(("iemTaskSwitch: cpu mode %d -> %d\n", pVCpu->iem.s.enmCpuMode, enmNewCpuMode)); 2914 pVCpu->iem.s.enmCpuMode = enmNewCpuMode; 2915 2907 2916 /** @todo Debug trap. */ 2908 2917 if (fIsNewTSS386 && fNewDebugTrap) … … 2917 2926 && ( !(fFlags & IEM_XCPT_FLAGS_T_SOFT_INT) 2918 2927 || (fFlags & IEM_XCPT_FLAGS_ICEBP_INSTR))) 2919 {2920 2928 uExt = 1; 2921 }2922 2929 else 2923 2930 uExt = 0; … … 3447 3454 iemRaiseXcptAdjustState(pVCpu, u8Vector); 3448 3455 3456 /* Make sure the CPU mode is correct. */ 3457 IEMMODE const enmNewCpuMode = iemCalcCpuMode(pVCpu); 3458 if (enmNewCpuMode != pVCpu->iem.s.enmCpuMode) 3459 Log(("iemRaiseXcptOrIntInProtMode: cpu mode %d -> %d\n", pVCpu->iem.s.enmCpuMode, enmNewCpuMode)); 3460 pVCpu->iem.s.enmCpuMode = enmNewCpuMode; 3461 3449 3462 return fFlags & IEM_XCPT_FLAGS_T_CPU_XCPT ? VINF_IEM_RAISED_XCPT : VINF_SUCCESS; 3450 3463 } … … 3690 3703 pVCpu->cpum.GstCtx.cs.Attr.u = X86DESC_GET_HID_ATTR(&DescCS.Legacy); 3691 3704 pVCpu->cpum.GstCtx.rip = uNewRip; 3705 pVCpu->iem.s.enmCpuMode = IEMMODE_64BIT; 3692 3706 3693 3707 fEfl &= ~fEflToClear; … … 4069 4083 { 4070 4084 return iemRaiseXcptOrInt(pVCpu, 0, X86_XCPT_TS, IEM_XCPT_FLAGS_T_CPU_XCPT | IEM_XCPT_FLAGS_ERR, 4071 pVCpu->cpum.GstCtx.tr.Sel, 0);4085 pVCpu->cpum.GstCtx.tr.Sel, 0); 4072 4086 } 4073 4087 -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp
r99651 r99983 3192 3192 pVCpu->cpum.GstCtx.rip = (uint16_t)uNewEip; 3193 3193 pVCpu->cpum.GstCtx.rsp = uNewEsp; /** @todo check this out! */ 3194 pVCpu->iem.s.uCpl = 3; 3194 pVCpu->iem.s.enmCpuMode = IEMMODE_16BIT; 3195 pVCpu->iem.s.uCpl = 3; 3195 3196 3196 3197 /* Flush the prefetch buffer. */ … … 4143 4144 */ 4144 4145 pVCpu->iem.s.uCpl = pVCpu->cpum.GstCtx.cs.Attr.n.u2Dpl; 4146 Assert(pVCpu->iem.s.enmCpuMode == IEMMODE_16BIT); 4145 4147 4146 4148 CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_HIDDEN_SEL_REGS | CPUM_CHANGED_IDTR | CPUM_CHANGED_GDTR | CPUM_CHANGED_TR | CPUM_CHANGED_LDTR); … … 4465 4467 pVCpu->cpum.GstCtx.rflags.Bits.u1RF = 0; 4466 4468 4467 pVCpu->iem.s.uCpl = 0; 4469 pVCpu->iem.s.uCpl = 0; 4470 pVCpu->iem.s.enmCpuMode = iemCalcCpuMode(pVCpu); 4468 4471 4469 4472 /* Flush the prefetch buffer. */ … … 4560 4563 pVCpu->cpum.GstCtx.rflags.Bits.u1RF = 0; 4561 4564 4562 pVCpu->iem.s.uCpl = 3; 4565 pVCpu->iem.s.uCpl = 3; 4566 pVCpu->iem.s.enmCpuMode = iemCalcCpuMode(pVCpu); 4563 4567 /** @todo single stepping */ 4564 4568 … … 6022 6026 Assert(pVCpu->cpum.GstCtx.cr0 == uNewCrX); 6023 6027 6028 /* Update the CPU mode if we're in 64-bit mode here, just in case 6029 we've exited long mode while in 64-bit code... */ 6030 /** @todo testcase: what happens if we disable paging while in 64-bit code? */ 6031 if (pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT) 6032 pVCpu->iem.s.enmCpuMode = iemCalcCpuMode(pVCpu); 6033 6024 6034 rcStrict = PGMChangeMode(pVCpu, pVCpu->cpum.GstCtx.cr0, pVCpu->cpum.GstCtx.cr4, pVCpu->cpum.GstCtx.msrEFER, 6025 6035 false /* fForce */); -
trunk/src/VBox/VMM/include/IEMInline.h
r99933 r99983 273 273 pVCpu->iem.s.uCpl = uCpl; 274 274 pVCpu->iem.s.enmCpuMode = enmMode; 275 /** @todo r=bird: The rest of this function should not be necessary! 276 * All these fields below will be re-initialized before we decode more code - as 277 * they are _not_ relevant to 'Exec' (xcpt rcPassUp), only to 'Decoding'. 278 * 279 * Only exception might be rcPassUp, though, I don't know why anyone other than 280 * the execution loops should need to mess around with it! 281 * 282 * I don't think we really need or want this function, better to just set uCpl 283 * and enmCpuMode explicitly in the relevant code. We do this in a number of 284 * other scenarios. Or, rename it to iemReCalcCpuModeAndCpl. 285 */ 275 286 pVCpu->iem.s.enmDefAddrMode = enmMode; /** @todo check if this is correct... */ 276 287 pVCpu->iem.s.enmEffAddrMode = enmMode;
Note:
See TracChangeset
for help on using the changeset viewer.

