Changeset 97441 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Nov 8, 2022 12:07:49 AM (2 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r97406 r97441 3927 3927 VBOXSTRICTRC iemRaiseDebugException(PVMCPUCC pVCpu) RT_NOEXCEPT 3928 3928 { 3929 /* * @todo set/clear RF. */3929 /* This always clears RF (via IEM_XCPT_FLAGS_DRx_INSTR_BP). */ 3930 3930 pVCpu->cpum.GstCtx.dr[7] &= ~X86_DR7_GD; 3931 return iemRaiseXcptOrInt(pVCpu, 0, X86_XCPT_DB, IEM_XCPT_FLAGS_T_CPU_XCPT , 0, 0);3931 return iemRaiseXcptOrInt(pVCpu, 0, X86_XCPT_DB, IEM_XCPT_FLAGS_T_CPU_XCPT | IEM_XCPT_FLAGS_DRx_INSTR_BP, 0, 0); 3932 3932 } 3933 3933 … … 4291 4291 * 4292 4292 * @param pVCpu The cross context virtual CPU structure of the calling thread. 4293 * @param cbInstr Instruction size. 4293 4294 * @param offNextInstr The offset of the next instruction. 4294 */ 4295 VBOXSTRICTRC iemRegRipRelativeJumpS8(PVMCPUCC pVCpu, int8_t offNextInstr) RT_NOEXCEPT 4296 { 4297 switch (pVCpu->iem.s.enmEffOpSize) 4295 * @param enmEffOpSize Effective operand size. 4296 */ 4297 VBOXSTRICTRC iemRegRipRelativeJumpS8AndFinishClearingRF(PVMCPUCC pVCpu, uint8_t cbInstr, int8_t offNextInstr, 4298 IEMMODE enmEffOpSize) RT_NOEXCEPT 4299 { 4300 switch (enmEffOpSize) 4298 4301 { 4299 4302 case IEMMODE_16BIT: 4300 4303 { 4301 uint16_t uNewIp = pVCpu->cpum.GstCtx.ip + offNextInstr + IEM_GET_INSTR_LEN(pVCpu); 4302 if ( uNewIp > pVCpu->cpum.GstCtx.cs.u32Limit 4303 && pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT) /* no need to check for non-canonical. */ 4304 uint16_t const uNewIp = pVCpu->cpum.GstCtx.ip + cbInstr + (int16_t)offNextInstr; 4305 if (RT_LIKELY( uNewIp <= pVCpu->cpum.GstCtx.cs.u32Limit 4306 || pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT /* no CS limit checks in 64-bit mode */)) 4307 pVCpu->cpum.GstCtx.rip = uNewIp; 4308 else 4304 4309 return iemRaiseGeneralProtectionFault0(pVCpu); 4305 pVCpu->cpum.GstCtx.rip = uNewIp;4306 4310 break; 4307 4311 } … … 4309 4313 case IEMMODE_32BIT: 4310 4314 { 4315 Assert(pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT); 4311 4316 Assert(pVCpu->cpum.GstCtx.rip <= UINT32_MAX); 4312 Assert(pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT); 4313 4314 uint32_t uNewEip = pVCpu->cpum.GstCtx.eip + offNextInstr + IEM_GET_INSTR_LEN(pVCpu); 4315 if (uNewEip > pVCpu->cpum.GstCtx.cs.u32Limit) 4317 4318 uint32_t const uNewEip = pVCpu->cpum.GstCtx.eip + cbInstr + (int32_t)offNextInstr; 4319 if (RT_LIKELY(uNewEip <= pVCpu->cpum.GstCtx.cs.u32Limit)) 4320 pVCpu->cpum.GstCtx.rip = uNewEip; 4321 else 4316 4322 return iemRaiseGeneralProtectionFault0(pVCpu); 4317 pVCpu->cpum.GstCtx.rip = uNewEip;4318 4323 break; 4319 4324 } … … 4323 4328 Assert(pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT); 4324 4329 4325 uint64_t uNewRip = pVCpu->cpum.GstCtx.rip + offNextInstr + IEM_GET_INSTR_LEN(pVCpu); 4326 if (!IEM_IS_CANONICAL(uNewRip)) 4330 uint64_t const uNewRip = pVCpu->cpum.GstCtx.rip + cbInstr + (int64_t)offNextInstr; 4331 if (RT_LIKELY(IEM_IS_CANONICAL(uNewRip))) 4332 pVCpu->cpum.GstCtx.rip = uNewRip; 4333 else 4327 4334 return iemRaiseGeneralProtectionFault0(pVCpu); 4328 pVCpu->cpum.GstCtx.rip = uNewRip;4329 4335 break; 4330 4336 } … … 4333 4339 } 4334 4340 4335 pVCpu->cpum.GstCtx.eflags.Bits.u1RF = 0; 4341 #ifndef IEM_WITH_CODE_TLB 4342 /* Flush the prefetch buffer. */ 4343 pVCpu->iem.s.cbOpcode = cbInstr; 4344 #endif 4345 4346 /* 4347 * Clear RF and finish the instruction (maybe raise #DB). 4348 */ 4349 return iemRegFinishClearingRF(pVCpu); 4350 } 4351 4352 4353 /** 4354 * Adds a 16-bit signed jump offset to RIP/EIP/IP. 4355 * 4356 * May raise a \#GP(0) if the new RIP is non-canonical or outside the code 4357 * segment limit. 4358 * 4359 * @returns Strict VBox status code. 4360 * @param pVCpu The cross context virtual CPU structure of the calling thread. 4361 * @param cbInstr Instruction size. 4362 * @param offNextInstr The offset of the next instruction. 4363 */ 4364 VBOXSTRICTRC iemRegRipRelativeJumpS16AndFinishClearingRF(PVMCPUCC pVCpu, uint8_t cbInstr, int16_t offNextInstr) RT_NOEXCEPT 4365 { 4366 Assert(pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT); 4367 4368 uint16_t const uNewIp = pVCpu->cpum.GstCtx.ip + cbInstr + offNextInstr; 4369 if (RT_LIKELY( uNewIp <= pVCpu->cpum.GstCtx.cs.u32Limit 4370 || pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT /* no limit checking in 64-bit mode */)) 4371 pVCpu->cpum.GstCtx.rip = uNewIp; 4372 else 4373 return iemRaiseGeneralProtectionFault0(pVCpu); 4336 4374 4337 4375 #ifndef IEM_WITH_CODE_TLB … … 4340 4378 #endif 4341 4379 4342 return VINF_SUCCESS; 4343 } 4344 4345 4346 /** 4347 * Adds a 16-bit signed jump offset to RIP/EIP/IP. 4380 /* 4381 * Clear RF and finish the instruction (maybe raise #DB). 4382 */ 4383 return iemRegFinishClearingRF(pVCpu); 4384 } 4385 4386 4387 /** 4388 * Adds a 32-bit signed jump offset to RIP/EIP/IP. 4348 4389 * 4349 4390 * May raise a \#GP(0) if the new RIP is non-canonical or outside the code … … 4354 4395 * @param offNextInstr The offset of the next instruction. 4355 4396 */ 4356 VBOXSTRICTRC iemRegRipRelativeJumpS16(PVMCPUCC pVCpu, int16_t offNextInstr) RT_NOEXCEPT 4357 { 4358 Assert(pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT); 4359 4360 uint16_t uNewIp = pVCpu->cpum.GstCtx.ip + offNextInstr + IEM_GET_INSTR_LEN(pVCpu); 4361 if ( uNewIp > pVCpu->cpum.GstCtx.cs.u32Limit 4362 && pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT) /* no need to check for non-canonical. */ 4363 return iemRaiseGeneralProtectionFault0(pVCpu); 4364 /** @todo Test 16-bit jump in 64-bit mode. possible? */ 4365 pVCpu->cpum.GstCtx.rip = uNewIp; 4366 pVCpu->cpum.GstCtx.eflags.Bits.u1RF = 0; 4397 VBOXSTRICTRC iemRegRipRelativeJumpS32AndFinishClearingRF(PVMCPUCC pVCpu, uint8_t cbInstr, int32_t offNextInstr, 4398 IEMMODE enmEffOpSize) RT_NOEXCEPT 4399 { 4400 if (enmEffOpSize == IEMMODE_32BIT) 4401 { 4402 Assert(pVCpu->cpum.GstCtx.rip <= UINT32_MAX); Assert(pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT); 4403 4404 uint32_t const uNewEip = pVCpu->cpum.GstCtx.eip + cbInstr + offNextInstr; 4405 if (RT_LIKELY(uNewEip <= pVCpu->cpum.GstCtx.cs.u32Limit)) 4406 pVCpu->cpum.GstCtx.rip = uNewEip; 4407 else 4408 return iemRaiseGeneralProtectionFault0(pVCpu); 4409 } 4410 else 4411 { 4412 Assert(enmEffOpSize == IEMMODE_64BIT); 4413 4414 uint64_t const uNewRip = pVCpu->cpum.GstCtx.rip + cbInstr + (int64_t)offNextInstr; 4415 if (RT_LIKELY(IEM_IS_CANONICAL(uNewRip))) 4416 pVCpu->cpum.GstCtx.rip = uNewRip; 4417 else 4418 return iemRaiseGeneralProtectionFault0(pVCpu); 4419 } 4367 4420 4368 4421 #ifndef IEM_WITH_CODE_TLB … … 4371 4424 #endif 4372 4425 4373 return VINF_SUCCESS; 4374 } 4375 4376 4377 /** 4378 * Adds a 32-bit signed jump offset to RIP/EIP/IP. 4379 * 4380 * May raise a \#GP(0) if the new RIP is non-canonical or outside the code 4381 * segment limit. 4382 * 4383 * @returns Strict VBox status code. 4384 * @param pVCpu The cross context virtual CPU structure of the calling thread. 4385 * @param offNextInstr The offset of the next instruction. 4386 */ 4387 VBOXSTRICTRC iemRegRipRelativeJumpS32(PVMCPUCC pVCpu, int32_t offNextInstr) RT_NOEXCEPT 4388 { 4389 Assert(pVCpu->iem.s.enmEffOpSize != IEMMODE_16BIT); 4390 4391 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_32BIT) 4392 { 4393 Assert(pVCpu->cpum.GstCtx.rip <= UINT32_MAX); Assert(pVCpu->iem.s.enmCpuMode != IEMMODE_64BIT); 4394 4395 uint32_t uNewEip = pVCpu->cpum.GstCtx.eip + offNextInstr + IEM_GET_INSTR_LEN(pVCpu); 4396 if (uNewEip > pVCpu->cpum.GstCtx.cs.u32Limit) 4397 return iemRaiseGeneralProtectionFault0(pVCpu); 4398 pVCpu->cpum.GstCtx.rip = uNewEip; 4399 } 4400 else 4401 { 4402 Assert(pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT); 4403 4404 uint64_t uNewRip = pVCpu->cpum.GstCtx.rip + offNextInstr + IEM_GET_INSTR_LEN(pVCpu); 4405 if (!IEM_IS_CANONICAL(uNewRip)) 4406 return iemRaiseGeneralProtectionFault0(pVCpu); 4407 pVCpu->cpum.GstCtx.rip = uNewRip; 4408 } 4409 pVCpu->cpum.GstCtx.eflags.Bits.u1RF = 0; 4410 4411 #ifndef IEM_WITH_CODE_TLB 4412 /* Flush the prefetch buffer. */ 4413 pVCpu->iem.s.cbOpcode = IEM_GET_INSTR_LEN(pVCpu); 4414 #endif 4415 4416 return VINF_SUCCESS; 4426 /* 4427 * Clear RF and finish the instruction (maybe raise #DB). 4428 */ 4429 return iemRegFinishClearingRF(pVCpu); 4417 4430 } 4418 4431 -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsOneByte.cpp.h
r97370 r97441 2800 2800 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 2801 2801 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 2802 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();2802 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 2803 2803 2804 2804 IEM_MC_BEGIN(0, 0); … … 2820 2820 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 2821 2821 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 2822 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();2822 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 2823 2823 2824 2824 IEM_MC_BEGIN(0, 0); … … 2839 2839 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 2840 2840 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 2841 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();2841 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 2842 2842 2843 2843 IEM_MC_BEGIN(0, 0); … … 2859 2859 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 2860 2860 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 2861 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();2861 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 2862 2862 2863 2863 IEM_MC_BEGIN(0, 0); … … 2879 2879 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 2880 2880 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 2881 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();2881 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 2882 2882 2883 2883 IEM_MC_BEGIN(0, 0); … … 2899 2899 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 2900 2900 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 2901 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();2901 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 2902 2902 2903 2903 IEM_MC_BEGIN(0, 0); … … 2919 2919 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 2920 2920 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 2921 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();2921 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 2922 2922 2923 2923 IEM_MC_BEGIN(0, 0); … … 2939 2939 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 2940 2940 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 2941 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();2941 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 2942 2942 2943 2943 IEM_MC_BEGIN(0, 0); … … 2959 2959 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 2960 2960 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 2961 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();2961 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 2962 2962 2963 2963 IEM_MC_BEGIN(0, 0); … … 2979 2979 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 2980 2980 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 2981 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();2981 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 2982 2982 2983 2983 IEM_MC_BEGIN(0, 0); … … 2999 2999 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 3000 3000 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 3001 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();3001 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 3002 3002 3003 3003 IEM_MC_BEGIN(0, 0); … … 3019 3019 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 3020 3020 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 3021 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();3021 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 3022 3022 3023 3023 IEM_MC_BEGIN(0, 0); … … 3039 3039 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 3040 3040 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 3041 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();3041 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 3042 3042 3043 3043 IEM_MC_BEGIN(0, 0); … … 3059 3059 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 3060 3060 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 3061 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();3061 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 3062 3062 3063 3063 IEM_MC_BEGIN(0, 0); … … 3079 3079 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 3080 3080 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 3081 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();3081 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 3082 3082 3083 3083 IEM_MC_BEGIN(0, 0); … … 3099 3099 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 3100 3100 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 3101 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();3101 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 3102 3102 3103 3103 IEM_MC_BEGIN(0, 0); … … 10505 10505 { 10506 10506 IEMOP_MNEMONIC(jmp_Jv, "jmp Jv"); 10507 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();10507 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 10508 10508 switch (pVCpu->iem.s.enmEffOpSize) 10509 10509 { … … 10560 10560 int8_t i8Imm; IEM_OPCODE_GET_NEXT_S8(&i8Imm); 10561 10561 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 10562 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();10562 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 10563 10563 10564 10564 IEM_MC_BEGIN(0, 0); -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsTwoByte0f.cpp.h
r97361 r97441 7695 7695 IEMOP_MNEMONIC(jo_Jv, "jo Jv"); 7696 7696 IEMOP_HLP_MIN_386(); 7697 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();7697 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 7698 7698 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 7699 7699 { … … 7730 7730 IEMOP_MNEMONIC(jno_Jv, "jno Jv"); 7731 7731 IEMOP_HLP_MIN_386(); 7732 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();7732 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 7733 7733 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 7734 7734 { … … 7765 7765 IEMOP_MNEMONIC(jc_Jv, "jc/jb/jnae Jv"); 7766 7766 IEMOP_HLP_MIN_386(); 7767 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();7767 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 7768 7768 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 7769 7769 { … … 7800 7800 IEMOP_MNEMONIC(jnc_Jv, "jnc/jnb/jae Jv"); 7801 7801 IEMOP_HLP_MIN_386(); 7802 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();7802 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 7803 7803 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 7804 7804 { … … 7835 7835 IEMOP_MNEMONIC(je_Jv, "je/jz Jv"); 7836 7836 IEMOP_HLP_MIN_386(); 7837 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();7837 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 7838 7838 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 7839 7839 { … … 7870 7870 IEMOP_MNEMONIC(jne_Jv, "jne/jnz Jv"); 7871 7871 IEMOP_HLP_MIN_386(); 7872 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();7872 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 7873 7873 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 7874 7874 { … … 7905 7905 IEMOP_MNEMONIC(jbe_Jv, "jbe/jna Jv"); 7906 7906 IEMOP_HLP_MIN_386(); 7907 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();7907 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 7908 7908 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 7909 7909 { … … 7940 7940 IEMOP_MNEMONIC(ja_Jv, "jnbe/ja Jv"); 7941 7941 IEMOP_HLP_MIN_386(); 7942 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();7942 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 7943 7943 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 7944 7944 { … … 7975 7975 IEMOP_MNEMONIC(js_Jv, "js Jv"); 7976 7976 IEMOP_HLP_MIN_386(); 7977 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();7977 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 7978 7978 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 7979 7979 { … … 8010 8010 IEMOP_MNEMONIC(jns_Jv, "jns Jv"); 8011 8011 IEMOP_HLP_MIN_386(); 8012 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();8012 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 8013 8013 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 8014 8014 { … … 8045 8045 IEMOP_MNEMONIC(jp_Jv, "jp Jv"); 8046 8046 IEMOP_HLP_MIN_386(); 8047 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();8047 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 8048 8048 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 8049 8049 { … … 8080 8080 IEMOP_MNEMONIC(jnp_Jv, "jnp Jv"); 8081 8081 IEMOP_HLP_MIN_386(); 8082 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();8082 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 8083 8083 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 8084 8084 { … … 8115 8115 IEMOP_MNEMONIC(jl_Jv, "jl/jnge Jv"); 8116 8116 IEMOP_HLP_MIN_386(); 8117 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();8117 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 8118 8118 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 8119 8119 { … … 8150 8150 IEMOP_MNEMONIC(jge_Jv, "jnl/jge Jv"); 8151 8151 IEMOP_HLP_MIN_386(); 8152 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();8152 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 8153 8153 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 8154 8154 { … … 8185 8185 IEMOP_MNEMONIC(jle_Jv, "jle/jng Jv"); 8186 8186 IEMOP_HLP_MIN_386(); 8187 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();8187 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 8188 8188 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 8189 8189 { … … 8220 8220 IEMOP_MNEMONIC(jg_Jv, "jnle/jg Jv"); 8221 8221 IEMOP_HLP_MIN_386(); 8222 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE ();8222 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX(); 8223 8223 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT) 8224 8224 { -
trunk/src/VBox/VMM/include/IEMInline.h
r97408 r97441 1288 1288 1289 1289 1290 /** 1291 * Sets the default operand size to 64-bit and recalculates the effective 1292 * operand size, with intel ignoring any operand size prefix (AMD respects it). 1293 * 1294 * This is for the relative jumps. 1295 * 1296 * @param pVCpu The cross context virtual CPU structure of the calling thread. 1297 */ 1298 DECLINLINE(void) iemRecalEffOpSize64DefaultAndIntelIgnoresOpSizePrefix(PVMCPUCC pVCpu) 1299 { 1300 Assert(pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT); 1301 pVCpu->iem.s.enmDefOpSize = IEMMODE_64BIT; 1302 if ( (pVCpu->iem.s.fPrefixes & (IEM_OP_PRF_SIZE_REX_W | IEM_OP_PRF_SIZE_OP)) != IEM_OP_PRF_SIZE_OP 1303 || pVCpu->iem.s.enmCpuVendor == CPUMCPUVENDOR_INTEL) 1304 pVCpu->iem.s.enmEffOpSize = IEMMODE_64BIT; 1305 else 1306 pVCpu->iem.s.enmEffOpSize = IEMMODE_16BIT; 1307 } 1308 1309 1290 1310 1291 1311 … … 1585 1605 uint64_t const uRipNext = uRipPrev + cbInstr; 1586 1606 if (RT_LIKELY( !((uRipNext ^ uRipPrev) & (RT_BIT_64(32) | RT_BIT_64(16))) 1587 || CPUMIsGuestIn64BitCodeEx(&pVCpu->cpum.GstCtx)))1607 || pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT)) 1588 1608 pVCpu->cpum.GstCtx.rip = uRipNext; 1589 1609 else if (IEM_GET_TARGET_CPU(pVCpu) >= IEMTARGETCPU_386) -
trunk/src/VBox/VMM/include/IEMInternal.h
r97361 r97441 3729 3729 /** @name Register Access. 3730 3730 * @{ */ 3731 VBOXSTRICTRC iemRegRipRelativeJumpS8(PVMCPUCC pVCpu, int8_t offNextInstr) RT_NOEXCEPT; 3732 VBOXSTRICTRC iemRegRipRelativeJumpS16(PVMCPUCC pVCpu, int16_t offNextInstr) RT_NOEXCEPT; 3733 VBOXSTRICTRC iemRegRipRelativeJumpS32(PVMCPUCC pVCpu, int32_t offNextInstr) RT_NOEXCEPT; 3731 VBOXSTRICTRC iemRegRipRelativeJumpS8AndFinishClearingRF(PVMCPUCC pVCpu, uint8_t cbInstr, int8_t offNextInstr, 3732 IEMMODE enmEffOpSize) RT_NOEXCEPT; 3733 VBOXSTRICTRC iemRegRipRelativeJumpS16AndFinishClearingRF(PVMCPUCC pVCpu, uint8_t cbInstr, int16_t offNextInstr) RT_NOEXCEPT; 3734 VBOXSTRICTRC iemRegRipRelativeJumpS32AndFinishClearingRF(PVMCPUCC pVCpu, uint8_t cbInstr, int32_t offNextInstr, 3735 IEMMODE enmEffOpSize) RT_NOEXCEPT; 3734 3736 VBOXSTRICTRC iemRegRipJump(PVMCPUCC pVCpu, uint64_t uNewRip) RT_NOEXCEPT; 3735 3737 /** @} */ -
trunk/src/VBox/VMM/include/IEMMc.h
r97370 r97441 55 55 /** Advances RIP, finishes the instruction and returns. 56 56 * This may include raising debug exceptions and such. */ 57 #define IEM_MC_ADVANCE_RIP_AND_FINISH() return iemReg UpdateRipAndFinishClearingRF(pVCpu)57 #define IEM_MC_ADVANCE_RIP_AND_FINISH() return iemRegAddToRipAndFinishingClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu)) 58 58 /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */ 59 #define IEM_MC_REL_JMP_S8_AND_FINISH(a_i8) return iemRegRipRelativeJumpS8(pVCpu, (a_i8)) 59 #define IEM_MC_REL_JMP_S8_AND_FINISH(a_i8) \ 60 return iemRegRipRelativeJumpS8AndFinishClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu), (a_i8), pVCpu->iem.s.enmEffOpSize) 61 /** Sets RIP (may trigger \#GP), finishes the instruction and returns. 62 * @note only usable in 16-bit op size mode. */ 63 #define IEM_MC_REL_JMP_S16_AND_FINISH(a_i16) \ 64 return iemRegRipRelativeJumpS16AndFinishClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu), (a_i16)) 60 65 /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */ 61 #define IEM_MC_REL_JMP_S16_AND_FINISH(a_i16) return iemRegRipRelativeJumpS16(pVCpu, (a_i16)) 62 /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */ 63 #define IEM_MC_REL_JMP_S32_AND_FINISH(a_i32) return iemRegRipRelativeJumpS32(pVCpu, (a_i32)) 66 #define IEM_MC_REL_JMP_S32_AND_FINISH(a_i32) \ 67 return iemRegRipRelativeJumpS32AndFinishClearingRF(pVCpu, IEM_GET_INSTR_LEN(pVCpu), (a_i32), pVCpu->iem.s.enmEffOpSize) 64 68 /** Sets RIP (may trigger \#GP), finishes the instruction and returns. */ 65 69 #define IEM_MC_SET_RIP_U16_AND_FINISH(a_u16NewIP) return iemRegRipJump((pVCpu), (a_u16NewIP)) -
trunk/src/VBox/VMM/include/IEMOpHlp.h
r96438 r97441 367 367 } while (0) 368 368 369 /** The instruction defaults to 64-bit operand size if 64-bit mode and intel 370 * CPUs ignore the operand size prefix complete (e.g. relative jumps). */ 371 #define IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX() \ 372 do \ 373 { \ 374 if (pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT) \ 375 iemRecalEffOpSize64DefaultAndIntelIgnoresOpSizePrefix(pVCpu); \ 376 } while (0) 377 369 378 /** The instruction has 64-bit operand size if 64-bit mode. */ 370 379 #define IEMOP_HLP_64BIT_OP_SIZE() \ -
trunk/src/VBox/VMM/testcase/tstIEMCheckMc.cpp
r97357 r97441 157 157 #define IEMOP_HLP_64BIT_OP_SIZE() do { } while (0) 158 158 #define IEMOP_HLP_DEFAULT_64BIT_OP_SIZE() do { } while (0) 159 #define IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX() do { } while (0) 159 160 #define IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE(a_szPrf) do { } while (0) 160 161 #define IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX() do { } while (0)
Note:
See TracChangeset
for help on using the changeset viewer.