Changeset 97452 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Nov 8, 2022 1:51:06 PM (2 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r97441 r97452 4434 4434 * Performs a near jump to the specified address. 4435 4435 * 4436 * May raise a \#GP(0) if the new RIP is non-canonical or outside the code 4437 * segment limit. 4438 * 4439 * @param pVCpu The cross context virtual CPU structure of the calling thread. 4440 * @param uNewRip The new RIP value. 4441 */ 4442 VBOXSTRICTRC iemRegRipJump(PVMCPUCC pVCpu, uint64_t uNewRip) RT_NOEXCEPT 4443 { 4444 switch (pVCpu->iem.s.enmEffOpSize) 4445 { 4446 case IEMMODE_16BIT: 4447 { 4448 Assert(uNewRip <= UINT16_MAX); 4449 if ( uNewRip > pVCpu->cpum.GstCtx.cs.u32Limit 4450 && pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT) /* no need to check for non-canonical. */ 4451 return iemRaiseGeneralProtectionFault0(pVCpu); 4452 /** @todo Test 16-bit jump in 64-bit mode. */ 4453 pVCpu->cpum.GstCtx.rip = uNewRip; 4454 break; 4455 } 4456 4457 case IEMMODE_32BIT: 4458 { 4459 Assert(uNewRip <= UINT32_MAX); 4460 Assert(pVCpu->cpum.GstCtx.rip <= UINT32_MAX); 4461 Assert(pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT); 4462 4463 if (uNewRip > pVCpu->cpum.GstCtx.cs.u32Limit) 4464 return iemRaiseGeneralProtectionFault0(pVCpu); 4465 pVCpu->cpum.GstCtx.rip = uNewRip; 4466 break; 4467 } 4468 4469 case IEMMODE_64BIT: 4470 { 4471 Assert(pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT); 4472 4473 if (!IEM_IS_CANONICAL(uNewRip)) 4474 return iemRaiseGeneralProtectionFault0(pVCpu); 4475 pVCpu->cpum.GstCtx.rip = uNewRip; 4476 break; 4477 } 4478 4479 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 4480 } 4481 4482 pVCpu->cpum.GstCtx.eflags.Bits.u1RF = 0; 4436 * May raise a \#GP(0) if the new IP outside the code segment limit. 4437 * 4438 * @param pVCpu The cross context virtual CPU structure of the calling thread. 4439 * @param uNewIp The new IP value. 4440 */ 4441 VBOXSTRICTRC iemRegRipJumpU16AndFinishClearningRF(PVMCPUCC pVCpu, uint16_t uNewIp) RT_NOEXCEPT 4442 { 4443 if (RT_LIKELY( uNewIp <= pVCpu->cpum.GstCtx.cs.u32Limit 4444 || pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT /* no limit checks in 64-bit mode */)) 4445 pVCpu->cpum.GstCtx.rip = uNewIp; 4446 else 4447 return iemRaiseGeneralProtectionFault0(pVCpu); 4448 /** @todo Test 16-bit jump in 64-bit mode. */ 4483 4449 4484 4450 #ifndef IEM_WITH_CODE_TLB … … 4487 4453 #endif 4488 4454 4489 return VINF_SUCCESS; 4455 /* 4456 * Clear RF and finish the instruction (maybe raise #DB). 4457 */ 4458 return iemRegFinishClearingRF(pVCpu); 4459 } 4460 4461 4462 /** 4463 * Performs a near jump to the specified address. 4464 * 4465 * May raise a \#GP(0) if the new RIP is outside the code segment limit. 4466 * 4467 * @param pVCpu The cross context virtual CPU structure of the calling thread. 4468 * @param uNewEip The new EIP value. 4469 */ 4470 VBOXSTRICTRC iemRegRipJumpU32AndFinishClearningRF(PVMCPUCC pVCpu, uint32_t uNewEip) RT_NOEXCEPT 4471 { 4472 Assert(pVCpu->cpum.GstCtx.rip <= UINT32_MAX); 4473 Assert(pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT); 4474 4475 if (RT_LIKELY(uNewEip <= pVCpu->cpum.GstCtx.cs.u32Limit)) 4476 pVCpu->cpum.GstCtx.rip = uNewEip; 4477 else 4478 return iemRaiseGeneralProtectionFault0(pVCpu); 4479 4480 #ifndef IEM_WITH_CODE_TLB 4481 /* Flush the prefetch buffer. */ 4482 pVCpu->iem.s.cbOpcode = IEM_GET_INSTR_LEN(pVCpu); 4483 #endif 4484 4485 /* 4486 * Clear RF and finish the instruction (maybe raise #DB). 4487 */ 4488 return iemRegFinishClearingRF(pVCpu); 4489 } 4490 4491 4492 /** 4493 * Performs a near jump to the specified address. 4494 * 4495 * May raise a \#GP(0) if the new RIP is non-canonical or outside the code 4496 * segment limit. 4497 * 4498 * @param pVCpu The cross context virtual CPU structure of the calling thread. 4499 * @param uNewRip The new RIP value. 4500 */ 4501 VBOXSTRICTRC iemRegRipJumpU64AndFinishClearningRF(PVMCPUCC pVCpu, uint64_t uNewRip) RT_NOEXCEPT 4502 { 4503 Assert(pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT); 4504 4505 if (RT_LIKELY(IEM_IS_CANONICAL(uNewRip))) 4506 pVCpu->cpum.GstCtx.rip = uNewRip; 4507 else 4508 return iemRaiseGeneralProtectionFault0(pVCpu); 4509 4510 #ifndef IEM_WITH_CODE_TLB 4511 /* Flush the prefetch buffer. */ 4512 pVCpu->iem.s.cbOpcode = IEM_GET_INSTR_LEN(pVCpu); 4513 #endif 4514 4515 /* 4516 * Clear RF and finish the instruction (maybe raise #DB). 4517 */ 4518 return iemRegFinishClearingRF(pVCpu); 4490 4519 } 4491 4520 -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsOneByte.cpp.h
r97441 r97452 11592 11592 { 11593 11593 IEMOP_MNEMONIC(jmpn_Ev, "jmpn Ev"); 11594 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();11594 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 11595 11595 11596 11596 if (IEM_IS_MODRM_REG_MODE(bRm))
Note:
See TracChangeset
for help on using the changeset viewer.